removed all stupid (void)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1034 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -817,15 +817,15 @@ qprintf(const Char *str, Char *s)
|
|||||||
{
|
{
|
||||||
Char *p;
|
Char *p;
|
||||||
|
|
||||||
(void)printf("%s:\n", str);
|
printf("%s:\n", str);
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", CHAR(*p));
|
printf("%c", CHAR(*p));
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", *p & M_PROTECT ? '"' : ' ');
|
printf("%c", *p & M_PROTECT ? '"' : ' ');
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", ismeta(*p) ? '_' : ' ');
|
printf("%c", ismeta(*p) ? '_' : ' ');
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -91,7 +91,7 @@ setpeer(int argc, char **argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
(void) another(&argc, &argv, "to");
|
another(&argc, &argv, "to");
|
||||||
if (argc < 2 || argc > 3) {
|
if (argc < 2 || argc > 3) {
|
||||||
printf("usage: %s host-name [port]\n", argv[0]);
|
printf("usage: %s host-name [port]\n", argv[0]);
|
||||||
code = -1;
|
code = -1;
|
||||||
@@ -119,14 +119,14 @@ setpeer(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Set up defaults for FTP.
|
* Set up defaults for FTP.
|
||||||
*/
|
*/
|
||||||
(void) strcpy(typename, "ascii"), type = TYPE_A;
|
strcpy(typename, "ascii"), type = TYPE_A;
|
||||||
curtype = TYPE_A;
|
curtype = TYPE_A;
|
||||||
(void) strcpy(formname, "non-print"), form = FORM_N;
|
strcpy(formname, "non-print"), form = FORM_N;
|
||||||
(void) strcpy(modename, "stream"), mode = MODE_S;
|
strcpy(modename, "stream"), mode = MODE_S;
|
||||||
(void) strcpy(structname, "file"), stru = STRU_F;
|
strcpy(structname, "file"), stru = STRU_F;
|
||||||
(void) strcpy(bytename, "8"), bytesize = 8;
|
strcpy(bytename, "8"), bytesize = 8;
|
||||||
if (autologin)
|
if (autologin)
|
||||||
(void) login(argv[1]);
|
login(argv[1]);
|
||||||
|
|
||||||
#if defined(unix) && NBBY == 8
|
#if defined(unix) && NBBY == 8
|
||||||
/*
|
/*
|
||||||
@@ -165,7 +165,7 @@ setpeer(int argc, char **argv)
|
|||||||
* for text files unless changed by the user.
|
* for text files unless changed by the user.
|
||||||
*/
|
*/
|
||||||
type = 0;
|
type = 0;
|
||||||
(void) strcpy(typename, "binary");
|
strcpy(typename, "binary");
|
||||||
if (overbose)
|
if (overbose)
|
||||||
printf("Using %s mode to transfer files.\n",
|
printf("Using %s mode to transfer files.\n",
|
||||||
typename);
|
typename);
|
||||||
@@ -238,7 +238,7 @@ settype(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
comret = command("TYPE %s", p->t_mode);
|
comret = command("TYPE %s", p->t_mode);
|
||||||
if (comret == COMPLETE) {
|
if (comret == COMPLETE) {
|
||||||
(void) strcpy(typename, p->t_name);
|
strcpy(typename, p->t_name);
|
||||||
curtype = type = p->t_type;
|
curtype = type = p->t_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -408,7 +408,7 @@ mabort(int signo)
|
|||||||
int ointer;
|
int ointer;
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
if (mflag && fromatty) {
|
if (mflag && fromatty) {
|
||||||
ointer = interactive;
|
ointer = interactive;
|
||||||
interactive = 1;
|
interactive = 1;
|
||||||
@@ -441,7 +441,7 @@ mput(int argc, char **argv)
|
|||||||
mname = argv[0];
|
mname = argv[0];
|
||||||
mflag = 1;
|
mflag = 1;
|
||||||
oldintr = signal(SIGINT, mabort);
|
oldintr = signal(SIGINT, mabort);
|
||||||
(void) setjmp(jabort);
|
setjmp(jabort);
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
char *cp, *tp2, tmpbuf[MaxPathLen];
|
char *cp, *tp2, tmpbuf[MaxPathLen];
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ mput(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ mput(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
globfree(&gl);
|
globfree(&gl);
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,14 +547,14 @@ void
|
|||||||
reget(int argc, char **argv)
|
reget(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) getit(argc, argv, 1, "r+w");
|
getit(argc, argv, 1, "r+w");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
get(int argc, char **argv)
|
get(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) getit(argc, argv, 0, restart_point ? "r+w" : "w" );
|
getit(argc, argv, 0, restart_point ? "r+w" : "w" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -681,7 +681,7 @@ mget(int argc, char **argv)
|
|||||||
mname = argv[0];
|
mname = argv[0];
|
||||||
mflag = 1;
|
mflag = 1;
|
||||||
oldintr = signal(SIGINT, mabort);
|
oldintr = signal(SIGINT, mabort);
|
||||||
(void) setjmp(jabort);
|
setjmp(jabort);
|
||||||
while ((cp = remglob(argv,proxy)) != NULL) {
|
while ((cp = remglob(argv,proxy)) != NULL) {
|
||||||
if (*cp == '\0') {
|
if (*cp == '\0') {
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
@@ -713,7 +713,7 @@ mget(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT,oldintr);
|
signal(SIGINT,oldintr);
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ remglob(char **argv, int doswitch)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ftemp) {
|
if (ftemp) {
|
||||||
(void) fclose(ftemp);
|
fclose(ftemp);
|
||||||
ftemp = NULL;
|
ftemp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -747,8 +747,8 @@ remglob(char **argv, int doswitch)
|
|||||||
return (cp);
|
return (cp);
|
||||||
}
|
}
|
||||||
if (ftemp == NULL) {
|
if (ftemp == NULL) {
|
||||||
(void) strcpy(temp, _PATH_TMP);
|
strcpy(temp, _PATH_TMP);
|
||||||
(void) mktemp(temp);
|
mktemp(temp);
|
||||||
oldverbose = verbose, verbose = 0;
|
oldverbose = verbose, verbose = 0;
|
||||||
oldhash = hash, hash = 0;
|
oldhash = hash, hash = 0;
|
||||||
if (doswitch) {
|
if (doswitch) {
|
||||||
@@ -761,14 +761,14 @@ remglob(char **argv, int doswitch)
|
|||||||
}
|
}
|
||||||
verbose = oldverbose; hash = oldhash;
|
verbose = oldverbose; hash = oldhash;
|
||||||
ftemp = fopen(temp, "r");
|
ftemp = fopen(temp, "r");
|
||||||
(void) unlink(temp);
|
unlink(temp);
|
||||||
if (ftemp == NULL) {
|
if (ftemp == NULL) {
|
||||||
printf("can't find list of remote files, oops\n");
|
printf("can't find list of remote files, oops\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fgets(buf, sizeof (buf), ftemp) == NULL) {
|
if (fgets(buf, sizeof (buf), ftemp) == NULL) {
|
||||||
(void) fclose(ftemp), ftemp = NULL;
|
fclose(ftemp), ftemp = NULL;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
if ((cp = strchr(buf, '\n')) != NULL)
|
if ((cp = strchr(buf, '\n')) != NULL)
|
||||||
@@ -978,7 +978,7 @@ cd(int argc, char **argv)
|
|||||||
if (command("CWD %s", argv[1]) == ERROR && code == 500) {
|
if (command("CWD %s", argv[1]) == ERROR && code == 500) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("CWD command not recognized, trying XCWD\n");
|
printf("CWD command not recognized, trying XCWD\n");
|
||||||
(void) command("XCWD %s", argv[1]);
|
command("XCWD %s", argv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1026,7 @@ delete(int argc, char **argv)
|
|||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) command("DELE %s", argv[1]);
|
command("DELE %s", argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1047,14 +1047,14 @@ mdelete(int argc, char **argv)
|
|||||||
mname = argv[0];
|
mname = argv[0];
|
||||||
mflag = 1;
|
mflag = 1;
|
||||||
oldintr = signal(SIGINT, mabort);
|
oldintr = signal(SIGINT, mabort);
|
||||||
(void) setjmp(jabort);
|
setjmp(jabort);
|
||||||
while ((cp = remglob(argv,0)) != NULL) {
|
while ((cp = remglob(argv,0)) != NULL) {
|
||||||
if (*cp == '\0') {
|
if (*cp == '\0') {
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (mflag && confirm(argv[0], cp)) {
|
if (mflag && confirm(argv[0], cp)) {
|
||||||
(void) command("DELE %s", cp);
|
command("DELE %s", cp);
|
||||||
if (!mflag && fromatty) {
|
if (!mflag && fromatty) {
|
||||||
ointer = interactive;
|
ointer = interactive;
|
||||||
interactive = 1;
|
interactive = 1;
|
||||||
@@ -1065,7 +1065,7 @@ mdelete(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,7 +1085,7 @@ usage:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (command("RNFR %s", argv[1]) == CONTINUE)
|
if (command("RNFR %s", argv[1]) == CONTINUE)
|
||||||
(void) command("RNTO %s", argv[2]);
|
command("RNTO %s", argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1150,7 +1150,7 @@ usage:
|
|||||||
mname = argv[0];
|
mname = argv[0];
|
||||||
mflag = 1;
|
mflag = 1;
|
||||||
oldintr = signal(SIGINT, mabort);
|
oldintr = signal(SIGINT, mabort);
|
||||||
(void) setjmp(jabort);
|
setjmp(jabort);
|
||||||
for (i = 1; mflag && i < argc-1; ++i) {
|
for (i = 1; mflag && i < argc-1; ++i) {
|
||||||
*mode = (i == 1) ? 'w' : 'a';
|
*mode = (i == 1) ? 'w' : 'a';
|
||||||
recvrequest(cmd, dest, argv[i], mode, 0);
|
recvrequest(cmd, dest, argv[i], mode, 0);
|
||||||
@@ -1163,7 +1163,7 @@ usage:
|
|||||||
interactive = ointer;
|
interactive = ointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1183,22 +1183,22 @@ shell(int argc, char **argv)
|
|||||||
old2 = signal (SIGQUIT, SIG_IGN);
|
old2 = signal (SIGQUIT, SIG_IGN);
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
for (pid = 3; pid < 20; pid++)
|
for (pid = 3; pid < 20; pid++)
|
||||||
(void) close(pid);
|
close(pid);
|
||||||
(void) signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
(void) signal(SIGQUIT, SIG_DFL);
|
signal(SIGQUIT, SIG_DFL);
|
||||||
shell = getenv("SHELL");
|
shell = getenv("SHELL");
|
||||||
if (shell == NULL)
|
if (shell == NULL)
|
||||||
shell = _PATH_BSHELL;
|
shell = _PATH_BSHELL;
|
||||||
namep = strrchr(shell,'/');
|
namep = strrchr(shell,'/');
|
||||||
if (namep == NULL)
|
if (namep == NULL)
|
||||||
namep = shell;
|
namep = shell;
|
||||||
(void) strcpy(shellnam,"-");
|
strcpy(shellnam,"-");
|
||||||
(void) strcat(shellnam, ++namep);
|
strcat(shellnam, ++namep);
|
||||||
if (strcmp(namep, "sh") != 0)
|
if (strcmp(namep, "sh") != 0)
|
||||||
shellnam[0] = '+';
|
shellnam[0] = '+';
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf ("%s\n", shell);
|
printf ("%s\n", shell);
|
||||||
(void) fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
execl(shell,shellnam,"-c",altarg,(char *)0);
|
execl(shell,shellnam,"-c",altarg,(char *)0);
|
||||||
@@ -1213,8 +1213,8 @@ shell(int argc, char **argv)
|
|||||||
if (pid > 0)
|
if (pid > 0)
|
||||||
while (wait(&status) != pid)
|
while (wait(&status) != pid)
|
||||||
;
|
;
|
||||||
(void) signal(SIGINT, old1);
|
signal(SIGINT, old1);
|
||||||
(void) signal(SIGQUIT, old2);
|
signal(SIGQUIT, old2);
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
warn("%s", "Try again later");
|
warn("%s", "Try again later");
|
||||||
code = -1;
|
code = -1;
|
||||||
@@ -1235,7 +1235,7 @@ user(int argc, char **argv)
|
|||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
(void) another(&argc, &argv, "username");
|
another(&argc, &argv, "username");
|
||||||
if (argc < 2 || argc > 4) {
|
if (argc < 2 || argc > 4) {
|
||||||
printf("usage: %s username [password] [account]\n", argv[0]);
|
printf("usage: %s username [password] [account]\n", argv[0]);
|
||||||
code = -1;
|
code = -1;
|
||||||
@@ -1254,8 +1254,8 @@ user(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (n == CONTINUE) {
|
if (n == CONTINUE) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
printf("Account: "); (void) fflush(stdout);
|
printf("Account: "); fflush(stdout);
|
||||||
(void) fgets(acct, sizeof(acct) - 1, stdin);
|
fgets(acct, sizeof(acct) - 1, stdin);
|
||||||
acct[strlen(acct) - 1] = '\0';
|
acct[strlen(acct) - 1] = '\0';
|
||||||
argv[3] = acct; argc++;
|
argv[3] = acct; argc++;
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1267,7 @@ user(int argc, char **argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!aflag && argc == 4) {
|
if (!aflag && argc == 4) {
|
||||||
(void) command("ACCT %s", argv[3]);
|
command("ACCT %s", argv[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,7 +1286,7 @@ pwd(int argc, char **argv)
|
|||||||
verbose = 1;
|
verbose = 1;
|
||||||
if (command("PWD") == ERROR && code == 500) {
|
if (command("PWD") == ERROR && code == 500) {
|
||||||
printf("PWD command not recognized, trying XPWD\n");
|
printf("PWD command not recognized, trying XPWD\n");
|
||||||
(void) command("XPWD");
|
command("XPWD");
|
||||||
}
|
}
|
||||||
verbose = oldverbose;
|
verbose = oldverbose;
|
||||||
}
|
}
|
||||||
@@ -1306,7 +1306,7 @@ makedir(int argc, char **argv)
|
|||||||
if (command("MKD %s", argv[1]) == ERROR && code == 500) {
|
if (command("MKD %s", argv[1]) == ERROR && code == 500) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("MKD command not recognized, trying XMKD\n");
|
printf("MKD command not recognized, trying XMKD\n");
|
||||||
(void) command("XMKD %s", argv[1]);
|
command("XMKD %s", argv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1325,7 +1325,7 @@ removedir(int argc, char **argv)
|
|||||||
if (command("RMD %s", argv[1]) == ERROR && code == 500) {
|
if (command("RMD %s", argv[1]) == ERROR && code == 500) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("RMD command not recognized, trying XRMD\n");
|
printf("RMD command not recognized, trying XRMD\n");
|
||||||
(void) command("XRMD %s", argv[1]);
|
command("XRMD %s", argv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1371,7 +1371,7 @@ quote1(char *initial, int argc, char **argv)
|
|||||||
int i, len;
|
int i, len;
|
||||||
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
||||||
|
|
||||||
(void) strcpy(buf, initial);
|
strcpy(buf, initial);
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
len += strlen(strcpy(&buf[len], argv[1]));
|
len += strlen(strcpy(&buf[len], argv[1]));
|
||||||
@@ -1398,7 +1398,7 @@ usage:
|
|||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) command("SITE CHMOD %s %s", argv[1], argv[2]);
|
command("SITE CHMOD %s %s", argv[1], argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1407,7 +1407,7 @@ do_umask(int argc, char **argv)
|
|||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
(void) command(argc == 1 ? "SITE UMASK" : "SITE UMASK %s", argv[1]);
|
command(argc == 1 ? "SITE UMASK" : "SITE UMASK %s", argv[1]);
|
||||||
verbose = oldverbose;
|
verbose = oldverbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1417,7 +1417,7 @@ ftp_idle(int argc, char **argv)
|
|||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
(void) command(argc == 1 ? "SITE IDLE" : "SITE IDLE %s", argv[1]);
|
command(argc == 1 ? "SITE IDLE" : "SITE IDLE %s", argv[1]);
|
||||||
verbose = oldverbose;
|
verbose = oldverbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,7 +1430,7 @@ rmthelp(int argc, char **argv)
|
|||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
(void) command(argc == 1 ? "HELP" : "HELP %s", argv[1]);
|
command(argc == 1 ? "HELP" : "HELP %s", argv[1]);
|
||||||
verbose = oldverbose;
|
verbose = oldverbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1460,9 +1460,9 @@ disconnect(int argc, char **argv)
|
|||||||
|
|
||||||
if (!connected)
|
if (!connected)
|
||||||
return;
|
return;
|
||||||
(void) command("QUIT");
|
command("QUIT");
|
||||||
if (cout) {
|
if (cout) {
|
||||||
(void) fclose(cout);
|
fclose(cout);
|
||||||
}
|
}
|
||||||
cout = NULL;
|
cout = NULL;
|
||||||
connected = 0;
|
connected = 0;
|
||||||
@@ -1481,7 +1481,7 @@ confirm(char *cmd, char *file)
|
|||||||
if (!interactive)
|
if (!interactive)
|
||||||
return (1);
|
return (1);
|
||||||
printf("%s %s? ", cmd, file);
|
printf("%s %s? ", cmd, file);
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
if (fgets(line, sizeof line, stdin) == NULL)
|
if (fgets(line, sizeof line, stdin) == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
return (*line != 'n' && *line != 'N');
|
return (*line != 'n' && *line != 'N');
|
||||||
@@ -1530,18 +1530,18 @@ account(int argc, char **argv)
|
|||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
++argv;
|
++argv;
|
||||||
--argc;
|
--argc;
|
||||||
(void) strncpy(acct,*argv,49);
|
strncpy(acct,*argv,49);
|
||||||
acct[49] = '\0';
|
acct[49] = '\0';
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
--argc;
|
--argc;
|
||||||
++argv;
|
++argv;
|
||||||
(void) strncat(acct,*argv, 49-strlen(acct));
|
strncat(acct,*argv, 49-strlen(acct));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
des_read_pw_string(acct, sizeof(acct), "Account:", 0);
|
des_read_pw_string(acct, sizeof(acct), "Account:", 0);
|
||||||
}
|
}
|
||||||
(void) command("ACCT %s", acct);
|
command("ACCT %s", acct);
|
||||||
}
|
}
|
||||||
|
|
||||||
jmp_buf abortprox;
|
jmp_buf abortprox;
|
||||||
@@ -1577,19 +1577,19 @@ doproxy(int argc, char **argv)
|
|||||||
c = getcmd(argv[1]);
|
c = getcmd(argv[1]);
|
||||||
if (c == (struct cmd *) -1) {
|
if (c == (struct cmd *) -1) {
|
||||||
printf("?Ambiguous command\n");
|
printf("?Ambiguous command\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
printf("?Invalid command\n");
|
printf("?Invalid command\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!c->c_proxy) {
|
if (!c->c_proxy) {
|
||||||
printf("?Invalid proxy command\n");
|
printf("?Invalid proxy command\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1601,9 +1601,9 @@ doproxy(int argc, char **argv)
|
|||||||
pswitch(1);
|
pswitch(1);
|
||||||
if (c->c_conn && !connected) {
|
if (c->c_conn && !connected) {
|
||||||
printf("Not connected\n");
|
printf("Not connected\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
pswitch(0);
|
pswitch(0);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1615,7 +1615,7 @@ doproxy(int argc, char **argv)
|
|||||||
proxflag = 0;
|
proxflag = 0;
|
||||||
}
|
}
|
||||||
pswitch(0);
|
pswitch(0);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1647,13 +1647,13 @@ setntrans(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
ntflag++;
|
ntflag++;
|
||||||
code = ntflag;
|
code = ntflag;
|
||||||
(void) strncpy(ntin, argv[1], 16);
|
strncpy(ntin, argv[1], 16);
|
||||||
ntin[16] = '\0';
|
ntin[16] = '\0';
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
ntout[0] = '\0';
|
ntout[0] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) strncpy(ntout, argv[2], 16);
|
strncpy(ntout, argv[2], 16);
|
||||||
ntout[16] = '\0';
|
ntout[16] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1711,10 +1711,10 @@ setnmap(int argc, char **argv)
|
|||||||
cp = strchr(altarg, ' ');
|
cp = strchr(altarg, ' ');
|
||||||
}
|
}
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
(void) strncpy(mapin, altarg, MaxPathLen - 1);
|
strncpy(mapin, altarg, MaxPathLen - 1);
|
||||||
while (*++cp == ' ')
|
while (*++cp == ' ')
|
||||||
continue;
|
continue;
|
||||||
(void) strncpy(mapout, cp, MaxPathLen - 1);
|
strncpy(mapout, cp, MaxPathLen - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -1921,7 +1921,7 @@ cdup(int argc, char **argv)
|
|||||||
if (command("CDUP") == ERROR && code == 500) {
|
if (command("CDUP") == ERROR && code == 500) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("CDUP command not recognized, trying XCUP\n");
|
printf("CDUP command not recognized, trying XCUP\n");
|
||||||
(void) command("XCUP");
|
command("XCUP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1944,7 +1944,7 @@ void
|
|||||||
syst(int argc, char **argv)
|
syst(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) command("SYST");
|
command("SYST");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1966,7 +1966,7 @@ macdef(int argc, char **argv)
|
|||||||
if (interactive) {
|
if (interactive) {
|
||||||
printf("Enter macro line by line, terminating it with a null line\n");
|
printf("Enter macro line by line, terminating it with a null line\n");
|
||||||
}
|
}
|
||||||
(void) strncpy(macros[macnum].mac_name, argv[1], 8);
|
strncpy(macros[macnum].mac_name, argv[1], 8);
|
||||||
if (macnum == 0) {
|
if (macnum == 0) {
|
||||||
macros[macnum].mac_start = macbuf;
|
macros[macnum].mac_start = macbuf;
|
||||||
}
|
}
|
||||||
@@ -2018,7 +2018,7 @@ sizecmd(int argc, char **argv)
|
|||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) command("SIZE %s", argv[1]);
|
command("SIZE %s", argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2056,7 +2056,7 @@ void
|
|||||||
rmtstatus(int argc, char **argv)
|
rmtstatus(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
|
command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -56,7 +56,7 @@ domacro(int argc, char **argv)
|
|||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) strcpy(line2, line);
|
strcpy(line2, line);
|
||||||
TOP:
|
TOP:
|
||||||
cp1 = macros[i].mac_start;
|
cp1 = macros[i].mac_start;
|
||||||
while (cp1 != macros[i].mac_end) {
|
while (cp1 != macros[i].mac_end) {
|
||||||
@@ -77,7 +77,7 @@ TOP:
|
|||||||
}
|
}
|
||||||
cp1--;
|
cp1--;
|
||||||
if (argc - 2 >= j) {
|
if (argc - 2 >= j) {
|
||||||
(void) strcpy(cp2, argv[j+1]);
|
strcpy(cp2, argv[j+1]);
|
||||||
cp2 += strlen(argv[j+1]);
|
cp2 += strlen(argv[j+1]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -86,7 +86,7 @@ TOP:
|
|||||||
loopflg = 1;
|
loopflg = 1;
|
||||||
cp1++;
|
cp1++;
|
||||||
if (count < argc) {
|
if (count < argc) {
|
||||||
(void) strcpy(cp2, argv[count]);
|
strcpy(cp2, argv[count]);
|
||||||
cp2 += strlen(argv[count]);
|
cp2 += strlen(argv[count]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -121,9 +121,9 @@ TOP:
|
|||||||
}
|
}
|
||||||
(*c->c_handler)(margc, margv);
|
(*c->c_handler)(margc, margv);
|
||||||
if (bell && c->c_bell) {
|
if (bell && c->c_bell) {
|
||||||
(void) putchar('\007');
|
putchar('\007');
|
||||||
}
|
}
|
||||||
(void) strcpy(line, line2);
|
strcpy(line, line2);
|
||||||
makeargv();
|
makeargv();
|
||||||
argc = margc;
|
argc = margc;
|
||||||
argv = margv;
|
argv = margv;
|
||||||
|
@@ -64,7 +64,7 @@ hookup(char *host, int port)
|
|||||||
hisctladdr.sin_addr.s_addr = inet_addr(host);
|
hisctladdr.sin_addr.s_addr = inet_addr(host);
|
||||||
if (hisctladdr.sin_addr.s_addr != INADDR_NONE) {
|
if (hisctladdr.sin_addr.s_addr != INADDR_NONE) {
|
||||||
hisctladdr.sin_family = AF_INET;
|
hisctladdr.sin_family = AF_INET;
|
||||||
(void) strncpy(hostnamebuf, host, sizeof(hostnamebuf));
|
strncpy(hostnamebuf, host, sizeof(hostnamebuf));
|
||||||
} else {
|
} else {
|
||||||
hp = gethostbyname(host);
|
hp = gethostbyname(host);
|
||||||
if (hp == NULL) {
|
if (hp == NULL) {
|
||||||
@@ -76,7 +76,7 @@ hookup(char *host, int port)
|
|||||||
memmove((caddr_t)&hisctladdr.sin_addr,
|
memmove((caddr_t)&hisctladdr.sin_addr,
|
||||||
hp->h_addr_list[0], hp->h_length);
|
hp->h_addr_list[0], hp->h_length);
|
||||||
memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length);
|
memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length);
|
||||||
(void) strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf));
|
strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf));
|
||||||
}
|
}
|
||||||
hostname = hostnamebuf;
|
hostname = hostnamebuf;
|
||||||
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
|
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
|
||||||
@@ -99,7 +99,7 @@ hookup(char *host, int port)
|
|||||||
hp->h_addr_list[0], hp->h_length);
|
hp->h_addr_list[0], hp->h_length);
|
||||||
fprintf(stdout, "Trying %s...\n",
|
fprintf(stdout, "Trying %s...\n",
|
||||||
inet_ntoa(hisctladdr.sin_addr));
|
inet_ntoa(hisctladdr.sin_addr));
|
||||||
(void) close(s);
|
close(s);
|
||||||
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
|
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
warn("socket");
|
warn("socket");
|
||||||
@@ -128,9 +128,9 @@ hookup(char *host, int port)
|
|||||||
if (cin == NULL || cout == NULL) {
|
if (cin == NULL || cout == NULL) {
|
||||||
warnx("fdopen failed.");
|
warnx("fdopen failed.");
|
||||||
if (cin)
|
if (cin)
|
||||||
(void) fclose(cin);
|
fclose(cin);
|
||||||
if (cout)
|
if (cout)
|
||||||
(void) fclose(cout);
|
fclose(cout);
|
||||||
code = -1;
|
code = -1;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@@ -138,9 +138,9 @@ hookup(char *host, int port)
|
|||||||
printf("Connected to %s.\n", hostname);
|
printf("Connected to %s.\n", hostname);
|
||||||
if (getreply(0) > 2) { /* read startup message from server */
|
if (getreply(0) > 2) { /* read startup message from server */
|
||||||
if (cin)
|
if (cin)
|
||||||
(void) fclose(cin);
|
fclose(cin);
|
||||||
if (cout)
|
if (cout)
|
||||||
(void) fclose(cout);
|
fclose(cout);
|
||||||
code = -1;
|
code = -1;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ hookup(char *host, int port)
|
|||||||
|
|
||||||
return (hostname);
|
return (hostname);
|
||||||
bad:
|
bad:
|
||||||
(void) close(s);
|
close(s);
|
||||||
return ((char *)0);
|
return ((char *)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ login(char *host)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (!aflag && acct != NULL)
|
if (!aflag && acct != NULL)
|
||||||
(void) command("ACCT %s", acct);
|
command("ACCT %s", acct);
|
||||||
if (proxy)
|
if (proxy)
|
||||||
return (1);
|
return (1);
|
||||||
for (n = 0; n < macnum; ++n) {
|
for (n = 0; n < macnum; ++n) {
|
||||||
if (!strcmp("init", macros[n].mac_name)) {
|
if (!strcmp("init", macros[n].mac_name)) {
|
||||||
(void) strcpy(line, "$init");
|
strcpy(line, "$init");
|
||||||
makeargv();
|
makeargv();
|
||||||
domacro(margc, margv);
|
domacro(margc, margv);
|
||||||
break;
|
break;
|
||||||
@@ -252,7 +252,7 @@ cmdabort(int sig)
|
|||||||
{
|
{
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
abrtflag++;
|
abrtflag++;
|
||||||
if (ptflag)
|
if (ptflag)
|
||||||
longjmp(ptabort,1);
|
longjmp(ptabort,1);
|
||||||
@@ -287,15 +287,15 @@ command(char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
if(debug){
|
if(debug){
|
||||||
printf("\n");
|
printf("\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
fprintf(cout, "\r\n");
|
fprintf(cout, "\r\n");
|
||||||
(void) fflush(cout);
|
fflush(cout);
|
||||||
cpend = 1;
|
cpend = 1;
|
||||||
r = getreply(!strcmp(fmt, "QUIT"));
|
r = getreply(!strcmp(fmt, "QUIT"));
|
||||||
if (abrtflag && oldintr != SIG_IGN)
|
if (abrtflag && oldintr != SIG_IGN)
|
||||||
(*oldintr)(SIGINT);
|
(*oldintr)(SIGINT);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,13 +415,13 @@ getreply(int expecteof)
|
|||||||
case WONT:
|
case WONT:
|
||||||
c = getc(cin);
|
c = getc(cin);
|
||||||
fprintf(cout, "%c%c%c", IAC, DONT, c);
|
fprintf(cout, "%c%c%c", IAC, DONT, c);
|
||||||
(void) fflush(cout);
|
fflush(cout);
|
||||||
break;
|
break;
|
||||||
case DO:
|
case DO:
|
||||||
case DONT:
|
case DONT:
|
||||||
c = getc(cin);
|
c = getc(cin);
|
||||||
fprintf(cout, "%c%c%c", IAC, WONT, c);
|
fprintf(cout, "%c%c%c", IAC, WONT, c);
|
||||||
(void) fflush(cout);
|
fflush(cout);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -431,14 +431,14 @@ getreply(int expecteof)
|
|||||||
dig++;
|
dig++;
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
if (expecteof) {
|
if (expecteof) {
|
||||||
(void) signal(SIGINT,oldintr);
|
signal(SIGINT,oldintr);
|
||||||
code = 221;
|
code = 221;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
lostpeer(0);
|
lostpeer(0);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("421 Service not available, remote server has closed connection\n");
|
printf("421 Service not available, remote server has closed connection\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
code = 421;
|
code = 421;
|
||||||
return (4);
|
return (4);
|
||||||
@@ -448,7 +448,7 @@ getreply(int expecteof)
|
|||||||
if (proxflag &&
|
if (proxflag &&
|
||||||
(dig == 1 || dig == 5 && verbose == 0))
|
(dig == 1 || dig == 5 && verbose == 0))
|
||||||
printf("%s:",hostname);
|
printf("%s:",hostname);
|
||||||
(void) putchar(c);
|
putchar(c);
|
||||||
}
|
}
|
||||||
if (dig < 4 && isdigit(c))
|
if (dig < 4 && isdigit(c))
|
||||||
code = code * 10 + (c - '0');
|
code = code * 10 + (c - '0');
|
||||||
@@ -475,8 +475,8 @@ getreply(int expecteof)
|
|||||||
*cp++ = c;
|
*cp++ = c;
|
||||||
}
|
}
|
||||||
if (verbose > 0 || verbose > -1 && n == '5') {
|
if (verbose > 0 || verbose > -1 && n == '5') {
|
||||||
(void) putchar(c);
|
putchar(c);
|
||||||
(void) fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
if (continuation && code != originalcode) {
|
if (continuation && code != originalcode) {
|
||||||
if (originalcode == 0)
|
if (originalcode == 0)
|
||||||
@@ -496,7 +496,7 @@ getreply(int expecteof)
|
|||||||
|
|
||||||
if (n != '1')
|
if (n != '1')
|
||||||
cpend = 0;
|
cpend = 0;
|
||||||
(void) signal(SIGINT,oldintr);
|
signal(SIGINT,oldintr);
|
||||||
if (code == 421 || originalcode == 421)
|
if (code == 421 || originalcode == 421)
|
||||||
lostpeer(0);
|
lostpeer(0);
|
||||||
if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN)
|
if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN)
|
||||||
@@ -525,7 +525,7 @@ abortsend(int sig)
|
|||||||
mflag = 0;
|
mflag = 0;
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
printf("\nsend aborted\nwaiting for remote to finish abort\n");
|
printf("\nsend aborted\nwaiting for remote to finish abort\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
longjmp(sendabort, 1);
|
longjmp(sendabort, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,16 +615,16 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
lmode = "w";
|
lmode = "w";
|
||||||
if (setjmp(sendabort)) {
|
if (setjmp(sendabort)) {
|
||||||
while (cpend) {
|
while (cpend) {
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
if (data >= 0) {
|
if (data >= 0) {
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = -1;
|
data = -1;
|
||||||
}
|
}
|
||||||
if (oldintr)
|
if (oldintr)
|
||||||
(void) signal(SIGINT,oldintr);
|
signal(SIGINT,oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE,oldintp);
|
signal(SIGPIPE,oldintp);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -636,8 +636,8 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
fin = popen(local + 1, "r");
|
fin = popen(local + 1, "r");
|
||||||
if (fin == NULL) {
|
if (fin == NULL) {
|
||||||
warn("%s", local + 1);
|
warn("%s", local + 1);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
fin = fopen(local, "r");
|
fin = fopen(local, "r");
|
||||||
if (fin == NULL) {
|
if (fin == NULL) {
|
||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -654,16 +654,16 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
if (fstat(fileno(fin), &st) < 0 ||
|
if (fstat(fileno(fin), &st) < 0 ||
|
||||||
(st.st_mode&S_IFMT) != S_IFREG) {
|
(st.st_mode&S_IFMT) != S_IFREG) {
|
||||||
fprintf(stdout, "%s: not a plain file.\n", local);
|
fprintf(stdout, "%s: not a plain file.\n", local);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
fclose(fin);
|
fclose(fin);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (initconn()) {
|
if (initconn()) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
code = -1;
|
code = -1;
|
||||||
if (closefunc != NULL)
|
if (closefunc != NULL)
|
||||||
(*closefunc)(fin);
|
(*closefunc)(fin);
|
||||||
@@ -704,18 +704,18 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
}
|
}
|
||||||
if (remote) {
|
if (remote) {
|
||||||
if (command("%s %s", cmd, remote) != PRELIM) {
|
if (command("%s %s", cmd, remote) != PRELIM) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
if (closefunc != NULL)
|
if (closefunc != NULL)
|
||||||
(*closefunc)(fin);
|
(*closefunc)(fin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (command("%s", cmd) != PRELIM) {
|
if (command("%s", cmd) != PRELIM) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
if (closefunc != NULL)
|
if (closefunc != NULL)
|
||||||
(*closefunc)(fin);
|
(*closefunc)(fin);
|
||||||
return;
|
return;
|
||||||
@@ -738,13 +738,13 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
while ((c = getc(fin)) != EOF) {
|
while ((c = getc(fin)) != EOF) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
while (hash && (bytes >= hashbytes)) {
|
while (hash && (bytes >= hashbytes)) {
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
hashbytes += HASHBYTES;
|
hashbytes += HASHBYTES;
|
||||||
}
|
}
|
||||||
if (ferror(dout))
|
if (ferror(dout))
|
||||||
break;
|
break;
|
||||||
(void) sec_putc('\r', dout);
|
sec_putc('\r', dout);
|
||||||
bytes++;
|
bytes++;
|
||||||
}
|
}
|
||||||
sec_putc(c, dout);
|
sec_putc(c, dout);
|
||||||
@@ -753,9 +753,9 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
sec_fflush(dout);
|
sec_fflush(dout);
|
||||||
if (hash) {
|
if (hash) {
|
||||||
if (bytes < hashbytes)
|
if (bytes < hashbytes)
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
(void) putchar('\n');
|
putchar('\n');
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if (ferror(fin))
|
if (ferror(fin))
|
||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
@@ -768,34 +768,34 @@ sendrequest(char *cmd, char *local, char *remote, int printnames)
|
|||||||
}
|
}
|
||||||
if (closefunc != NULL)
|
if (closefunc != NULL)
|
||||||
(*closefunc)(fin);
|
(*closefunc)(fin);
|
||||||
(void) fclose(dout);
|
fclose(dout);
|
||||||
(void) gettimeofday(&stop, (struct timezone *)0);
|
gettimeofday(&stop, (struct timezone *)0);
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
ptransfer("sent", bytes, &start, &stop);
|
ptransfer("sent", bytes, &start, &stop);
|
||||||
return;
|
return;
|
||||||
abort:
|
abort:
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
if (!cpend) {
|
if (!cpend) {
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data >= 0) {
|
if (data >= 0) {
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = -1;
|
data = -1;
|
||||||
}
|
}
|
||||||
if (dout)
|
if (dout)
|
||||||
(void) fclose(dout);
|
fclose(dout);
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
code = -1;
|
code = -1;
|
||||||
if (closefunc != NULL && fin != NULL)
|
if (closefunc != NULL && fin != NULL)
|
||||||
(*closefunc)(fin);
|
(*closefunc)(fin);
|
||||||
(void) gettimeofday(&stop, (struct timezone *)0);
|
gettimeofday(&stop, (struct timezone *)0);
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
ptransfer("sent", bytes, &start, &stop);
|
ptransfer("sent", bytes, &start, &stop);
|
||||||
}
|
}
|
||||||
@@ -809,7 +809,7 @@ abortrecv(int sig)
|
|||||||
mflag = 0;
|
mflag = 0;
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
printf("\nreceive aborted\nwaiting for remote to finish abort\n");
|
printf("\nreceive aborted\nwaiting for remote to finish abort\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
longjmp(recvabort, 1);
|
longjmp(recvabort, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,14 +843,14 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
tcrflag = !crflag && is_retr;
|
tcrflag = !crflag && is_retr;
|
||||||
if (setjmp(recvabort)) {
|
if (setjmp(recvabort)) {
|
||||||
while (cpend) {
|
while (cpend) {
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
if (data >= 0) {
|
if (data >= 0) {
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = -1;
|
data = -1;
|
||||||
}
|
}
|
||||||
if (oldintr)
|
if (oldintr)
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
|
|
||||||
if (errno != ENOENT && errno != EACCES) {
|
if (errno != ENOENT && errno != EACCES) {
|
||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -872,27 +872,27 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
*dir = '/';
|
*dir = '/';
|
||||||
if (d < 0) {
|
if (d < 0) {
|
||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!runique && errno == EACCES &&
|
if (!runique && errno == EACCES &&
|
||||||
chmod(local, 0600) < 0) {
|
chmod(local, 0600) < 0) {
|
||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (runique && errno == EACCES &&
|
if (runique && errno == EACCES &&
|
||||||
(local = gunique(local)) == NULL) {
|
(local = gunique(local)) == NULL) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (runique && (local = gunique(local)) == NULL) {
|
else if (runique && (local = gunique(local)) == NULL) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -903,7 +903,7 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
} else if (curtype != type)
|
} else if (curtype != type)
|
||||||
changetype(type, 0);
|
changetype(type, 0);
|
||||||
if (initconn()) {
|
if (initconn()) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -914,12 +914,12 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
return;
|
return;
|
||||||
if (remote) {
|
if (remote) {
|
||||||
if (command("%s %s", cmd, remote) != PRELIM) {
|
if (command("%s %s", cmd, remote) != PRELIM) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (command("%s", cmd) != PRELIM) {
|
if (command("%s", cmd) != PRELIM) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -953,7 +953,7 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
#endif
|
#endif
|
||||||
if (blocksize > bufsize) {
|
if (blocksize > bufsize) {
|
||||||
if (buf)
|
if (buf)
|
||||||
(void) free(buf);
|
free(buf);
|
||||||
buf = malloc(blocksize);
|
buf = malloc(blocksize);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
warn("malloc");
|
warn("malloc");
|
||||||
@@ -963,7 +963,7 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
bufsize = blocksize;
|
bufsize = blocksize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) gettimeofday(&start, (struct timezone *)0);
|
gettimeofday(&start, (struct timezone *)0);
|
||||||
switch (curtype) {
|
switch (curtype) {
|
||||||
|
|
||||||
case TYPE_I:
|
case TYPE_I:
|
||||||
@@ -982,17 +982,17 @@ recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
|||||||
bytes += c;
|
bytes += c;
|
||||||
if (hash) {
|
if (hash) {
|
||||||
while (bytes >= hashbytes) {
|
while (bytes >= hashbytes) {
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
hashbytes += HASHBYTES;
|
hashbytes += HASHBYTES;
|
||||||
}
|
}
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hash && bytes > 0) {
|
if (hash && bytes > 0) {
|
||||||
if (bytes < HASHBYTES)
|
if (bytes < HASHBYTES)
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
(void) putchar('\n');
|
putchar('\n');
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
if (errno != EPIPE)
|
if (errno != EPIPE)
|
||||||
@@ -1034,15 +1034,15 @@ done:
|
|||||||
bare_lfs++;
|
bare_lfs++;
|
||||||
while (c == '\r') {
|
while (c == '\r') {
|
||||||
while (hash && (bytes >= hashbytes)) {
|
while (hash && (bytes >= hashbytes)) {
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
hashbytes += HASHBYTES;
|
hashbytes += HASHBYTES;
|
||||||
}
|
}
|
||||||
bytes++;
|
bytes++;
|
||||||
if ((c = sec_getc(din)) != '\n' || tcrflag) {
|
if ((c = sec_getc(din)) != '\n' || tcrflag) {
|
||||||
if (ferror(fout))
|
if (ferror(fout))
|
||||||
goto break2;
|
goto break2;
|
||||||
(void) putc('\r', fout);
|
putc('\r', fout);
|
||||||
if (c == '\0') {
|
if (c == '\0') {
|
||||||
bytes++;
|
bytes++;
|
||||||
goto contin2;
|
goto contin2;
|
||||||
@@ -1051,7 +1051,7 @@ done:
|
|||||||
goto contin2;
|
goto contin2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) putc(c, fout);
|
putc(c, fout);
|
||||||
bytes++;
|
bytes++;
|
||||||
contin2: ;
|
contin2: ;
|
||||||
}
|
}
|
||||||
@@ -1062,9 +1062,9 @@ break2:
|
|||||||
}
|
}
|
||||||
if (hash) {
|
if (hash) {
|
||||||
if (bytes < hashbytes)
|
if (bytes < hashbytes)
|
||||||
(void) putchar('#');
|
putchar('#');
|
||||||
(void) putchar('\n');
|
putchar('\n');
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if (ferror(din)) {
|
if (ferror(din)) {
|
||||||
if (errno != EPIPE)
|
if (errno != EPIPE)
|
||||||
@@ -1077,12 +1077,12 @@ break2:
|
|||||||
}
|
}
|
||||||
if (closefunc != NULL)
|
if (closefunc != NULL)
|
||||||
(*closefunc)(fout);
|
(*closefunc)(fout);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintp);
|
signal(SIGPIPE, oldintp);
|
||||||
(void) fclose(din);
|
fclose(din);
|
||||||
(void) gettimeofday(&stop, (struct timezone *)0);
|
gettimeofday(&stop, (struct timezone *)0);
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
if (bytes > 0 && is_retr)
|
if (bytes > 0 && is_retr)
|
||||||
ptransfer("received", bytes, &start, &stop);
|
ptransfer("received", bytes, &start, &stop);
|
||||||
return;
|
return;
|
||||||
@@ -1091,28 +1091,28 @@ abort:
|
|||||||
/* abort using RFC959 recommended IP,SYNC sequence */
|
/* abort using RFC959 recommended IP,SYNC sequence */
|
||||||
|
|
||||||
if (oldintp)
|
if (oldintp)
|
||||||
(void) signal(SIGPIPE, oldintr);
|
signal(SIGPIPE, oldintr);
|
||||||
(void) signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
if (!cpend) {
|
if (!cpend) {
|
||||||
code = -1;
|
code = -1;
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
abort_remote(din);
|
abort_remote(din);
|
||||||
code = -1;
|
code = -1;
|
||||||
if (data >= 0) {
|
if (data >= 0) {
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = -1;
|
data = -1;
|
||||||
}
|
}
|
||||||
if (closefunc != NULL && fout != NULL)
|
if (closefunc != NULL && fout != NULL)
|
||||||
(*closefunc)(fout);
|
(*closefunc)(fout);
|
||||||
if (din)
|
if (din)
|
||||||
(void) fclose(din);
|
fclose(din);
|
||||||
(void) gettimeofday(&stop, (struct timezone *)0);
|
gettimeofday(&stop, (struct timezone *)0);
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
ptransfer("received", bytes, &start, &stop);
|
ptransfer("received", bytes, &start, &stop);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1192,7 +1192,7 @@ noport:
|
|||||||
if (sendport)
|
if (sendport)
|
||||||
data_addr.sin_port = 0; /* let system pick one */
|
data_addr.sin_port = 0; /* let system pick one */
|
||||||
if (data != -1)
|
if (data != -1)
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = socket(AF_INET, SOCK_STREAM, 0);
|
data = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (data < 0) {
|
if (data < 0) {
|
||||||
warn("socket");
|
warn("socket");
|
||||||
@@ -1245,7 +1245,7 @@ noport:
|
|||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
bad:
|
bad:
|
||||||
(void) close(data), data = -1;
|
close(data), data = -1;
|
||||||
if (tmpno)
|
if (tmpno)
|
||||||
sendport = 1;
|
sendport = 1;
|
||||||
return (1);
|
return (1);
|
||||||
@@ -1263,10 +1263,10 @@ dataconn(char *lmode)
|
|||||||
s = accept(data, (struct sockaddr *) &from, &fromlen);
|
s = accept(data, (struct sockaddr *) &from, &fromlen);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
warn("accept");
|
warn("accept");
|
||||||
(void) close(data), data = -1;
|
close(data), data = -1;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = s;
|
data = s;
|
||||||
#ifdef IP_TOS
|
#ifdef IP_TOS
|
||||||
tos = IPTOS_THROUGHPUT;
|
tos = IPTOS_THROUGHPUT;
|
||||||
@@ -1364,7 +1364,7 @@ pswitch(int flag)
|
|||||||
ip->connect = connected;
|
ip->connect = connected;
|
||||||
connected = op->connect;
|
connected = op->connect;
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
(void) strncpy(ip->name, hostname, sizeof(ip->name) - 1);
|
strncpy(ip->name, hostname, sizeof(ip->name) - 1);
|
||||||
ip->name[strlen(ip->name)] = '\0';
|
ip->name[strlen(ip->name)] = '\0';
|
||||||
} else
|
} else
|
||||||
ip->name[0] = 0;
|
ip->name[0] = 0;
|
||||||
@@ -1391,21 +1391,21 @@ pswitch(int flag)
|
|||||||
mcase = op->mcse;
|
mcase = op->mcse;
|
||||||
ip->ntflg = ntflag;
|
ip->ntflg = ntflag;
|
||||||
ntflag = op->ntflg;
|
ntflag = op->ntflg;
|
||||||
(void) strncpy(ip->nti, ntin, 16);
|
strncpy(ip->nti, ntin, 16);
|
||||||
(ip->nti)[strlen(ip->nti)] = '\0';
|
(ip->nti)[strlen(ip->nti)] = '\0';
|
||||||
(void) strcpy(ntin, op->nti);
|
strcpy(ntin, op->nti);
|
||||||
(void) strncpy(ip->nto, ntout, 16);
|
strncpy(ip->nto, ntout, 16);
|
||||||
(ip->nto)[strlen(ip->nto)] = '\0';
|
(ip->nto)[strlen(ip->nto)] = '\0';
|
||||||
(void) strcpy(ntout, op->nto);
|
strcpy(ntout, op->nto);
|
||||||
ip->mapflg = mapflag;
|
ip->mapflg = mapflag;
|
||||||
mapflag = op->mapflg;
|
mapflag = op->mapflg;
|
||||||
(void) strncpy(ip->mi, mapin, MaxPathLen - 1);
|
strncpy(ip->mi, mapin, MaxPathLen - 1);
|
||||||
(ip->mi)[strlen(ip->mi)] = '\0';
|
(ip->mi)[strlen(ip->mi)] = '\0';
|
||||||
(void) strcpy(mapin, op->mi);
|
strcpy(mapin, op->mi);
|
||||||
(void) strncpy(ip->mo, mapout, MaxPathLen - 1);
|
strncpy(ip->mo, mapout, MaxPathLen - 1);
|
||||||
(ip->mo)[strlen(ip->mo)] = '\0';
|
(ip->mo)[strlen(ip->mo)] = '\0';
|
||||||
(void) strcpy(mapout, op->mo);
|
strcpy(mapout, op->mo);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (abrtflag) {
|
if (abrtflag) {
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
(*oldintr)(SIGINT);
|
(*oldintr)(SIGINT);
|
||||||
@@ -1417,7 +1417,7 @@ abortpt(int sig)
|
|||||||
{
|
{
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
ptabflg++;
|
ptabflg++;
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
@@ -1465,7 +1465,7 @@ proxtrans(char *cmd, char *local, char *remote)
|
|||||||
goto abort;
|
goto abort;
|
||||||
oldintr = signal(SIGINT, abortpt);
|
oldintr = signal(SIGINT, abortpt);
|
||||||
if (command("%s %s", cmd, remote) != PRELIM) {
|
if (command("%s %s", cmd, remote) != PRELIM) {
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
pswitch(1);
|
pswitch(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1475,16 +1475,16 @@ proxtrans(char *cmd, char *local, char *remote)
|
|||||||
if (command("%s %s", cmd2, local) != PRELIM)
|
if (command("%s %s", cmd2, local) != PRELIM)
|
||||||
goto abort;
|
goto abort;
|
||||||
ptflag++;
|
ptflag++;
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
pswitch(0);
|
pswitch(0);
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
pswitch(1);
|
pswitch(1);
|
||||||
ptflag = 0;
|
ptflag = 0;
|
||||||
printf("local: %s remote: %s\n", local, remote);
|
printf("local: %s remote: %s\n", local, remote);
|
||||||
return;
|
return;
|
||||||
abort:
|
abort:
|
||||||
(void) signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
ptflag = 0;
|
ptflag = 0;
|
||||||
if (strcmp(cmd, "RETR") && !proxy)
|
if (strcmp(cmd, "RETR") && !proxy)
|
||||||
pswitch(1);
|
pswitch(1);
|
||||||
@@ -1499,7 +1499,7 @@ abort:
|
|||||||
pswitch(1);
|
pswitch(1);
|
||||||
if (ptabflg)
|
if (ptabflg)
|
||||||
code = -1;
|
code = -1;
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cpend)
|
if (cpend)
|
||||||
@@ -1513,7 +1513,7 @@ abort:
|
|||||||
pswitch(1);
|
pswitch(1);
|
||||||
if (ptabflg)
|
if (ptabflg)
|
||||||
code = -1;
|
code = -1;
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1531,15 +1531,15 @@ abort:
|
|||||||
code = -1;
|
code = -1;
|
||||||
lostpeer(0);
|
lostpeer(0);
|
||||||
}
|
}
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
if (proxy)
|
if (proxy)
|
||||||
pswitch(0);
|
pswitch(0);
|
||||||
pswitch(1);
|
pswitch(1);
|
||||||
if (ptabflg)
|
if (ptabflg)
|
||||||
code = -1;
|
code = -1;
|
||||||
(void) signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1557,7 +1557,7 @@ reset(int argc, char **argv)
|
|||||||
lostpeer(0);
|
lostpeer(0);
|
||||||
}
|
}
|
||||||
else if (nfnd) {
|
else if (nfnd) {
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1579,7 +1579,7 @@ gunique(char *local)
|
|||||||
warn("local: %s", local);
|
warn("local: %s", local);
|
||||||
return ((char *) 0);
|
return ((char *) 0);
|
||||||
}
|
}
|
||||||
(void) strcpy(new, local);
|
strcpy(new, local);
|
||||||
cp = new + strlen(new);
|
cp = new + strlen(new);
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
while (!d) {
|
while (!d) {
|
||||||
@@ -1622,7 +1622,7 @@ abort_remote(FILE *din)
|
|||||||
if (send(fileno(cout), buf, 3, MSG_OOB) != 3)
|
if (send(fileno(cout), buf, 3, MSG_OOB) != 3)
|
||||||
warn("abort");
|
warn("abort");
|
||||||
fprintf(cout,"%cABOR\r\n", DM);
|
fprintf(cout,"%cABOR\r\n", DM);
|
||||||
(void) fflush(cout);
|
fflush(cout);
|
||||||
FD_ZERO(&mask);
|
FD_ZERO(&mask);
|
||||||
FD_SET(fileno(cin), &mask);
|
FD_SET(fileno(cin), &mask);
|
||||||
if (din) {
|
if (din) {
|
||||||
@@ -1642,7 +1642,7 @@ abort_remote(FILE *din)
|
|||||||
}
|
}
|
||||||
if (getreply(0) == ERROR && code == 552) {
|
if (getreply(0) == ERROR && code == 552) {
|
||||||
/* 552 needed for nic style abort */
|
/* 552 needed for nic style abort */
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
(void) getreply(0);
|
getreply(0);
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
(void)fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: ftp [-dgintv] [host [port]]\n");
|
"usage: ftp [-dgintv] [host [port]]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -103,15 +103,15 @@ main(int argc, char **argv)
|
|||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
if (pw != NULL) {
|
if (pw != NULL) {
|
||||||
home = homedir;
|
home = homedir;
|
||||||
(void) strcpy(home, pw->pw_dir);
|
strcpy(home, pw->pw_dir);
|
||||||
}
|
}
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
char *xargv[5];
|
char *xargv[5];
|
||||||
|
|
||||||
if (setjmp(toplevel))
|
if (setjmp(toplevel))
|
||||||
exit(0);
|
exit(0);
|
||||||
(void) signal(SIGINT, intr);
|
signal(SIGINT, intr);
|
||||||
(void) signal(SIGPIPE, lostpeer);
|
signal(SIGPIPE, lostpeer);
|
||||||
xargv[0] = argv[0]; /* or should this be "ftp"? */
|
xargv[0] = argv[0]; /* or should this be "ftp"? */
|
||||||
xargv[1] = argv[0];
|
xargv[1] = argv[0];
|
||||||
xargv[2] = argv[1];
|
xargv[2] = argv[1];
|
||||||
@@ -121,8 +121,8 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (setjmp(toplevel) == 0) {
|
if (setjmp(toplevel) == 0) {
|
||||||
top = 1;
|
top = 1;
|
||||||
(void) signal(SIGINT, intr);
|
signal(SIGINT, intr);
|
||||||
(void) signal(SIGPIPE, lostpeer);
|
signal(SIGPIPE, lostpeer);
|
||||||
} else
|
} else
|
||||||
top = 0;
|
top = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -144,13 +144,13 @@ lostpeer(int sig)
|
|||||||
|
|
||||||
if (connected) {
|
if (connected) {
|
||||||
if (cout != NULL) {
|
if (cout != NULL) {
|
||||||
(void) shutdown(fileno(cout), 1+1);
|
shutdown(fileno(cout), 1+1);
|
||||||
(void) fclose(cout);
|
fclose(cout);
|
||||||
cout = NULL;
|
cout = NULL;
|
||||||
}
|
}
|
||||||
if (data >= 0) {
|
if (data >= 0) {
|
||||||
(void) shutdown(data, 1+1);
|
shutdown(data, 1+1);
|
||||||
(void) close(data);
|
close(data);
|
||||||
data = -1;
|
data = -1;
|
||||||
}
|
}
|
||||||
connected = 0;
|
connected = 0;
|
||||||
@@ -158,8 +158,8 @@ lostpeer(int sig)
|
|||||||
pswitch(1);
|
pswitch(1);
|
||||||
if (connected) {
|
if (connected) {
|
||||||
if (cout != NULL) {
|
if (cout != NULL) {
|
||||||
(void) shutdown(fileno(cout), 1+1);
|
shutdown(fileno(cout), 1+1);
|
||||||
(void) fclose(cout);
|
fclose(cout);
|
||||||
cout = NULL;
|
cout = NULL;
|
||||||
}
|
}
|
||||||
connected = 0;
|
connected = 0;
|
||||||
@@ -198,11 +198,11 @@ cmdscanner(int top)
|
|||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (!top)
|
if (!top)
|
||||||
(void) putchar('\n');
|
putchar('\n');
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (fromatty) {
|
if (fromatty) {
|
||||||
printf("ftp> ");
|
printf("ftp> ");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if (fgets(line, sizeof line, stdin) == NULL)
|
if (fgets(line, sizeof line, stdin) == NULL)
|
||||||
quit(0, 0);
|
quit(0, 0);
|
||||||
@@ -238,12 +238,12 @@ cmdscanner(int top)
|
|||||||
}
|
}
|
||||||
(*c->c_handler)(margc, margv);
|
(*c->c_handler)(margc, margv);
|
||||||
if (bell && c->c_bell)
|
if (bell && c->c_bell)
|
||||||
(void) putchar('\007');
|
putchar('\007');
|
||||||
if (c->c_handler != help)
|
if (c->c_handler != help)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void) signal(SIGINT, intr);
|
signal(SIGINT, intr);
|
||||||
(void) signal(SIGPIPE, lostpeer);
|
signal(SIGPIPE, lostpeer);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cmd *
|
struct cmd *
|
||||||
@@ -466,7 +466,7 @@ help(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (c->c_name) {
|
else if (c->c_name) {
|
||||||
for (k=0; k < strlen(c->c_name); k++) {
|
for (k=0; k < strlen(c->c_name); k++) {
|
||||||
(void) putchar(' ');
|
putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c + lines >= &cmdtab[NCMDS]) {
|
if (c + lines >= &cmdtab[NCMDS]) {
|
||||||
@@ -476,7 +476,7 @@ help(int argc, char **argv)
|
|||||||
w = strlen(c->c_name);
|
w = strlen(c->c_name);
|
||||||
while (w < width) {
|
while (w < width) {
|
||||||
w = (w + 8) &~ 7;
|
w = (w + 8) &~ 7;
|
||||||
(void) putchar('\t');
|
putchar('\t');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ ruserpass(char *host, char **aname, char **apass, char **aacct)
|
|||||||
hdir = getenv("HOME");
|
hdir = getenv("HOME");
|
||||||
if (hdir == NULL)
|
if (hdir == NULL)
|
||||||
hdir = ".";
|
hdir = ".";
|
||||||
(void) sprintf(buf, "%s/.netrc", hdir);
|
sprintf(buf, "%s/.netrc", hdir);
|
||||||
cfile = fopen(buf, "r");
|
cfile = fopen(buf, "r");
|
||||||
if (cfile == NULL) {
|
if (cfile == NULL) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
@@ -128,7 +128,7 @@ next:
|
|||||||
if (token())
|
if (token())
|
||||||
if (*aname == 0) {
|
if (*aname == 0) {
|
||||||
*aname = malloc((unsigned) strlen(tokval) + 1);
|
*aname = malloc((unsigned) strlen(tokval) + 1);
|
||||||
(void) strcpy(*aname, tokval);
|
strcpy(*aname, tokval);
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(*aname, tokval))
|
if (strcmp(*aname, tokval))
|
||||||
goto next;
|
goto next;
|
||||||
@@ -144,7 +144,7 @@ next:
|
|||||||
}
|
}
|
||||||
if (token() && *apass == 0) {
|
if (token() && *apass == 0) {
|
||||||
*apass = malloc((unsigned) strlen(tokval) + 1);
|
*apass = malloc((unsigned) strlen(tokval) + 1);
|
||||||
(void) strcpy(*apass, tokval);
|
strcpy(*apass, tokval);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACCOUNT:
|
case ACCOUNT:
|
||||||
@@ -156,12 +156,12 @@ next:
|
|||||||
}
|
}
|
||||||
if (token() && *aacct == 0) {
|
if (token() && *aacct == 0) {
|
||||||
*aacct = malloc((unsigned) strlen(tokval) + 1);
|
*aacct = malloc((unsigned) strlen(tokval) + 1);
|
||||||
(void) strcpy(*aacct, tokval);
|
strcpy(*aacct, tokval);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MACDEF:
|
case MACDEF:
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
(void) fclose(cfile);
|
fclose(cfile);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t');
|
while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t');
|
||||||
@@ -230,10 +230,10 @@ next:
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
(void) fclose(cfile);
|
fclose(cfile);
|
||||||
return (0);
|
return (0);
|
||||||
bad:
|
bad:
|
||||||
(void) fclose(cfile);
|
fclose(cfile);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -239,7 +239,7 @@ cmd
|
|||||||
{
|
{
|
||||||
usedefault = 0;
|
usedefault = 0;
|
||||||
if (pdata >= 0) {
|
if (pdata >= 0) {
|
||||||
(void) close(pdata);
|
close(pdata);
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
}
|
}
|
||||||
reply(200, "PORT command successful.");
|
reply(200, "PORT command successful.");
|
||||||
@@ -492,7 +492,7 @@ cmd
|
|||||||
|
|
||||||
if ($4) {
|
if ($4) {
|
||||||
oldmask = umask(0);
|
oldmask = umask(0);
|
||||||
(void) umask(oldmask);
|
umask(oldmask);
|
||||||
reply(200, "Current UMASK is %03o", oldmask);
|
reply(200, "Current UMASK is %03o", oldmask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ cmd
|
|||||||
maxtimeout);
|
maxtimeout);
|
||||||
} else {
|
} else {
|
||||||
ftpd_timeout = $5;
|
ftpd_timeout = $5;
|
||||||
(void) alarm((unsigned) ftpd_timeout);
|
alarm((unsigned) ftpd_timeout);
|
||||||
reply(200,
|
reply(200,
|
||||||
"Maximum IDLE time set to %d seconds",
|
"Maximum IDLE time set to %d seconds",
|
||||||
ftpd_timeout);
|
ftpd_timeout);
|
||||||
@@ -1009,13 +1009,13 @@ getline(char *s, int n)
|
|||||||
case WONT:
|
case WONT:
|
||||||
c = getc(stdin);
|
c = getc(stdin);
|
||||||
printf("%c%c%c", IAC, DONT, 0377&c);
|
printf("%c%c%c", IAC, DONT, 0377&c);
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
continue;
|
continue;
|
||||||
case DO:
|
case DO:
|
||||||
case DONT:
|
case DONT:
|
||||||
c = getc(stdin);
|
c = getc(stdin);
|
||||||
printf("%c%c%c", IAC, WONT, 0377&c);
|
printf("%c%c%c", IAC, WONT, 0377&c);
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
continue;
|
continue;
|
||||||
case IAC:
|
case IAC:
|
||||||
break;
|
break;
|
||||||
@@ -1082,13 +1082,13 @@ yylex(void)
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
||||||
case CMD:
|
case CMD:
|
||||||
(void) signal(SIGALRM, toolong);
|
signal(SIGALRM, toolong);
|
||||||
(void) alarm((unsigned) ftpd_timeout);
|
alarm((unsigned) ftpd_timeout);
|
||||||
if (getline(cbuf, sizeof(cbuf)-1) == NULL) {
|
if (getline(cbuf, sizeof(cbuf)-1) == NULL) {
|
||||||
reply(221, "You could at least say goodbye.");
|
reply(221, "You could at least say goodbye.");
|
||||||
dologout(0);
|
dologout(0);
|
||||||
}
|
}
|
||||||
(void) alarm(0);
|
alarm(0);
|
||||||
#ifdef HASSETPROCTITLE
|
#ifdef HASSETPROCTITLE
|
||||||
if (strncasecmp(cbuf, "PASS", 4) != NULL)
|
if (strncasecmp(cbuf, "PASS", 4) != NULL)
|
||||||
setproctitle("%s: %s", proctitle, cbuf);
|
setproctitle("%s: %s", proctitle, cbuf);
|
||||||
@@ -1305,7 +1305,7 @@ copy(char *s)
|
|||||||
p = malloc((unsigned) strlen(s) + 1);
|
p = malloc((unsigned) strlen(s) + 1);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
fatal("Ran out of memory.");
|
fatal("Ran out of memory.");
|
||||||
(void) strcpy(p, s);
|
strcpy(p, s);
|
||||||
return (p);
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1396,7 +1396,7 @@ sizecmd(char *filename)
|
|||||||
}
|
}
|
||||||
if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
|
if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
|
||||||
reply(550, "%s: not a plain file.", filename);
|
reply(550, "%s: not a plain file.", filename);
|
||||||
(void) fclose(fin);
|
fclose(fin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1406,7 +1406,7 @@ sizecmd(char *filename)
|
|||||||
count++;
|
count++;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
(void) fclose(fin);
|
fclose(fin);
|
||||||
|
|
||||||
reply(213, "%ld", count);
|
reply(213, "%ld", count);
|
||||||
break; }
|
break; }
|
||||||
|
@@ -391,7 +391,7 @@ main(int argc, char **argv)
|
|||||||
sprintf(ttyline, "ftp%u", (unsigned)getpid());
|
sprintf(ttyline, "ftp%u", (unsigned)getpid());
|
||||||
|
|
||||||
|
|
||||||
/* (void) freopen(_PATH_DEVNULL, "w", stderr); */
|
/* freopen(_PATH_DEVNULL, "w", stderr); */
|
||||||
signal(SIGPIPE, lostconn);
|
signal(SIGPIPE, lostconn);
|
||||||
signal(SIGCHLD, SIG_IGN);
|
signal(SIGCHLD, SIG_IGN);
|
||||||
if (signal(SIGURG, myoob) == SIG_ERR)
|
if (signal(SIGURG, myoob) == SIG_ERR)
|
||||||
@@ -428,8 +428,8 @@ main(int argc, char **argv)
|
|||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
lreply(530, "%s", line);
|
lreply(530, "%s", line);
|
||||||
}
|
}
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
(void) fclose(fd);
|
fclose(fd);
|
||||||
reply(530, "System not available.");
|
reply(530, "System not available.");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@@ -439,8 +439,8 @@ main(int argc, char **argv)
|
|||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
lreply(220, "%s", line);
|
lreply(220, "%s", line);
|
||||||
}
|
}
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
(void) fclose(fd);
|
fclose(fd);
|
||||||
/* reply(220,) must follow */
|
/* reply(220,) must follow */
|
||||||
}
|
}
|
||||||
k_gethostname(hostname, sizeof(hostname));
|
k_gethostname(hostname, sizeof(hostname));
|
||||||
@@ -474,7 +474,7 @@ sgetsave(char *s)
|
|||||||
dologout(1);
|
dologout(1);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
(void) strcpy(new, s);
|
strcpy(new, s);
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ checkuser(char *fname, char *name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
return (found);
|
return (found);
|
||||||
}
|
}
|
||||||
@@ -651,7 +651,7 @@ int do_login(int code, char *passwd)
|
|||||||
reply(550, "Can't set gid.");
|
reply(550, "Can't set gid.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void) initgroups(pw->pw_name, pw->pw_gid);
|
initgroups(pw->pw_name, pw->pw_gid);
|
||||||
|
|
||||||
/* open wtmp before chroot */
|
/* open wtmp before chroot */
|
||||||
logwtmp(ttyline, pw->pw_name, remotehost);
|
logwtmp(ttyline, pw->pw_name, remotehost);
|
||||||
@@ -719,7 +719,7 @@ int do_login(int code, char *passwd)
|
|||||||
syslog(LOG_INFO, "FTP LOGIN FROM %s as %s",
|
syslog(LOG_INFO, "FTP LOGIN FROM %s as %s",
|
||||||
remotehost, pw->pw_name);
|
remotehost, pw->pw_name);
|
||||||
}
|
}
|
||||||
(void) umask(defumask);
|
umask(defumask);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,7 +732,7 @@ static void
|
|||||||
end_login(void)
|
end_login(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) seteuid((uid_t)0);
|
seteuid((uid_t)0);
|
||||||
if (logged_in)
|
if (logged_in)
|
||||||
logwtmp(ttyline, "", "");
|
logwtmp(ttyline, "", "");
|
||||||
pw = NULL;
|
pw = NULL;
|
||||||
@@ -924,7 +924,7 @@ retrieve(char *cmd, char *name)
|
|||||||
#else
|
#else
|
||||||
send_data(fin, dout, BUFSIZ);
|
send_data(fin, dout, BUFSIZ);
|
||||||
#endif
|
#endif
|
||||||
(void) fclose(dout);
|
fclose(dout);
|
||||||
data = -1;
|
data = -1;
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
done:
|
done:
|
||||||
@@ -1027,7 +1027,7 @@ store(char *name, char *mode, int unique)
|
|||||||
else
|
else
|
||||||
reply(226, "Transfer complete.");
|
reply(226, "Transfer complete.");
|
||||||
}
|
}
|
||||||
(void) fclose(din);
|
fclose(din);
|
||||||
data = -1;
|
data = -1;
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
done:
|
done:
|
||||||
@@ -1042,7 +1042,7 @@ getdatasock(char *mode)
|
|||||||
|
|
||||||
if (data >= 0)
|
if (data >= 0)
|
||||||
return (fdopen(data, mode));
|
return (fdopen(data, mode));
|
||||||
(void) seteuid((uid_t)0);
|
seteuid((uid_t)0);
|
||||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -1060,7 +1060,7 @@ getdatasock(char *mode)
|
|||||||
goto bad;
|
goto bad;
|
||||||
sleep(tries);
|
sleep(tries);
|
||||||
}
|
}
|
||||||
(void) seteuid((uid_t)pw->pw_uid);
|
seteuid((uid_t)pw->pw_uid);
|
||||||
#ifdef IP_TOS
|
#ifdef IP_TOS
|
||||||
on = IPTOS_THROUGHPUT;
|
on = IPTOS_THROUGHPUT;
|
||||||
if (setsockopt(s, IPPROTO_IP, IP_TOS, (void *)&on, sizeof(int)) < 0)
|
if (setsockopt(s, IPPROTO_IP, IP_TOS, (void *)&on, sizeof(int)) < 0)
|
||||||
@@ -1070,8 +1070,8 @@ getdatasock(char *mode)
|
|||||||
bad:
|
bad:
|
||||||
/* Return the real value of errno (close may change it) */
|
/* Return the real value of errno (close may change it) */
|
||||||
t = errno;
|
t = errno;
|
||||||
(void) seteuid((uid_t)pw->pw_uid);
|
seteuid((uid_t)pw->pw_uid);
|
||||||
(void) close(s);
|
close(s);
|
||||||
errno = t;
|
errno = t;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -1086,9 +1086,9 @@ dataconn(char *name, off_t size, char *mode)
|
|||||||
file_size = size;
|
file_size = size;
|
||||||
byte_count = 0;
|
byte_count = 0;
|
||||||
if (size != (off_t) -1)
|
if (size != (off_t) -1)
|
||||||
(void) sprintf(sizebuf, " (%ld bytes)", size);
|
sprintf(sizebuf, " (%ld bytes)", size);
|
||||||
else
|
else
|
||||||
(void) strcpy(sizebuf, "");
|
strcpy(sizebuf, "");
|
||||||
if (pdata >= 0) {
|
if (pdata >= 0) {
|
||||||
struct sockaddr_in from;
|
struct sockaddr_in from;
|
||||||
int s, fromlen = sizeof(from);
|
int s, fromlen = sizeof(from);
|
||||||
@@ -1096,15 +1096,15 @@ dataconn(char *name, off_t size, char *mode)
|
|||||||
s = accept(pdata, (struct sockaddr *)&from, &fromlen);
|
s = accept(pdata, (struct sockaddr *)&from, &fromlen);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
reply(425, "Can't open data connection.");
|
reply(425, "Can't open data connection.");
|
||||||
(void) close(pdata);
|
close(pdata);
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
(void) close(pdata);
|
close(pdata);
|
||||||
pdata = s;
|
pdata = s;
|
||||||
#ifdef IP_TOS
|
#ifdef IP_TOS
|
||||||
tos = IPTOS_THROUGHPUT;
|
tos = IPTOS_THROUGHPUT;
|
||||||
(void) setsockopt(s, IPPROTO_IP, IP_TOS, (void *)&tos,
|
setsockopt(s, IPPROTO_IP, IP_TOS, (void *)&tos,
|
||||||
sizeof(int));
|
sizeof(int));
|
||||||
#endif
|
#endif
|
||||||
reply(150, "Opening %s mode data connection for '%s'%s.",
|
reply(150, "Opening %s mode data connection for '%s'%s.",
|
||||||
@@ -1136,7 +1136,7 @@ dataconn(char *name, off_t size, char *mode)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
perror_reply(425, "Can't build data connection");
|
perror_reply(425, "Can't build data connection");
|
||||||
(void) fclose(file);
|
fclose(file);
|
||||||
data = -1;
|
data = -1;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -1356,20 +1356,20 @@ statfilecmd(char *filename)
|
|||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
if (ferror(stdout)){
|
if (ferror(stdout)){
|
||||||
perror_reply(421, "control connection");
|
perror_reply(421, "control connection");
|
||||||
(void) ftpd_pclose(fin);
|
ftpd_pclose(fin);
|
||||||
dologout(1);
|
dologout(1);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
if (ferror(fin)) {
|
if (ferror(fin)) {
|
||||||
perror_reply(551, filename);
|
perror_reply(551, filename);
|
||||||
(void) ftpd_pclose(fin);
|
ftpd_pclose(fin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) putc('\r', stdout);
|
putc('\r', stdout);
|
||||||
}
|
}
|
||||||
(void) putc(c, stdout);
|
putc(c, stdout);
|
||||||
}
|
}
|
||||||
(void) ftpd_pclose(fin);
|
ftpd_pclose(fin);
|
||||||
reply(211, "End of Status");
|
reply(211, "End of Status");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1623,9 +1623,9 @@ dolog(struct sockaddr_in *sin)
|
|||||||
sizeof(struct in_addr), AF_INET);
|
sizeof(struct in_addr), AF_INET);
|
||||||
|
|
||||||
if (hp)
|
if (hp)
|
||||||
(void) strncpy(remotehost, hp->h_name, sizeof(remotehost));
|
strncpy(remotehost, hp->h_name, sizeof(remotehost));
|
||||||
else
|
else
|
||||||
(void) strncpy(remotehost, inet_ntoa(sin->sin_addr),
|
strncpy(remotehost, inet_ntoa(sin->sin_addr),
|
||||||
sizeof(remotehost));
|
sizeof(remotehost));
|
||||||
#endif
|
#endif
|
||||||
inaddr2str (sin->sin_addr, remotehost, sizeof(remotehost));
|
inaddr2str (sin->sin_addr, remotehost, sizeof(remotehost));
|
||||||
@@ -1647,7 +1647,7 @@ dologout(int status)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (logged_in) {
|
if (logged_in) {
|
||||||
(void) seteuid((uid_t)0);
|
seteuid((uid_t)0);
|
||||||
logwtmp(ttyline, "", "");
|
logwtmp(ttyline, "", "");
|
||||||
dest_tkt();
|
dest_tkt();
|
||||||
if(k_hasafs())
|
if(k_hasafs())
|
||||||
@@ -1725,12 +1725,12 @@ passive(void)
|
|||||||
}
|
}
|
||||||
pasv_addr = ctrl_addr;
|
pasv_addr = ctrl_addr;
|
||||||
pasv_addr.sin_port = 0;
|
pasv_addr.sin_port = 0;
|
||||||
(void) seteuid((uid_t)0);
|
seteuid((uid_t)0);
|
||||||
if (bind(pdata, (struct sockaddr *)&pasv_addr, sizeof(pasv_addr)) < 0) {
|
if (bind(pdata, (struct sockaddr *)&pasv_addr, sizeof(pasv_addr)) < 0) {
|
||||||
(void) seteuid((uid_t)pw->pw_uid);
|
seteuid((uid_t)pw->pw_uid);
|
||||||
goto pasv_error;
|
goto pasv_error;
|
||||||
}
|
}
|
||||||
(void) seteuid((uid_t)pw->pw_uid);
|
seteuid((uid_t)pw->pw_uid);
|
||||||
len = sizeof(pasv_addr);
|
len = sizeof(pasv_addr);
|
||||||
if (getsockname(pdata, (struct sockaddr *) &pasv_addr, &len) < 0)
|
if (getsockname(pdata, (struct sockaddr *) &pasv_addr, &len) < 0)
|
||||||
goto pasv_error;
|
goto pasv_error;
|
||||||
@@ -1746,7 +1746,7 @@ passive(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pasv_error:
|
pasv_error:
|
||||||
(void) close(pdata);
|
close(pdata);
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
perror_reply(425, "Can't open passive connection");
|
perror_reply(425, "Can't open passive connection");
|
||||||
return;
|
return;
|
||||||
@@ -1774,11 +1774,11 @@ gunique(char *local)
|
|||||||
}
|
}
|
||||||
if (cp)
|
if (cp)
|
||||||
*cp = '/';
|
*cp = '/';
|
||||||
(void) strcpy(new, local);
|
strcpy(new, local);
|
||||||
cp = new + strlen(new);
|
cp = new + strlen(new);
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
for (count = 1; count < 100; count++) {
|
for (count = 1; count < 100; count++) {
|
||||||
(void)sprintf(cp, "%d", count);
|
sprintf(cp, "%d", count);
|
||||||
if (stat(new, &st) < 0)
|
if (stat(new, &st) < 0)
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
@@ -1851,7 +1851,7 @@ send_file_list(char *whichf)
|
|||||||
}
|
}
|
||||||
perror_reply(550, whichf);
|
perror_reply(550, whichf);
|
||||||
if (dout != NULL) {
|
if (dout != NULL) {
|
||||||
(void) fclose(dout);
|
fclose(dout);
|
||||||
transflag = 0;
|
transflag = 0;
|
||||||
data = -1;
|
data = -1;
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
@@ -1909,7 +1909,7 @@ send_file_list(char *whichf)
|
|||||||
byte_count += strlen(nbuf) + 1;
|
byte_count += strlen(nbuf) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
}
|
||||||
if (dout == NULL)
|
if (dout == NULL)
|
||||||
reply(550, "No files found.");
|
reply(550, "No files found.");
|
||||||
@@ -1922,7 +1922,7 @@ send_file_list(char *whichf)
|
|||||||
if (dout != NULL){
|
if (dout != NULL){
|
||||||
auth_write(fileno(dout), buf, 0); /* XXX flush */
|
auth_write(fileno(dout), buf, 0); /* XXX flush */
|
||||||
|
|
||||||
(void) fclose(dout);
|
fclose(dout);
|
||||||
}
|
}
|
||||||
data = -1;
|
data = -1;
|
||||||
pdata = -1;
|
pdata = -1;
|
||||||
|
@@ -101,5 +101,5 @@ stty_default(void)
|
|||||||
|
|
||||||
termios.c_cc[VSUSP] = Ctl('Z');
|
termios.c_cc[VSUSP] = Ctl('Z');
|
||||||
|
|
||||||
(void)tcsetattr(0, TCSANOW, &termios);
|
tcsetattr(0, TCSANOW, &termios);
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
int nchar; /* Bytes written/read */
|
int nchar; /* Bytes written/read */
|
||||||
|
|
||||||
/* Create a temporary maildrop into which to copy the updated maildrop */
|
/* Create a temporary maildrop into which to copy the updated maildrop */
|
||||||
(void)sprintf(p->temp_drop,POP_DROP,p->user);
|
sprintf(p->temp_drop,POP_DROP,p->user);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(p->debug)
|
if(p->debug)
|
||||||
@@ -41,7 +41,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
|
|
||||||
/* First create a unique file. Would prefer mkstemp, but Ultrix...*/
|
/* First create a unique file. Would prefer mkstemp, but Ultrix...*/
|
||||||
strcpy(template,POP_TMPDROP);
|
strcpy(template,POP_TMPDROP);
|
||||||
(void) mktemp(template);
|
mktemp(template);
|
||||||
if ( (tf=fopen(template,"w+")) == NULL ) { /* failure, bail out */
|
if ( (tf=fopen(template,"w+")) == NULL ) { /* failure, bail out */
|
||||||
pop_log(p,POP_PRIORITY,
|
pop_log(p,POP_PRIORITY,
|
||||||
"Unable to create temporary temporary maildrop '%s': %s",template,
|
"Unable to create temporary temporary maildrop '%s': %s",template,
|
||||||
@@ -52,23 +52,23 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
|
|
||||||
/* Now give this file to the user */
|
/* Now give this file to the user */
|
||||||
if (pwp) {
|
if (pwp) {
|
||||||
(void) chown(template,pwp->pw_uid, pwp->pw_gid);
|
chown(template,pwp->pw_uid, pwp->pw_gid);
|
||||||
}
|
}
|
||||||
(void) chmod(template,0600);
|
chmod(template,0600);
|
||||||
|
|
||||||
/* Now link this file to the temporary maildrop. If this fails it
|
/* Now link this file to the temporary maildrop. If this fails it
|
||||||
* is probably because the temporary maildrop already exists. If so,
|
* is probably because the temporary maildrop already exists. If so,
|
||||||
* this is ok. We can just go on our way, because by the time we try
|
* this is ok. We can just go on our way, because by the time we try
|
||||||
* to write into the file we will be running as the user.
|
* to write into the file we will be running as the user.
|
||||||
*/
|
*/
|
||||||
(void) link(template,p->temp_drop);
|
link(template,p->temp_drop);
|
||||||
(void) fclose(tf);
|
fclose(tf);
|
||||||
(void) unlink(template);
|
unlink(template);
|
||||||
|
|
||||||
/* Now we run as the user. */
|
/* Now we run as the user. */
|
||||||
if (pwp) {
|
if (pwp) {
|
||||||
(void) setuid(pwp->pw_uid);
|
setuid(pwp->pw_uid);
|
||||||
(void) setgid(pwp->pw_gid);
|
setgid(pwp->pw_gid);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(p->debug)pop_log(p,POP_DEBUG,"uid = %d, gid = %d",getuid(),getgid());
|
if(p->debug)pop_log(p,POP_DEBUG,"uid = %d, gid = %d",getuid(),getgid());
|
||||||
@@ -104,7 +104,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
|
|
||||||
/* Lock the maildrop */
|
/* Lock the maildrop */
|
||||||
if (k_flock (mfd, K_LOCK_EX) == -1) {
|
if (k_flock (mfd, K_LOCK_EX) == -1) {
|
||||||
(void)close(mfd) ;
|
close(mfd) ;
|
||||||
return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop,
|
return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
@@ -122,21 +122,21 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
see the new mail until the error goes away.
|
see the new mail until the error goes away.
|
||||||
Should let them process the current backlog, in case
|
Should let them process the current backlog, in case
|
||||||
the error is a quota problem requiring deletions! */
|
the error is a quota problem requiring deletions! */
|
||||||
(void)ftruncate(dfd,(int)offset) ;
|
ftruncate(dfd,(int)offset) ;
|
||||||
} else {
|
} else {
|
||||||
/* Mail transferred! Zero the mail drop NOW, that we
|
/* Mail transferred! Zero the mail drop NOW, that we
|
||||||
do not have to do gymnastics to figure out what's new
|
do not have to do gymnastics to figure out what's new
|
||||||
and what is old later */
|
and what is old later */
|
||||||
(void)ftruncate(mfd,0) ;
|
ftruncate(mfd,0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the actual mail drop */
|
/* Close the actual mail drop */
|
||||||
(void)close (mfd);
|
close (mfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire a stream pointer for the temporary maildrop */
|
/* Acquire a stream pointer for the temporary maildrop */
|
||||||
if ( (p->drop = fdopen(dfd,"a+")) == NULL ) {
|
if ( (p->drop = fdopen(dfd,"a+")) == NULL ) {
|
||||||
(void)close(dfd) ;
|
close(dfd) ;
|
||||||
return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
|
return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
|
||||||
p->temp_drop);
|
p->temp_drop);
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ pop_dropinfo(POP *p)
|
|||||||
p->msg_count = ALLOC_MSGS;
|
p->msg_count = ALLOC_MSGS;
|
||||||
p->mlp = (MsgInfoList *)calloc((unsigned)p->msg_count,sizeof(MsgInfoList));
|
p->mlp = (MsgInfoList *)calloc((unsigned)p->msg_count,sizeof(MsgInfoList));
|
||||||
if (p->mlp == NULL){
|
if (p->mlp == NULL){
|
||||||
(void)fclose (p->drop);
|
fclose (p->drop);
|
||||||
p->msg_count = 0;
|
p->msg_count = 0;
|
||||||
return pop_msg (p,POP_FAILURE,
|
return pop_msg (p,POP_FAILURE,
|
||||||
"Can't build message list for '%s': Out of memory", p->user);
|
"Can't build message list for '%s': Out of memory", p->user);
|
||||||
@@ -101,7 +101,7 @@ pop_dropinfo(POP *p)
|
|||||||
p->mlp=(MsgInfoList *) realloc(p->mlp,
|
p->mlp=(MsgInfoList *) realloc(p->mlp,
|
||||||
(p->msg_count+=ALLOC_MSGS)*sizeof(MsgInfoList));
|
(p->msg_count+=ALLOC_MSGS)*sizeof(MsgInfoList));
|
||||||
if (p->mlp == NULL){
|
if (p->mlp == NULL){
|
||||||
(void)fclose (p->drop);
|
fclose (p->drop);
|
||||||
p->msg_count = 0;
|
p->msg_count = 0;
|
||||||
return pop_msg (p,POP_FAILURE,
|
return pop_msg (p,POP_FAILURE,
|
||||||
"Can't build message list for '%s': Out of memory",
|
"Can't build message list for '%s': Out of memory",
|
||||||
|
@@ -47,12 +47,12 @@ pop_list (POP *p)
|
|||||||
/* Loop through the message information list. Skip deleted messages */
|
/* Loop through the message information list. Skip deleted messages */
|
||||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
||||||
if (!mp->del_flag)
|
if (!mp->del_flag)
|
||||||
(void)fprintf(p->output,"%u %lu\r\n",mp->number,mp->length);
|
fprintf(p->output,"%u %lu\r\n",mp->number,mp->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "." signals the end of a multi-line transmission */
|
/* "." signals the end of a multi-line transmission */
|
||||||
(void)fprintf(p->output,".\r\n");
|
fprintf(p->output,".\r\n");
|
||||||
(void)fflush(p->output);
|
fflush(p->output);
|
||||||
|
|
||||||
return(POP_SUCCESS);
|
return(POP_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@@ -29,13 +29,13 @@ pop_log(POP *p, int stat, char *format, ...)
|
|||||||
int a3 = va_arg(ap, int);
|
int a3 = va_arg(ap, int);
|
||||||
int a4 = va_arg(ap, int);
|
int a4 = va_arg(ap, int);
|
||||||
int a5 = va_arg(ap, int);
|
int a5 = va_arg(ap, int);
|
||||||
(void)sprintf(msgbuf, format, a0, a1, a2, a3, a4, a5, 0, 4711);
|
sprintf(msgbuf, format, a0, a1, a2, a3, a4, a5, 0, 4711);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_VSPRINTF */
|
#endif /* HAVE_VSPRINTF */
|
||||||
|
|
||||||
if (p->debug && p->trace) {
|
if (p->debug && p->trace) {
|
||||||
(void)fprintf(p->trace,"%s\n",msgbuf);
|
fprintf(p->trace,"%s\n",msgbuf);
|
||||||
(void)fflush(p->trace);
|
fflush(p->trace);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
syslog (stat,"%s",msgbuf);
|
syslog (stat,"%s",msgbuf);
|
||||||
|
@@ -25,9 +25,9 @@ pop_msg(POP *p, int stat, char *format, ...)
|
|||||||
|
|
||||||
/* Format the POP status code at the beginning of the message */
|
/* Format the POP status code at the beginning of the message */
|
||||||
if (stat == POP_SUCCESS)
|
if (stat == POP_SUCCESS)
|
||||||
(void)sprintf (mp,"%s ",POP_OK);
|
sprintf (mp,"%s ",POP_OK);
|
||||||
else
|
else
|
||||||
(void)sprintf (mp,"%s ",POP_ERR);
|
sprintf (mp,"%s ",POP_ERR);
|
||||||
|
|
||||||
/* Point past the POP status indicator in the message message */
|
/* Point past the POP status indicator in the message message */
|
||||||
mp += strlen(mp);
|
mp += strlen(mp);
|
||||||
@@ -44,7 +44,7 @@ pop_msg(POP *p, int stat, char *format, ...)
|
|||||||
int a3 = va_arg(ap, int);
|
int a3 = va_arg(ap, int);
|
||||||
int a4 = va_arg(ap, int);
|
int a4 = va_arg(ap, int);
|
||||||
int a5 = va_arg(ap, int);
|
int a5 = va_arg(ap, int);
|
||||||
(void)sprintf(mp, format, a0, a1, a2, a3, a4, a5, 0, 4711);
|
sprintf(mp, format, a0, a1, a2, a3, a4, a5, 0, 4711);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_VSPRINTF */
|
#endif /* HAVE_VSPRINTF */
|
||||||
|
|
||||||
@@ -59,11 +59,11 @@ pop_msg(POP *p, int stat, char *format, ...)
|
|||||||
pop_log(p,POP_PRIORITY,"%s",message);
|
pop_log(p,POP_PRIORITY,"%s",message);
|
||||||
|
|
||||||
/* Append the <CR><LF> */
|
/* Append the <CR><LF> */
|
||||||
(void)strcat(message, "\r\n");
|
strcat(message, "\r\n");
|
||||||
|
|
||||||
/* Send the message to the client */
|
/* Send the message to the client */
|
||||||
(void)fputs(message,p->output);
|
fputs(message,p->output);
|
||||||
(void)fflush(p->output);
|
fflush(p->output);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return(stat);
|
return(stat);
|
||||||
|
@@ -87,10 +87,10 @@ pop_send(POP *p)
|
|||||||
pop_msg(p,POP_SUCCESS,"%u octets",mp->length);
|
pop_msg(p,POP_SUCCESS,"%u octets",mp->length);
|
||||||
|
|
||||||
/* Position to the start of the message */
|
/* Position to the start of the message */
|
||||||
(void)fseek(p->drop,mp->offset,0);
|
fseek(p->drop,mp->offset,0);
|
||||||
|
|
||||||
/* Skip the first line (the sendmail "From" line) */
|
/* Skip the first line (the sendmail "From" line) */
|
||||||
(void)fgets (buffer,MAXMSGLINELEN,p->drop);
|
fgets (buffer,MAXMSGLINELEN,p->drop);
|
||||||
|
|
||||||
#ifdef RETURN_PATH_HANDLING
|
#ifdef RETURN_PATH_HANDLING
|
||||||
return_path_sent = 0;
|
return_path_sent = 0;
|
||||||
@@ -146,8 +146,8 @@ pop_send(POP *p)
|
|||||||
return (pop_msg (p,POP_FAILURE,"SIGHUP or SIGPIPE flagged"));
|
return (pop_msg (p,POP_FAILURE,"SIGHUP or SIGPIPE flagged"));
|
||||||
}
|
}
|
||||||
/* "." signals the end of a multi-line transmission */
|
/* "." signals the end of a multi-line transmission */
|
||||||
(void)fputs(".\r\n",p->output);
|
fputs(".\r\n",p->output);
|
||||||
(void)fflush(p->output);
|
fflush(p->output);
|
||||||
|
|
||||||
return(POP_SUCCESS);
|
return(POP_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@@ -80,12 +80,12 @@ pop_uidl (POP *p)
|
|||||||
/* Loop through the message information list. Skip deleted messages */
|
/* Loop through the message information list. Skip deleted messages */
|
||||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
||||||
if (!mp->del_flag)
|
if (!mp->del_flag)
|
||||||
(void)fprintf(p->output,"%u %s\r\n",mp->number,mp->msg_id);
|
fprintf(p->output,"%u %s\r\n",mp->number,mp->msg_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "." signals the end of a multi-line transmission */
|
/* "." signals the end of a multi-line transmission */
|
||||||
(void)fprintf(p->output,".\r\n");
|
fprintf(p->output,".\r\n");
|
||||||
(void)fflush(p->output);
|
fflush(p->output);
|
||||||
|
|
||||||
return(POP_SUCCESS);
|
return(POP_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@@ -43,8 +43,8 @@ pop_updt (POP *p)
|
|||||||
if (p->msgs_deleted == p->msg_count) {
|
if (p->msgs_deleted == p->msg_count) {
|
||||||
/* Truncate before close, to avoid race condition, DO NOT UNLINK!
|
/* Truncate before close, to avoid race condition, DO NOT UNLINK!
|
||||||
Another process may have opened, and not yet tried to lock */
|
Another process may have opened, and not yet tried to lock */
|
||||||
(void)ftruncate ((int)fileno(p->drop),0);
|
ftruncate ((int)fileno(p->drop),0);
|
||||||
(void)fclose(p->drop) ;
|
fclose(p->drop) ;
|
||||||
return (POP_SUCCESS);
|
return (POP_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ pop_updt (POP *p)
|
|||||||
|
|
||||||
/* Lock the user's real mail drop */
|
/* Lock the user's real mail drop */
|
||||||
if ( k_flock(mfd, K_LOCK_EX) == -1 ) {
|
if ( k_flock(mfd, K_LOCK_EX) == -1 ) {
|
||||||
(void)fclose(md) ;
|
fclose(md) ;
|
||||||
return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop,
|
return pop_msg(p,POP_FAILURE, "flock: '%s': %s", p->temp_drop,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
@@ -77,18 +77,18 @@ pop_updt (POP *p)
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( nchar != 0 ) {
|
if ( nchar != 0 ) {
|
||||||
(void)fclose(md) ;
|
fclose(md) ;
|
||||||
(void)ftruncate((int)fileno(p->drop),(int)offset) ;
|
ftruncate((int)fileno(p->drop),(int)offset) ;
|
||||||
(void)fclose(p->drop) ;
|
fclose(p->drop) ;
|
||||||
return pop_msg(p,POP_FAILURE,standard_error);
|
return pop_msg(p,POP_FAILURE,standard_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
rewind(md);
|
rewind(md);
|
||||||
(void)ftruncate(mfd,0) ;
|
ftruncate(mfd,0) ;
|
||||||
|
|
||||||
/* Synch stdio and the kernel for the POP drop */
|
/* Synch stdio and the kernel for the POP drop */
|
||||||
rewind(p->drop);
|
rewind(p->drop);
|
||||||
(void)lseek((int)fileno(p->drop),0,SEEK_SET);
|
lseek((int)fileno(p->drop),0,SEEK_SET);
|
||||||
|
|
||||||
/* Transfer messages not flagged for deletion from the temporary
|
/* Transfer messages not flagged for deletion from the temporary
|
||||||
maildrop to the new maildrop */
|
maildrop to the new maildrop */
|
||||||
@@ -114,7 +114,7 @@ pop_updt (POP *p)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)fseek(p->drop,mp->offset,0);
|
fseek(p->drop,mp->offset,0);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(p->debug)
|
if(p->debug)
|
||||||
@@ -128,9 +128,9 @@ pop_updt (POP *p)
|
|||||||
/* Update the message status */
|
/* Update the message status */
|
||||||
if (strncasecmp(buffer,"Status:",7) == 0) {
|
if (strncasecmp(buffer,"Status:",7) == 0) {
|
||||||
if (mp->retr_flag)
|
if (mp->retr_flag)
|
||||||
(void)fputs("Status: RO\n",md);
|
fputs("Status: RO\n",md);
|
||||||
else
|
else
|
||||||
(void)fputs(buffer, md);
|
fputs(buffer, md);
|
||||||
status_written++;
|
status_written++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -139,19 +139,19 @@ pop_updt (POP *p)
|
|||||||
doing_body = 1;
|
doing_body = 1;
|
||||||
if (status_written == 0) {
|
if (status_written == 0) {
|
||||||
if (mp->retr_flag)
|
if (mp->retr_flag)
|
||||||
(void)fputs("Status: RO\n\n",md);
|
fputs("Status: RO\n\n",md);
|
||||||
else
|
else
|
||||||
(void)fputs("Status: U\n\n",md);
|
fputs("Status: U\n\n",md);
|
||||||
}
|
}
|
||||||
else (void)fputs ("\n", md);
|
else fputs ("\n", md);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Save another header line */
|
/* Save another header line */
|
||||||
(void)fputs (buffer, md);
|
fputs (buffer, md);
|
||||||
}
|
}
|
||||||
else { /* Body */
|
else { /* Body */
|
||||||
if (strncmp(buffer,"From ",5) == 0) break;
|
if (strncmp(buffer,"From ",5) == 0) break;
|
||||||
(void)fputs (buffer, md);
|
fputs (buffer, md);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,16 +159,16 @@ pop_updt (POP *p)
|
|||||||
/* flush and check for errors now! The new mail will writen
|
/* flush and check for errors now! The new mail will writen
|
||||||
without stdio, since we need not separate messages */
|
without stdio, since we need not separate messages */
|
||||||
|
|
||||||
(void)fflush(md) ;
|
fflush(md) ;
|
||||||
if (ferror(md)) {
|
if (ferror(md)) {
|
||||||
(void)ftruncate(mfd,0) ;
|
ftruncate(mfd,0) ;
|
||||||
(void)fclose(md) ;
|
fclose(md) ;
|
||||||
(void)fclose(p->drop) ;
|
fclose(p->drop) ;
|
||||||
return pop_msg(p,POP_FAILURE,standard_error);
|
return pop_msg(p,POP_FAILURE,standard_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go to start of new mail if any */
|
/* Go to start of new mail if any */
|
||||||
(void)lseek((int)fileno(p->drop),offset,SEEK_SET);
|
lseek((int)fileno(p->drop),offset,SEEK_SET);
|
||||||
|
|
||||||
while((nchar=read((int)fileno(p->drop),buffer,BUFSIZ)) > 0)
|
while((nchar=read((int)fileno(p->drop),buffer,BUFSIZ)) > 0)
|
||||||
if ( nchar != write(mfd,buffer,nchar) ) {
|
if ( nchar != write(mfd,buffer,nchar) ) {
|
||||||
@@ -176,16 +176,16 @@ pop_updt (POP *p)
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( nchar != 0 ) {
|
if ( nchar != 0 ) {
|
||||||
(void)ftruncate(mfd,0) ;
|
ftruncate(mfd,0) ;
|
||||||
(void)fclose(md) ;
|
fclose(md) ;
|
||||||
(void)fclose(p->drop) ;
|
fclose(p->drop) ;
|
||||||
return pop_msg(p,POP_FAILURE,standard_error);
|
return pop_msg(p,POP_FAILURE,standard_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the maildrop and empty temporary maildrop */
|
/* Close the maildrop and empty temporary maildrop */
|
||||||
(void)fclose(md);
|
fclose(md);
|
||||||
(void)ftruncate((int)fileno(p->drop),0);
|
ftruncate((int)fileno(p->drop),0);
|
||||||
(void)fclose(p->drop);
|
fclose(p->drop);
|
||||||
|
|
||||||
return(pop_quit(p));
|
return(pop_quit(p));
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ pop_xmit (POP *p)
|
|||||||
_exit(1);
|
_exit(1);
|
||||||
case -1:
|
case -1:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!p->debug) (void)unlink (temp_xmit);
|
if (!p->debug) unlink (temp_xmit);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return (pop_msg(p,POP_FAILURE,
|
return (pop_msg(p,POP_FAILURE,
|
||||||
"Unable to execute \"%s\"",MAIL_COMMAND));
|
"Unable to execute \"%s\"",MAIL_COMMAND));
|
||||||
|
@@ -36,7 +36,7 @@ ring(int sig)
|
|||||||
static char *
|
static char *
|
||||||
tgets(char *str, int size, FILE *fp, int timeout)
|
tgets(char *str, int size, FILE *fp, int timeout)
|
||||||
{
|
{
|
||||||
(void) signal(SIGALRM, ring);
|
signal(SIGALRM, ring);
|
||||||
alarm(timeout);
|
alarm(timeout);
|
||||||
if (setjmp(env))
|
if (setjmp(env))
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
@@ -585,13 +585,13 @@ auth_wait(char *name)
|
|||||||
if (Server && !authenticating)
|
if (Server && !authenticating)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
(void) signal(SIGALRM, auth_intr);
|
signal(SIGALRM, auth_intr);
|
||||||
alarm(30);
|
alarm(30);
|
||||||
while (!authenticated)
|
while (!authenticated)
|
||||||
if (telnet_spin())
|
if (telnet_spin())
|
||||||
break;
|
break;
|
||||||
alarm(0);
|
alarm(0);
|
||||||
(void) signal(SIGALRM, SIG_DFL);
|
signal(SIGALRM, SIG_DFL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now check to see if the user is valid or not
|
* Now check to see if the user is valid or not
|
||||||
|
@@ -317,7 +317,7 @@ krb5_data *outbuf;
|
|||||||
if (retval = encode_krb5_enc_cred_part(&cred_enc_part, &scratch))
|
if (retval = encode_krb5_enc_cred_part(&cred_enc_part, &scratch))
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(scratch); }
|
#define cleanup_scratch() { memset(scratch->data, 0, scratch->length); krb5_free_data(scratch); }
|
||||||
|
|
||||||
/* put together an eblock for this encryption */
|
/* put together an eblock for this encryption */
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ krb5_data *outbuf;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define cleanup_encpart() {\
|
#define cleanup_encpart() {\
|
||||||
(void) memset(ret_cred.enc_part.ciphertext.data, 0, \
|
memset(ret_cred.enc_part.ciphertext.data, 0, \
|
||||||
ret_cred.enc_part.ciphertext.length); \
|
ret_cred.enc_part.ciphertext.length); \
|
||||||
free(ret_cred.enc_part.ciphertext.data); \
|
free(ret_cred.enc_part.ciphertext.data); \
|
||||||
ret_cred.enc_part.ciphertext.length = 0; \
|
ret_cred.enc_part.ciphertext.length = 0; \
|
||||||
@@ -351,7 +351,7 @@ krb5_data *outbuf;
|
|||||||
goto clean_encpart;
|
goto clean_encpart;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
|
#define cleanup_prockey() {krb5_finish_key(&eblock);}
|
||||||
|
|
||||||
/* call the encryption routine */
|
/* call the encryption routine */
|
||||||
if (retval = krb5_encrypt((krb5_pointer) scratch->data,
|
if (retval = krb5_encrypt((krb5_pointer) scratch->data,
|
||||||
@@ -470,14 +470,14 @@ const krb5_address *recv_addr; /* optional */
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cleanup_credmsg() {(void)krb5_xfree(credmsg->enc_part.ciphertext.data); (void)krb5_xfree(credmsg);}
|
#define cleanup_credmsg() {krb5_xfree(credmsg->enc_part.ciphertext.data); krb5_xfree(credmsg);}
|
||||||
|
|
||||||
if (!(scratch = (krb5_data *) malloc(sizeof(*scratch)))) {
|
if (!(scratch = (krb5_data *) malloc(sizeof(*scratch)))) {
|
||||||
cleanup_credmsg();
|
cleanup_credmsg();
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cleanup_scratch() {(void)memset(scratch->data, 0, scratch->length); (void)krb5_xfree(scratch->data);}
|
#define cleanup_scratch() {memset(scratch->data, 0, scratch->length); krb5_xfree(scratch->data);}
|
||||||
|
|
||||||
if (retval = encode_krb5_ticket(credmsg->tickets[0], &scratch)) {
|
if (retval = encode_krb5_ticket(credmsg->tickets[0], &scratch)) {
|
||||||
cleanup_credmsg();
|
cleanup_credmsg();
|
||||||
@@ -516,7 +516,7 @@ const krb5_address *recv_addr; /* optional */
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
|
#define cleanup_prockey() {krb5_finish_key(&eblock);}
|
||||||
|
|
||||||
/* call the decryption routine */
|
/* call the decryption routine */
|
||||||
if (retval = krb5_decrypt((krb5_pointer) credmsg->enc_part.ciphertext.data,
|
if (retval = krb5_decrypt((krb5_pointer) credmsg->enc_part.ciphertext.data,
|
||||||
@@ -545,7 +545,7 @@ const krb5_address *recv_addr; /* optional */
|
|||||||
}
|
}
|
||||||
cleanup_scratch();
|
cleanup_scratch();
|
||||||
|
|
||||||
#define cleanup_mesg() {(void)krb5_xfree(credmsg_enc_part);}
|
#define cleanup_mesg() {krb5_xfree(credmsg_enc_part);}
|
||||||
|
|
||||||
if (retval = krb5_timeofday(¤ttime)) {
|
if (retval = krb5_timeofday(¤ttime)) {
|
||||||
cleanup_mesg();
|
cleanup_mesg();
|
||||||
|
@@ -385,8 +385,8 @@ kerberos5_is(ap, data, cnt)
|
|||||||
|
|
||||||
errout:
|
errout:
|
||||||
authdat = 0;
|
authdat = 0;
|
||||||
(void) strcpy(errbuf, "Read req failed: ");
|
strcpy(errbuf, "Read req failed: ");
|
||||||
(void) strcat(errbuf, error_message(r));
|
strcat(errbuf, error_message(r));
|
||||||
Data(ap, KRB_REJECT, errbuf, -1);
|
Data(ap, KRB_REJECT, errbuf, -1);
|
||||||
if (auth_debug_mode)
|
if (auth_debug_mode)
|
||||||
printf("%s\r\n", errbuf);
|
printf("%s\r\n", errbuf);
|
||||||
@@ -443,8 +443,8 @@ kerberos5_is(ap, data, cnt)
|
|||||||
UserNameRequested)) {
|
UserNameRequested)) {
|
||||||
char errbuf[128];
|
char errbuf[128];
|
||||||
|
|
||||||
(void) strcpy(errbuf, "Read forwarded creds failed: ");
|
strcpy(errbuf, "Read forwarded creds failed: ");
|
||||||
(void) strcat(errbuf, error_message(r));
|
strcat(errbuf, error_message(r));
|
||||||
Data(ap, KRB_FORWARD_REJECT, errbuf, -1);
|
Data(ap, KRB_FORWARD_REJECT, errbuf, -1);
|
||||||
if (auth_debug_mode)
|
if (auth_debug_mode)
|
||||||
printf("Could not read forwarded credentials\r\n");
|
printf("Could not read forwarded credentials\r\n");
|
||||||
|
@@ -102,15 +102,15 @@ local_des_read_pw_string(s,max,prompt,verify)
|
|||||||
if (ioctl(0,TIOCSETP,(char *)&tty_state) == -1)
|
if (ioctl(0,TIOCSETP,(char *)&tty_state) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
while (!ok) {
|
while (!ok) {
|
||||||
(void) printf(prompt);
|
printf(prompt);
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
while (!fgets(s, max, stdin));
|
while (!fgets(s, max, stdin));
|
||||||
|
|
||||||
if ((ptr = strchr(s, '\n')))
|
if ((ptr = strchr(s, '\n')))
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
if (verify) {
|
if (verify) {
|
||||||
printf("\nVerifying, please re-enter %s",prompt);
|
printf("\nVerifying, please re-enter %s",prompt);
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
if (!fgets(key_string, sizeof(key_string), stdin)) {
|
if (!fgets(key_string, sizeof(key_string), stdin)) {
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
continue;
|
continue;
|
||||||
@@ -119,7 +119,7 @@ local_des_read_pw_string(s,max,prompt,verify)
|
|||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
if (strcmp(s,key_string)) {
|
if (strcmp(s,key_string)) {
|
||||||
printf("\n\07\07Mismatch - try again\n");
|
printf("\n\07\07Mismatch - try again\n");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -348,7 +348,7 @@ static int sendcmd(int argc, char **argv)
|
|||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if ((s = GETSEND(argv[i])) == 0) {
|
if ((s = GETSEND(argv[i])) == 0) {
|
||||||
fprintf(stderr, "Telnet 'send' error - argument disappeared!\n");
|
fprintf(stderr, "Telnet 'send' error - argument disappeared!\n");
|
||||||
(void) quit();
|
quit();
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
if (s->handler) {
|
if (s->handler) {
|
||||||
@@ -1305,14 +1305,14 @@ setescape(argc, argv)
|
|||||||
arg = argv[1];
|
arg = argv[1];
|
||||||
else {
|
else {
|
||||||
printf("new escape character: ");
|
printf("new escape character: ");
|
||||||
(void) fgets(buf, sizeof(buf), stdin);
|
fgets(buf, sizeof(buf), stdin);
|
||||||
arg = buf;
|
arg = buf;
|
||||||
}
|
}
|
||||||
if (arg[0] != '\0')
|
if (arg[0] != '\0')
|
||||||
escape = arg[0];
|
escape = arg[0];
|
||||||
printf("Escape character is '%s'.\n", control(escape));
|
printf("Escape character is '%s'.\n", control(escape));
|
||||||
|
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1323,7 +1323,7 @@ togcrmod()
|
|||||||
crmod = !crmod;
|
crmod = !crmod;
|
||||||
printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
|
printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
|
||||||
printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
|
printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1337,7 +1337,7 @@ suspend()
|
|||||||
long oldrows, oldcols, newrows, newcols, err;
|
long oldrows, oldcols, newrows, newcols, err;
|
||||||
|
|
||||||
err = (TerminalWindowSize(&oldrows, &oldcols) == 0) ? 1 : 0;
|
err = (TerminalWindowSize(&oldrows, &oldcols) == 0) ? 1 : 0;
|
||||||
(void) kill(0, SIGTSTP);
|
kill(0, SIGTSTP);
|
||||||
/*
|
/*
|
||||||
* If we didn't get the window size before the SUSPEND, but we
|
* If we didn't get the window size before the SUSPEND, but we
|
||||||
* can get them now (?), then send the NAWS to make sure that
|
* can get them now (?), then send the NAWS to make sure that
|
||||||
@@ -1393,7 +1393,7 @@ shell(int argc, char **argv)
|
|||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
(void)wait((int *)0); /* Wait for the shell to complete */
|
wait((int *)0); /* Wait for the shell to complete */
|
||||||
|
|
||||||
if (TerminalWindowSize(&newrows, &newcols) && connected &&
|
if (TerminalWindowSize(&newrows, &newcols) && connected &&
|
||||||
(err || ((oldrows != newrows) || (oldcols != newcols)))) {
|
(err || ((oldrows != newrows) || (oldcols != newcols)))) {
|
||||||
@@ -1409,9 +1409,9 @@ static int bye(int argc, char **argv)
|
|||||||
extern int resettermname;
|
extern int resettermname;
|
||||||
|
|
||||||
if (connected) {
|
if (connected) {
|
||||||
(void) shutdown(net, 2);
|
shutdown(net, 2);
|
||||||
printf("Connection closed.\n");
|
printf("Connection closed.\n");
|
||||||
(void) NetClose(net);
|
NetClose(net);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
resettermname = 1;
|
resettermname = 1;
|
||||||
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
|
||||||
@@ -1428,7 +1428,7 @@ static int bye(int argc, char **argv)
|
|||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
int quit(void)
|
int quit(void)
|
||||||
{
|
{
|
||||||
(void) call(bye, "bye", "fromquit", 0);
|
call(bye, "bye", "fromquit", 0);
|
||||||
Exit(0);
|
Exit(0);
|
||||||
return 0; /*NOTREACHED*/
|
return 0; /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
@@ -1438,7 +1438,7 @@ int quit(void)
|
|||||||
logout()
|
logout()
|
||||||
{
|
{
|
||||||
send_do(TELOPT_LOGOUT, 1);
|
send_do(TELOPT_LOGOUT, 1);
|
||||||
(void) netflush();
|
netflush();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2058,7 +2058,7 @@ static int status(int argc, char **argv)
|
|||||||
printf("No connection.\n");
|
printf("No connection.\n");
|
||||||
}
|
}
|
||||||
printf("Escape character is '%s'.\n", control(escape));
|
printf("Escape character is '%s'.\n", control(escape));
|
||||||
(void) fflush(stdout);
|
fflush(stdout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2068,7 +2068,7 @@ static int status(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
ayt_status()
|
ayt_status()
|
||||||
{
|
{
|
||||||
(void) call(status, "status", "notmuch", 0);
|
call(status, "status", "notmuch", 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2180,9 +2180,9 @@ int tn(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
(void) strcpy(line, "open ");
|
strcpy(line, "open ");
|
||||||
printf("(to) ");
|
printf("(to) ");
|
||||||
(void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
|
fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
|
||||||
makeargv();
|
makeargv();
|
||||||
argc = margc;
|
argc = margc;
|
||||||
argv = margv;
|
argv = margv;
|
||||||
@@ -2248,7 +2248,7 @@ int tn(int argc, char **argv)
|
|||||||
if (temp != (unsigned long) -1) {
|
if (temp != (unsigned long) -1) {
|
||||||
sin.sin_addr.s_addr = temp;
|
sin.sin_addr.s_addr = temp;
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
(void) strcpy(_hostname, hostp);
|
strcpy(_hostname, hostp);
|
||||||
hostname = _hostname;
|
hostname = _hostname;
|
||||||
} else {
|
} else {
|
||||||
host = gethostbyname(hostp);
|
host = gethostbyname(hostp);
|
||||||
@@ -2353,7 +2353,7 @@ int tn(int argc, char **argv)
|
|||||||
host->h_addr_list++;
|
host->h_addr_list++;
|
||||||
memmove((caddr_t)&sin.sin_addr,
|
memmove((caddr_t)&sin.sin_addr,
|
||||||
host->h_addr_list[0], host->h_length);
|
host->h_addr_list[0], host->h_length);
|
||||||
(void) NetClose(net);
|
NetClose(net);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif /* defined(h_addr) */
|
#endif /* defined(h_addr) */
|
||||||
@@ -2382,10 +2382,10 @@ int tn(int argc, char **argv)
|
|||||||
env_define((unsigned char *)"USER", (unsigned char *)user);
|
env_define((unsigned char *)"USER", (unsigned char *)user);
|
||||||
env_export((unsigned char *)"USER");
|
env_export((unsigned char *)"USER");
|
||||||
}
|
}
|
||||||
(void) call(status, "status", "notmuch", 0);
|
call(status, "status", "notmuch", 0);
|
||||||
if (setjmp(peerdied) == 0)
|
if (setjmp(peerdied) == 0)
|
||||||
telnet(user);
|
telnet(user);
|
||||||
(void) NetClose(net);
|
NetClose(net);
|
||||||
ExitString("Connection closed by foreign host.\n",1);
|
ExitString("Connection closed by foreign host.\n",1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
@@ -2493,8 +2493,8 @@ command(top, tbuf, cnt)
|
|||||||
if (!top) {
|
if (!top) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
(void) signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
(void) signal(SIGQUIT, SIG_DFL);
|
signal(SIGQUIT, SIG_DFL);
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (rlogin == _POSIX_VDISABLE)
|
if (rlogin == _POSIX_VDISABLE)
|
||||||
@@ -2516,7 +2516,7 @@ command(top, tbuf, cnt)
|
|||||||
printf("%s> ", prompt);
|
printf("%s> ", prompt);
|
||||||
if (fgets(line, sizeof(line), stdin) == NULL) {
|
if (fgets(line, sizeof(line), stdin) == NULL) {
|
||||||
if (feof(stdin) || ferror(stdin)) {
|
if (feof(stdin) || ferror(stdin)) {
|
||||||
(void) quit();
|
quit();
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -229,7 +229,7 @@ int main(int argc, char **argv)
|
|||||||
extern char *dest_realm, dst_realm_buf[];
|
extern char *dest_realm, dst_realm_buf[];
|
||||||
extern int dst_realm_sz;
|
extern int dst_realm_sz;
|
||||||
dest_realm = dst_realm_buf;
|
dest_realm = dst_realm_buf;
|
||||||
(void)strncpy(dest_realm, optarg, dst_realm_sz);
|
strncpy(dest_realm, optarg, dst_realm_sz);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
(void)setjmp(toplevel);
|
setjmp(toplevel);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
command(1, 0, 0);
|
command(1, 0, 0);
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ stilloob()
|
|||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
perror("select");
|
perror("select");
|
||||||
(void) quit();
|
quit();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
if (FD_ISSET(net, &excepts)) {
|
if (FD_ISSET(net, &excepts)) {
|
||||||
@@ -157,7 +157,7 @@ netflush()
|
|||||||
if (errno != ENOBUFS && errno != EWOULDBLOCK) {
|
if (errno != ENOBUFS && errno != EWOULDBLOCK) {
|
||||||
setcommandmode();
|
setcommandmode();
|
||||||
perror(hostname);
|
perror(hostname);
|
||||||
(void)NetClose(net);
|
NetClose(net);
|
||||||
ring_clear_mark(&netoring);
|
ring_clear_mark(&netoring);
|
||||||
longjmp(peerdied, -1);
|
longjmp(peerdied, -1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
@@ -174,7 +174,7 @@ netflush()
|
|||||||
* up the other half.
|
* up the other half.
|
||||||
*/
|
*/
|
||||||
if ((n1 == n) && ring_full_consecutive(&netoring)) {
|
if ((n1 == n) && ring_full_consecutive(&netoring)) {
|
||||||
(void) netflush();
|
netflush();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -213,9 +213,9 @@ void
|
|||||||
TerminalFlushOutput()
|
TerminalFlushOutput()
|
||||||
{
|
{
|
||||||
#ifdef TIOCFLUSH
|
#ifdef TIOCFLUSH
|
||||||
(void) ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
|
ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
|
||||||
#else
|
#else
|
||||||
(void) ioctl(fileno(stdout), TCFLSH, (char *) 0);
|
ioctl(fileno(stdout), TCFLSH, (char *) 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,10 +487,10 @@ TerminalNewMode(int f)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
(void) signal(SIGTSTP, susp);
|
signal(SIGTSTP, susp);
|
||||||
#endif /* SIGTSTP */
|
#endif /* SIGTSTP */
|
||||||
#ifdef SIGINFO
|
#ifdef SIGINFO
|
||||||
(void) signal(SIGINFO, ayt);
|
signal(SIGINFO, ayt);
|
||||||
#endif
|
#endif
|
||||||
#ifdef NOKERNINFO
|
#ifdef NOKERNINFO
|
||||||
tmp_tc.c_lflag |= NOKERNINFO;
|
tmp_tc.c_lflag |= NOKERNINFO;
|
||||||
@@ -526,10 +526,10 @@ TerminalNewMode(int f)
|
|||||||
#ifdef SIGINFO
|
#ifdef SIGINFO
|
||||||
RETSIGTYPE ayt_status();
|
RETSIGTYPE ayt_status();
|
||||||
|
|
||||||
(void) signal(SIGINFO, ayt_status);
|
signal(SIGINFO, ayt_status);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
(void) signal(SIGTSTP, SIG_DFL);
|
signal(SIGTSTP, SIG_DFL);
|
||||||
sigemptyset(&sm);
|
sigemptyset(&sm);
|
||||||
sigaddset(&sm, SIGTSTP);
|
sigaddset(&sm, SIGTSTP);
|
||||||
sigprocmask(SIG_UNBLOCK, &sm, NULL);
|
sigprocmask(SIG_UNBLOCK, &sm, NULL);
|
||||||
@@ -757,17 +757,17 @@ ayt(sig)
|
|||||||
void
|
void
|
||||||
sys_telnet_init()
|
sys_telnet_init()
|
||||||
{
|
{
|
||||||
(void) signal(SIGINT, intr);
|
signal(SIGINT, intr);
|
||||||
(void) signal(SIGQUIT, intr2);
|
signal(SIGQUIT, intr2);
|
||||||
(void) signal(SIGPIPE, deadpeer);
|
signal(SIGPIPE, deadpeer);
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
(void) signal(SIGWINCH, sendwin);
|
signal(SIGWINCH, sendwin);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
(void) signal(SIGTSTP, susp);
|
signal(SIGTSTP, susp);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGINFO
|
#ifdef SIGINFO
|
||||||
(void) signal(SIGINFO, ayt);
|
signal(SIGINFO, ayt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setconnmode(0);
|
setconnmode(0);
|
||||||
@@ -845,7 +845,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
|
|||||||
if (FD_ISSET(net, &xbits)) {
|
if (FD_ISSET(net, &xbits)) {
|
||||||
FD_CLR(net, &xbits);
|
FD_CLR(net, &xbits);
|
||||||
SYNCHing = 1;
|
SYNCHing = 1;
|
||||||
(void) ttyflush(1); /* flush already enqueued data */
|
ttyflush(1); /* flush already enqueued data */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1208,7 +1208,7 @@ slc_export()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
slc_end_reply();
|
slc_end_reply();
|
||||||
(void)slc_update();
|
slc_update();
|
||||||
setconnmode(1); /* Make sure the character values are set */
|
setconnmode(1); /* Make sure the character values are set */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1688,7 +1688,7 @@ process_iac:
|
|||||||
*/
|
*/
|
||||||
printoption("RCVD", IAC, DM);
|
printoption("RCVD", IAC, DM);
|
||||||
SYNCHing = 1;
|
SYNCHing = 1;
|
||||||
(void) ttyflush(1);
|
ttyflush(1);
|
||||||
SYNCHing = stilloob();
|
SYNCHing = stilloob();
|
||||||
settimer(gotDM);
|
settimer(gotDM);
|
||||||
break;
|
break;
|
||||||
@@ -2134,7 +2134,7 @@ doflush()
|
|||||||
NETADD(TELOPT_TM);
|
NETADD(TELOPT_TM);
|
||||||
flushline = 1;
|
flushline = 1;
|
||||||
flushout = 1;
|
flushout = 1;
|
||||||
(void) ttyflush(1); /* Flush/drop output */
|
ttyflush(1); /* Flush/drop output */
|
||||||
/* do printoption AFTER flush, otherwise the output gets tossed... */
|
/* do printoption AFTER flush, otherwise the output gets tossed... */
|
||||||
printoption("SENT", DO, TELOPT_TM);
|
printoption("SENT", DO, TELOPT_TM);
|
||||||
}
|
}
|
||||||
|
@@ -857,13 +857,13 @@ EmptyTerminal(void)
|
|||||||
|
|
||||||
if (TTYBYTES() == 0) {
|
if (TTYBYTES() == 0) {
|
||||||
FD_SET(tout, &outs);
|
FD_SET(tout, &outs);
|
||||||
(void) select(tout+1, 0, &outs, 0,
|
select(tout+1, 0, &outs, 0,
|
||||||
(struct timeval *) 0); /* wait for TTLOWAT */
|
(struct timeval *) 0); /* wait for TTLOWAT */
|
||||||
} else {
|
} else {
|
||||||
while (TTYBYTES()) {
|
while (TTYBYTES()) {
|
||||||
(void) ttyflush(0);
|
ttyflush(0);
|
||||||
FD_SET(tout, &outs);
|
FD_SET(tout, &outs);
|
||||||
(void) select(tout+1, 0, &outs, 0,
|
select(tout+1, 0, &outs, 0,
|
||||||
(struct timeval *) 0); /* wait for TTLOWAT */
|
(struct timeval *) 0); /* wait for TTLOWAT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -874,7 +874,7 @@ SetForExit(void)
|
|||||||
{
|
{
|
||||||
setconnmode(0);
|
setconnmode(0);
|
||||||
do {
|
do {
|
||||||
(void)telrcv(); /* Process any incoming data */
|
telrcv(); /* Process any incoming data */
|
||||||
EmptyTerminal();
|
EmptyTerminal();
|
||||||
} while (ring_full_count(&netiring)); /* While there is any */
|
} while (ring_full_count(&netiring)); /* While there is any */
|
||||||
setcommandmode();
|
setcommandmode();
|
||||||
|
@@ -159,7 +159,7 @@ start_slc(getit)
|
|||||||
slcchange = 0;
|
slcchange = 0;
|
||||||
if (getit)
|
if (getit)
|
||||||
init_termbuf();
|
init_termbuf();
|
||||||
(void) sprintf((char *)slcbuf, "%c%c%c%c",
|
sprintf((char *)slcbuf, "%c%c%c%c",
|
||||||
IAC, SB, TELOPT_LINEMODE, LM_SLC);
|
IAC, SB, TELOPT_LINEMODE, LM_SLC);
|
||||||
slcptr = slcbuf + 4;
|
slcptr = slcbuf + 4;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ end_slc(bufp)
|
|||||||
*bufp = &slcbuf[4];
|
*bufp = &slcbuf[4];
|
||||||
return(slcptr - slcbuf - 4);
|
return(slcptr - slcbuf - 4);
|
||||||
} else {
|
} else {
|
||||||
(void) sprintf((char *)slcptr, "%c%c", IAC, SE);
|
sprintf((char *)slcptr, "%c%c", IAC, SE);
|
||||||
slcptr += 2;
|
slcptr += 2;
|
||||||
len = slcptr - slcbuf;
|
len = slcptr - slcbuf;
|
||||||
writenet(slcbuf, len);
|
writenet(slcbuf, len);
|
||||||
@@ -483,7 +483,7 @@ deferslc()
|
|||||||
if (def_slcbuf) {
|
if (def_slcbuf) {
|
||||||
start_slc(1);
|
start_slc(1);
|
||||||
do_opt_slc(def_slcbuf, def_slclen);
|
do_opt_slc(def_slcbuf, def_slclen);
|
||||||
(void) end_slc(0);
|
end_slc(0);
|
||||||
free(def_slcbuf);
|
free(def_slcbuf);
|
||||||
def_slcbuf = (unsigned char *)0;
|
def_slcbuf = (unsigned char *)0;
|
||||||
def_slclen = 0;
|
def_slclen = 0;
|
||||||
|
@@ -436,7 +436,7 @@ send_do(int option, int init)
|
|||||||
set_his_want_state_will(option);
|
set_his_want_state_will(option);
|
||||||
do_dont_resp[option]++;
|
do_dont_resp[option]++;
|
||||||
}
|
}
|
||||||
(void) sprintf(nfrontp, (char *)doopt, option);
|
sprintf(nfrontp, (char *)doopt, option);
|
||||||
nfrontp += sizeof (dont) - 2;
|
nfrontp += sizeof (dont) - 2;
|
||||||
|
|
||||||
DIAG(TD_OPTIONS, printoption("td: send do", option));
|
DIAG(TD_OPTIONS, printoption("td: send do", option));
|
||||||
@@ -655,7 +655,7 @@ send_dont(int option, int init)
|
|||||||
set_his_want_state_wont(option);
|
set_his_want_state_wont(option);
|
||||||
do_dont_resp[option]++;
|
do_dont_resp[option]++;
|
||||||
}
|
}
|
||||||
(void) sprintf(nfrontp, (char *)dont, option);
|
sprintf(nfrontp, (char *)dont, option);
|
||||||
nfrontp += sizeof (doopt) - 2;
|
nfrontp += sizeof (doopt) - 2;
|
||||||
|
|
||||||
DIAG(TD_OPTIONS, printoption("td: send dont", option));
|
DIAG(TD_OPTIONS, printoption("td: send dont", option));
|
||||||
@@ -802,7 +802,7 @@ send_will(int option, int init)
|
|||||||
set_my_want_state_will(option);
|
set_my_want_state_will(option);
|
||||||
will_wont_resp[option]++;
|
will_wont_resp[option]++;
|
||||||
}
|
}
|
||||||
(void) sprintf(nfrontp, (char *)will, option);
|
sprintf(nfrontp, (char *)will, option);
|
||||||
nfrontp += sizeof (doopt) - 2;
|
nfrontp += sizeof (doopt) - 2;
|
||||||
|
|
||||||
DIAG(TD_OPTIONS, printoption("td: send will", option));
|
DIAG(TD_OPTIONS, printoption("td: send will", option));
|
||||||
@@ -914,7 +914,7 @@ dooption(int option)
|
|||||||
set_my_want_state_will(TELOPT_LOGOUT);
|
set_my_want_state_will(TELOPT_LOGOUT);
|
||||||
send_will(TELOPT_LOGOUT, 0);
|
send_will(TELOPT_LOGOUT, 0);
|
||||||
set_my_state_will(TELOPT_LOGOUT);
|
set_my_state_will(TELOPT_LOGOUT);
|
||||||
(void)netflush();
|
netflush();
|
||||||
cleanup(0);
|
cleanup(0);
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
break;
|
break;
|
||||||
@@ -959,7 +959,7 @@ send_wont(int option, int init)
|
|||||||
set_my_want_state_wont(option);
|
set_my_want_state_wont(option);
|
||||||
will_wont_resp[option]++;
|
will_wont_resp[option]++;
|
||||||
}
|
}
|
||||||
(void) sprintf(nfrontp, (char *)wont, option);
|
sprintf(nfrontp, (char *)wont, option);
|
||||||
nfrontp += sizeof (wont) - 2;
|
nfrontp += sizeof (wont) - 2;
|
||||||
|
|
||||||
DIAG(TD_OPTIONS, printoption("td: send wont", option));
|
DIAG(TD_OPTIONS, printoption("td: send wont", option));
|
||||||
@@ -1177,7 +1177,7 @@ suboption(void)
|
|||||||
*/
|
*/
|
||||||
start_slc(1);
|
start_slc(1);
|
||||||
do_opt_slc(subpointer, subend - subpointer);
|
do_opt_slc(subpointer, subend - subpointer);
|
||||||
(void) end_slc(0);
|
end_slc(0);
|
||||||
break;
|
break;
|
||||||
} else if (request == LM_MODE) {
|
} else if (request == LM_MODE) {
|
||||||
if (SB_EOF())
|
if (SB_EOF())
|
||||||
@@ -1229,7 +1229,7 @@ suboption(void)
|
|||||||
return;
|
return;
|
||||||
settimer(xdisplocsubopt);
|
settimer(xdisplocsubopt);
|
||||||
subpointer[SB_LEN()] = '\0';
|
subpointer[SB_LEN()] = '\0';
|
||||||
(void)setenv("DISPLAY", (char *)subpointer, 1);
|
setenv("DISPLAY", (char *)subpointer, 1);
|
||||||
break;
|
break;
|
||||||
} /* end of case TELOPT_XDISPLOC */
|
} /* end of case TELOPT_XDISPLOC */
|
||||||
|
|
||||||
@@ -1396,7 +1396,7 @@ suboption(void)
|
|||||||
case ENV_USERVAR:
|
case ENV_USERVAR:
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
if (valp)
|
if (valp)
|
||||||
(void)setenv(varp, valp, 1);
|
setenv(varp, valp, 1);
|
||||||
else
|
else
|
||||||
unsetenv(varp);
|
unsetenv(varp);
|
||||||
cp = varp = (char *)subpointer;
|
cp = varp = (char *)subpointer;
|
||||||
@@ -1415,7 +1415,7 @@ suboption(void)
|
|||||||
}
|
}
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
if (valp)
|
if (valp)
|
||||||
(void)setenv(varp, valp, 1);
|
setenv(varp, valp, 1);
|
||||||
else
|
else
|
||||||
unsetenv(varp);
|
unsetenv(varp);
|
||||||
break;
|
break;
|
||||||
|
@@ -87,7 +87,7 @@ char wtmpf[] = "/etc/wtmp";
|
|||||||
#include <sys/stropts.h>
|
#include <sys/stropts.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCPYN(a, b) (void) strncpy(a, b, sizeof(a))
|
#define SCPYN(a, b) strncpy(a, b, sizeof(a))
|
||||||
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
|
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STREAM_H
|
#ifdef HAVE_SYS_STREAM_H
|
||||||
@@ -173,10 +173,10 @@ init_termbuf(void)
|
|||||||
{
|
{
|
||||||
# ifdef STREAMSPTY
|
# ifdef STREAMSPTY
|
||||||
if (really_stream)
|
if (really_stream)
|
||||||
(void) tcgetattr(ttyfd, &termbuf);
|
tcgetattr(ttyfd, &termbuf);
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
(void) tcgetattr(ourpty, &termbuf);
|
tcgetattr(ourpty, &termbuf);
|
||||||
termbuf2 = termbuf;
|
termbuf2 = termbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,10 +202,10 @@ set_termbuf(void)
|
|||||||
if (memcmp((char *)&termbuf, (char *)&termbuf2, sizeof(termbuf)))
|
if (memcmp((char *)&termbuf, (char *)&termbuf2, sizeof(termbuf)))
|
||||||
# ifdef STREAMSPTY
|
# ifdef STREAMSPTY
|
||||||
if (really_stream)
|
if (really_stream)
|
||||||
(void) tcsetattr(ttyfd, TCSANOW, &termbuf);
|
tcsetattr(ttyfd, TCSANOW, &termbuf);
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
(void) tcsetattr(ourpty, TCSANOW, &termbuf);
|
tcsetattr(ourpty, TCSANOW, &termbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -451,11 +451,11 @@ int getpty(int *ptynum)
|
|||||||
#ifndef CRAY
|
#ifndef CRAY
|
||||||
|
|
||||||
#ifndef __hpux
|
#ifndef __hpux
|
||||||
(void) sprintf(line, "/dev/ptyXX");
|
sprintf(line, "/dev/ptyXX");
|
||||||
p1 = &line[8];
|
p1 = &line[8];
|
||||||
p2 = &line[9];
|
p2 = &line[9];
|
||||||
#else
|
#else
|
||||||
(void) sprintf(line, "/dev/ptym/ptyXX");
|
sprintf(line, "/dev/ptym/ptyXX");
|
||||||
p1 = &line[13];
|
p1 = &line[13];
|
||||||
p2 = &line[14];
|
p2 = &line[14];
|
||||||
#endif
|
#endif
|
||||||
@@ -503,23 +503,23 @@ int getpty(int *ptynum)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
|
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
|
||||||
(void) sprintf(myline, "/dev/pty/%03d", *ptynum);
|
sprintf(myline, "/dev/pty/%03d", *ptynum);
|
||||||
p = open(myline, 2);
|
p = open(myline, 2);
|
||||||
if (p < 0)
|
if (p < 0)
|
||||||
continue;
|
continue;
|
||||||
(void) sprintf(line, "/dev/ttyp%03d", *ptynum);
|
sprintf(line, "/dev/ttyp%03d", *ptynum);
|
||||||
/*
|
/*
|
||||||
* Here are some shenanigans to make sure that there
|
* Here are some shenanigans to make sure that there
|
||||||
* are no listeners lurking on the line.
|
* are no listeners lurking on the line.
|
||||||
*/
|
*/
|
||||||
if(stat(line, &sb) < 0) {
|
if(stat(line, &sb) < 0) {
|
||||||
(void) close(p);
|
close(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(sb.st_uid || sb.st_gid || sb.st_mode != 0600) {
|
if(sb.st_uid || sb.st_gid || sb.st_mode != 0600) {
|
||||||
chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
chmod(line, 0600);
|
chmod(line, 0600);
|
||||||
(void)close(p);
|
close(p);
|
||||||
p = open(myline, 2);
|
p = open(myline, 2);
|
||||||
if (p < 0)
|
if (p < 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -531,7 +531,7 @@ int getpty(int *ptynum)
|
|||||||
return(p);
|
return(p);
|
||||||
else {
|
else {
|
||||||
/* no tty side to pty so skip it */
|
/* no tty side to pty so skip it */
|
||||||
(void) close(p);
|
close(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CRAY */
|
#endif /* CRAY */
|
||||||
@@ -576,7 +576,7 @@ tty_setlinemode(on)
|
|||||||
{
|
{
|
||||||
#ifdef TIOCEXT
|
#ifdef TIOCEXT
|
||||||
set_termbuf();
|
set_termbuf();
|
||||||
(void) ioctl(ourpty, TIOCEXT, (char *)&on);
|
ioctl(ourpty, TIOCEXT, (char *)&on);
|
||||||
init_termbuf();
|
init_termbuf();
|
||||||
#else /* !TIOCEXT */
|
#else /* !TIOCEXT */
|
||||||
# ifdef EXTPROC
|
# ifdef EXTPROC
|
||||||
@@ -967,8 +967,8 @@ void getptyslave(void)
|
|||||||
# ifdef TIOCNOTTY
|
# ifdef TIOCNOTTY
|
||||||
t = open(_PATH_TTY, O_RDWR);
|
t = open(_PATH_TTY, O_RDWR);
|
||||||
if (t >= 0) {
|
if (t >= 0) {
|
||||||
(void) ioctl(t, TIOCNOTTY, (char *)0);
|
ioctl(t, TIOCNOTTY, (char *)0);
|
||||||
(void) close(t);
|
close(t);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1023,7 +1023,7 @@ void getptyslave(void)
|
|||||||
memset((char *)&ws, 0, sizeof(ws));
|
memset((char *)&ws, 0, sizeof(ws));
|
||||||
ws.ws_col = def_col;
|
ws.ws_col = def_col;
|
||||||
ws.ws_row = def_row;
|
ws.ws_row = def_row;
|
||||||
(void)ioctl(t, TIOCSWINSZ, (char *)&ws);
|
ioctl(t, TIOCSWINSZ, (char *)&ws);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -1069,7 +1069,7 @@ void getptyslave(void)
|
|||||||
if (login_tty(t) == -1)
|
if (login_tty(t) == -1)
|
||||||
fatalperror(net, "login_tty");
|
fatalperror(net, "login_tty");
|
||||||
if (net > 2)
|
if (net > 2)
|
||||||
(void) close(net);
|
close(net);
|
||||||
#if defined(AUTHENTICATION) && defined(NO_LOGIN_F) && defined(LOGIN_R)
|
#if defined(AUTHENTICATION) && defined(NO_LOGIN_F) && defined(LOGIN_R)
|
||||||
/*
|
/*
|
||||||
* Leave the pty open so that we can write out the rlogin
|
* Leave the pty open so that we can write out the rlogin
|
||||||
@@ -1077,7 +1077,7 @@ void getptyslave(void)
|
|||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
if (ourpty > 2) {
|
if (ourpty > 2) {
|
||||||
(void) close(ourpty);
|
close(ourpty);
|
||||||
ourpty = -1;
|
ourpty = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1103,12 +1103,12 @@ int cleanopen(char *line)
|
|||||||
* Make sure that other people can't open the
|
* Make sure that other people can't open the
|
||||||
* slave side of the connection.
|
* slave side of the connection.
|
||||||
*/
|
*/
|
||||||
(void) chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
(void) chmod(line, 0600);
|
chmod(line, 0600);
|
||||||
}
|
}
|
||||||
|
|
||||||
# if !defined(CRAY) && (BSD > 43)
|
# if !defined(CRAY) && (BSD > 43)
|
||||||
(void) revoke(line);
|
revoke(line);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
t = open(line, O_RDWR|O_NOCTTY);
|
t = open(line, O_RDWR|O_NOCTTY);
|
||||||
@@ -1121,12 +1121,12 @@ int cleanopen(char *line)
|
|||||||
* ourselves.
|
* ourselves.
|
||||||
*/
|
*/
|
||||||
# if !(defined(CRAY) || defined(__hpux)) && (BSD <= 43) && !defined(STREAMSPTY)
|
# if !(defined(CRAY) || defined(__hpux)) && (BSD <= 43) && !defined(STREAMSPTY)
|
||||||
(void) signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
#ifdef HAVE_VHANGUP
|
#ifdef HAVE_VHANGUP
|
||||||
vhangup();
|
vhangup();
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
(void) signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
t = open(line, O_RDWR|O_NOCTTY);
|
t = open(line, O_RDWR|O_NOCTTY);
|
||||||
if (t < 0)
|
if (t < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -1134,15 +1134,15 @@ int cleanopen(char *line)
|
|||||||
# if defined(CRAY) && defined(TCVHUP)
|
# if defined(CRAY) && defined(TCVHUP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
(void) signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
(void) ioctl(t, TCVHUP, (char *)0);
|
ioctl(t, TCVHUP, (char *)0);
|
||||||
(void) signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
|
|
||||||
i = open(line, O_RDWR);
|
i = open(line, O_RDWR);
|
||||||
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
(void) close(t);
|
close(t);
|
||||||
t = i;
|
t = i;
|
||||||
}
|
}
|
||||||
# endif /* defined(CRAY) && defined(TCVHUP) */
|
# endif /* defined(CRAY) && defined(TCVHUP) */
|
||||||
@@ -1189,19 +1189,19 @@ int login_tty(int t)
|
|||||||
* it out before opening the tty...
|
* it out before opening the tty...
|
||||||
*/
|
*/
|
||||||
#if defined HAVE_SETPGID
|
#if defined HAVE_SETPGID
|
||||||
(void) setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
#else
|
#else
|
||||||
(void) setpgrp(0, 0); /* if setpgid isn't available, setpgrp
|
setpgrp(0, 0); /* if setpgid isn't available, setpgrp
|
||||||
probably takes arguments */
|
probably takes arguments */
|
||||||
#endif
|
#endif
|
||||||
close(open(line, O_RDWR));
|
close(open(line, O_RDWR));
|
||||||
# endif
|
# endif
|
||||||
if (t != 0)
|
if (t != 0)
|
||||||
(void) dup2(t, 0);
|
dup2(t, 0);
|
||||||
if (t != 1)
|
if (t != 1)
|
||||||
(void) dup2(t, 1);
|
dup2(t, 1);
|
||||||
if (t != 2)
|
if (t != 2)
|
||||||
(void) dup2(t, 2);
|
dup2(t, 2);
|
||||||
if (t > 2)
|
if (t > 2)
|
||||||
close(t);
|
close(t);
|
||||||
return(0);
|
return(0);
|
||||||
@@ -1262,7 +1262,7 @@ startslave(char *host, int autologin, char *autoname)
|
|||||||
/*
|
/*
|
||||||
* Create utmp entry for child
|
* Create utmp entry for child
|
||||||
*/
|
*/
|
||||||
(void) time(&wtmp.ut_time);
|
time(&wtmp.ut_time);
|
||||||
wtmp.ut_type = LOGIN_PROCESS;
|
wtmp.ut_type = LOGIN_PROCESS;
|
||||||
wtmp.ut_pid = pid;
|
wtmp.ut_pid = pid;
|
||||||
SCPYN(wtmp.ut_user, "LOGIN");
|
SCPYN(wtmp.ut_user, "LOGIN");
|
||||||
@@ -1276,11 +1276,11 @@ startslave(char *host, int autologin, char *autoname)
|
|||||||
pututline(&wtmp);
|
pututline(&wtmp);
|
||||||
endutent();
|
endutent();
|
||||||
if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {
|
if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {
|
||||||
(void) write(i, (char *)&wtmp, sizeof(struct utmp));
|
write(i, (char *)&wtmp, sizeof(struct utmp));
|
||||||
(void) close(i);
|
close(i);
|
||||||
}
|
}
|
||||||
#ifdef CRAY
|
#ifdef CRAY
|
||||||
(void) signal(WJSIGNAL, sigjob);
|
signal(WJSIGNAL, sigjob);
|
||||||
#endif
|
#endif
|
||||||
utmp_sig_notify(pid);
|
utmp_sig_notify(pid);
|
||||||
# endif /* PARENT_DOES_UTMP */
|
# endif /* PARENT_DOES_UTMP */
|
||||||
@@ -1653,7 +1653,7 @@ static
|
|||||||
void
|
void
|
||||||
rmut(void)
|
rmut(void)
|
||||||
{
|
{
|
||||||
f;
|
int f;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
struct utmp *u, *utmp;
|
struct utmp *u, *utmp;
|
||||||
int nutmp;
|
int nutmp;
|
||||||
@@ -1661,7 +1661,7 @@ rmut(void)
|
|||||||
|
|
||||||
f = open(utmpf, O_RDWR);
|
f = open(utmpf, O_RDWR);
|
||||||
if (f >= 0) {
|
if (f >= 0) {
|
||||||
(void) fstat(f, &statbf);
|
fstat(f, &statbf);
|
||||||
utmp = (struct utmp *)malloc((unsigned)statbf.st_size);
|
utmp = (struct utmp *)malloc((unsigned)statbf.st_size);
|
||||||
if (!utmp)
|
if (!utmp)
|
||||||
syslog(LOG_ERR, "utmp malloc failed");
|
syslog(LOG_ERR, "utmp malloc failed");
|
||||||
@@ -1673,17 +1673,17 @@ rmut(void)
|
|||||||
if (SCMPN(u->ut_line, line+5) ||
|
if (SCMPN(u->ut_line, line+5) ||
|
||||||
u->ut_name[0]==0)
|
u->ut_name[0]==0)
|
||||||
continue;
|
continue;
|
||||||
(void) lseek(f, ((long)u)-((long)utmp), L_SET);
|
lseek(f, ((long)u)-((long)utmp), L_SET);
|
||||||
SCPYN(u->ut_name, "");
|
SCPYN(u->ut_name, "");
|
||||||
#ifdef HAVE_UT_HOST
|
#ifdef HAVE_UT_HOST
|
||||||
SCPYN(u->ut_host, "");
|
SCPYN(u->ut_host, "");
|
||||||
#endif
|
#endif
|
||||||
(void) time(&u->ut_time);
|
time(&u->ut_time);
|
||||||
(void) write(f, (char *)u, sizeof(wtmp));
|
write(f, (char *)u, sizeof(wtmp));
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) close(f);
|
close(f);
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
f = open(wtmpf, O_WRONLY|O_APPEND);
|
f = open(wtmpf, O_WRONLY|O_APPEND);
|
||||||
@@ -1693,16 +1693,16 @@ rmut(void)
|
|||||||
#ifdef HAVE_UT_HOST
|
#ifdef HAVE_UT_HOST
|
||||||
SCPYN(wtmp.ut_host, "");
|
SCPYN(wtmp.ut_host, "");
|
||||||
#endif
|
#endif
|
||||||
(void) time(&wtmp.ut_time);
|
time(&wtmp.ut_time);
|
||||||
(void) write(f, (char *)&wtmp, sizeof(wtmp));
|
write(f, (char *)&wtmp, sizeof(wtmp));
|
||||||
(void) close(f);
|
close(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) chmod(line, 0666);
|
chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
line[strlen("/dev/")] = 'p';
|
line[strlen("/dev/")] = 'p';
|
||||||
(void) chmod(line, 0666);
|
chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
} /* end of rmut */
|
} /* end of rmut */
|
||||||
#endif /* CRAY */
|
#endif /* CRAY */
|
||||||
|
|
||||||
@@ -1716,24 +1716,24 @@ rmut (char *line)
|
|||||||
int fd; /* for /etc/wtmp */
|
int fd; /* for /etc/wtmp */
|
||||||
|
|
||||||
utmp.ut_type = USER_PROCESS;
|
utmp.ut_type = USER_PROCESS;
|
||||||
(void) strncpy(utmp.ut_id, line+12, sizeof(utmp.ut_id));
|
strncpy(utmp.ut_id, line+12, sizeof(utmp.ut_id));
|
||||||
(void) setutent();
|
setutent();
|
||||||
utptr = getutid(&utmp);
|
utptr = getutid(&utmp);
|
||||||
/* write it out only if it exists */
|
/* write it out only if it exists */
|
||||||
if (utptr) {
|
if (utptr) {
|
||||||
utptr->ut_type = DEAD_PROCESS;
|
utptr->ut_type = DEAD_PROCESS;
|
||||||
utptr->ut_time = time((long *) 0);
|
utptr->ut_time = time((long *) 0);
|
||||||
(void) pututline(utptr);
|
pututline(utptr);
|
||||||
/* set wtmp entry if wtmp file exists */
|
/* set wtmp entry if wtmp file exists */
|
||||||
if ((fd = open(wtmpf, O_WRONLY | O_APPEND)) >= 0) {
|
if ((fd = open(wtmpf, O_WRONLY | O_APPEND)) >= 0) {
|
||||||
(void) write(fd, utptr, sizeof(utmp));
|
write(fd, utptr, sizeof(utmp));
|
||||||
(void) close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) endutent();
|
endutent();
|
||||||
|
|
||||||
(void) chmod(line, 0666);
|
chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
line[14] = line[13];
|
line[14] = line[13];
|
||||||
line[13] = line[12];
|
line[13] = line[12];
|
||||||
line[8] = 'm';
|
line[8] = 'm';
|
||||||
@@ -1741,8 +1741,8 @@ rmut (char *line)
|
|||||||
line[10] = 'p';
|
line[10] = 'p';
|
||||||
line[11] = 't';
|
line[11] = 't';
|
||||||
line[12] = 'y';
|
line[12] = 'y';
|
||||||
(void) chmod(line, 0666);
|
chmod(line, 0666);
|
||||||
(void) chown(line, 0, 0);
|
chown(line, 0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1797,7 +1797,7 @@ cleanup(int sig)
|
|||||||
# endif /* CRAY */
|
# endif /* CRAY */
|
||||||
rmut(line);
|
rmut(line);
|
||||||
close(ourpty);
|
close(ourpty);
|
||||||
(void) shutdown(net, 2);
|
shutdown(net, 2);
|
||||||
# ifdef CRAY
|
# ifdef CRAY
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
cleantmp(&wtmp);
|
cleantmp(&wtmp);
|
||||||
@@ -1852,7 +1852,7 @@ _utmp_sig_rcv(sig)
|
|||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
caught = 1;
|
caught = 1;
|
||||||
(void) signal(SIGUSR1, func);
|
signal(SIGUSR1, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1868,7 +1868,7 @@ utmp_sig_init()
|
|||||||
void
|
void
|
||||||
utmp_sig_reset()
|
utmp_sig_reset()
|
||||||
{
|
{
|
||||||
(void) signal(SIGUSR1, func); /* reset handler to default */
|
signal(SIGUSR1, func); /* reset handler to default */
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef __hpux
|
# ifdef __hpux
|
||||||
|
@@ -643,12 +643,12 @@ getterminaltype(name)
|
|||||||
* we have to just go with what we (might) have already gotten.
|
* we have to just go with what we (might) have already gotten.
|
||||||
*/
|
*/
|
||||||
if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) {
|
if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) {
|
||||||
(void) strncpy(first, terminaltype, sizeof(first));
|
strncpy(first, terminaltype, sizeof(first));
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/*
|
/*
|
||||||
* Save the unknown name, and request the next name.
|
* Save the unknown name, and request the next name.
|
||||||
*/
|
*/
|
||||||
(void) strncpy(last, terminaltype, sizeof(last));
|
strncpy(last, terminaltype, sizeof(last));
|
||||||
_gettermname();
|
_gettermname();
|
||||||
if (terminaltypeok(terminaltype))
|
if (terminaltypeok(terminaltype))
|
||||||
break;
|
break;
|
||||||
@@ -667,7 +667,7 @@ getterminaltype(name)
|
|||||||
*/
|
*/
|
||||||
_gettermname();
|
_gettermname();
|
||||||
if (strncmp(first, terminaltype, sizeof(first)) != 0)
|
if (strncmp(first, terminaltype, sizeof(first)) != 0)
|
||||||
(void) strcpy(terminaltype, first);
|
strcpy(terminaltype, first);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -779,7 +779,7 @@ void doit(struct sockaddr_in *who)
|
|||||||
remote_host_name[sizeof(remote_host_name)-1] = 0;
|
remote_host_name[sizeof(remote_host_name)-1] = 0;
|
||||||
host = remote_host_name;
|
host = remote_host_name;
|
||||||
|
|
||||||
(void) k_gethostname(host_name, sizeof (host_name));
|
k_gethostname(host_name, sizeof (host_name));
|
||||||
hostname = host_name;
|
hostname = host_name;
|
||||||
|
|
||||||
#ifndef abs
|
#ifndef abs
|
||||||
@@ -976,34 +976,34 @@ telnet(f, p)
|
|||||||
*/
|
*/
|
||||||
telrcv();
|
telrcv();
|
||||||
|
|
||||||
(void) ioctl(f, FIONBIO, (char *)&on);
|
ioctl(f, FIONBIO, (char *)&on);
|
||||||
(void) ioctl(p, FIONBIO, (char *)&on);
|
ioctl(p, FIONBIO, (char *)&on);
|
||||||
|
|
||||||
#if defined(SO_OOBINLINE)
|
#if defined(SO_OOBINLINE)
|
||||||
(void) setsockopt(net, SOL_SOCKET, SO_OOBINLINE,
|
setsockopt(net, SOL_SOCKET, SO_OOBINLINE,
|
||||||
(void *)&on, sizeof on);
|
(void *)&on, sizeof on);
|
||||||
#endif /* defined(SO_OOBINLINE) */
|
#endif /* defined(SO_OOBINLINE) */
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
(void) signal(SIGTSTP, SIG_IGN);
|
signal(SIGTSTP, SIG_IGN);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGTTOU
|
#ifdef SIGTTOU
|
||||||
/*
|
/*
|
||||||
* Ignoring SIGTTOU keeps the kernel from blocking us
|
* Ignoring SIGTTOU keeps the kernel from blocking us
|
||||||
* in ttioct() in /sys/tty.c.
|
* in ttioct() in /sys/tty.c.
|
||||||
*/
|
*/
|
||||||
(void) signal(SIGTTOU, SIG_IGN);
|
signal(SIGTTOU, SIG_IGN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void) signal(SIGCHLD, cleanup);
|
signal(SIGCHLD, cleanup);
|
||||||
|
|
||||||
#ifdef TIOCNOTTY
|
#ifdef TIOCNOTTY
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
t = open(_PATH_TTY, O_RDWR);
|
t = open(_PATH_TTY, O_RDWR);
|
||||||
if (t >= 0) {
|
if (t >= 0) {
|
||||||
(void) ioctl(t, TIOCNOTTY, (char *)0);
|
ioctl(t, TIOCNOTTY, (char *)0);
|
||||||
(void) close(t);
|
close(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1027,7 +1027,7 @@ telnet(f, p)
|
|||||||
HN = getstr("hn", &cp);
|
HN = getstr("hn", &cp);
|
||||||
IM = getstr("im", &cp);
|
IM = getstr("im", &cp);
|
||||||
if (HN && *HN)
|
if (HN && *HN)
|
||||||
(void) strcpy(host_name, HN);
|
strcpy(host_name, HN);
|
||||||
if (IM == 0)
|
if (IM == 0)
|
||||||
IM = "";
|
IM = "";
|
||||||
} else {
|
} else {
|
||||||
@@ -1039,7 +1039,7 @@ telnet(f, p)
|
|||||||
putf(IM, ptyibuf2);
|
putf(IM, ptyibuf2);
|
||||||
|
|
||||||
if (pcc)
|
if (pcc)
|
||||||
(void) strncat(ptyibuf2, ptyip, pcc+1);
|
strncat(ptyibuf2, ptyip, pcc+1);
|
||||||
ptyip = ptyibuf2;
|
ptyip = ptyibuf2;
|
||||||
pcc = strlen(ptyip);
|
pcc = strlen(ptyip);
|
||||||
#ifdef LINEMODE
|
#ifdef LINEMODE
|
||||||
@@ -1143,7 +1143,7 @@ telnet(f, p)
|
|||||||
if (SYNCHing) {
|
if (SYNCHing) {
|
||||||
int atmark;
|
int atmark;
|
||||||
|
|
||||||
(void) ioctl(net, SIOCATMARK, (char *)&atmark);
|
ioctl(net, SIOCATMARK, (char *)&atmark);
|
||||||
if (atmark) {
|
if (atmark) {
|
||||||
ncc = recv(net, netibuf, sizeof (netibuf), MSG_OOB);
|
ncc = recv(net, netibuf, sizeof (netibuf), MSG_OOB);
|
||||||
if ((ncc == -1) && (errno == EINVAL)) {
|
if ((ncc == -1) && (errno == EINVAL)) {
|
||||||
@@ -1235,7 +1235,7 @@ telnet(f, p)
|
|||||||
ptyibuf[0] & TIOCPKT_DOSTOP ? 1 : 0;
|
ptyibuf[0] & TIOCPKT_DOSTOP ? 1 : 0;
|
||||||
if (newflow != flowmode) {
|
if (newflow != flowmode) {
|
||||||
flowmode = newflow;
|
flowmode = newflow;
|
||||||
(void) sprintf(nfrontp,
|
sprintf(nfrontp,
|
||||||
"%c%c%c%c%c%c",
|
"%c%c%c%c%c%c",
|
||||||
IAC, SB, TELOPT_LFLOW,
|
IAC, SB, TELOPT_LFLOW,
|
||||||
flowmode ? LFLOW_ON
|
flowmode ? LFLOW_ON
|
||||||
@@ -1392,12 +1392,12 @@ interrupt()
|
|||||||
if (really_stream)
|
if (really_stream)
|
||||||
{
|
{
|
||||||
int sig = SIGINT;
|
int sig = SIGINT;
|
||||||
(void) ioctl(ourpty, TIOCSIGNAL, &sig);
|
ioctl(ourpty, TIOCSIGNAL, &sig);
|
||||||
(void) ioctl(ourpty, I_FLUSH, FLUSHR);
|
ioctl(ourpty, I_FLUSH, FLUSHR);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef TCSIG
|
#ifdef TCSIG
|
||||||
(void) ioctl(ourpty, TCSIG, (char *)SIGINT);
|
ioctl(ourpty, TCSIG, (char *)SIGINT);
|
||||||
#else /* TCSIG */
|
#else /* TCSIG */
|
||||||
init_termbuf();
|
init_termbuf();
|
||||||
*pfrontp++ = slctab[SLC_IP].sptr ?
|
*pfrontp++ = slctab[SLC_IP].sptr ?
|
||||||
@@ -1416,7 +1416,7 @@ sendbrk()
|
|||||||
{
|
{
|
||||||
ptyflush(); /* half-hearted */
|
ptyflush(); /* half-hearted */
|
||||||
#ifdef TCSIG
|
#ifdef TCSIG
|
||||||
(void) ioctl(ourpty, TCSIG, (char *)SIGQUIT);
|
ioctl(ourpty, TCSIG, (char *)SIGQUIT);
|
||||||
#else /* TCSIG */
|
#else /* TCSIG */
|
||||||
init_termbuf();
|
init_termbuf();
|
||||||
*pfrontp++ = slctab[SLC_ABORT].sptr ?
|
*pfrontp++ = slctab[SLC_ABORT].sptr ?
|
||||||
@@ -1430,7 +1430,7 @@ sendsusp()
|
|||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
ptyflush(); /* half-hearted */
|
ptyflush(); /* half-hearted */
|
||||||
# ifdef TCSIG
|
# ifdef TCSIG
|
||||||
(void) ioctl(ourpty, TCSIG, (char *)SIGTSTP);
|
ioctl(ourpty, TCSIG, (char *)SIGTSTP);
|
||||||
# else /* TCSIG */
|
# else /* TCSIG */
|
||||||
*pfrontp++ = slctab[SLC_SUSP].sptr ?
|
*pfrontp++ = slctab[SLC_SUSP].sptr ?
|
||||||
(unsigned char)*slctab[SLC_SUSP].sptr : '\032';
|
(unsigned char)*slctab[SLC_SUSP].sptr : '\032';
|
||||||
@@ -1447,11 +1447,11 @@ recv_ayt()
|
|||||||
{
|
{
|
||||||
#if defined(SIGINFO) && defined(TCSIG)
|
#if defined(SIGINFO) && defined(TCSIG)
|
||||||
if (slctab[SLC_AYT].sptr && *slctab[SLC_AYT].sptr != _POSIX_VDISABLE) {
|
if (slctab[SLC_AYT].sptr && *slctab[SLC_AYT].sptr != _POSIX_VDISABLE) {
|
||||||
(void) ioctl(ourpty, TCSIG, (char *)SIGINFO);
|
ioctl(ourpty, TCSIG, (char *)SIGINFO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
(void) strcpy(nfrontp, "\r\n[Yes]\r\n");
|
strcpy(nfrontp, "\r\n[Yes]\r\n");
|
||||||
nfrontp += 9;
|
nfrontp += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -276,7 +276,7 @@ localstat()
|
|||||||
# endif /* KLUDGELINEMODE */
|
# endif /* KLUDGELINEMODE */
|
||||||
send_do(TELOPT_LINEMODE, 1);
|
send_do(TELOPT_LINEMODE, 1);
|
||||||
/* send along edit modes */
|
/* send along edit modes */
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
|
sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
|
||||||
TELOPT_LINEMODE, LM_MODE, useeditmode,
|
TELOPT_LINEMODE, LM_MODE, useeditmode,
|
||||||
IAC, SE);
|
IAC, SE);
|
||||||
nfrontp += 7;
|
nfrontp += 7;
|
||||||
@@ -305,7 +305,7 @@ localstat()
|
|||||||
/*
|
/*
|
||||||
* Send along appropriate edit mode mask.
|
* Send along appropriate edit mode mask.
|
||||||
*/
|
*/
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
|
sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
|
||||||
TELOPT_LINEMODE, LM_MODE, useeditmode,
|
TELOPT_LINEMODE, LM_MODE, useeditmode,
|
||||||
IAC, SE);
|
IAC, SE);
|
||||||
nfrontp += 7;
|
nfrontp += 7;
|
||||||
@@ -318,7 +318,7 @@ localstat()
|
|||||||
*/
|
*/
|
||||||
start_slc(0);
|
start_slc(0);
|
||||||
check_slc();
|
check_slc();
|
||||||
(void) end_slc(0);
|
end_slc(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@@ -352,7 +352,7 @@ flowstat()
|
|||||||
if (his_state_is_will(TELOPT_LFLOW)) {
|
if (his_state_is_will(TELOPT_LFLOW)) {
|
||||||
if (tty_flowmode() != flowmode) {
|
if (tty_flowmode() != flowmode) {
|
||||||
flowmode = tty_flowmode();
|
flowmode = tty_flowmode();
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c",
|
sprintf(nfrontp, "%c%c%c%c%c%c",
|
||||||
IAC, SB, TELOPT_LFLOW,
|
IAC, SB, TELOPT_LFLOW,
|
||||||
flowmode ? LFLOW_ON : LFLOW_OFF,
|
flowmode ? LFLOW_ON : LFLOW_OFF,
|
||||||
IAC, SE);
|
IAC, SE);
|
||||||
@@ -360,7 +360,7 @@ flowstat()
|
|||||||
}
|
}
|
||||||
if (tty_restartany() != restartany) {
|
if (tty_restartany() != restartany) {
|
||||||
restartany = tty_restartany();
|
restartany = tty_restartany();
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c",
|
sprintf(nfrontp, "%c%c%c%c%c%c",
|
||||||
IAC, SB, TELOPT_LFLOW,
|
IAC, SB, TELOPT_LFLOW,
|
||||||
restartany ? LFLOW_RESTART_ANY
|
restartany ? LFLOW_RESTART_ANY
|
||||||
: LFLOW_RESTART_XON,
|
: LFLOW_RESTART_XON,
|
||||||
@@ -438,7 +438,7 @@ clientstat(code, parm1, parm2)
|
|||||||
useeditmode |= MODE_SOFT_TAB;
|
useeditmode |= MODE_SOFT_TAB;
|
||||||
if (tty_islitecho())
|
if (tty_islitecho())
|
||||||
useeditmode |= MODE_LIT_ECHO;
|
useeditmode |= MODE_LIT_ECHO;
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
|
sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
|
||||||
SB, TELOPT_LINEMODE, LM_MODE,
|
SB, TELOPT_LINEMODE, LM_MODE,
|
||||||
useeditmode, IAC, SE);
|
useeditmode, IAC, SE);
|
||||||
nfrontp += 7;
|
nfrontp += 7;
|
||||||
@@ -497,7 +497,7 @@ clientstat(code, parm1, parm2)
|
|||||||
set_termbuf();
|
set_termbuf();
|
||||||
|
|
||||||
if (!ack) {
|
if (!ack) {
|
||||||
(void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
|
sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
|
||||||
SB, TELOPT_LINEMODE, LM_MODE,
|
SB, TELOPT_LINEMODE, LM_MODE,
|
||||||
useeditmode|MODE_ACK,
|
useeditmode|MODE_ACK,
|
||||||
IAC, SE);
|
IAC, SE);
|
||||||
@@ -534,7 +534,7 @@ clientstat(code, parm1, parm2)
|
|||||||
|
|
||||||
ws.ws_col = parm1;
|
ws.ws_col = parm1;
|
||||||
ws.ws_row = parm2;
|
ws.ws_row = parm2;
|
||||||
(void) ioctl(ourpty, TIOCSWINSZ, (char *)&ws);
|
ioctl(ourpty, TIOCSWINSZ, (char *)&ws);
|
||||||
}
|
}
|
||||||
#endif /* TIOCSWINSZ */
|
#endif /* TIOCSWINSZ */
|
||||||
|
|
||||||
@@ -602,7 +602,7 @@ defer_terminit()
|
|||||||
memset((char *)&ws, 0, sizeof(ws));
|
memset((char *)&ws, 0, sizeof(ws));
|
||||||
ws.ws_col = def_col;
|
ws.ws_col = def_col;
|
||||||
ws.ws_row = def_row;
|
ws.ws_row = def_row;
|
||||||
(void) ioctl(ourpty, TIOCSWINSZ, (char *)&ws);
|
ioctl(ourpty, TIOCSWINSZ, (char *)&ws);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -346,7 +346,7 @@ void fatal(int f, char *msg)
|
|||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
(void) sprintf(buf, "telnetd: %s.\r\n", msg);
|
sprintf(buf, "telnetd: %s.\r\n", msg);
|
||||||
#if defined(ENCRYPTION)
|
#if defined(ENCRYPTION)
|
||||||
if (encrypt_output) {
|
if (encrypt_output) {
|
||||||
/*
|
/*
|
||||||
@@ -357,7 +357,7 @@ void fatal(int f, char *msg)
|
|||||||
netflush();
|
netflush();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
(void) write(f, buf, (int)strlen(buf));
|
write(f, buf, (int)strlen(buf));
|
||||||
sleep(1); /*XXX*/
|
sleep(1); /*XXX*/
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ fatalperror(int f, char *msg)
|
|||||||
{
|
{
|
||||||
char buf[BUFSIZ], *strerror(int);
|
char buf[BUFSIZ], *strerror(int);
|
||||||
|
|
||||||
(void) sprintf(buf, "%s: %s", msg, strerror(errno));
|
sprintf(buf, "%s: %s", msg, strerror(errno));
|
||||||
fatal(f, buf);
|
fatal(f, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ void edithost(char *pat, char *host)
|
|||||||
pat++;
|
pat++;
|
||||||
}
|
}
|
||||||
if (*host)
|
if (*host)
|
||||||
(void) strncpy(res, host,
|
strncpy(res, host,
|
||||||
sizeof editedhost - (res - editedhost) -1);
|
sizeof editedhost - (res - editedhost) -1);
|
||||||
else
|
else
|
||||||
*res = '\0';
|
*res = '\0';
|
||||||
@@ -499,8 +499,8 @@ void putf(char *cp, char *where)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
(void)time(&t);
|
time(&t);
|
||||||
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
|
strftime(db, sizeof(db), fmtstr, localtime(&t));
|
||||||
putstr(db);
|
putstr(db);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -505,10 +505,10 @@ countdown(XtPointer _t, XtIntervalId *_d)
|
|||||||
}
|
}
|
||||||
seconds = time(0) - locked_at;
|
seconds = time(0) - locked_at;
|
||||||
if (seconds >= 3600)
|
if (seconds >= 3600)
|
||||||
(void) sprintf(buf, "Locked for %d:%02d:%02d ",
|
sprintf(buf, "Locked for %d:%02d:%02d ",
|
||||||
(int)seconds/3600, (int)seconds/60%60, (int)seconds%60);
|
(int)seconds/3600, (int)seconds/60%60, (int)seconds%60);
|
||||||
else
|
else
|
||||||
(void) sprintf(buf, "Locked for %2d:%02d ",
|
sprintf(buf, "Locked for %2d:%02d ",
|
||||||
(int)seconds/60, (int)seconds%60);
|
(int)seconds/60, (int)seconds%60);
|
||||||
|
|
||||||
XDrawImageString(dpy, XtWindow(widget), gc,
|
XDrawImageString(dpy, XtWindow(widget), gc,
|
||||||
|
@@ -92,7 +92,7 @@ getopt(nargc, nargv, ostr)
|
|||||||
p = *nargv;
|
p = *nargv;
|
||||||
else
|
else
|
||||||
++p;
|
++p;
|
||||||
(void)fprintf(stderr, "%s: illegal option -- %c\n",
|
fprintf(stderr, "%s: illegal option -- %c\n",
|
||||||
p, optopt);
|
p, optopt);
|
||||||
}
|
}
|
||||||
return(BADCH);
|
return(BADCH);
|
||||||
@@ -114,7 +114,7 @@ getopt(nargc, nargv, ostr)
|
|||||||
if (*ostr == ':')
|
if (*ostr == ':')
|
||||||
return(BADARG);
|
return(BADARG);
|
||||||
if (opterr)
|
if (opterr)
|
||||||
(void)fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: option requires an argument -- %c\n",
|
"%s: option requires an argument -- %c\n",
|
||||||
p, optopt);
|
p, optopt);
|
||||||
return(BADCH);
|
return(BADCH);
|
||||||
|
@@ -124,16 +124,16 @@ initshells()
|
|||||||
if ((fp = fopen(_PATH_SHELLS, "r")) == NULL)
|
if ((fp = fopen(_PATH_SHELLS, "r")) == NULL)
|
||||||
return (okshells);
|
return (okshells);
|
||||||
if (fstat(fileno(fp), &statb) == -1) {
|
if (fstat(fileno(fp), &statb) == -1) {
|
||||||
(void)fclose(fp);
|
fclose(fp);
|
||||||
return (okshells);
|
return (okshells);
|
||||||
}
|
}
|
||||||
if ((strings = malloc((u_int)statb.st_size)) == NULL) {
|
if ((strings = malloc((u_int)statb.st_size)) == NULL) {
|
||||||
(void)fclose(fp);
|
fclose(fp);
|
||||||
return (okshells);
|
return (okshells);
|
||||||
}
|
}
|
||||||
shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
|
shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
|
||||||
if (shells == NULL) {
|
if (shells == NULL) {
|
||||||
(void)fclose(fp);
|
fclose(fp);
|
||||||
free(strings);
|
free(strings);
|
||||||
strings = NULL;
|
strings = NULL;
|
||||||
return (okshells);
|
return (okshells);
|
||||||
@@ -151,7 +151,7 @@ initshells()
|
|||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
}
|
}
|
||||||
*sp = NULL;
|
*sp = NULL;
|
||||||
(void)fclose(fp);
|
fclose(fp);
|
||||||
return (shells);
|
return (shells);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_GETUSERSHELL */
|
#endif /* HAVE_GETUSERSHELL */
|
||||||
|
@@ -817,15 +817,15 @@ qprintf(const Char *str, Char *s)
|
|||||||
{
|
{
|
||||||
Char *p;
|
Char *p;
|
||||||
|
|
||||||
(void)printf("%s:\n", str);
|
printf("%s:\n", str);
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", CHAR(*p));
|
printf("%c", CHAR(*p));
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", *p & M_PROTECT ? '"' : ' ');
|
printf("%c", *p & M_PROTECT ? '"' : ' ');
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
for (p = s; *p; p++)
|
for (p = s; *p; p++)
|
||||||
(void)printf("%c", ismeta(*p) ? '_' : ' ');
|
printf("%c", ismeta(*p) ? '_' : ' ');
|
||||||
(void)printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -223,17 +223,17 @@ iruserok(u_int32_t raddr, int superuser, const char *ruser, const char *luser)
|
|||||||
again:
|
again:
|
||||||
if (hostf) {
|
if (hostf) {
|
||||||
if (__ivaliduser(hostf, raddr, luser, ruser) == 0) {
|
if (__ivaliduser(hostf, raddr, luser, ruser) == 0) {
|
||||||
(void)fclose(hostf);
|
fclose(hostf);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
(void)fclose(hostf);
|
fclose(hostf);
|
||||||
}
|
}
|
||||||
if (first == 1 && (__check_rhosts_file || superuser)) {
|
if (first == 1 && (__check_rhosts_file || superuser)) {
|
||||||
first = 0;
|
first = 0;
|
||||||
if ((pwd = k_getpwnam((char*)luser)) == NULL)
|
if ((pwd = k_getpwnam((char*)luser)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
(void)strcpy(pbuf, pwd->pw_dir);
|
strcpy(pbuf, pwd->pw_dir);
|
||||||
(void)strcat(pbuf, "/.rhosts");
|
strcat(pbuf, "/.rhosts");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change effective uid while opening .rhosts. If root and
|
* Change effective uid while opening .rhosts. If root and
|
||||||
@@ -241,9 +241,9 @@ again:
|
|||||||
* are protected read/write owner only.
|
* are protected read/write owner only.
|
||||||
*/
|
*/
|
||||||
uid = geteuid();
|
uid = geteuid();
|
||||||
(void)seteuid(pwd->pw_uid);
|
seteuid(pwd->pw_uid);
|
||||||
hostf = fopen(pbuf, "r");
|
hostf = fopen(pbuf, "r");
|
||||||
(void)seteuid(uid);
|
seteuid(uid);
|
||||||
|
|
||||||
if (hostf == NULL)
|
if (hostf == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
@@ -265,7 +265,7 @@ again:
|
|||||||
/* If there were any problems, quit. */
|
/* If there were any problems, quit. */
|
||||||
if (cp) {
|
if (cp) {
|
||||||
__rcmd_errstr = cp;
|
__rcmd_errstr = cp;
|
||||||
(void)fclose(hostf);
|
fclose(hostf);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
goto again;
|
goto again;
|
||||||
|
Reference in New Issue
Block a user