diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2001-05-14 13:44:25 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2001-05-14 13:44:25 +0000 |
commit | 241816854b8049967c23ee2c6a2f80a65a43c28a (patch) | |
tree | f01ba8ff066a68e8b3b9209bfe2adfac8444d364 /kerberosIV | |
parent | 43e9f39c3b0e4f3566311ebdff8fba53aa6f1c92 (diff) |
Merge krb4-1.0.8
Diffstat (limited to 'kerberosIV')
-rw-r--r-- | kerberosIV/src/appl/ftp/ftpd/ftpd.c | 15 | ||||
-rw-r--r-- | kerberosIV/src/lib/roken/glob.c | 61 | ||||
-rw-r--r-- | kerberosIV/src/man/kadmind.8 | 4 |
3 files changed, 49 insertions, 31 deletions
diff --git a/kerberosIV/src/appl/ftp/ftpd/ftpd.c b/kerberosIV/src/appl/ftp/ftpd/ftpd.c index 6f0ad14dfc9..6cb00a9c9cf 100644 --- a/kerberosIV/src/appl/ftp/ftpd/ftpd.c +++ b/kerberosIV/src/appl/ftp/ftpd/ftpd.c @@ -38,7 +38,7 @@ #endif #include "getarg.h" -RCSID("$KTH: ftpd.c,v 1.131.2.4 2000/09/26 09:30:26 assar Exp $"); +RCSID("$KTH: ftpd.c,v 1.131.2.8 2001/03/26 11:43:25 assar Exp $"); static char version[] = "Version 6.00"; @@ -840,8 +840,8 @@ pass(char *passwd) /* some clients insists on sending a password */ if (logged_in && askpasswd == 0){ - reply(230, "Dumpucko!"); - return; + reply(230, "Password not necessary"); + return; } if (logged_in || askpasswd == 0) { @@ -1880,6 +1880,9 @@ pasv(void) return; } + if(pdata != -1) + close(pdata); + pdata = socket(ctrl_addr->sa_family, SOCK_STREAM, 0); if (pdata < 0) { perror_reply(425, "Can't open passive connection"); @@ -2081,9 +2084,9 @@ list_file(char *file) pdata = -1; } else { #ifdef HAVE_LS_A - const char *cmd = "/bin/ls -lA -- %s"; + const char *cmd = "/bin/ls -lA %s"; #else - const char *cmd = "/bin/ls -la -- %s"; + const char *cmd = "/bin/ls -la %s"; #endif retrieve(cmd, file); } @@ -2103,7 +2106,7 @@ send_file_list(char *whichf) char buf[MaxPathLen]; if (strpbrk(whichf, "~{[*?") != NULL) { - int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE; + int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE|GLOB_LIMIT; memset(&gl, 0, sizeof(gl)); freeglob = 1; diff --git a/kerberosIV/src/lib/roken/glob.c b/kerberosIV/src/lib/roken/glob.c index 8f53e56416d..1613fe12939 100644 --- a/kerberosIV/src/lib/roken/glob.c +++ b/kerberosIV/src/lib/roken/glob.c @@ -87,6 +87,9 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#ifdef HAVE_LIMITS_H +#include <limits.h> /* Solaris ARG_MAX */ +#endif #include "glob.h" #include "roken.h" @@ -145,16 +148,16 @@ static int compare (const void *, const void *); static void g_Ctoc (const Char *, char *); static int g_lstat (Char *, struct stat *, glob_t *); static DIR *g_opendir (Char *, glob_t *); -static Char *g_strchr (Char *, int); +static Char *g_strchr (const Char *, int); #ifdef notdef static Char *g_strcat (Char *, const Char *); #endif static int g_stat (Char *, struct stat *, glob_t *); static int glob0 (const Char *, glob_t *); -static int glob1 (Char *, glob_t *); -static int glob2 (Char *, Char *, Char *, glob_t *); -static int glob3 (Char *, Char *, Char *, Char *, glob_t *); -static int globextend (const Char *, glob_t *); +static int glob1 (Char *, glob_t *, size_t *); +static int glob2 (Char *, Char *, Char *, glob_t *, size_t *); +static int glob3 (Char *, Char *, Char *, Char *, glob_t *, size_t *); +static int globextend (const Char *, glob_t *, size_t *); static const Char * globtilde (const Char *, Char *, glob_t *); static int globexp1 (const Char *, glob_t *); static int globexp2 (const Char *, const Char *, glob_t *, int *); @@ -173,7 +176,7 @@ glob(const char *pattern, int c; Char *bufnext, *bufend, patbuf[MaxPathLen+1]; - patnext = (u_char *) pattern; + patnext = (const u_char *) pattern; if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; @@ -224,7 +227,7 @@ static int globexp1(const Char *pattern, glob_t *pglob) if (pattern[0] == CHAR_LBRACE && pattern[1] == CHAR_RBRACE && pattern[2] == CHAR_EOS) return glob0(pattern, pglob); - while ((ptr = (const Char *) g_strchr((Char *) ptr, CHAR_LBRACE)) != NULL) + while ((ptr = (const Char *) g_strchr(ptr, CHAR_LBRACE)) != NULL) if (!globexp2(ptr, pattern, pglob, &rv)) return rv; @@ -405,6 +408,7 @@ glob0(const Char *pattern, glob_t *pglob) const Char *qpatnext; int c, err, oldpathc; Char *bufnext, patbuf[MaxPathLen+1]; + size_t limit = 0; qpatnext = globtilde(pattern, patbuf, pglob); oldpathc = pglob->gl_pathc; @@ -418,7 +422,7 @@ glob0(const Char *pattern, glob_t *pglob) if (c == CHAR_NOT) ++qpatnext; if (*qpatnext == CHAR_EOS || - g_strchr((Char *) qpatnext+1, CHAR_RBRACKET) == NULL) { + g_strchr(qpatnext+1, CHAR_RBRACKET) == NULL) { *bufnext++ = CHAR_LBRACKET; if (c == CHAR_NOT) --qpatnext; @@ -462,7 +466,7 @@ glob0(const Char *pattern, glob_t *pglob) qprintf("glob0:", patbuf); #endif - if ((err = glob1(patbuf, pglob)) != 0) + if ((err = glob1(patbuf, pglob, &limit)) != 0) return(err); /* @@ -475,7 +479,7 @@ glob0(const Char *pattern, glob_t *pglob) ((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) - return(globextend(pattern, pglob)); + return(globextend(pattern, pglob, &limit)); else if (!(pglob->gl_flags & GLOB_NOSORT)) qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), compare); @@ -489,14 +493,14 @@ compare(const void *p, const void *q) } static int -glob1(Char *pattern, glob_t *pglob) +glob1(Char *pattern, glob_t *pglob, size_t *limit) { Char pathbuf[MaxPathLen+1]; /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */ if (*pattern == CHAR_EOS) return(0); - return(glob2(pathbuf, pathbuf, pattern, pglob)); + return(glob2(pathbuf, pathbuf, pattern, pglob, limit)); } /* @@ -514,7 +518,8 @@ glob1(Char *pattern, glob_t *pglob) #endif static int -glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob) +glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob, + size_t *limit) { struct stat sb; Char *p, *q; @@ -539,7 +544,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob) *pathend = CHAR_EOS; } ++pglob->gl_matchc; - return(globextend(pathbuf, pglob)); + return(globextend(pathbuf, pglob, limit)); } /* Find end of next segment, copy tentatively to pathend. */ @@ -557,14 +562,15 @@ glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob) while (*pattern == CHAR_SEP) *pathend++ = *pattern++; } else /* Need expansion, recurse. */ - return(glob3(pathbuf, pathend, pattern, p, pglob)); + return(glob3(pathbuf, pathend, pattern, p, pglob, + limit)); } - /* CHAR_NOTREACHED */ + /* NOTREACHED */ } static int glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern, - glob_t *pglob) + glob_t *pglob, size_t *limit) { struct dirent *dp; DIR *dirp; @@ -614,7 +620,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern, *pathend = CHAR_EOS; continue; } - err = glob2(pathbuf, --dc, restpattern, pglob); + err = glob2(pathbuf, --dc, restpattern, pglob, limit); if (err) break; } @@ -642,11 +648,11 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern, * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int -globextend(const Char *path, glob_t *pglob) +globextend(const Char *path, glob_t *pglob, size_t *limit) { char **pathv; int i; - u_int newsize; + size_t newsize, len; char *copy; const Char *p; @@ -667,11 +673,19 @@ globextend(const Char *path, glob_t *pglob) for (p = path; *p++;) continue; - if ((copy = malloc(p - path)) != NULL) { + len = (size_t)(p - path); + *limit += len; + if ((copy = malloc(len)) != NULL) { g_Ctoc(path, copy); pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; } pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; + + if ((pglob->gl_flags & GLOB_LIMIT) && (newsize + *limit) >= ARG_MAX) { + errno = 0; + return(GLOB_NOSPACE); + } + return(copy == NULL ? GLOB_NOSPACE : 0); } @@ -739,6 +753,7 @@ globfree(glob_t *pglob) if (*pp) free(*pp); free(pglob->gl_pathv); + pglob->gl_pathv = NULL; } } @@ -781,11 +796,11 @@ g_stat(Char *fn, struct stat *sb, glob_t *pglob) } static Char * -g_strchr(Char *str, int ch) +g_strchr(const Char *str, int ch) { do { if (*str == ch) - return (str); + return (Char *)str; } while (*str++); return (NULL); } diff --git a/kerberosIV/src/man/kadmind.8 b/kerberosIV/src/man/kadmind.8 index 1f5f4ed3d0d..b9311a070d1 100644 --- a/kerberosIV/src/man/kadmind.8 +++ b/kerberosIV/src/man/kadmind.8 @@ -1,4 +1,4 @@ -.\" $KTH: kadmind.8,v 1.6 1999/09/15 15:10:08 assar Exp $ +.\" $KTH: kadmind.8,v 1.6.2.1 2001/03/15 16:31:12 assar Exp $ .\" Copyright 1989 by the Massachusetts Institute of Technology. .\" .\" For copying and distribution information, @@ -118,7 +118,7 @@ Default log file. /etc/kerberosIV Default access control list directory. .TP -admin_acl.{add,get,mod} +admin_acl.{add,get,mod,del} Access control list files (within the directory) .TP /etc/kerberosIV/principal.pag, /etc/kerberosIV/principal.dir |