diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-05-21 12:09:35 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-05-21 12:09:35 +0800 |
commit | 04518e9e801ee57bd6d4caab470da8dc0ec98fd7 (patch) | |
tree | 5e46adedc7cd70e6f7b0547a200544cbcf80b96b /svr-auth.c | |
parent | 41f531ceafc86507c82847f44f9c9e126d798c48 (diff) | |
parent | a57947c513a53e77de0b2eaa67ca6404f444a29f (diff) |
merge in HEAD
--HG--
branch : ecc
Diffstat (limited to 'svr-auth.c')
-rw-r--r-- | svr-auth.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -225,6 +225,7 @@ static int checkusername(unsigned char *username, unsigned int userlen) { char* listshell = NULL; char* usershell = NULL; + int uid; TRACE(("enter checkusername")) if (userlen > MAX_USERNAME_LEN) { return DROPBEAR_FAILURE; @@ -254,6 +255,18 @@ static int checkusername(unsigned char *username, unsigned int userlen) { return DROPBEAR_FAILURE; } + /* check if we are running as non-root, and login user is different from the server */ + uid = geteuid(); + if (uid != 0 && uid != ses.authstate.pw_uid) { + TRACE(("running as nonroot, only server uid is allowed")) + dropbear_log(LOG_WARNING, + "Login attempt with wrong user %s from %s", + ses.authstate.pw_name, + svr_ses.addrstring); + send_msg_userauth_failure(0, 1); + return DROPBEAR_FAILURE; + } + /* check for non-root if desired */ if (svr_opts.norootlogin && ses.authstate.pw_uid == 0) { TRACE(("leave checkusername: root login disabled")) |