]> code.citadel.org Git - citadel.git/blobdiff - citadel/chkpw.c
* Reverted the code I checked in last week that created a
[citadel.git] / citadel / chkpw.c
index c2cc5cd65965b20dae01877b026032d86dc6ae32..5bdb571c16c9e37fa39fded038eb4630d1a737cb 100644 (file)
@@ -105,7 +105,8 @@ int main(int argc, char **argv) {
        }
        while(1) {
                printf("\n\nUsername: ");
-               gets(buf);
+               fgets(buf, sizeof buf, stdin);
+               buf[strlen(buf)-1] = 0;
                p = getpwnam(buf);
                if (p == NULL) {
                        printf("Not found\n");
@@ -114,7 +115,8 @@ int main(int argc, char **argv) {
                        uid = p->pw_uid;
                        printf("     uid: %d\n", uid);
                        printf("Password: ");
-                       gets(buf);
+                       fgets(buf, sizeof buf, stdin);
+                       buf[strlen(buf)-1] = 0;
                        validpw(uid, buf);
                }
        }