[MINI2440] Updated defconfig to add (optional) packages
[openwrt/mini2440.git] / package / dropbear / patches / 100-pubkey_path.patch
blobff6673488b3f3e1a7d8ea9231426764fa8505a66
1 Index: dropbear-0.51/svr-authpubkey.c
2 ===================================================================
3 --- dropbear-0.51.orig/svr-authpubkey.c 2008-04-22 17:29:49.000000000 -0700
4 +++ dropbear-0.51/svr-authpubkey.c 2008-04-22 17:29:49.000000000 -0700
5 @@ -176,6 +176,8 @@
6 goto out;
9 + if (ses.authstate.pw_uid != 0) {
11 /* we don't need to check pw and pw_dir for validity, since
12 * its been done in checkpubkeyperms. */
13 len = strlen(ses.authstate.pw_dir);
14 @@ -187,6 +189,9 @@
16 /* open the file */
17 authfile = fopen(filename, "r");
18 + } else {
19 + authfile = fopen("/etc/dropbear/authorized_keys","r");
20 + }
21 if (authfile == NULL) {
22 goto out;
24 @@ -274,6 +279,8 @@
25 goto out;
28 + if (ses.authstate.pw_uid != 0) {
30 /* allocate max required pathname storage,
31 * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */
32 filename = m_malloc(len + 22);
33 @@ -295,6 +302,14 @@
34 if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
35 goto out;
37 + } else {
38 + if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) {
39 + goto out;
40 + }
41 + if (checkfileperm("/etc/dropbear/authorized_keys") != DROPBEAR_SUCCESS) {
42 + goto out;
43 + }
44 + }
46 /* file looks ok, return success */
47 ret = DROPBEAR_SUCCESS;