diff options
author | des <des@FreeBSD.org> | 2005-02-23 17:13:28 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2005-02-23 17:13:28 +0000 |
commit | 6b77db7044ad3c8ae7480d9c1fd51d91a18ae29d (patch) | |
tree | 2a254f4101573926ab81e15e0550fbb63628a896 /libexec | |
parent | 5b54fb1016aebc4f114acc933b9e1d0010243286 (diff) | |
download | FreeBSD-src-6b77db7044ad3c8ae7480d9c1fd51d91a18ae29d.zip FreeBSD-src-6b77db7044ad3c8ae7480d9c1fd51d91a18ae29d.tar.gz |
Make WARNS=6-clean.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rexecd/Makefile | 2 | ||||
-rw-r--r-- | libexec/rexecd/rexecd.c | 23 |
2 files changed, 13 insertions, 12 deletions
diff --git a/libexec/rexecd/Makefile b/libexec/rexecd/Makefile index cef9729..05b003e 100644 --- a/libexec/rexecd/Makefile +++ b/libexec/rexecd/Makefile @@ -3,7 +3,7 @@ PROG= rexecd MAN= rexecd.8 -#WARNS?= 4 +WARNS?= 6 WFORMAT=0 DPADD= ${LIBPAM} ${LIBUTIL} diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c index 0a6e4dd..596c86e 100644 --- a/libexec/rexecd/rexecd.c +++ b/libexec/rexecd/rexecd.c @@ -79,10 +79,12 @@ static int pam_err; char **environ; char remote[MAXHOSTNAMELEN]; -struct sockaddr_storage asin; +struct sockaddr_storage sa; + +char default_shell[] = _PATH_BSHELL; static void doit(struct sockaddr *); -static void getstr(char *, int, char *); +static void getstr(char *, int, const char *); static void error(const char *fmt, ...); int no_uid_0 = 1; @@ -131,7 +133,6 @@ static void doit(struct sockaddr *fromp) { char cmdbuf[NCARGS+1], *cp; - const char *namep; char user[16], pass[16]; struct passwd *pwd; int fd, r, sd; @@ -140,7 +141,6 @@ doit(struct sockaddr *fromp) fd_set rfds, fds; char buf[BUFSIZ], sig; int one = 1; - char **envlist, **env; (void) signal(SIGINT, SIG_DFL); (void) signal(SIGQUIT, SIG_DFL); @@ -149,6 +149,7 @@ doit(struct sockaddr *fromp) dup2(STDIN_FILENO, STDOUT_FILENO); (void) alarm(60); port = 0; + sd = -1; for (;;) { char c; if (read(STDIN_FILENO, &c, 1) != 1) @@ -161,10 +162,10 @@ doit(struct sockaddr *fromp) sd = socket(fromp->sa_family, SOCK_STREAM, 0); if (sd < 0) exit(1); - bzero(&asin, sizeof(asin)); - asin.ss_family = fromp->sa_family; - asin.ss_len = fromp->sa_len; - if (bind(sd, (struct sockaddr *)&asin, asin.ss_len) < 0) + bzero(&sa, sizeof(sa)); + sa.ss_family = fromp->sa_family; + sa.ss_len = fromp->sa_len; + if (bind(sd, (struct sockaddr *)&sa, sa.ss_len) < 0) exit(1); switch (fromp->sa_family) { case AF_INET: @@ -256,7 +257,7 @@ doit(struct sockaddr *fromp) for (fd = getdtablesize(); fd > 2; fd--) (void) close(fd); if (*pwd->pw_shell == '\0') - pwd->pw_shell = _PATH_BSHELL; + pwd->pw_shell = default_shell; if (setsid() == -1) syslog(LOG_ERR, "setsid() failed: %m"); if (setlogin(pwd->pw_name) < 0) @@ -300,7 +301,7 @@ error(const char *fmt, ...) } static void -getstr(char *buf, int cnt, char *err) +getstr(char *buf, int cnt, const char *field) { char c; @@ -309,7 +310,7 @@ getstr(char *buf, int cnt, char *err) exit(1); *buf++ = c; if (--cnt == 0) { - error("%s too long\n", err); + error("%s too long\n", field); exit(1); } } while (c != 0); |