1 diff -urN dropbear.old/svr-authpubkey.c dropbear.dev/svr-authpubkey.c
2 --- dropbear.old/svr-authpubkey.c 2005-12-09 06:42:33.000000000 +0100
3 +++ dropbear.dev/svr-authpubkey.c 2005-12-12 01:35:32.139358750 +0100
5 unsigned char* keyblob, unsigned int keybloblen) {
7 FILE * authfile = NULL;
8 - char * filename = NULL;
9 int ret = DROPBEAR_FAILURE;
11 unsigned int len, pos;
16 - /* we don't need to check pw and pw_dir for validity, since
17 - * its been done in checkpubkeyperms. */
18 - len = strlen(ses.authstate.pw->pw_dir);
19 - /* allocate max required pathname storage,
20 - * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */
21 - filename = m_malloc(len + 22);
22 - snprintf(filename, len + 22, "%s/.ssh/authorized_keys",
23 - ses.authstate.pw->pw_dir);
26 - authfile = fopen(filename, "r");
27 + authfile = fopen("/etc/dropbear/authorized_keys", "r");
28 if (authfile == NULL) {
36 TRACE(("leave checkpubkey: ret=%d", ret))
41 /* Returns DROPBEAR_SUCCESS if file permissions for pubkeys are ok,
42 * DROPBEAR_FAILURE otherwise.
43 - * Checks that the user's homedir, ~/.ssh, and
44 - * ~/.ssh/authorized_keys are all owned by either root or the user, and are
45 + * Checks that /etc/dropbear and /etc/dropbear/authorized_keys
46 + * are all owned by either root or the user, and are
48 static int checkpubkeyperms() {
50 - char* filename = NULL;
51 int ret = DROPBEAR_FAILURE;
58 - /* allocate max required pathname storage,
59 - * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */
60 - filename = m_malloc(len + 22);
61 - strncpy(filename, ses.authstate.pw->pw_dir, len+1);
64 - if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
69 - strncat(filename, "/.ssh", 5); /* strlen("/.ssh") == 5 */
70 - if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
71 + if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) {
75 - /* now check ~/.ssh/authorized_keys */
76 - strncat(filename, "/authorized_keys", 16);
77 - if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
78 + if (checkfileperm("/etc/dropbear/authorized_keys") != DROPBEAR_SUCCESS) {
83 ret = DROPBEAR_SUCCESS;
88 TRACE(("leave checkpubkeyperms"))