Use MaxHostNameLen and MaxPathLen

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@536 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-05-13 02:07:52 +00:00
parent 69cfc74ba3
commit 446b212817
14 changed files with 38 additions and 44 deletions

View File

@@ -423,7 +423,7 @@ mput(int argc, char **argv)
oldintr = signal(SIGINT, mabort); oldintr = signal(SIGINT, mabort);
(void) setjmp(jabort); (void) setjmp(jabort);
if (proxy) { if (proxy) {
char *cp, *tp2, tmpbuf[MAXPATHLEN]; char *cp, *tp2, tmpbuf[MaxPathLen];
while ((cp = remglob(argv,0)) != NULL) { while ((cp = remglob(argv,0)) != NULL) {
if (*cp == 0) { if (*cp == 0) {
@@ -566,7 +566,7 @@ usage:
return (0); return (0);
} }
if (loc && mcase) { if (loc && mcase) {
char *tp = argv[1], *tp2, tmpbuf[MAXPATHLEN]; char *tp = argv[1], *tp2, tmpbuf[MaxPathLen];
while (*tp && !islower(*tp)) { while (*tp && !islower(*tp)) {
tp++; tp++;
@@ -672,7 +672,7 @@ mget(int argc, char **argv)
{ {
sighand oldintr; sighand oldintr;
int ch, ointer; int ch, ointer;
char *cp, *tp, *tp2, tmpbuf[MAXPATHLEN]; char *cp, *tp, *tp2, tmpbuf[MaxPathLen];
if (argc < 2 && !another(&argc, &argv, "remote-files")) { if (argc < 2 && !another(&argc, &argv, "remote-files")) {
printf("usage: %s remote-files\n", argv[0]); printf("usage: %s remote-files\n", argv[0]);
@@ -722,7 +722,7 @@ char *
remglob(char **argv, int doswitch) remglob(char **argv, int doswitch)
{ {
char temp[16]; char temp[16];
static char buf[MAXPATHLEN]; static char buf[MaxPathLen];
static FILE *ftemp = NULL; static FILE *ftemp = NULL;
static char **args; static char **args;
int oldverbose, oldhash; int oldverbose, oldhash;
@@ -990,7 +990,7 @@ cd(int argc, char **argv)
void void
lcd(int argc, char **argv) lcd(int argc, char **argv)
{ {
char buf[MAXPATHLEN]; char buf[MaxPathLen];
if (argc < 2) if (argc < 2)
argc++, argv[1] = home; argc++, argv[1] = home;
@@ -1656,7 +1656,7 @@ setntrans(int argc, char **argv)
char * char *
dotrans(char *name) dotrans(char *name)
{ {
static char new[MAXPATHLEN]; static char new[MaxPathLen];
char *cp1, *cp2 = new; char *cp1, *cp2 = new;
int i, ostop, found; int i, ostop, found;
@@ -1707,16 +1707,16 @@ setnmap(int argc, char **argv)
cp = strchr(altarg, ' '); cp = strchr(altarg, ' ');
} }
*cp = '\0'; *cp = '\0';
(void) strncpy(mapin, altarg, MAXPATHLEN - 1); (void) strncpy(mapin, altarg, MaxPathLen - 1);
while (*++cp == ' ') while (*++cp == ' ')
continue; continue;
(void) strncpy(mapout, cp, MAXPATHLEN - 1); (void) strncpy(mapout, cp, MaxPathLen - 1);
} }
char * char *
domap(char *name) domap(char *name)
{ {
static char new[MAXPATHLEN]; static char new[MaxPathLen];
char *cp1 = name, *cp2 = mapin; char *cp1 = name, *cp2 = mapin;
char *tp[9], *te[9]; char *tp[9], *te[9];
int i, toks[9], toknum = 0, match = 1; int i, toks[9], toknum = 0, match = 1;

View File

@@ -1269,7 +1269,7 @@ pswitch(int flag)
sighand oldintr; sighand oldintr;
static struct comvars { static struct comvars {
int connect; int connect;
char name[MAXHOSTNAMELEN]; char name[MaxHostNameLen];
struct sockaddr_in mctl; struct sockaddr_in mctl;
struct sockaddr_in hctl; struct sockaddr_in hctl;
FILE *in; FILE *in;
@@ -1284,8 +1284,8 @@ pswitch(int flag)
char nti[17]; char nti[17];
char nto[17]; char nto[17];
int mapflg; int mapflg;
char mi[MAXPATHLEN]; char mi[MaxPathLen];
char mo[MAXPATHLEN]; char mo[MaxPathLen];
} proxstruct, tmpstruct; } proxstruct, tmpstruct;
struct comvars *ip, *op; struct comvars *ip, *op;
@@ -1342,10 +1342,10 @@ pswitch(int flag)
(void) strcpy(ntout, op->nto); (void) strcpy(ntout, op->nto);
ip->mapflg = mapflag; ip->mapflg = mapflag;
mapflag = op->mapflg; mapflag = op->mapflg;
(void) strncpy(ip->mi, mapin, MAXPATHLEN - 1); (void) strncpy(ip->mi, mapin, MaxPathLen - 1);
(ip->mi)[strlen(ip->mi)] = '\0'; (ip->mi)[strlen(ip->mi)] = '\0';
(void) strcpy(mapin, op->mi); (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'; (ip->mo)[strlen(ip->mo)] = '\0';
(void) strcpy(mapout, op->mo); (void) strcpy(mapout, op->mo);
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
@@ -1508,7 +1508,7 @@ reset(int argc, char **argv)
char * char *
gunique(char *local) gunique(char *local)
{ {
static char new[MAXPATHLEN]; static char new[MaxPathLen];
char *cp = strrchr(local, '/'); char *cp = strrchr(local, '/');
int d, count=0; int d, count=0;
char ext = '1'; char ext = '1';

View File

@@ -72,8 +72,8 @@ extern int passivemode; /* passive mode enabled */
extern char *altarg; /* argv[1] with no shell-like preprocessing */ extern char *altarg; /* argv[1] with no shell-like preprocessing */
extern char ntin[17]; /* input translation table */ extern char ntin[17]; /* input translation table */
extern char ntout[17]; /* output translation table */ extern char ntout[17]; /* output translation table */
extern char mapin[MAXPATHLEN]; /* input map template */ extern char mapin[MaxPathLen]; /* input map template */
extern char mapout[MAXPATHLEN]; /* output map template */ extern char mapout[MaxPathLen]; /* output map template */
extern char typename[32]; /* name of file transfer type */ extern char typename[32]; /* name of file transfer type */
extern int type; /* requested file transfer type */ extern int type; /* requested file transfer type */
extern int curtype; /* current file transfer type */ extern int curtype; /* current file transfer type */

View File

@@ -28,8 +28,8 @@ int passivemode; /* passive mode enabled */
char *altarg; /* argv[1] with no shell-like preprocessing */ char *altarg; /* argv[1] with no shell-like preprocessing */
char ntin[17]; /* input translation table */ char ntin[17]; /* input translation table */
char ntout[17]; /* output translation table */ char ntout[17]; /* output translation table */
char mapin[MAXPATHLEN]; /* input map template */ char mapin[MaxPathLen]; /* input map template */
char mapout[MAXPATHLEN]; /* output map template */ char mapout[MaxPathLen]; /* output map template */
char typename[32]; /* name of file transfer type */ char typename[32]; /* name of file transfer type */
int type; /* requested file transfer type */ int type; /* requested file transfer type */
int curtype; /* current file transfer type */ int curtype; /* current file transfer type */

View File

@@ -42,7 +42,7 @@ main(int argc, char **argv)
{ {
int ch, top; int ch, top;
struct passwd *pw = NULL; struct passwd *pw = NULL;
char *cp, homedir[MAXPATHLEN]; char *cp, homedir[MaxPathLen];
struct servent *sp; struct servent *sp;
sp = getservbyname("ftp", "tcp"); sp = getservbyname("ftp", "tcp");

View File

@@ -137,8 +137,8 @@ off_t byte_count;
#endif #endif
int defumask = CMASK; /* default umask value */ int defumask = CMASK; /* default umask value */
char tmpline[10240]; char tmpline[10240];
char hostname[MAXHOSTNAMELEN]; char hostname[MaxHostNameLen];
char remotehost[MAXHOSTNAMELEN]; char remotehost[MaxHostNameLen];
static char ttyline[20]; static char ttyline[20];
char *tty = ttyline; /* for klogin */ char *tty = ttyline; /* for klogin */
@@ -206,7 +206,7 @@ static struct passwd * sk_getpwnam (char *);
static char * static char *
curdir(void) 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) if (getcwd(path, sizeof(path)-2) == NULL)
return (""); return ("");
@@ -1447,7 +1447,7 @@ removedir(char *name)
void void
pwd(void) pwd(void)
{ {
char path[MAXPATHLEN + 1]; char path[MaxPathLen + 1];
char *ret; char *ret;
/* SunOS has a broken getcwd that does popen(pwd) (!!!), this /* SunOS has a broken getcwd that does popen(pwd) (!!!), this
@@ -1624,7 +1624,7 @@ pasv_error:
static char * static char *
gunique(char *local) gunique(char *local)
{ {
static char new[MAXPATHLEN]; static char new[MaxPathLen];
struct stat st; struct stat st;
int count; int count;
char *cp; char *cp;
@@ -1740,7 +1740,7 @@ send_file_list(char *whichf)
continue; continue;
while ((dir = readdir(dirp)) != NULL) { while ((dir = readdir(dirp)) != NULL) {
char nbuf[MAXPATHLEN]; char nbuf[MaxPathLen];
if (!strcmp(dir->d_name, ".")) if (!strcmp(dir->d_name, "."))
continue; continue;

View File

@@ -16,7 +16,7 @@ klogin(char *name, char *password)
int kerror; int kerror;
KTEXT_ST tkt; KTEXT_ST tkt;
AUTH_DAT ad; AUTH_DAT ad;
char hostname[MAXHOSTNAMELEN]; char hostname[MaxHostNameLen];
char realm[REALM_SZ]; char realm[REALM_SZ];
char *phost; char *phost;

View File

@@ -81,7 +81,7 @@ pop_init(POP *p,int argcount,char **argmessage)
p->myname = argmessage[0]; p->myname = argmessage[0];
/* Get the name of our host */ /* Get the name of our host */
(void)gethostname(p->myhost,MAXHOSTNAMELEN); (void)gethostname(p->myhost,MaxHostNameLen);
/* Open the log file */ /* Open the log file */
#ifdef SYSLOG42 #ifdef SYSLOG42

View File

@@ -71,9 +71,6 @@
#define FALSE 0 #define FALSE 0
#define NEWLINE '\n' #define NEWLINE '\n'
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
#define MAXUSERNAMELEN 65 #define MAXUSERNAMELEN 65
#define MAXDROPLEN 64 #define MAXDROPLEN 64
#define MAXLINELEN 1024 #define MAXLINELEN 1024
@@ -190,7 +187,7 @@ typedef struct { /* POP parameter block */
int debug; /* Debugging requested */ int debug; /* Debugging requested */
char * myname; /* The name of this POP char * myname; /* The name of this POP
daemon program */ daemon program */
char myhost[MAXHOSTNAMELEN]; /* The name of our host char myhost[MaxHostNameLen]; /* The name of our host
computer */ computer */
char * client; /* Canonical name of client char * client; /* Canonical name of client
computer */ computer */

View File

@@ -72,8 +72,8 @@ RCSID("$Id$");
#include <netinet/ip.h> #include <netinet/ip.h>
#ifndef MAXHOSTNAMELEN #ifndef MaxHostNameLen
#define MAXHOSTNAMELEN 64 #define MaxHostNameLen 64
#endif #endif
#if defined(IPPROTO_IP) && defined(IP_TOS) #if defined(IPPROTO_IP) && defined(IP_TOS)
@@ -81,7 +81,7 @@ int tos = -1;
#endif /* defined(IPPROTO_IP) && defined(IP_TOS) */ #endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
char *hostname; char *hostname;
static char _hostname[MAXHOSTNAMELEN]; static char _hostname[MaxHostNameLen];
extern char *getenv(); extern char *getenv();

View File

@@ -48,7 +48,7 @@ RCSID("$Id$");
#ifdef NEWINIT #ifdef NEWINIT
#include <initreq.h> #include <initreq.h>
int utmp_len = MAXHOSTNAMELEN; /* sizeof(init_request.host) */ int utmp_len = MaxHostNameLen; /* sizeof(init_request.host) */
#else /* NEWINIT*/ #else /* NEWINIT*/
# ifdef HAVE_UTMPX_H # ifdef HAVE_UTMPX_H
# include <utmpx.h> # include <utmpx.h>

View File

@@ -789,13 +789,10 @@ terminaltypeok(s)
return(1); return(1);
} }
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif /* MAXHOSTNAMELEN */
char *hostname; char *hostname;
char host_name[MAXHOSTNAMELEN]; char host_name[MaxHostNameLen];
char remote_host_name[MAXHOSTNAMELEN]; char remote_host_name[MaxHostNameLen];
#ifndef convex #ifndef convex
extern void telnet P((int, int)); extern void telnet P((int, int));

View File

@@ -8,7 +8,7 @@ RCSID("$Id$");
char* char*
getcwd(char *path, int size) getcwd(char *path, int size)
{ {
char xxx[MAXPATHLEN]; char xxx[MaxPathLen];
char *ret; char *ret;
ret = getwd(xxx); ret = getwd(xxx);
if(ret) if(ret)

View File

@@ -77,8 +77,8 @@ __ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser)
{ {
register char *user, *p; register char *user, *p;
int ch; int ch;
char buf[MAXHOSTNAMELEN + 128]; /* host + login */ char buf[MaxHostNameLen + 128]; /* host + login */
char hname[MAXHOSTNAMELEN]; char hname[MaxHostNameLen];
struct hostent *hp; struct hostent *hp;
/* Presumed guilty until proven innocent. */ /* Presumed guilty until proven innocent. */
int userok = 0, hostok = 0; int userok = 0, hostok = 0;