comparison cli-runopts.c @ 989:73ea0dce9a57 pam

Merge up to date
author Matt Johnston <matt@ucc.asn.au>
date Fri, 23 Jan 2015 21:38:47 +0800
parents a4032b946355
children 6fb4c010c448
comparison
equal deleted inserted replaced
925:bae0b34bc059 989:73ea0dce9a57
88 #endif 88 #endif
89 #ifdef ENABLE_USER_ALGO_LIST 89 #ifdef ENABLE_USER_ALGO_LIST
90 "-c <cipher list> Specify preferred ciphers ('-c help' to list options)\n" 90 "-c <cipher list> Specify preferred ciphers ('-c help' to list options)\n"
91 "-m <MAC list> Specify preferred MACs for packet verification (or '-m help')\n" 91 "-m <MAC list> Specify preferred MACs for packet verification (or '-m help')\n"
92 #endif 92 #endif
93 "-V Version\n"
93 #ifdef DEBUG_TRACE 94 #ifdef DEBUG_TRACE
94 "-v verbose (compiled with DEBUG_TRACE)\n" 95 "-v verbose (compiled with DEBUG_TRACE)\n"
95 #endif 96 #endif
96 ,DROPBEAR_VERSION, cli_opts.progname, 97 ,DROPBEAR_VERSION, cli_opts.progname,
97 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); 98 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT);
161 /* not yet 162 /* not yet
162 opts.ipv4 = 1; 163 opts.ipv4 = 1;
163 opts.ipv6 = 1; 164 opts.ipv6 = 1;
164 */ 165 */
165 opts.recv_window = DEFAULT_RECV_WINDOW; 166 opts.recv_window = DEFAULT_RECV_WINDOW;
167 opts.keepalive_secs = DEFAULT_KEEPALIVE;
168 opts.idle_timeout_secs = DEFAULT_IDLE_TIMEOUT;
166 169
167 fill_own_user(); 170 fill_own_user();
168 171
169 /* Iterate all the arguments */ 172 /* Iterate all the arguments */
170 for (i = 1; i < (unsigned int)argc; i++) { 173 for (i = 1; i < (unsigned int)argc; i++) {
320 case 'R': 323 case 'R':
321 #endif 324 #endif
322 #ifndef ENABLE_CLI_LOCALTCPFWD 325 #ifndef ENABLE_CLI_LOCALTCPFWD
323 case 'L': 326 case 'L':
324 #endif 327 #endif
328 case 'V':
329 print_version();
330 exit(EXIT_SUCCESS);
331 break;
325 case 'o': 332 case 'o':
326 case 'b': 333 case 'b':
327 next = &dummy; 334 next = &dummy;
328 default: 335 default:
329 fprintf(stderr, 336 fprintf(stderr,
674 struct passwd *pw = NULL; 681 struct passwd *pw = NULL;
675 682
676 uid = getuid(); 683 uid = getuid();
677 684
678 pw = getpwuid(uid); 685 pw = getpwuid(uid);
679 if (pw == NULL || pw->pw_name == NULL) { 686 if (pw && pw->pw_name != NULL) {
680 dropbear_exit("Unknown own user"); 687 cli_opts.own_user = m_strdup(pw->pw_name);
681 } 688 } else {
682 689 dropbear_log(LOG_INFO, "Warning: failed to identify current user. Trying anyway.");
683 cli_opts.own_user = m_strdup(pw->pw_name); 690 cli_opts.own_user = m_strdup("unknown");
691 }
692
684 } 693 }
685 694
686 #ifdef ENABLE_CLI_ANYTCPFWD 695 #ifdef ENABLE_CLI_ANYTCPFWD
687 /* Turn a "[listenaddr:]listenport:remoteaddr:remoteport" string into into a forwarding 696 /* Turn a "[listenaddr:]listenport:remoteaddr:remoteport" string into into a forwarding
688 * set, and add it to the forwarding list */ 697 * set, and add it to the forwarding list */