Mercurial > dropbear
comparison svr-authpubkey.c @ 1633:592a18dac250
Support servers without multiple user support (#76)
author | Patrick Stewart <patstew@gmail.com> |
---|---|
date | Wed, 20 Mar 2019 14:44:49 +0000 |
parents | 9579377b5f8b |
children | 76189c9ffea2 |
comparison
equal
deleted
inserted
replaced
1632:c4bf28ccab97 | 1633:592a18dac250 |
---|---|
345 * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ | 345 * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ |
346 filename = m_malloc(len + 22); | 346 filename = m_malloc(len + 22); |
347 snprintf(filename, len + 22, "%s/.ssh/authorized_keys", | 347 snprintf(filename, len + 22, "%s/.ssh/authorized_keys", |
348 ses.authstate.pw_dir); | 348 ses.authstate.pw_dir); |
349 | 349 |
350 #if DROPBEAR_SVR_MULTIUSER | |
350 /* open the file as the authenticating user. */ | 351 /* open the file as the authenticating user. */ |
351 origuid = getuid(); | 352 origuid = getuid(); |
352 origgid = getgid(); | 353 origgid = getgid(); |
353 if ((setegid(ses.authstate.pw_gid)) < 0 || | 354 if ((setegid(ses.authstate.pw_gid)) < 0 || |
354 (seteuid(ses.authstate.pw_uid)) < 0) { | 355 (seteuid(ses.authstate.pw_uid)) < 0) { |
355 dropbear_exit("Failed to set euid"); | 356 dropbear_exit("Failed to set euid"); |
356 } | 357 } |
358 #endif | |
357 | 359 |
358 authfile = fopen(filename, "r"); | 360 authfile = fopen(filename, "r"); |
359 | 361 |
362 #if DROPBEAR_SVR_MULTIUSER | |
360 if ((seteuid(origuid)) < 0 || | 363 if ((seteuid(origuid)) < 0 || |
361 (setegid(origgid)) < 0) { | 364 (setegid(origgid)) < 0) { |
362 dropbear_exit("Failed to revert euid"); | 365 dropbear_exit("Failed to revert euid"); |
363 } | 366 } |
367 #endif | |
364 | 368 |
365 if (authfile == NULL) { | 369 if (authfile == NULL) { |
366 goto out; | 370 goto out; |
367 } | 371 } |
368 TRACE(("checkpubkey: opened authorized_keys OK")) | 372 TRACE(("checkpubkey: opened authorized_keys OK")) |