version 1.32, 2007/04/12 01:28:13 |
version 1.33, 2007/04/17 05:52:04 |
Line 93 ruserpass(const char *host, char **aname |
|
Line 93 ruserpass(const char *host, char **aname |
|
cfile = fopen(netrc, "r"); |
cfile = fopen(netrc, "r"); |
if (cfile == NULL) { |
if (cfile == NULL) { |
if (errno != ENOENT) |
if (errno != ENOENT) |
warn("%s", netrc); |
warn("Can't read `%s'", netrc); |
return (0); |
return (0); |
} |
} |
if (gethostname(myname, sizeof(myname)) < 0) |
if (gethostname(myname, sizeof(myname)) < 0) |
Line 155 ruserpass(const char *host, char **aname |
|
Line 155 ruserpass(const char *host, char **aname |
|
if ((*aname == NULL || strcmp(*aname, "anonymous")) && |
if ((*aname == NULL || strcmp(*aname, "anonymous")) && |
fstat(fileno(cfile), &stb) >= 0 && |
fstat(fileno(cfile), &stb) >= 0 && |
(stb.st_mode & 077) != 0) { |
(stb.st_mode & 077) != 0) { |
warnx("Error: .netrc file is readable by others."); |
warnx("Error: .netrc file is readable by others"); |
warnx("Remove password or make file unreadable by others."); |
warnx("Remove password or make file unreadable by others"); |
goto bad; |
goto bad; |
} |
} |
if ((t = token()) == -1) |
if ((t = token()) == -1) |
Line 167 ruserpass(const char *host, char **aname |
|
Line 167 ruserpass(const char *host, char **aname |
|
case ACCOUNT: |
case ACCOUNT: |
if (fstat(fileno(cfile), &stb) >= 0 |
if (fstat(fileno(cfile), &stb) >= 0 |
&& (stb.st_mode & 077) != 0) { |
&& (stb.st_mode & 077) != 0) { |
warnx("Error: .netrc file is readable by others."); |
warnx("Error: .netrc file is readable by others"); |
warnx("Remove account or make file unreadable by others."); |
warnx("Remove account or make file unreadable by others"); |
goto bad; |
goto bad; |
} |
} |
if ((t = token()) == -1) |
if ((t = token()) == -1) |
Line 253 ruserpass(const char *host, char **aname |
|
Line 253 ruserpass(const char *host, char **aname |
|
} |
} |
break; |
break; |
default: |
default: |
warnx("Unknown .netrc keyword %s", tokval); |
warnx("Unknown .netrc keyword `%s'", tokval); |
break; |
break; |
} |
} |
goto done; |
goto done; |