Mercurial > dropbear
comparison svr-auth.c @ 11:f76c9389e9e0
Mostly done with the listener changeover
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 03 Jun 2004 17:22:48 +0000 |
parents | fe6bca95afa7 |
children | d7cc5b484a2e |
comparison
equal
deleted
inserted
replaced
9:7f77962de998 | 11:f76c9389e9e0 |
---|---|
149 !(ses.opts->norootpass && svr_ses.authstate.pw->pw_uid == 0) ) { | 149 !(ses.opts->norootpass && svr_ses.authstate.pw->pw_uid == 0) ) { |
150 /* user wants to try password auth */ | 150 /* user wants to try password auth */ |
151 if (methodlen == AUTH_METHOD_PASSWORD_LEN && | 151 if (methodlen == AUTH_METHOD_PASSWORD_LEN && |
152 strncmp(methodname, AUTH_METHOD_PASSWORD, | 152 strncmp(methodname, AUTH_METHOD_PASSWORD, |
153 AUTH_METHOD_PASSWORD_LEN) == 0) { | 153 AUTH_METHOD_PASSWORD_LEN) == 0) { |
154 passwordauth(username, userlen); | 154 passwordauth(); |
155 goto out; | 155 goto out; |
156 } | 156 } |
157 } | 157 } |
158 #endif | 158 #endif |
159 | 159 |
160 #ifdef DROPBEAR_PUBKEY_AUTH | 160 #ifdef DROPBEAR_PUBKEY_AUTH |
161 /* user wants to try pubkey auth */ | 161 /* user wants to try pubkey auth */ |
162 if (methodlen == AUTH_METHOD_PUBKEY_LEN && | 162 if (methodlen == AUTH_METHOD_PUBKEY_LEN && |
163 strncmp(methodname, AUTH_METHOD_PUBKEY, | 163 strncmp(methodname, AUTH_METHOD_PUBKEY, |
164 AUTH_METHOD_PUBKEY_LEN) == 0) { | 164 AUTH_METHOD_PUBKEY_LEN) == 0) { |
165 pubkeyauth(username, userlen); | 165 pubkeyauth(); |
166 goto out; | 166 goto out; |
167 } | 167 } |
168 #endif | 168 #endif |
169 | 169 |
170 /* nothing matched, we just fail */ | 170 /* nothing matched, we just fail */ |
198 dropbear_log(LOG_WARNING, "client trying multiple usernames"); | 198 dropbear_log(LOG_WARNING, "client trying multiple usernames"); |
199 m_free(svr_ses.authstate.username); | 199 m_free(svr_ses.authstate.username); |
200 } | 200 } |
201 authclear(); | 201 authclear(); |
202 svr_ses.authstate.pw = getpwnam((char*)username); | 202 svr_ses.authstate.pw = getpwnam((char*)username); |
203 svr_ses.authstate.username = strdup(username); | 203 svr_ses.authstate.username = m_strdup(username); |
204 m_free(svr_ses.authstate.printableuser); | 204 m_free(svr_ses.authstate.printableuser); |
205 } | 205 } |
206 | 206 |
207 /* check that user exists */ | 207 /* check that user exists */ |
208 if (svr_ses.authstate.pw == NULL) { | 208 if (svr_ses.authstate.pw == NULL) { |
212 send_msg_userauth_failure(0, 1); | 212 send_msg_userauth_failure(0, 1); |
213 return DROPBEAR_FAILURE; | 213 return DROPBEAR_FAILURE; |
214 } | 214 } |
215 | 215 |
216 /* We can set it once we know its a real user */ | 216 /* We can set it once we know its a real user */ |
217 svr_ses.authstate.printableuser = strdup(svr_ses.authstate.pw->pw_name); | 217 svr_ses.authstate.printableuser = m_strdup(svr_ses.authstate.pw->pw_name); |
218 | 218 |
219 /* check for non-root if desired */ | 219 /* check for non-root if desired */ |
220 if (ses.opts->norootlogin && svr_ses.authstate.pw->pw_uid == 0) { | 220 if (ses.opts->norootlogin && svr_ses.authstate.pw->pw_uid == 0) { |
221 TRACE(("leave checkusername: root login disabled")); | 221 TRACE(("leave checkusername: root login disabled")); |
222 dropbear_log(LOG_WARNING, "root login rejected"); | 222 dropbear_log(LOG_WARNING, "root login rejected"); |