summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/bootpd/bootpd.c8
-rw-r--r--libexec/ftpd/ftpd.c9
-rw-r--r--libexec/getty/main.c5
-rw-r--r--libexec/rbootd/conf.c4
-rw-r--r--libexec/rbootd/rbootd.c6
-rw-r--r--libexec/rexecd/rexecd.c6
-rw-r--r--libexec/rlogind/rlogind.c6
-rw-r--r--libexec/rshd/rshd.c11
-rw-r--r--libexec/talkd/talkd.c7
-rw-r--r--libexec/telnetd/sys_term.c3
-rw-r--r--libexec/telnetd/telnetd.c16
-rw-r--r--libexec/tftpd/tftpd.c8
-rw-r--r--libexec/uucpd/uucpd.c6
13 files changed, 52 insertions, 43 deletions
diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c
index 6d6a74f..b4cace6 100644
--- a/libexec/bootpd/bootpd.c
+++ b/libexec/bootpd/bootpd.c
@@ -19,7 +19,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
- $Id: bootpd.c,v 1.9 1998/12/12 20:56:53 dillon Exp $
+ $Id: bootpd.c,v 1.10 1998/12/13 21:02:28 eivind Exp $
************************************************************************/
@@ -162,7 +162,8 @@ char *progname;
char *chdir_path;
struct in_addr my_ip_addr;
-char *hostname, default_hostname[MAXHOSTNAMELEN + 1];
+static const char *hostname;
+static char default_hostname[MAXHOSTNAMELEN];
/* Flags set by signal catcher. */
PRIVATE int do_readtab = 0;
@@ -255,10 +256,11 @@ main(argc, argv)
stmp = NULL;
timeout = &actualtimeout;
- if (gethostname(default_hostname, MAXHOSTNAMELEN) < 0) {
+ if (gethostname(default_hostname, sizeof(default_hostname) - 1) < 0) {
report(LOG_ERR, "bootpd: can't get hostname\n");
exit(1);
}
+ default_hostname[sizeof(default_hostname) - 1] = '\0';
hostname = default_hostname;
/*
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 3012fab..aaa1e7d 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -44,7 +44,7 @@ static char copyright[] =
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
- "$Id: ftpd.c,v 1.52 1998/10/13 20:42:01 des Exp $";
+ "$Id: ftpd.c,v 1.53 1999/04/06 23:05:57 brian Exp $";
#endif /* not lint */
/*
@@ -166,7 +166,7 @@ static struct ftphost {
} *thishost, *firsthost;
#endif
-char remotehost[MAXHOSTNAMELEN + 1];
+char remotehost[MAXHOSTNAMELEN];
char *ident = NULL;
static char ttyline[20];
@@ -542,7 +542,8 @@ main(argc, argv, envp)
#ifndef VIRTUAL_HOSTING
if ((hostname = malloc(MAXHOSTNAMELEN)) == NULL)
fatal("Ran out of memory.");
- (void) gethostname(hostname, MAXHOSTNAMELEN);
+ (void) gethostname(hostname, MAXHOSTNAMELEN - 1);
+ hostname[MAXHOSTNAMELEN - 1] = '\0';
#endif
reply(220, "%s FTP server (%s) ready.", hostname, version);
(void) setjmp(errcatch);
@@ -1896,7 +1897,7 @@ static void
dolog(sin)
struct sockaddr_in *sin;
{
- realhostname(remotehost, sizeof remotehost - 1, &sin->sin_addr);
+ realhostname(remotehost, sizeof(remotehost) - 1, &sin->sin_addr);
#ifdef SETPROCTITLE
#ifdef VIRTUAL_HOSTING
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index 0047f59..cf1bf29 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)from: main.c 8.1 (Berkeley) 6/20/93";
#endif
static const char rcsid[] =
- "$Id: main.c,v 1.24 1999/03/09 22:04:44 brian Exp $";
+ "$Id: main.c,v 1.25 1999/04/04 04:36:50 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -194,7 +194,8 @@ main(argc, argv)
signal(SIGQUIT, SIG_IGN);
openlog("getty", LOG_ODELAY|LOG_CONS|LOG_PID, LOG_AUTH);
- gethostname(hostname, sizeof(hostname));
+ gethostname(hostname, sizeof(hostname) - 1);
+ hostname[sizeof(hostname) - 1] = '\0';
if (hostname[0] == '\0')
strcpy(hostname, "Amnesiac");
diff --git a/libexec/rbootd/conf.c b/libexec/rbootd/conf.c
index 157f52b..e2d9643 100644
--- a/libexec/rbootd/conf.c
+++ b/libexec/rbootd/conf.c
@@ -49,7 +49,7 @@
static const char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: conf.c,v 1.3 1997/11/24 07:33:40 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -69,7 +69,7 @@ static const char rcsid[] =
** simplify the boot file search code.
*/
-char MyHost[MAXHOSTNAMELEN+1]; /* host name */
+char MyHost[MAXHOSTNAMELEN]; /* host name */
pid_t MyPid; /* process id */
int DebugFlg = 0; /* set true if debugging */
int BootAny = 0; /* set true if we boot anyone */
diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c
index a74734c..b8e384d 100644
--- a/libexec/rbootd/rbootd.c
+++ b/libexec/rbootd/rbootd.c
@@ -55,7 +55,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: rbootd.c,v 1.9 1997/11/24 07:33:41 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -168,11 +168,11 @@ main(argc, argv)
/*
* Grab our host name and pid.
*/
- if (gethostname(MyHost, MAXHOSTNAMELEN) < 0) {
+ if (gethostname(MyHost, MAXHOSTNAMELEN - 1) < 0) {
syslog(LOG_ERR, "gethostname: %m");
Exit(0);
}
- MyHost[MAXHOSTNAMELEN] = '\0';
+ MyHost[MAXHOSTNAMELEN - 1] = '\0';
MyPid = getpid();
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index 740368f..8c8c06b 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)rexecd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: rexecd.c,v 1.15 1997/11/26 07:29:04 charnier Exp $";
+ "$Id: rexecd.c,v 1.16 1999/04/06 23:05:57 brian Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -73,7 +73,7 @@ char path[sizeof(_PATH_DEFPATH) + sizeof("PATH=")] = "PATH=";
char *envinit[] =
{homedir, shell, path, username, 0};
char **environ;
-char remote[MAXHOSTNAMELEN + 1];
+char remote[MAXHOSTNAMELEN];
struct sockaddr_in asin = { AF_INET };
@@ -104,7 +104,7 @@ main(argc, argv)
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0)
err(1, "getpeername");
- realhostname(remote, sizeof remote - 1, &from.sin_addr);
+ realhostname(remote, sizeof(remote) - 1, &from.sin_addr);
doit(0, &from);
return(0);
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index a7cdba5..9974ed6 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)rlogind.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: rlogind.c,v 1.20 1998/12/16 07:20:44 peter Exp $";
+ "$Id: rlogind.c,v 1.21 1999/04/06 23:05:58 brian Exp $";
#endif /* not lint */
/*
@@ -211,7 +211,7 @@ doit(f, fromp)
{
int master, pid, on = 1;
int authenticated = 0;
- char hostname[2 * MAXHOSTNAMELEN + 1];
+ char hostname[MAXHOSTNAMELEN];
char c;
alarm(60);
@@ -226,7 +226,7 @@ doit(f, fromp)
alarm(0);
fromp->sin_port = ntohs((u_short)fromp->sin_port);
- realhostname(hostname, sizeof hostname - 1, &fromp->sin_addr);
+ realhostname(hostname, sizeof(hostname) - 1, &fromp->sin_addr);
hostname[sizeof(hostname) - 1] = '\0';
#ifdef KERBEROS
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c
index 5ed7437b..24b7d35 100644
--- a/libexec/rshd/rshd.c
+++ b/libexec/rshd/rshd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94";
#endif
static const char rcsid[] =
- "$Id: rshd.c,v 1.23 1998/12/16 07:20:45 peter Exp $";
+ "$Id: rshd.c,v 1.24 1999/04/06 23:05:58 brian Exp $";
#endif /* not lint */
/*
@@ -216,7 +216,7 @@ doit(fromp)
char *errorstr;
char *cp, sig, buf[BUFSIZ];
char cmdbuf[NCARGS+1], locuser[16], remuser[16];
- char fromhost[2 * MAXHOSTNAMELEN + 1];
+ char fromhost[MAXHOSTNAMELEN];
#ifdef LOGIN_CAP
login_cap_t *lc;
#endif
@@ -348,9 +348,7 @@ doit(fromp)
dup2(f, 2);
#endif
errorstr = NULL;
- strncpy(fromhost, inet_ntoa(fromp->sin_addr),
- sizeof(fromhost) - 1);
- realhostname(fromhost, sizeof fromhost - 1, &fromp->sin_addr);
+ realhostname(fromhost, sizeof(fromhost) - 1, &fromp->sin_addr);
fromhost[sizeof(fromhost) - 1] = '\0';
#ifdef KERBEROS
@@ -784,7 +782,8 @@ local_domain(h)
char *p1, *p2;
localhost[0] = 0;
- (void) gethostname(localhost, sizeof(localhost));
+ (void) gethostname(localhost, sizeof(localhost) - 1);
+ localhost[sizeof(localhost) - 1] = '\0';
p1 = topdomain(localhost);
p2 = topdomain(h);
if (p1 == NULL || p2 == NULL || !strcasecmp(p1, p2))
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index bb61f7e..72e4a5f 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: talkd.c,v 1.8 1997/12/02 12:33:42 charnier Exp $";
+ "$Id: talkd.c,v 1.9 1998/12/01 21:12:57 dillon Exp $";
#endif /* not lint */
/*
@@ -73,7 +73,7 @@ int sockt;
int debug = 0;
long lastmsgtime;
-char hostname[MAXHOSTNAMELEN + 1];
+char hostname[MAXHOSTNAMELEN];
#define TIMEOUT 30
#define MAXIDLE 120
@@ -97,10 +97,11 @@ main(argc, argv)
errx(1, "getuid: not super-user");
#endif
openlog("talkd", LOG_PID, LOG_DAEMON);
- if (gethostname(hostname, sizeof (hostname) - 1) < 0) {
+ if (gethostname(hostname, sizeof(hostname) - 1) < 0) {
syslog(LOG_ERR, "gethostname: %m");
_exit(1);
}
+ hostname[sizeof(hostname) - 1] = '\0';
if (chdir(_PATH_DEV) < 0) {
syslog(LOG_ERR, "chdir: %s: %m", _PATH_DEV);
_exit(1);
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index c08228e..d53c6c7 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)sys_term.c 8.2 (Berkeley) 12/15/93";
#endif
static const char rcsid[] =
- "$Id: sys_term.c,v 1.19 1997/12/24 19:21:09 imp Exp $";
+ "$Id: sys_term.c,v 1.20 1998/05/14 10:07:29 jb Exp $";
#endif /* not lint */
#include "telnetd.h"
@@ -52,7 +52,6 @@ extern char *altlogin;
# define PARENT_DOES_UTMP
#endif
-int utmp_len = MAXHOSTNAMELEN;
#ifdef NEWINIT
#include <initreq.h>
#else /* NEWINIT*/
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 8baaaf4..fd4b6da 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93";
#endif
static const char rcsid[] =
- "$Id: telnetd.c,v 1.16 1999/04/06 00:29:41 brian Exp $";
+ "$Id: telnetd.c,v 1.17 1999/04/06 23:05:58 brian Exp $";
#endif /* not lint */
#include "telnetd.h"
@@ -90,7 +90,8 @@ int auth_level = 0;
int require_SecurID = 0;
#endif
-extern int utmp_len;
+char remote_hostname[UT_HOSTSIZE + 1];
+int utmp_len = sizeof(remote_hostname) - 1;
int registerd_host_only = 0;
#ifdef STREAMSPTY
@@ -361,6 +362,10 @@ main(argc, argv)
case 'u':
utmp_len = atoi(optarg);
+ if (utmp_len < 0)
+ utmp_len = -utmp_len;
+ if (utmp_len >= sizeof(remote_hostname))
+ utmp_len = sizeof(remote_hostname) - 1;
break;
case 'U':
@@ -758,7 +763,6 @@ terminaltypeok(s)
char *hostname;
char host_name[MAXHOSTNAMELEN];
-char remote_hostname[UT_HOSTSIZE + 1];
extern void telnet P((int, int, char *));
@@ -813,12 +817,14 @@ doit(who)
#endif /* _SC_CRAY_SECURE_SYS */
/* get name of connected client */
- if (realhostname(remote_hostname, sizeof remote_hostname - 1,
+ if (realhostname(remote_hostname, utmp_len,
&who->sin_addr) == HOSTNAME_INVALIDADDR && registerd_host_only)
fatal(net, "Couldn't resolve your address into a host name.\r\n\
Please contact your net administrator");
+ remote_hostname[utmp_len] = '\0';
- (void) gethostname(host_name, sizeof (host_name));
+ (void) gethostname(host_name, sizeof(host_name) - 1);
+ host_name[sizeof(host_name) - 1] = '\0';
hostname = host_name;
#if defined(AUTHENTICATION)
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index f1f8a9a..54cda4b 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: tftpd.c,v 1.12 1998/10/30 16:17:39 dg Exp $";
+ "$Id: tftpd.c,v 1.13 1999/04/06 23:05:59 brian Exp $";
#endif /* not lint */
/*
@@ -325,10 +325,10 @@ again:
}
ecode = (*pf->f_validate)(&filename, tp->th_opcode);
if (logging) {
- char host[MAXHOSTNAMELEN + 1];
+ char host[MAXHOSTNAMELEN];
- realhostname(host, sizeof host - 1, &from.sin_addr);
- host[sizeof host - 1] = '\0';
+ realhostname(host, sizeof(host) - 1, &from.sin_addr);
+ host[sizeof(host) - 1] = '\0';
syslog(LOG_INFO, "%s: %s request for %s: %s", host,
tp->th_opcode == WRQ ? "write" : "read",
filename, errtomsg(ecode));
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index e15c05b..dcb3b0e 100644
--- a/libexec/uucpd/uucpd.c
+++ b/libexec/uucpd/uucpd.c
@@ -45,7 +45,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)uucpd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: uucpd.c,v 1.16 1999/03/30 10:23:35 joerg Exp $";
+ "$Id: uucpd.c,v 1.17 1999/04/06 23:06:00 brian Exp $";
#endif /* not lint */
/*
@@ -122,8 +122,8 @@ void badlogin(char *name, struct sockaddr_in *sin)
{
char remotehost[MAXHOSTNAMELEN];
- realhostname(remotehost, sizeof remotehost - 1, &sin->sin_addr);
- remotehost[sizeof remotehost - 1] = '\0';
+ realhostname(remotehost, sizeof(remotehost) - 1, &sin->sin_addr);
+ remotehost[sizeof(remotehost) - 1] = '\0';
syslog(LOG_NOTICE, "LOGIN FAILURE FROM %s", remotehost);
syslog(LOG_AUTHPRIV|LOG_NOTICE,
OpenPOWER on IntegriCloud