From 446b212817a0b54680f5309d28bcb40f9cbb39f7 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Mon, 13 May 1996 02:07:52 +0000 Subject: [PATCH] Use MaxHostNameLen and MaxPathLen git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@536 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/cmds.c | 18 +++++++++--------- appl/ftp/ftp/ftp.c | 12 ++++++------ appl/ftp/ftp/ftp_var.h | 4 ++-- appl/ftp/ftp/globals.c | 4 ++-- appl/ftp/ftp/main.c | 2 +- appl/ftp/ftpd/ftpd.c | 12 ++++++------ appl/ftp/ftpd/klogin.c | 2 +- appl/popper/pop_init.c | 2 +- appl/popper/popper.h | 5 +---- appl/telnet/telnet/commands.c | 6 +++--- appl/telnet/telnetd/sys_term.c | 2 +- appl/telnet/telnetd/telnetd.c | 7 ++----- lib/roken/getcwd.c | 2 +- lib/roken/iruserok.c | 4 ++-- 14 files changed, 38 insertions(+), 44 deletions(-) diff --git a/appl/ftp/ftp/cmds.c b/appl/ftp/ftp/cmds.c index ba2208a7f..e9a9bd6c4 100644 --- a/appl/ftp/ftp/cmds.c +++ b/appl/ftp/ftp/cmds.c @@ -423,7 +423,7 @@ mput(int argc, char **argv) oldintr = signal(SIGINT, mabort); (void) setjmp(jabort); if (proxy) { - char *cp, *tp2, tmpbuf[MAXPATHLEN]; + char *cp, *tp2, tmpbuf[MaxPathLen]; while ((cp = remglob(argv,0)) != NULL) { if (*cp == 0) { @@ -566,7 +566,7 @@ usage: return (0); } if (loc && mcase) { - char *tp = argv[1], *tp2, tmpbuf[MAXPATHLEN]; + char *tp = argv[1], *tp2, tmpbuf[MaxPathLen]; while (*tp && !islower(*tp)) { tp++; @@ -672,7 +672,7 @@ mget(int argc, char **argv) { sighand oldintr; int ch, ointer; - char *cp, *tp, *tp2, tmpbuf[MAXPATHLEN]; + char *cp, *tp, *tp2, tmpbuf[MaxPathLen]; if (argc < 2 && !another(&argc, &argv, "remote-files")) { printf("usage: %s remote-files\n", argv[0]); @@ -722,7 +722,7 @@ char * remglob(char **argv, int doswitch) { char temp[16]; - static char buf[MAXPATHLEN]; + static char buf[MaxPathLen]; static FILE *ftemp = NULL; static char **args; int oldverbose, oldhash; @@ -990,7 +990,7 @@ cd(int argc, char **argv) void lcd(int argc, char **argv) { - char buf[MAXPATHLEN]; + char buf[MaxPathLen]; if (argc < 2) argc++, argv[1] = home; @@ -1656,7 +1656,7 @@ setntrans(int argc, char **argv) char * dotrans(char *name) { - static char new[MAXPATHLEN]; + static char new[MaxPathLen]; char *cp1, *cp2 = new; int i, ostop, found; @@ -1707,16 +1707,16 @@ setnmap(int argc, char **argv) cp = strchr(altarg, ' '); } *cp = '\0'; - (void) strncpy(mapin, altarg, MAXPATHLEN - 1); + (void) strncpy(mapin, altarg, MaxPathLen - 1); while (*++cp == ' ') continue; - (void) strncpy(mapout, cp, MAXPATHLEN - 1); + (void) strncpy(mapout, cp, MaxPathLen - 1); } char * domap(char *name) { - static char new[MAXPATHLEN]; + static char new[MaxPathLen]; char *cp1 = name, *cp2 = mapin; char *tp[9], *te[9]; int i, toks[9], toknum = 0, match = 1; diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 48816d8df..c1a99976b 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -1269,7 +1269,7 @@ pswitch(int flag) sighand oldintr; static struct comvars { int connect; - char name[MAXHOSTNAMELEN]; + char name[MaxHostNameLen]; struct sockaddr_in mctl; struct sockaddr_in hctl; FILE *in; @@ -1284,8 +1284,8 @@ pswitch(int flag) char nti[17]; char nto[17]; int mapflg; - char mi[MAXPATHLEN]; - char mo[MAXPATHLEN]; + char mi[MaxPathLen]; + char mo[MaxPathLen]; } proxstruct, tmpstruct; struct comvars *ip, *op; @@ -1342,10 +1342,10 @@ pswitch(int flag) (void) strcpy(ntout, op->nto); ip->mapflg = mapflag; mapflag = op->mapflg; - (void) strncpy(ip->mi, mapin, MAXPATHLEN - 1); + (void) strncpy(ip->mi, mapin, MaxPathLen - 1); (ip->mi)[strlen(ip->mi)] = '\0'; (void) strcpy(mapin, op->mi); - (void) strncpy(ip->mo, mapout, MAXPATHLEN - 1); + (void) strncpy(ip->mo, mapout, MaxPathLen - 1); (ip->mo)[strlen(ip->mo)] = '\0'; (void) strcpy(mapout, op->mo); (void) signal(SIGINT, oldintr); @@ -1508,7 +1508,7 @@ reset(int argc, char **argv) char * gunique(char *local) { - static char new[MAXPATHLEN]; + static char new[MaxPathLen]; char *cp = strrchr(local, '/'); int d, count=0; char ext = '1'; diff --git a/appl/ftp/ftp/ftp_var.h b/appl/ftp/ftp/ftp_var.h index 515fbd3c4..d383fbbd6 100644 --- a/appl/ftp/ftp/ftp_var.h +++ b/appl/ftp/ftp/ftp_var.h @@ -72,8 +72,8 @@ extern int passivemode; /* passive mode enabled */ extern char *altarg; /* argv[1] with no shell-like preprocessing */ extern char ntin[17]; /* input translation table */ extern char ntout[17]; /* output translation table */ -extern char mapin[MAXPATHLEN]; /* input map template */ -extern char mapout[MAXPATHLEN]; /* output map template */ +extern char mapin[MaxPathLen]; /* input map template */ +extern char mapout[MaxPathLen]; /* output map template */ extern char typename[32]; /* name of file transfer type */ extern int type; /* requested file transfer type */ extern int curtype; /* current file transfer type */ diff --git a/appl/ftp/ftp/globals.c b/appl/ftp/ftp/globals.c index 32af193bb..b1ab973f2 100644 --- a/appl/ftp/ftp/globals.c +++ b/appl/ftp/ftp/globals.c @@ -28,8 +28,8 @@ int passivemode; /* passive mode enabled */ char *altarg; /* argv[1] with no shell-like preprocessing */ char ntin[17]; /* input translation table */ char ntout[17]; /* output translation table */ -char mapin[MAXPATHLEN]; /* input map template */ -char mapout[MAXPATHLEN]; /* output map template */ +char mapin[MaxPathLen]; /* input map template */ +char mapout[MaxPathLen]; /* output map template */ char typename[32]; /* name of file transfer type */ int type; /* requested file transfer type */ int curtype; /* current file transfer type */ diff --git a/appl/ftp/ftp/main.c b/appl/ftp/ftp/main.c index c0b170c14..34c9eaeda 100644 --- a/appl/ftp/ftp/main.c +++ b/appl/ftp/ftp/main.c @@ -42,7 +42,7 @@ main(int argc, char **argv) { int ch, top; struct passwd *pw = NULL; - char *cp, homedir[MAXPATHLEN]; + char *cp, homedir[MaxPathLen]; struct servent *sp; sp = getservbyname("ftp", "tcp"); diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index 32812e507..f84beaebc 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -137,8 +137,8 @@ off_t byte_count; #endif int defumask = CMASK; /* default umask value */ char tmpline[10240]; -char hostname[MAXHOSTNAMELEN]; -char remotehost[MAXHOSTNAMELEN]; +char hostname[MaxHostNameLen]; +char remotehost[MaxHostNameLen]; static char ttyline[20]; char *tty = ttyline; /* for klogin */ @@ -206,7 +206,7 @@ static struct passwd * sk_getpwnam (char *); static char * curdir(void) { - static char path[MAXPATHLEN+1+1]; /* path + '/' + '\0' */ + static char path[MaxPathLen+1+1]; /* path + '/' + '\0' */ if (getcwd(path, sizeof(path)-2) == NULL) return (""); @@ -1447,7 +1447,7 @@ removedir(char *name) void pwd(void) { - char path[MAXPATHLEN + 1]; + char path[MaxPathLen + 1]; char *ret; /* SunOS has a broken getcwd that does popen(pwd) (!!!), this @@ -1624,7 +1624,7 @@ pasv_error: static char * gunique(char *local) { - static char new[MAXPATHLEN]; + static char new[MaxPathLen]; struct stat st; int count; char *cp; @@ -1740,7 +1740,7 @@ send_file_list(char *whichf) continue; while ((dir = readdir(dirp)) != NULL) { - char nbuf[MAXPATHLEN]; + char nbuf[MaxPathLen]; if (!strcmp(dir->d_name, ".")) continue; diff --git a/appl/ftp/ftpd/klogin.c b/appl/ftp/ftpd/klogin.c index 202d0d908..9bb9d550c 100644 --- a/appl/ftp/ftpd/klogin.c +++ b/appl/ftp/ftpd/klogin.c @@ -16,7 +16,7 @@ klogin(char *name, char *password) int kerror; KTEXT_ST tkt; AUTH_DAT ad; - char hostname[MAXHOSTNAMELEN]; + char hostname[MaxHostNameLen]; char realm[REALM_SZ]; char *phost; diff --git a/appl/popper/pop_init.c b/appl/popper/pop_init.c index b38ebc6f3..639d1ce04 100644 --- a/appl/popper/pop_init.c +++ b/appl/popper/pop_init.c @@ -81,7 +81,7 @@ pop_init(POP *p,int argcount,char **argmessage) p->myname = argmessage[0]; /* Get the name of our host */ - (void)gethostname(p->myhost,MAXHOSTNAMELEN); + (void)gethostname(p->myhost,MaxHostNameLen); /* Open the log file */ #ifdef SYSLOG42 diff --git a/appl/popper/popper.h b/appl/popper/popper.h index b0c470ceb..0e08b52c2 100644 --- a/appl/popper/popper.h +++ b/appl/popper/popper.h @@ -71,9 +71,6 @@ #define FALSE 0 #define NEWLINE '\n' -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif #define MAXUSERNAMELEN 65 #define MAXDROPLEN 64 #define MAXLINELEN 1024 @@ -190,7 +187,7 @@ typedef struct { /* POP parameter block */ int debug; /* Debugging requested */ char * myname; /* The name of this POP daemon program */ - char myhost[MAXHOSTNAMELEN]; /* The name of our host + char myhost[MaxHostNameLen]; /* The name of our host computer */ char * client; /* Canonical name of client computer */ diff --git a/appl/telnet/telnet/commands.c b/appl/telnet/telnet/commands.c index c357ce73d..992e5e7a7 100644 --- a/appl/telnet/telnet/commands.c +++ b/appl/telnet/telnet/commands.c @@ -72,8 +72,8 @@ RCSID("$Id$"); #include -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 +#ifndef MaxHostNameLen +#define MaxHostNameLen 64 #endif #if defined(IPPROTO_IP) && defined(IP_TOS) @@ -81,7 +81,7 @@ int tos = -1; #endif /* defined(IPPROTO_IP) && defined(IP_TOS) */ char *hostname; -static char _hostname[MAXHOSTNAMELEN]; +static char _hostname[MaxHostNameLen]; extern char *getenv(); diff --git a/appl/telnet/telnetd/sys_term.c b/appl/telnet/telnetd/sys_term.c index b6e596a2e..d747ead75 100644 --- a/appl/telnet/telnetd/sys_term.c +++ b/appl/telnet/telnetd/sys_term.c @@ -48,7 +48,7 @@ RCSID("$Id$"); #ifdef NEWINIT #include -int utmp_len = MAXHOSTNAMELEN; /* sizeof(init_request.host) */ +int utmp_len = MaxHostNameLen; /* sizeof(init_request.host) */ #else /* NEWINIT*/ # ifdef HAVE_UTMPX_H # include diff --git a/appl/telnet/telnetd/telnetd.c b/appl/telnet/telnetd/telnetd.c index 37fa6bb61..b20033ef2 100644 --- a/appl/telnet/telnetd/telnetd.c +++ b/appl/telnet/telnetd/telnetd.c @@ -789,13 +789,10 @@ terminaltypeok(s) return(1); } -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif /* MAXHOSTNAMELEN */ char *hostname; -char host_name[MAXHOSTNAMELEN]; -char remote_host_name[MAXHOSTNAMELEN]; +char host_name[MaxHostNameLen]; +char remote_host_name[MaxHostNameLen]; #ifndef convex extern void telnet P((int, int)); diff --git a/lib/roken/getcwd.c b/lib/roken/getcwd.c index 4053bdaa0..c202cacba 100644 --- a/lib/roken/getcwd.c +++ b/lib/roken/getcwd.c @@ -8,7 +8,7 @@ RCSID("$Id$"); char* getcwd(char *path, int size) { - char xxx[MAXPATHLEN]; + char xxx[MaxPathLen]; char *ret; ret = getwd(xxx); if(ret) diff --git a/lib/roken/iruserok.c b/lib/roken/iruserok.c index 5ba7f483d..c3548701e 100644 --- a/lib/roken/iruserok.c +++ b/lib/roken/iruserok.c @@ -77,8 +77,8 @@ __ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser) { register char *user, *p; int ch; - char buf[MAXHOSTNAMELEN + 128]; /* host + login */ - char hname[MAXHOSTNAMELEN]; + char buf[MaxHostNameLen + 128]; /* host + login */ + char hname[MaxHostNameLen]; struct hostent *hp; /* Presumed guilty until proven innocent. */ int userok = 0, hostok = 0;