comparison dropbearconvert.c @ 299:740e782679be ucc-axis-hack

Various changes to compile+kind of run on UCC's axis board. Note that fprintf(stdin -> printf( accounts for many of the changes
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:57:09 +0000
parents c85c88500ea6
children
comparison
equal deleted inserted replaced
266:e37b160c414c 299:740e782679be
35 35
36 static void printhelp(char * progname); 36 static void printhelp(char * progname);
37 37
38 static void printhelp(char * progname) { 38 static void printhelp(char * progname) {
39 39
40 fprintf(stderr, "Usage: %s <inputtype> <outputtype> <inputfile> <outputfile>\n\n" 40 printf( "Usage: %s <inputtype> <outputtype> <inputfile> <outputfile>\n\n"
41 "CAUTION: This program is for convenience only, and is not secure if used on\n" 41 "CAUTION: This program is for convenience only, and is not secure if used on\n"
42 "untrusted input files, ie it could allow arbitrary code execution.\n" 42 "untrusted input files, ie it could allow arbitrary code execution.\n"
43 "All parameters must be specified in order.\n" 43 "All parameters must be specified in order.\n"
44 "\n" 44 "\n"
45 "The input and output types are one of:\n" 45 "The input and output types are one of:\n"
67 debug_trace = 1; 67 debug_trace = 1;
68 #endif 68 #endif
69 69
70 /* get the commandline options */ 70 /* get the commandline options */
71 if (argc != 5) { 71 if (argc != 5) {
72 fprintf(stderr, "All arguments must be specified\n"); 72 printf( "All arguments must be specified\n");
73 goto usage; 73 goto usage;
74 } 74 }
75 75
76 /* input type */ 76 /* input type */
77 if (argv[1][0] == 'd') { 77 if (argv[1][0] == 'd') {
78 intype = KEYFILE_DROPBEAR; 78 intype = KEYFILE_DROPBEAR;
79 } else if (argv[1][0] == 'o') { 79 } else if (argv[1][0] == 'o') {
80 intype = KEYFILE_OPENSSH; 80 intype = KEYFILE_OPENSSH;
81 } else { 81 } else {
82 fprintf(stderr, "Invalid input key type\n"); 82 printf( "Invalid input key type\n");
83 goto usage; 83 goto usage;
84 } 84 }
85 85
86 /* output type */ 86 /* output type */
87 if (argv[2][0] == 'd') { 87 if (argv[2][0] == 'd') {
88 outtype = KEYFILE_DROPBEAR; 88 outtype = KEYFILE_DROPBEAR;
89 } else if (argv[2][0] == 'o') { 89 } else if (argv[2][0] == 'o') {
90 outtype = KEYFILE_OPENSSH; 90 outtype = KEYFILE_OPENSSH;
91 } else { 91 } else {
92 fprintf(stderr, "Invalid output key type\n"); 92 printf( "Invalid output key type\n");
93 goto usage; 93 goto usage;
94 } 94 }
95 95
96 /* we don't want output readable by others */ 96 /* we don't want output readable by others */
97 umask(077); 97 umask(077);
114 char * keytype = NULL; 114 char * keytype = NULL;
115 int ret = 1; 115 int ret = 1;
116 116
117 key = import_read(infile, NULL, intype); 117 key = import_read(infile, NULL, intype);
118 if (!key) { 118 if (!key) {
119 fprintf(stderr, "Error reading key from '%s'\n", 119 printf( "Error reading key from '%s'\n",
120 infile); 120 infile);
121 goto out; 121 goto out;
122 } 122 }
123 123
124 #ifdef DROPBEAR_RSA 124 #ifdef DROPBEAR_RSA
130 if (key->dsskey != NULL) { 130 if (key->dsskey != NULL) {
131 keytype = "DSS"; 131 keytype = "DSS";
132 } 132 }
133 #endif 133 #endif
134 134
135 fprintf(stderr, "Key is a %s key\n", keytype); 135 printf( "Key is a %s key\n", keytype);
136 136
137 if (import_write(outfile, key, NULL, outtype) != 1) { 137 if (import_write(outfile, key, NULL, outtype) != 1) {
138 fprintf(stderr, "Error writing key to '%s'\n", outfile); 138 printf( "Error writing key to '%s'\n", outfile);
139 } else { 139 } else {
140 fprintf(stderr, "Wrote key to '%s'\n", outfile); 140 printf( "Wrote key to '%s'\n", outfile);
141 ret = 0; 141 ret = 0;
142 } 142 }
143 143
144 out: 144 out:
145 if (key) { 145 if (key) {