X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/975b8341cc7ff17cbe4a5900b6ed41c47cceed62..fb6ea8dca0129dbb93ecb5fe1147a7b03138bbf8:/sbr/ruserpass.c?ds=inline diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index 7669f8bb..7892cbfd 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -102,7 +102,8 @@ ruserpass(char *host, char **aname, char **apass) 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. */ @@ -148,9 +149,11 @@ ruserpass(char *host, char **aname, char **apass) } 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'; - if (*tmp != '\0') { + if (*tmp != '\0' || myname == NULL) { myname = tmp; }