Mercurial > dropbear
comparison svr-runopts.c @ 1445:a3a96dbf9a58
Use MAX_AUTH_TRIES rather than DEFAULT_AUTH_TRIES, don't limit argument range
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Jun 2017 22:20:38 +0800 |
parents | 517c67cbcd31 |
children | 4afde04f0607 2d450c1056e3 |
comparison
equal
deleted
inserted
replaced
1444:bfed37d12d90 | 1445:a3a96dbf9a58 |
---|---|
71 #if DROPBEAR_SVR_PASSWORD_AUTH || DROPBEAR_SVR_PAM_AUTH | 71 #if DROPBEAR_SVR_PASSWORD_AUTH || DROPBEAR_SVR_PAM_AUTH |
72 "-s Disable password logins\n" | 72 "-s Disable password logins\n" |
73 "-g Disable password logins for root\n" | 73 "-g Disable password logins for root\n" |
74 "-B Allow blank password logins\n" | 74 "-B Allow blank password logins\n" |
75 #endif | 75 #endif |
76 "-T <1 to %d> Maximum authentication tries (default %d)\n" | 76 "-T Maximum authentication tries (default %d)\n" |
77 #if DROPBEAR_SVR_LOCALTCPFWD | 77 #if DROPBEAR_SVR_LOCALTCPFWD |
78 "-j Disable local port forwarding\n" | 78 "-j Disable local port forwarding\n" |
79 #endif | 79 #endif |
80 #if DROPBEAR_SVR_REMOTETCPFWD | 80 #if DROPBEAR_SVR_REMOTETCPFWD |
81 "-k Disable remote port forwarding\n" | 81 "-k Disable remote port forwarding\n" |
106 RSA_PRIV_FILENAME, | 106 RSA_PRIV_FILENAME, |
107 #endif | 107 #endif |
108 #if DROPBEAR_ECDSA | 108 #if DROPBEAR_ECDSA |
109 ECDSA_PRIV_FILENAME, | 109 ECDSA_PRIV_FILENAME, |
110 #endif | 110 #endif |
111 MAX_AUTH_TRIES, DEFAULT_AUTH_TRIES, | 111 MAX_AUTH_TRIES, |
112 DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, | 112 DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, |
113 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); | 113 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); |
114 } | 114 } |
115 | 115 |
116 void svr_getopts(int argc, char ** argv) { | 116 void svr_getopts(int argc, char ** argv) { |
133 svr_opts.forkbg = 1; | 133 svr_opts.forkbg = 1; |
134 svr_opts.norootlogin = 0; | 134 svr_opts.norootlogin = 0; |
135 svr_opts.noauthpass = 0; | 135 svr_opts.noauthpass = 0; |
136 svr_opts.norootpass = 0; | 136 svr_opts.norootpass = 0; |
137 svr_opts.allowblankpass = 0; | 137 svr_opts.allowblankpass = 0; |
138 svr_opts.maxauthtries = DEFAULT_AUTH_TRIES; | 138 svr_opts.maxauthtries = MAX_AUTH_TRIES; |
139 svr_opts.inetdmode = 0; | 139 svr_opts.inetdmode = 0; |
140 svr_opts.portcount = 0; | 140 svr_opts.portcount = 0; |
141 svr_opts.hostkey = NULL; | 141 svr_opts.hostkey = NULL; |
142 svr_opts.delay_hostkey = 0; | 142 svr_opts.delay_hostkey = 0; |
143 svr_opts.pidfile = DROPBEAR_PIDFILE; | 143 svr_opts.pidfile = DROPBEAR_PIDFILE; |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 if (maxauthtries_arg) { | 342 if (maxauthtries_arg) { |
343 unsigned int val = 0; | 343 unsigned int val = 0; |
344 if (m_str_to_uint(maxauthtries_arg, &val) == DROPBEAR_FAILURE || | 344 if (m_str_to_uint(maxauthtries_arg, &val) == DROPBEAR_FAILURE |
345 val == 0 || val > MAX_AUTH_TRIES) { | 345 || val == 0) { |
346 dropbear_exit("Bad maxauthtries '%s'", maxauthtries_arg); | 346 dropbear_exit("Bad maxauthtries '%s'", maxauthtries_arg); |
347 } | 347 } |
348 svr_opts.maxauthtries = val; | 348 svr_opts.maxauthtries = val; |
349 } | 349 } |
350 | 350 |