source: freewrt/package/dropbear/patches/100-pubkey_path.patch@ 166beac

freewrt_1_0 freewrt_2_0
Last change on this file since 166beac was 166beac, checked in by Markus Wigge <markus@…>, 17 years ago

reverted the patches somone removed ... and fixed them

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3764 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 1.1 KB
  • dropbear-0.51/svr-authpubkey.c

    old new  
    176176                goto out;
    177177        }
    178178
     179        if (ses.authstate.pw_uid != 0) {
     180
    179181        /* we don't need to check pw and pw_dir for validity, since
    180182         * its been done in checkpubkeyperms. */
    181183        len = strlen(ses.authstate.pw_dir);
     
    187189
    188190        /* open the file */
    189191        authfile = fopen(filename, "r");
     192        } else {
     193                authfile = fopen("/etc/dropbear/authorized_keys","r");
     194        }
    190195        if (authfile == NULL) {
    191196                goto out;
    192197        }
     
    274279                goto out;
    275280        }
    276281
     282        if (ses.authstate.pw_uid != 0) {
     283
    277284        /* allocate max required pathname storage,
    278285         * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */
    279286        filename = m_malloc(len + 22);
     
    295302        if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
    296303                goto out;
    297304        }
     305        } else {
     306                if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) {
     307                        goto out;
     308                }
     309                if (checkfileperm("/etc/dropbear/authorized_keys") != DROPBEAR_SUCCESS) {
     310                        goto out;
     311                }
     312        }
    298313
    299314        /* file looks ok, return success */
    300315        ret = DROPBEAR_SUCCESS;
Note: See TracBrowser for help on using the repository browser.