version 1.20, 2006/05/16 23:43:16 |
version 1.21, 2007/03/22 11:35:02 |
|
|
if ((mydomain = strchr(myname, '.')) == NULL) |
if ((mydomain = strchr(myname, '.')) == NULL) |
mydomain = ""; |
mydomain = ""; |
next: |
next: |
while ((t = token())) switch(t) { |
while ((t = token()) > 0) switch(t) { |
|
|
case DEFAULT: |
case DEFAULT: |
usedefault = 1; |
usedefault = 1; |
|
|
|
|
case MACH: |
case MACH: |
if (!usedefault) { |
if (!usedefault) { |
if (token() != ID) |
if ((t = token()) == -1) |
|
goto bad; |
|
if (t != ID) |
continue; |
continue; |
/* |
/* |
* Allow match either for user's input host name |
* Allow match either for user's input host name |
|
|
continue; |
continue; |
} |
} |
match: |
match: |
while ((t = token()) && t != MACH && t != DEFAULT) switch(t) { |
while ((t = token()) > 0 && |
|
t != MACH && t != DEFAULT) switch(t) { |
|
|
case LOGIN: |
case LOGIN: |
if (token()) { |
if ((t = token()) == -1) |
|
goto bad; |
|
if (t) { |
if (*aname == 0) |
if (*aname == 0) |
*aname = strdup(tokval); |
*aname = strdup(tokval); |
else { |
else { |
|
|
warnx("Remove password or make file unreadable by others."); |
warnx("Remove password or make file unreadable by others."); |
goto bad; |
goto bad; |
} |
} |
if (token() && *apass == 0) |
if ((t = token()) == -1) |
|
goto bad; |
|
if (t && *apass == 0) |
*apass = strdup(tokval); |
*apass = strdup(tokval); |
break; |
break; |
case ACCOUNT: |
case ACCOUNT: |
|
|
warnx("Remove account or make file unreadable by others."); |
warnx("Remove account or make file unreadable by others."); |
goto bad; |
goto bad; |
} |
} |
if (token() && *aacct == 0) |
if ((t = token()) == -1) |
|
goto bad; |
|
if (t && *aacct == 0) |
*aacct = strdup(tokval); |
*aacct = strdup(tokval); |
break; |
break; |
case MACDEF: |
case MACDEF: |
|
|
goto done; |
goto done; |
} |
} |
done: |
done: |
|
if (t == -1) |
|
goto bad; |
(void)fclose(cfile); |
(void)fclose(cfile); |
return (0); |
return (0); |
bad: |
bad: |
|
|
if (c == '\\') |
if (c == '\\') |
c = fgetc(cfile); |
c = fgetc(cfile); |
*cp++ = c; |
*cp++ = c; |
|
if (cp == tokval + sizeof(tokval)) { |
|
warnx("Token in .netrc too long"); |
|
return (-1); |
|
} |
} |
} |
} else { |
} else { |
*cp++ = c; |
*cp++ = c; |
|
|
if (c == '\\') |
if (c == '\\') |
c = fgetc(cfile); |
c = fgetc(cfile); |
*cp++ = c; |
*cp++ = c; |
|
if (cp == tokval + sizeof(tokval)) { |
|
warnx("Token in .netrc too long"); |
|
return (-1); |
|
} |
} |
} |
} |
} |
*cp = 0; |
*cp = 0; |