comparison svr-auth.c @ 1355:3fdd8c5a0195 fuzz

merge main to fuzz
author Matt Johnston <matt@ucc.asn.au>
date Thu, 18 May 2017 23:45:10 +0800
parents 5c2899e35b63 750ec4ec4cbe
children ea150e3e95a6
comparison
equal deleted inserted replaced
1354:7618759e9327 1355:3fdd8c5a0195
54 * user decides to try with a different username etc, and is also invoked 54 * user decides to try with a different username etc, and is also invoked
55 * on initialisation */ 55 * on initialisation */
56 static void authclear() { 56 static void authclear() {
57 57
58 memset(&ses.authstate, 0, sizeof(ses.authstate)); 58 memset(&ses.authstate, 0, sizeof(ses.authstate));
59 #ifdef ENABLE_SVR_PUBKEY_AUTH 59 #if DROPBEAR_SVR_PUBKEY_AUTH
60 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY; 60 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY;
61 #endif 61 #endif
62 #if defined(ENABLE_SVR_PASSWORD_AUTH) || defined(ENABLE_SVR_PAM_AUTH) 62 #if DROPBEAR_SVR_PASSWORD_AUTH || DROPBEAR_SVR_PAM_AUTH
63 if (!svr_opts.noauthpass) { 63 if (!svr_opts.noauthpass) {
64 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD; 64 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD;
65 } 65 }
66 #endif 66 #endif
67 if (ses.authstate.pw_name) { 67 if (ses.authstate.pw_name) {
167 send_msg_userauth_failure(0, 0); 167 send_msg_userauth_failure(0, 0);
168 goto out; 168 goto out;
169 } 169 }
170 } 170 }
171 171
172 #ifdef ENABLE_SVR_PASSWORD_AUTH 172 #if DROPBEAR_SVR_PASSWORD_AUTH
173 if (!svr_opts.noauthpass && 173 if (!svr_opts.noauthpass &&
174 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { 174 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) {
175 /* user wants to try password auth */ 175 /* user wants to try password auth */
176 if (methodlen == AUTH_METHOD_PASSWORD_LEN && 176 if (methodlen == AUTH_METHOD_PASSWORD_LEN &&
177 strncmp(methodname, AUTH_METHOD_PASSWORD, 177 strncmp(methodname, AUTH_METHOD_PASSWORD,
182 } 182 }
183 } 183 }
184 } 184 }
185 #endif 185 #endif
186 186
187 #ifdef ENABLE_SVR_PAM_AUTH 187 #if DROPBEAR_SVR_PAM_AUTH
188 if (!svr_opts.noauthpass && 188 if (!svr_opts.noauthpass &&
189 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { 189 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) {
190 /* user wants to try password auth */ 190 /* user wants to try password auth */
191 if (methodlen == AUTH_METHOD_PASSWORD_LEN && 191 if (methodlen == AUTH_METHOD_PASSWORD_LEN &&
192 strncmp(methodname, AUTH_METHOD_PASSWORD, 192 strncmp(methodname, AUTH_METHOD_PASSWORD,
197 } 197 }
198 } 198 }
199 } 199 }
200 #endif 200 #endif
201 201
202 #ifdef ENABLE_SVR_PUBKEY_AUTH 202 #if DROPBEAR_SVR_PUBKEY_AUTH
203 /* user wants to try pubkey auth */ 203 /* user wants to try pubkey auth */
204 if (methodlen == AUTH_METHOD_PUBKEY_LEN && 204 if (methodlen == AUTH_METHOD_PUBKEY_LEN &&
205 strncmp(methodname, AUTH_METHOD_PUBKEY, 205 strncmp(methodname, AUTH_METHOD_PUBKEY,
206 AUTH_METHOD_PUBKEY_LEN) == 0) { 206 AUTH_METHOD_PUBKEY_LEN) == 0) {
207 if (valid_user) { 207 if (valid_user) {