diff options
author | des <des@FreeBSD.org> | 2009-09-17 13:31:39 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-09-17 13:31:39 +0000 |
commit | 7ee29ca49959a5c2b0ba8f60cc7885a1bcf12691 (patch) | |
tree | 0c2c6d031c26dd91d9604be7af3834277e335263 /libexec | |
parent | 46197420cc38a05e35d2d08681f4ea36c5ebe3b1 (diff) | |
parent | 124e83aa64b26f6b00736a45c3e25dfda8c7060e (diff) | |
download | FreeBSD-src-7ee29ca49959a5c2b0ba8f60cc7885a1bcf12691.zip FreeBSD-src-7ee29ca49959a5c2b0ba8f60cc7885a1bcf12691.tar.gz |
Merge from head up to r188941 (last revision before the USB stack switch)
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/bootpd/rtmsg.c | 1 | ||||
-rw-r--r-- | libexec/comsat/comsat.c | 23 | ||||
-rw-r--r-- | libexec/ftpd/extern.h | 2 | ||||
-rw-r--r-- | libexec/ftpd/ftpcmd.y | 28 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.8 | 2 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.c | 7 | ||||
-rw-r--r-- | libexec/rtld-elf/Makefile | 3 |
7 files changed, 48 insertions, 18 deletions
diff --git a/libexec/bootpd/rtmsg.c b/libexec/bootpd/rtmsg.c index 4584569..071a7d1 100644 --- a/libexec/bootpd/rtmsg.c +++ b/libexec/bootpd/rtmsg.c @@ -152,7 +152,6 @@ tryagain: sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && - (rtm->rtm_flags & RTF_LLINFO) && !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: case IFT_ISO88024: case IFT_ISO88025: diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c index ed14b1a..fd7cc8d 100644 --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -203,21 +203,32 @@ notify(struct utmp *utp, char file[], off_t offset, int folder) struct stat stb; struct termios tio; char tty[20], name[sizeof(utmp[0].ut_name) + 1]; + const char *cr = utp->ut_line; - (void)snprintf(tty, sizeof(tty), "%s%.*s", - _PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line); - if (strchr(tty + sizeof(_PATH_DEV) - 1, '/')) { + if (strncmp(cr, "pts/", 4) == 0) + cr += 4; + if (strchr(cr, '/')) { /* A slash is an attempt to break security... */ - syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty); + syslog(LOG_AUTH | LOG_NOTICE, "Unexpected `/' in `%s'", + utp->ut_line); return; } - if (stat(tty, &stb) || !(stb.st_mode & (S_IXUSR | S_IXGRP))) { + (void)snprintf(tty, sizeof(tty), "%s%.*s", + _PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line); + if (stat(tty, &stb) == -1 || !(stb.st_mode & (S_IXUSR | S_IXGRP))) { dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty); return; } dsyslog(LOG_DEBUG, "notify %s on %s\n", utp->ut_name, tty); - if (fork()) + switch (fork()) { + case -1: + syslog(LOG_NOTICE, "fork failed (%m)"); return; + case 0: + break; + default: + return; + } (void)signal(SIGALRM, SIG_DFL); (void)alarm((u_int)30); if ((tp = fopen(tty, "w")) == NULL) { diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 7c1cc8e..d869f67 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -46,7 +46,7 @@ void fatalerror(char *); void ftpd_logwtmp(char *, char *, struct sockaddr *addr); int ftpd_pclose(FILE *); FILE *ftpd_popen(char *, char *); -char *getline(char *, int, FILE *); +int getline(char *, int, FILE *); void lreply(int, const char *, ...) __printflike(2, 3); void makedir(char *); void nack(char *); diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 3c6ecb7..fcef73e 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1191,7 +1191,7 @@ lookup(struct tab *p, char *cmd) /* * getline - a hacked up version of fgets to ignore TELNET escape codes. */ -char * +int getline(char *s, int n, FILE *iop) { int c; @@ -1207,7 +1207,7 @@ getline(char *s, int n, FILE *iop) if (ftpdebug) syslog(LOG_DEBUG, "command: %s", s); tmpline[0] = '\0'; - return(s); + return(0); } if (c == 0) tmpline[0] = '\0'; @@ -1244,13 +1244,24 @@ getline(char *s, int n, FILE *iop) } } *cs++ = c; - if (--n <= 0 || c == '\n') + if (--n <= 0) { + /* + * If command doesn't fit into buffer, discard the + * rest of the command and indicate truncation. + * This prevents the command to be split up into + * multiple commands. + */ + while (c != '\n' && (c = getc(iop)) != EOF) + ; + return (-2); + } + if (c == '\n') break; } got_eof: sigprocmask(SIG_SETMASK, &osset, NULL); if (c == EOF && cs == s) - return (NULL); + return (-1); *cs++ = '\0'; if (ftpdebug) { if (!guest && strncasecmp("pass ", s, 5) == 0) { @@ -1270,7 +1281,7 @@ got_eof: syslog(LOG_DEBUG, "command: %.*s", len, s); } } - return (s); + return (0); } static void @@ -1300,9 +1311,14 @@ yylex(void) case CMD: (void) signal(SIGALRM, toolong); (void) alarm(timeout); - if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) { + n = getline(cbuf, sizeof(cbuf)-1, stdin); + if (n == -1) { reply(221, "You could at least say goodbye."); dologout(0); + } else if (n == -2) { + reply(500, "Command too long."); + (void) alarm(0); + continue; } (void) alarm(0); #ifdef SETPROCTITLE diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8 index ae5d62c..9334bd9 100644 --- a/libexec/ftpd/ftpd.8 +++ b/libexec/ftpd/ftpd.8 @@ -205,7 +205,7 @@ for more information. Note that option is a virtual no-op in .Fx 5.0 and above; both port -ranges are indentical by default. +ranges are identical by default. .It Fl u The default file creation mode mask is set to .Ar umask , diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 5095f20..59dc71c 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -2794,15 +2794,20 @@ static int myoob(void) { char *cp; + int ret; if (!transflag) { syslog(LOG_ERR, "Internal: myoob() while no transfer"); return (0); } cp = tmpline; - if (getline(cp, 7, stdin) == NULL) { + ret = getline(cp, 7, stdin); + if (ret == -1) { reply(221, "You could at least say goodbye."); dologout(0); + } else if (ret == -2) { + /* Ignore truncated command. */ + return (0); } upper(cp); if (strcmp(cp, "ABOR\r\n") == 0) { diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index abf9209..7c20398 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ -WITHOUT_SSP= - .include <bsd.own.mk> +MK_SSP= no PROG?= ld-elf.so.1 SRCS= rtld_start.S \ |