]> git.armaanb.net Git - opendoas.git/blobdiff - shadow.c
timestamp: error out if fstat and lstat st_ino and st_dev are not the same
[opendoas.git] / shadow.c
index a775b2beec88571d6e8ed44af651b58a47d084f2..71c71c697dd644017a7d77bc8541f029c49038f2 100644 (file)
--- a/shadow.c
+++ b/shadow.c
@@ -64,15 +64,18 @@ shadowauth(const char *myname, int persist)
                        "tty required for %s", myname);
                errx(1, "a tty is required");
        }
-       if ((encrypted = crypt(response, hash)) == NULL)
-               err(1, "crypt");
+       if (response == NULL)
+               err(1, "readpassphrase");
+       if ((encrypted = crypt(response, hash)) == NULL) {
+               explicit_bzero(rbuf, sizeof(rbuf));
+               errx(1, "Authorization failed");
+       }
+       explicit_bzero(rbuf, sizeof(rbuf));
        if (strcmp(encrypted, hash) != 0) {
                syslog(LOG_AUTHPRIV | LOG_NOTICE, "failed auth for %s", myname);
                errx(1, "Authorization failed");
        }
 
-       explicit_bzero(rbuf, sizeof(rbuf));
-
 #ifdef USE_TIMESTAMP
 good:
        if (fd != -1) {