diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2014-10-29 17:54:11 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2014-10-29 17:54:11 -0700 |
commit | 851c762ee722a84d15348b2512b3b578282e590b (patch) | |
tree | 264d6f94c9ea861418ec19254921bf3f11b1718a /sesman/verify_user.c | |
parent | 9cb9a4bb5710ae33548e8649b680a67dce2d16bf (diff) | |
download | xrdp-proprietary-851c762ee722a84d15348b2512b3b578282e590b.tar.gz xrdp-proprietary-851c762ee722a84d15348b2512b3b578282e590b.zip |
sesman: check for null from crypt()
Diffstat (limited to 'sesman/verify_user.c')
-rw-r--r-- | sesman/verify_user.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sesman/verify_user.c b/sesman/verify_user.c index 98d3dd32..49c475c6 100644 --- a/sesman/verify_user.c +++ b/sesman/verify_user.c @@ -51,6 +51,7 @@ long DEFAULT_CC auth_userpass(char *user, char *pass, int *errorcode) { const char *encr; + const char *epass; struct passwd *spw; struct spwd *stp; @@ -84,8 +85,12 @@ auth_userpass(char *user, char *pass, int *errorcode) /* old system with only passwd */ encr = spw->pw_passwd; } - - return (strcmp(encr, crypt(pass, encr)) == 0); + epass = crypt(pass, encr); + if (epass == 0) + { + return 0; + } + return (strcmp(encr, epass) == 0); } /******************************************************************************/ |