Mercurial > dropbear
comparison dbutil.c @ 1295:750ec4ec4cbe
Convert #ifdef to #if, other build changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 04 May 2016 15:33:40 +0200 |
parents | 3017bc7d6238 |
children | 21156be2bb26 |
comparison
equal
deleted
inserted
replaced
1294:56aba7dedbea | 1295:750ec4ec4cbe |
---|---|
77 void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN | 77 void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN |
78 = generic_dropbear_exit; | 78 = generic_dropbear_exit; |
79 void (*_dropbear_log)(int priority, const char* format, va_list param) | 79 void (*_dropbear_log)(int priority, const char* format, va_list param) |
80 = generic_dropbear_log; | 80 = generic_dropbear_log; |
81 | 81 |
82 #ifdef DEBUG_TRACE | 82 #if DEBUG_TRACE |
83 int debug_trace = 0; | 83 int debug_trace = 0; |
84 #endif | 84 #endif |
85 | 85 |
86 #ifndef DISABLE_SYSLOG | 86 #ifndef DISABLE_SYSLOG |
87 void startsyslog(const char *ident) { | 87 void startsyslog(const char *ident) { |
147 _dropbear_log(priority, format, param); | 147 _dropbear_log(priority, format, param); |
148 va_end(param); | 148 va_end(param); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 #ifdef DEBUG_TRACE | 152 #if DEBUG_TRACE |
153 | 153 |
154 static double debug_start_time = -1; | 154 static double debug_start_time = -1; |
155 | 155 |
156 void debug_start_net() | 156 void debug_start_net() |
157 { | 157 { |
180 } | 180 } |
181 | 181 |
182 void dropbear_trace(const char* format, ...) { | 182 void dropbear_trace(const char* format, ...) { |
183 va_list param; | 183 va_list param; |
184 | 184 |
185 if (!debug_trace) { | 185 if (!ses.debug_trace) { |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 va_start(param, format); | 189 va_start(param, format); |
190 fprintf(stderr, "TRACE (%d) %f: ", getpid(), time_since_start()); | 190 fprintf(stderr, "TRACE (%d) %f: ", getpid(), time_since_start()); |
260 } | 260 } |
261 if (ret_errfd && pipe(errfds) != 0) { | 261 if (ret_errfd && pipe(errfds) != 0) { |
262 return DROPBEAR_FAILURE; | 262 return DROPBEAR_FAILURE; |
263 } | 263 } |
264 | 264 |
265 #ifdef USE_VFORK | 265 #if DROPBEAR_VFORK |
266 pid = vfork(); | 266 pid = vfork(); |
267 #else | 267 #else |
268 pid = fork(); | 268 pid = fork(); |
269 #endif | 269 #endif |
270 | 270 |
369 } | 369 } |
370 | 370 |
371 execv(usershell, argv); | 371 execv(usershell, argv); |
372 } | 372 } |
373 | 373 |
374 #ifdef DEBUG_TRACE | 374 #if DEBUG_TRACE |
375 void printhex(const char * label, const unsigned char * buf, int len) { | 375 void printhex(const char * label, const unsigned char * buf, int len) { |
376 | 376 |
377 int i; | 377 int i; |
378 | 378 |
379 fprintf(stderr, "%s\n", label); | 379 fprintf(stderr, "%s\n", label); |
463 | 463 |
464 /* get a line from the file into buffer in the style expected for an | 464 /* get a line from the file into buffer in the style expected for an |
465 * authkeys file. | 465 * authkeys file. |
466 * Will return DROPBEAR_SUCCESS if data is read, or DROPBEAR_FAILURE on EOF.*/ | 466 * Will return DROPBEAR_SUCCESS if data is read, or DROPBEAR_FAILURE on EOF.*/ |
467 /* Only used for ~/.ssh/known_hosts and ~/.ssh/authorized_keys */ | 467 /* Only used for ~/.ssh/known_hosts and ~/.ssh/authorized_keys */ |
468 #if defined(DROPBEAR_CLIENT) || defined(ENABLE_SVR_PUBKEY_AUTH) | 468 #if DROPBEAR_CLIENT || DROPBEAR_SVR_PUBKEY_AUTH |
469 int buf_getline(buffer * line, FILE * authfile) { | 469 int buf_getline(buffer * line, FILE * authfile) { |
470 | 470 |
471 int c = EOF; | 471 int c = EOF; |
472 | 472 |
473 buf_setpos(line, 0); | 473 buf_setpos(line, 0); |