summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-10-26 04:59:21 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-10-26 04:59:21 +0000
commitf64a55f52ec6d4720253a0a92864c415fcad8138 (patch)
tree8686149589bdc7faa20a46bb1f3c1c96996a04fd
parent249c32754d62349faf9504e4bf47d06574c3bf9a (diff)
set $LOGNAME and pass -Wall
-rw-r--r--libexec/uucpd/uucpd.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index 787d48c2dae..237eeb14c18 100644
--- a/libexec/uucpd/uucpd.c
+++ b/libexec/uucpd/uucpd.c
@@ -42,7 +42,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: uucpd.c,v 1.4 1996/09/02 13:12:23 deraadt Exp $";
+static char rcsid[] = "$Id: uucpd.c,v 1.5 1996/10/26 04:59:20 millert Exp $";
#endif /* not lint */
/*
@@ -68,18 +68,25 @@ static char rcsid[] = "$Id: uucpd.c,v 1.4 1996/09/02 13:12:23 deraadt Exp $";
#include <string.h>
#include "pathnames.h"
+void doit __P((struct sockaddr_in *));
+int readline __P((register char *, register int n));
+void dologout __P((void));
+void dologin __P((struct passwd *, struct sockaddr_in *));
+
struct sockaddr_in hisctladdr;
int hisaddrlen = sizeof hisctladdr;
struct sockaddr_in myctladdr;
int mypid;
-char Username[64];
+char Username[64], Loginname[64];
char *nenv[] = {
Username,
+ Loginname,
NULL,
};
extern char **environ;
+int
main(argc, argv)
int argc;
char **argv;
@@ -89,7 +96,6 @@ char **argv;
struct servent *sp;
#endif /* !BSDINETD */
extern int errno;
- int dologout();
environ = nenv;
#ifdef BSDINETD
@@ -154,6 +160,7 @@ char **argv;
#endif /* !BSDINETD */
}
+void
doit(sinp)
struct sockaddr_in *sinp;
{
@@ -191,7 +198,8 @@ struct sockaddr_in *sinp;
}
}
alarm(0);
- sprintf(Username, "USER=%s", user);
+ (void) snprintf(Username, sizeof(Username), "USER=%s", user);
+ (void) snprintf(Loginname, sizeof(Loginname), "LOGNAME=%s", user);
dologin(pw, sinp);
setlogin(user);
setgid(pw->pw_gid);
@@ -202,6 +210,7 @@ struct sockaddr_in *sinp;
perror("uucico server: execl");
}
+int
readline(p, n)
register char *p;
register int n;
@@ -228,6 +237,7 @@ register int n;
struct utmp utmp;
+void
dologout()
{
union wait status;
@@ -240,7 +250,7 @@ dologout()
#endif /* !BSDINETD */
wtmp = open(_PATH_WTMP, O_WRONLY|O_APPEND);
if (wtmp >= 0) {
- sprintf(utmp.ut_line, "uucp%.4d", pid);
+ (void) sprintf(utmp.ut_line, "uucp%.4d", pid);
SCPYN(utmp.ut_name, "");
SCPYN(utmp.ut_host, "");
(void) time(&utmp.ut_time);
@@ -253,6 +263,7 @@ dologout()
/*
* Record login in wtmp file.
*/
+void
dologin(pw, sin)
struct passwd *pw;
struct sockaddr_in *sin;
@@ -273,7 +284,7 @@ struct sockaddr_in *sin;
wtmp = open(_PATH_WTMP, O_WRONLY|O_APPEND);
if (wtmp >= 0) {
/* hack, but must be unique and no tty line */
- sprintf(line, "uucp%.4d", getpid());
+ (void) sprintf(line, "uucp%.4d", getpid());
SCPYN(utmp.ut_line, line);
SCPYN(utmp.ut_name, pw->pw_name);
SCPYN(utmp.ut_host, remotehost);