]> diplodocus.org Git - nmh/blobdiff - sbr/ruserpass.c
Improve these comments a bit.
[nmh] / sbr / ruserpass.c
index 7669f8bb7030cd76243b396004f419950da74721..7892cbfdc46a636791d26fe48f54f7d266faeaf1 100644 (file)
@@ -102,7 +102,8 @@ ruserpass(char *host, char **aname, char **apass)
                        break;
 
                    case PASSWD:
                        break;
 
                    case PASSWD:
-                       if (fstat(fileno(cfile), &stb) >= 0 &&
+                       if (!credentials_no_perm_check &&
+                           fstat(fileno(cfile), &stb) >= 0 &&
                            (stb.st_mode & 077) != 0) {
                            /* We make this a fatal error to force the
                               user to correct it. */
                            (stb.st_mode & 077) != 0) {
                            /* We make this a fatal error to force the
                               user to correct it. */
@@ -148,9 +149,11 @@ ruserpass(char *host, char **aname, char **apass)
        }
        printf("Name (%s:%s): ", host, myname);
 
        }
        printf("Name (%s:%s): ", host, myname);
 
-       fgets(tmp, sizeof(tmp) - 1, stdin);
+       if (fgets(tmp, sizeof(tmp) - 1, stdin) == NULL) {
+           advise ("tmp", "fgets");
+       }
        tmp[strlen(tmp) - 1] = '\0';
        tmp[strlen(tmp) - 1] = '\0';
-       if (*tmp != '\0') {
+       if (*tmp != '\0' || myname == NULL) {
            myname = tmp;
        }
 
            myname = tmp;
        }