SCCS-vsn: libexec/rshd/rshd.c 4.21
SCCS-vsn: libexec/rlogind/rlogind.c 4.22
SCCS-vsn: libexec/telnetd/telnetd.c 4.29
SCCS-vsn: libexec/tftpd/tftpd.c 4.14
-static char sccsid[] = "@(#)rlogind.c 4.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)rlogind.c 4.22 (Berkeley) %G%";
#include <sgtty.h>
#include <stdio.h>
#include <netdb.h>
#include <sgtty.h>
#include <stdio.h>
#include <netdb.h>
extern errno;
int reapchild();
extern errno;
int reapchild();
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
- fprintf(stderr, "%s: ", argv[0]);
- perror("setsockopt (SO_KEEPALIVE)");
+ openlog(argv[0], LOG_PID, 0);
+ syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
-static char sccsid[] = "@(#)rshd.c 4.20 (Berkeley) %G%";
+static char sccsid[] = "@(#)rshd.c 4.21 (Berkeley) %G%";
#include <pwd.h>
#include <signal.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
#include <netdb.h>
-struct passwd *getpwnam();
-char *index(), *rindex(), *sprintf();
+char *index(), *rindex();
/* VARARGS 1 */
int error();
/* VARARGS 1 */
int error();
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
- fprintf(stderr, "%s: ", argv[0]);
- perror("setsockopt (SO_KEEPALIVE)");
+ openlog(argv[0], LOG_PID, 0);
+ syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
}
linger.l_onoff = 1;
linger.l_linger = 60; /* XXX */
if (setsockopt(0, SOL_SOCKET, SO_LINGER, &linger, sizeof (linger)) < 0) {
}
linger.l_onoff = 1;
linger.l_linger = 60; /* XXX */
if (setsockopt(0, SOL_SOCKET, SO_LINGER, &linger, sizeof (linger)) < 0) {
- fprintf(stderr, "%s: ", argv[0]);
- perror("setsockopt (SO_LINGER)");
+ openlog(argv[0], LOG_PID, 0);
+ syslog(LOG_WARNING, "setsockopt (SO_LINGER): %m");
fromp->sin_port = ntohs((u_short)fromp->sin_port);
if (fromp->sin_family != AF_INET ||
fromp->sin_port >= IPPORT_RESERVED) {
fromp->sin_port = ntohs((u_short)fromp->sin_port);
if (fromp->sin_family != AF_INET ||
fromp->sin_port >= IPPORT_RESERVED) {
- fprintf(stderr, "rshd: malformed from address\n");
+ openlog("rshd", LOG_PID, 0);
+ syslog(LOG_ERR, "malformed from address\n");
exit(1);
}
(void) alarm(60);
exit(1);
}
(void) alarm(60);
for (;;) {
char c;
if (read(f, &c, 1) != 1) {
for (;;) {
char c;
if (read(f, &c, 1) != 1) {
+ openlog("rshd", LOG_PID, 0);
+ syslog(LOG_ERR, "read: %m");
shutdown(f, 1+1);
exit(1);
}
shutdown(f, 1+1);
exit(1);
}
int lport = IPPORT_RESERVED - 1, retryshift;
s = rresvport(&lport);
if (s < 0) {
int lport = IPPORT_RESERVED - 1, retryshift;
s = rresvport(&lport);
if (s < 0) {
- perror("rshd: can't get stderr port");
+ openlog("rshd", LOG_PID, 0);
+ syslog(LOG_ERR, "can't get stderr port: %m");
exit(1);
}
if (port >= IPPORT_RESERVED) {
exit(1);
}
if (port >= IPPORT_RESERVED) {
- fprintf(stderr, "rshd: 2nd port not reserved\n");
+ openlog("rshd", LOG_PID, 0);
+ syslog(LOG_ERR, "2nd port not reserved\n");
exit(1);
}
fromp->sin_port = htons((u_short)port);
if (connect(s, fromp, sizeof (*fromp), 0) < 0) {
exit(1);
}
fromp->sin_port = htons((u_short)port);
if (connect(s, fromp, sizeof (*fromp), 0) < 0) {
- perror("rshd: connect");
+ openlog("rshd", LOG_PID, 0);
+ syslog(LOG_ERR, "connect: %m");
-static char sccsid[] = "@(#)telnetd.c 4.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnetd.c 4.29 (Berkeley) %G%";
#include <errno.h>
#include <sgtty.h>
#include <netdb.h>
#include <errno.h>
#include <sgtty.h>
#include <netdb.h>
#define BELL '\07'
#define BANNER "\r\n\r\n4.2 BSD UNIX (%s)\r\n\r\r\n\r%s"
#define BELL '\07'
#define BANNER "\r\n\r\n4.2 BSD UNIX (%s)\r\n\r\r\n\r%s"
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
_exit(1);
}
if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) {
- fprintf(stderr, "%s: ", argv[0]);
- perror("setsockopt (SO_KEEPALIVE)");
+ openlog(argv[0], LOG_PID, 0);
+ syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
-static char sccsid[] = "@(#)tftpd.c 4.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)tftpd.c 4.14 (Berkeley) %G%";
#include <ctype.h>
#include <netdb.h>
#include <setjmp.h>
#include <ctype.h>
#include <netdb.h>
#include <setjmp.h>
close(1);
peer = socket(AF_INET, SOCK_DGRAM, 0);
if (peer < 0) {
close(1);
peer = socket(AF_INET, SOCK_DGRAM, 0);
if (peer < 0) {
- perror("tftpd: socket");
+ openlog("tftpd", LOG_PID, 0);
+ syslog(LOG_ERR, "socket: %m");
exit(1);
}
if (bind(peer, (caddr_t)&sin, sizeof (sin)) < 0) {
exit(1);
}
if (bind(peer, (caddr_t)&sin, sizeof (sin)) < 0) {
+ openlog("tftpd", LOG_PID, 0);
+ syslog(LOG_ERR, "bind: %m");
exit(1);
}
if (connect(peer, (caddr_t)&from, sizeof(from)) < 0) {
exit(1);
}
if (connect(peer, (caddr_t)&from, sizeof(from)) < 0) {
- perror("tftpd: connect");
+ openlog("tftpd", LOG_PID, 0);
+ syslog(LOG_ERR, "connect: %m");
exit(1);
}
tp = (struct tftphdr *)buf;
exit(1);
}
tp = (struct tftphdr *)buf;