|
Lines 210-217
Link Here
|
| 210 |
/* Log before sending the reply */ |
210 |
/* Log before sending the reply */ |
| 211 |
auth_log(authctxt, authenticated, method, " ssh2"); |
211 |
auth_log(authctxt, authenticated, method, " ssh2"); |
| 212 |
|
212 |
|
| 213 |
if (authctxt->postponed) |
213 |
if (authctxt->postponed) { |
|
|
214 |
if (!authctxt->multiple_auth_failure && |
| 215 |
authctxt->multiple_auth.flags) |
| 216 |
goto fake_auth_failure; |
| 214 |
return; |
217 |
return; |
|
|
218 |
} |
| 215 |
|
219 |
|
| 216 |
/* XXX todo: check if multiple auth methods are needed */ |
220 |
/* XXX todo: check if multiple auth methods are needed */ |
| 217 |
if (authenticated == 1) { |
221 |
if (authenticated == 1) { |
|
Lines 225-230
Link Here
|
| 225 |
} else { |
229 |
} else { |
| 226 |
if (authctxt->failures++ > options.max_authtries) |
230 |
if (authctxt->failures++ > options.max_authtries) |
| 227 |
packet_disconnect(AUTH_FAIL_MSG, authctxt->user); |
231 |
packet_disconnect(AUTH_FAIL_MSG, authctxt->user); |
|
|
232 |
fake_auth_failure: |
| 228 |
methods = authmethods_get(); |
233 |
methods = authmethods_get(); |
| 229 |
packet_start(SSH2_MSG_USERAUTH_FAILURE); |
234 |
packet_start(SSH2_MSG_USERAUTH_FAILURE); |
| 230 |
packet_put_cstring(methods); |
235 |
packet_put_cstring(methods); |
|
Lines 233-238
Link Here
|
| 233 |
packet_write_wait(); |
238 |
packet_write_wait(); |
| 234 |
xfree(methods); |
239 |
xfree(methods); |
| 235 |
} |
240 |
} |
|
|
241 |
} |
| 242 |
|
| 243 |
void |
| 244 |
auth2_multiple_auth(const char *method, Authctxt *authctxt, int *authenticated) |
| 245 |
{ |
| 246 |
debug3("%s[%d],entry,method %s,auth(%d,%d,%d),*auth %d,postponed %d", |
| 247 |
__func__, getpid(), method, authctxt->multiple_auth_failure, |
| 248 |
authctxt->multiple_auth.pubkey_passwd.passwd, |
| 249 |
authctxt->multiple_auth.pubkey_passwd.pubkey, *authenticated, |
| 250 |
authctxt->postponed); |
| 251 |
|
| 252 |
if (options.require_both_password_and_pub_key == 1 && |
| 253 |
(!strcasecmp(method, "password") || |
| 254 |
!strcasecmp(method, "publickey"))) { |
| 255 |
if (!*authenticated && !strcasecmp(method, "publickey")) |
| 256 |
authctxt->multiple_auth_failure = 1; |
| 257 |
else if (!authctxt->multiple_auth_failure) { |
| 258 |
if (!strcasecmp(method, "password")) |
| 259 |
authctxt-> |
| 260 |
multiple_auth.pubkey_passwd.passwd = 1; |
| 261 |
else if (!strcasecmp(method, "publickey")) |
| 262 |
authctxt-> |
| 263 |
multiple_auth.pubkey_passwd.pubkey = 1; |
| 264 |
|
| 265 |
if (!authctxt->multiple_auth.pubkey_passwd.passwd || |
| 266 |
!authctxt->multiple_auth.pubkey_passwd.pubkey) { |
| 267 |
authctxt->postponed = 1; |
| 268 |
*authenticated = 0; |
| 269 |
} |
| 270 |
} |
| 271 |
else |
| 272 |
*authenticated = 0; |
| 273 |
} |
| 274 |
debug3("%s[%d],exit,multiple_auth (%d,%d,%d),*auth %d,postponed %d", |
| 275 |
__func__, getpid(), authctxt->multiple_auth_failure, |
| 276 |
authctxt->multiple_auth.pubkey_passwd.passwd, |
| 277 |
authctxt->multiple_auth.pubkey_passwd.pubkey, *authenticated, |
| 278 |
authctxt->postponed); |
| 236 |
} |
279 |
} |
| 237 |
|
280 |
|
| 238 |
#define DELIM "," |
281 |
#define DELIM "," |