File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -988,6 +988,7 @@ void cli_regular_interval(struct cli_def *cli, int seconds) {
988988#define DES_PREFIX "{crypt}" // To distinguish clear text from DES crypted
989989#define MD5_PREFIX "$1$"
990990
991+ // returns 0 on fail/error, 1 if password checks out
991992static int pass_matches (const char * pass , const char * attempt ) {
992993 int des ;
993994 if ((des = !strncasecmp (pass , DES_PREFIX , sizeof (DES_PREFIX ) - 1 ))) pass += sizeof (DES_PREFIX ) - 1 ;
@@ -996,7 +997,10 @@ static int pass_matches(const char *pass, const char *attempt) {
996997 // TODO(dparrish): Find a small crypt(3) function for use on windows
997998 if (des || !strncmp (pass , MD5_PREFIX , sizeof (MD5_PREFIX ) - 1 )) attempt = crypt (attempt , pass );
998999#endif
999-
1000+ if (!attempt ) {
1001+ // silent return here...
1002+ return 0 ;
1003+ }
10001004 return !strcmp (pass , attempt );
10011005}
10021006
You can’t perform that action at this time.
0 commit comments