X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/28c3595a77a8c942bee1057085776dad0b3d53f4..f7eb978bd395752d3d9037ea4436b8e2db41f135:/sbr/ruserpass.c 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; }