Mercurial > dropbear
comparison svr-auth.c @ 1617:1fbe598a14fb
Merge bugfix delay invalid users
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 23 Aug 2018 23:43:45 +0800 |
parents | 768ebf737aa0 5d2d1021ca00 |
children | e11ed628708b |
comparison
equal
deleted
inserted
replaced
1611:0196f4f83fee | 1617:1fbe598a14fb |
---|---|
147 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { | 147 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { |
148 /* user wants to try password auth */ | 148 /* user wants to try password auth */ |
149 if (methodlen == AUTH_METHOD_PASSWORD_LEN && | 149 if (methodlen == AUTH_METHOD_PASSWORD_LEN && |
150 strncmp(methodname, AUTH_METHOD_PASSWORD, | 150 strncmp(methodname, AUTH_METHOD_PASSWORD, |
151 AUTH_METHOD_PASSWORD_LEN) == 0) { | 151 AUTH_METHOD_PASSWORD_LEN) == 0) { |
152 if (valid_user) { | 152 svr_auth_password(valid_user); |
153 svr_auth_password(); | 153 goto out; |
154 goto out; | |
155 } | |
156 } | 154 } |
157 } | 155 } |
158 #endif | 156 #endif |
159 | 157 |
160 #if DROPBEAR_SVR_PAM_AUTH | 158 #if DROPBEAR_SVR_PAM_AUTH |
162 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { | 160 !(svr_opts.norootpass && ses.authstate.pw_uid == 0) ) { |
163 /* user wants to try password auth */ | 161 /* user wants to try password auth */ |
164 if (methodlen == AUTH_METHOD_PASSWORD_LEN && | 162 if (methodlen == AUTH_METHOD_PASSWORD_LEN && |
165 strncmp(methodname, AUTH_METHOD_PASSWORD, | 163 strncmp(methodname, AUTH_METHOD_PASSWORD, |
166 AUTH_METHOD_PASSWORD_LEN) == 0) { | 164 AUTH_METHOD_PASSWORD_LEN) == 0) { |
167 if (valid_user) { | 165 svr_auth_pam(valid_user); |
168 svr_auth_pam(); | 166 goto out; |
169 goto out; | |
170 } | |
171 } | 167 } |
172 } | 168 } |
173 #endif | 169 #endif |
174 | 170 |
175 #if DROPBEAR_SVR_PUBKEY_AUTH | 171 #if DROPBEAR_SVR_PUBKEY_AUTH |
176 /* user wants to try pubkey auth */ | 172 /* user wants to try pubkey auth */ |
177 if (methodlen == AUTH_METHOD_PUBKEY_LEN && | 173 if (methodlen == AUTH_METHOD_PUBKEY_LEN && |
178 strncmp(methodname, AUTH_METHOD_PUBKEY, | 174 strncmp(methodname, AUTH_METHOD_PUBKEY, |
179 AUTH_METHOD_PUBKEY_LEN) == 0) { | 175 AUTH_METHOD_PUBKEY_LEN) == 0) { |
180 if (valid_user) { | 176 svr_auth_pubkey(valid_user); |
181 svr_auth_pubkey(); | |
182 } else { | |
183 /* pubkey has no failure delay */ | |
184 send_msg_userauth_failure(0, 0); | |
185 } | |
186 goto out; | 177 goto out; |
187 } | 178 } |
188 #endif | 179 #endif |
189 | 180 |
190 /* nothing matched, we just fail with a delay */ | 181 /* nothing matched, we just fail with a delay */ |