From: Ezra Peisach Date: Wed, 6 Jun 2001 18:06:36 +0000 (+0000) Subject: * ftpcmd.y: Include "ftpd_var.h" and remove prototype for reply() X-Git-Tag: krb5-1.3-alpha1~1479 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=81d9cbdca2e02f8b6c64a599fccbaede73aed420;p=krb5.git * ftpcmd.y: Include "ftpd_var.h" and remove prototype for reply() and lreply(). Add prototypes and declare as returning void sizecmd(), help() and yylex(). Cleanup assignments in conditionals. * ftpd.c: Include for initgroups() prototype. Move reply(), lreply() prototypes to ftpd_var.h (and include same). Include "krb524.h" for krb524_convert_creds_kdc() prototype. Include secure.h. Provide static prototypes for ftpd_gss_convert_creds(), ftpd_gss_userok(), dolog(), receive_data(), login(), end_login(), disallowed_user(), restricted_user(), checkuser(). Declare main(), checkuser(), disallowed_user(), restricted_user(), end_login(), kpass(), retreive_data(), auth_data(), secure_printf(), ftpd_gss_userok(), as returning int. Declare setdlevel(), user(), pass(), login(), retreive(), store_file(), secure_error(), statfilecmd(), stat_cmd(), fatal(), reply(), lreply(), ack(), nack(), yyerror(), delete_file(), cwd(), makedir(), removedir(), pwd(), renamecmd(), dolog(), dologout(), passive(), perror_reply(), auth(), send_file_list(), reply_gss_error(), secure_gss_error(), ftpd_gss_convert_creds(), as returning void. Cleanup printf argument mismatches. * ftpd_var.h: New header file with many prototypes from ftpd.c. * popen.c (ftpd_popen): Add parenthesis in conditional to distinguish || vs &&. Add prototype for blkfree(). (ftpd_pclose): Declare as returning int. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13276 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 4da4317da..9f74c68e2 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,34 @@ +2001-06-06 Ezra Peisach + + * ftpcmd.y: Include "ftpd_var.h" and remove prototype for reply() + and lreply(). Add prototypes and declare as returning void + sizecmd(), help() and yylex(). Cleanup assignments in + conditionals. + + * ftpd.c: Include for initgroups() prototype. Move + reply(), lreply() prototypes to ftpd_var.h (and include + same). Include "krb524.h" for krb524_convert_creds_kdc() + prototype. Include secure.h. Provide static prototypes for + ftpd_gss_convert_creds(), ftpd_gss_userok(), dolog(), + receive_data(), login(), end_login(), disallowed_user(), + restricted_user(), checkuser(). Declare main(), checkuser(), + disallowed_user(), restricted_user(), end_login(), kpass(), + retreive_data(), auth_data(), secure_printf(), ftpd_gss_userok(), + as returning int. Declare setdlevel(), user(), pass(), login(), + retreive(), store_file(), secure_error(), statfilecmd(), + stat_cmd(), fatal(), reply(), lreply(), ack(), nack(), yyerror(), + delete_file(), cwd(), makedir(), removedir(), pwd(), renamecmd(), + dolog(), dologout(), passive(), perror_reply(), auth(), + send_file_list(), reply_gss_error(), secure_gss_error(), + ftpd_gss_convert_creds(), as returning void. Cleanup printf + argument mismatches. + + * ftpd_var.h: New header file with many prototypes from ftpd.c. + + * popen.c (ftpd_popen): Add parenthesis in conditional to + distinguish || vs &&. Add prototype for blkfree(). + (ftpd_pclose): Declare as returning int. + 2001-04-25 Tom Yu * ftpcmd.y: Don't dereference a NULL pointer returned from diff --git a/src/appl/gssftp/ftpd/ftpcmd.y b/src/appl/gssftp/ftpd/ftpcmd.y index 1c5ac1e0c..664d0b6ee 100644 --- a/src/appl/gssftp/ftpd/ftpcmd.y +++ b/src/appl/gssftp/ftpd/ftpcmd.y @@ -67,16 +67,13 @@ static char sccsid[] = "@(#)ftpcmd.y 5.24 (Berkeley) 2/25/91"; #include #include +#include "ftpd_var.h" + extern char *auth_type; unsigned int maxbuf, actualbuf; unsigned char *ucbuf; -#if defined(STDARG) || (defined(__STDC__) && ! defined(VARARGS)) || defined(HAVE_STDARG_H) -extern reply(int, char *, ...); -extern lreply(int, char *, ...); -#endif - static int kerror; /* XXX needed for all auth types */ #ifdef KRB5_KRB4_COMPAT extern struct sockaddr_in his_addr, ctrl_addr; @@ -135,6 +132,7 @@ extern char *globerr; extern int usedefault; extern int transflag; extern char tmpline[]; + char **ftpglob(); off_t restart_point; @@ -167,6 +165,10 @@ struct tab { }; struct tab cmdtab[]; struct tab sitetab[]; + +void sizecmd(char *); +void help(struct tab *, char *); +static int yylex(void); %} %union { int num; char *str; } @@ -269,7 +271,8 @@ cmd: USER SP username CRLF if (!auth_type) reply(503, "Must first perform authentication"); else if (strlen($3) > 10 || - strlen($3) == 10 && strcmp($3,"4294967296") >= 0) + (strlen($3) == 10 && + strcmp($3,"4294967296") >= 0)) reply(501, "Bad value for PBSZ: %s", $3); else { if (ucbuf) (void) free(ucbuf); @@ -610,8 +613,8 @@ cmd: USER SP username CRLF = { if ($2 && $4 != NULL) { struct stat stbuf; - if (stat((char *) $4, &stbuf) < 0) - perror_reply(550, "%s", (char *) $4); + if (stat($4, &stbuf) < 0) + perror_reply(550, $4); else if ((stbuf.st_mode&S_IFMT) != S_IFREG) { reply(550, "%s: not a plain file.", (char *) $4); @@ -664,8 +667,9 @@ rcmd: RNFR check_login SP pathname CRLF = { fromname = (char *) 0; restart_point = $3; - reply(350, "Restarting at %ld. %s", restart_point, - "Send STORE or RETRIEVE to initiate transfer."); + reply(350, "Restarting at %ld. %s", + (long) restart_point, + "Send STORE or RETRIEVE to initiate transfer."); } ; @@ -977,9 +981,8 @@ getline(s, n, iop) char *s; register FILE *iop; { - register c; + register int c; register char *cs; - int atmark; cs = s; /* tmpline may contain saved command from urgent mode interruption */ @@ -1080,7 +1083,8 @@ getline(s, n, iop) #endif /* NOENCRYPTION */ if ((cp = strpbrk(cs, " \r\n"))) *cp = '\0'; - if (kerror = radix_encode(cs, out, &len, 1)) { + kerror = radix_encode(cs, out, &len, 1); + if (kerror) { reply(501, "Can't base 64 decode argument to %s command (%s)", mic ? "MIC" : "ENC", radix_error(kerror)); *s = '\0'; @@ -1186,6 +1190,7 @@ toolong(sig) dologout(1); } +static int yylex() { static int cpos, state; @@ -1408,6 +1413,7 @@ yylex() } } +void upper(s) register char *s; { @@ -1431,6 +1437,7 @@ copy(s) return (p); } +void help(ctab, s) struct tab *ctab; char *s; @@ -1495,6 +1502,7 @@ help(ctab, s) c->name, c->help); } +void sizecmd(filename) char *filename; { @@ -1506,7 +1514,7 @@ char *filename; (stbuf.st_mode&S_IFMT) != S_IFREG) reply(550, "%s: not a plain file.", filename); else - reply(213, "%lu", stbuf.st_size); + reply(213, "%lu", (long) stbuf.st_size); break;} case TYPE_A: { FILE *fin; diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index 717fdd09a..c19f6207e 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -53,7 +53,6 @@ static char sccsid[] = "@(#)ftpd.c 5.40 (Berkeley) 7/2/91"; #endif #include #include - #include #include #include @@ -71,6 +70,7 @@ static char sccsid[] = "@(#)ftpd.c 5.40 (Berkeley) 7/2/91"; #ifdef HAVE_SHADOW #include #endif +#include #include #ifndef POSIX_SETJMP #undef sigjmp_buf @@ -120,21 +120,10 @@ extern char *mktemp (); #include -#ifdef STDARG -extern reply(int, char *, ...) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) - __attribute__ ((__format__ (__printf__, 2, 3))) -#endif - ; -extern lreply(int, char *, ...) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) - __attribute__ ((__format__ (__printf__, 2, 3))) -#endif - ; -#endif - #ifdef KRB5_KRB4_COMPAT +#include #include +#include AUTH_DAT kdata; KTEXT_ST ticket; @@ -154,6 +143,10 @@ static char *gss_services[] = { "ftp", "host", NULL }; #include krb5_context kcontext; krb5_ccache ccache; + +static void ftpd_gss_convert_creds(char *name, gss_cred_id_t); +static int ftpd_gss_userok(gss_buffer_t, char *name); + #endif /* GSSAPI */ char *auth_type; /* Authentication succeeded? If so, what type? */ @@ -166,6 +159,9 @@ int have_creds; /* User has credentials on disk */ * NOT to be used on this machine. * Commonly used to disallow uucp. */ +#include "ftpd_var.h" +#include "secure.h" + extern int errno; extern char *crypt(); extern char version[]; @@ -249,6 +245,13 @@ void send_data(FILE *instr, FILE *outstr, off_t blksize); void send_data(); FILE *dataconn(); #endif +static void dolog(struct sockaddr_in *); +static int receive_data(FILE *, FILE *); +static void login(char *passwd); +static void end_login(void); +static int disallowed_user(char *); +static int restricted_user(char *); +static int checkuser(char *); #ifdef SETPROCTITLE char **Argv = NULL; /* pointer to argument vector */ @@ -272,6 +275,7 @@ int stripdomain = 1; int maxhostlen = 0; int always_ip = 0; +int main(argc, argv, envp) int argc; char *argv[]; @@ -657,6 +661,7 @@ path_expand(path) /* * Set data channel protection level */ +void setdlevel(prot_level) int prot_level; { @@ -694,6 +699,7 @@ int askpasswd; /* had user command, ask for passwd */ * "restrict." Restricted users are allowed to login, but a chroot() is * done to their home directory. */ +void user(name) char *name; { @@ -735,7 +741,8 @@ user(name) return; } - if (pw = sgetpwnam(name)) { + pw = sgetpwnam(name); + if (pw) { if ((shell = pw->pw_shell) == NULL || *shell == 0) shell = "/bin/sh"; #ifdef HAVE_GETUSERSHELL @@ -775,7 +782,8 @@ user(name) name = "[username too long]"; } sprintf(buf, "GSSAPI user %s is%s authorized as %s", - client_name.value, authorized ? "" : " not", + (char *) client_name.value, + authorized ? "" : " not", name); } #ifdef KRB5_KRB4_COMPAT @@ -841,6 +849,7 @@ user(name) * Return 1 if they are (a disallowed user), -1 if their username * is followed by "restrict." (a restricted user). Otherwise return 0. */ +static int checkuser(name) char *name; { @@ -878,12 +887,14 @@ checkuser(name) return (0); } +static int disallowed_user(name) char *name; { return(checkuser(name) == 1); } +static int restricted_user(name) char *name; { @@ -894,6 +905,7 @@ restricted_user(name) * Terminate login as previous user, if any, resetting state; * used when USER command is given or login fails. */ +static void end_login() { @@ -914,11 +926,11 @@ end_login() guest = 0; } +static int kpass(name, passwd) char *name, *passwd; { #ifdef GSSAPI - krb5_error_code code; krb5_principal server, me; krb5_creds my_creds; krb5_timestamp now; @@ -943,7 +955,7 @@ char *name, *passwd; return 0; my_creds.client = me; - sprintf(ccname, "FILE:/tmp/krb5cc_ftpd%d", getpid()); + sprintf(ccname, "FILE:/tmp/krb5cc_ftpd%ld", (long) getpid()); if (krb5_cc_resolve(kcontext, ccname, &ccache)) return(0); if (krb5_cc_initialize(kcontext, ccache, me)) @@ -982,7 +994,7 @@ char *name, *passwd; if (krb_get_lrealm(realm, 1) != KSUCCESS) goto nuke_ccache; - sprintf(ccname, "%s_ftpd%d", TKT_ROOT, getpid()); + sprintf(ccname, "%s_ftpd%ld", TKT_ROOT, (long) getpid()); krb_set_tkt_string(ccname); if (krb_get_pw_in_tkt(name, "", realm, "krbtgt", realm, 1, passwd)) @@ -1036,6 +1048,7 @@ nuke_ccache: return(0); } +void pass(passwd) char *passwd; { @@ -1092,6 +1105,7 @@ pass(passwd) return; } +static void login(passwd) char *passwd; { @@ -1109,7 +1123,7 @@ login(passwd) (void) initgroups(pw->pw_name, pw->pw_gid); /* open wtmp before chroot */ - (void) sprintf(ttyline, "ftp%d", getpid()); + (void) sprintf(ttyline, "ftp%ld", (long) getpid()); pty_logwtmp(ttyline, pw->pw_name, rhost_sane); logged_in = 1; @@ -1188,6 +1202,7 @@ bad: end_login(); } +void retrieve(cmd, name) char *cmd, *name; { @@ -1261,6 +1276,7 @@ done: syslog(LOG_NOTICE, "get: %i bytes transferred", byte_count); } +void store_file(name, mode, unique) char *name, *mode; int unique; @@ -1451,9 +1467,11 @@ dataconn(name, size, mode) * FTP_BUFSIZ */ #ifdef STDARG +void secure_error(char *fmt, ...) #else /* VARARGS1 */ +void secure_error(fmt, p1, p2, p3, p4, p5) char *fmt; #endif @@ -1564,6 +1582,7 @@ file_err: * * N.B.: Form isn't handled. */ +static int receive_data(instr, outstr) FILE *instr, *outstr; { @@ -1644,6 +1663,7 @@ file_err: return (-1); } +void statfilecmd(filename) char *filename; { @@ -1697,13 +1717,14 @@ statfilecmd(filename) reply(211, "End of Status"); } +void statcmd() { struct sockaddr_in *sin; u_char *a, *p; char str[FTP_BUFSIZ]; - lreply(211, "%s FTP server status:", hostname, version); + lreply(211, "%s FTP server status:", hostname); reply(0, " %s", version); sprintf(str, " Connected to %s", remotehost[0] ? remotehost : ""); sprintf(&str[strlen(str)], " (%s)", rhost_addra); @@ -1760,6 +1781,7 @@ printaddr: reply(211, "End of status"); } +void fatal(s) char *s; { @@ -1776,9 +1798,11 @@ char cont_char = ' '; * FTP_BUFSIZ bytes for now. */ #ifdef STDARG +void reply(int n, char *fmt, ...) #else /* VARARGS2 */ +void reply(n, fmt, p0, p1, p2, p3, p4, p5) int n; char *fmt; @@ -1868,7 +1892,7 @@ reply(n, fmt, p0, p1, p2, p3, p4, p5) if (length >= sizeof(in) / 4 * 3) { syslog(LOG_ERR, "input to radix_encode too long"); fputs(in, stdout); - } else if (kerror = radix_encode(out, in, &length, 0)) { + } else if ((kerror = radix_encode(out, in, &length, 0))) { syslog(LOG_ERR, "Couldn't encode reply (%s)", radix_error(kerror)); fputs(in,stdout); @@ -1892,9 +1916,11 @@ reply(n, fmt, p0, p1, p2, p3, p4, p5) * FTP_BUFSIZ */ #ifdef STDARG +void lreply(int n, char *fmt, ...) #else /* VARARGS2 */ +void lreply(n, fmt, p0, p1, p2, p3, p4, p5) int n; char *fmt; @@ -1915,12 +1941,14 @@ lreply(n, fmt, p0, p1, p2, p3, p4, p5) cont_char = ' '; } +void ack(s) char *s; { reply(250, "%s command successful.", s); } +void nack(s) char *s; { @@ -1928,17 +1956,21 @@ nack(s) } /* ARGSUSED */ +void yyerror(s) char *s; { char *cp; - if (cp = strchr(cbuf,'\n')) + cp = strchr(cbuf,'\n'); + if (cp) *cp = '\0'; reply(500, "'%.*s': command not understood.", - FTP_BUFSIZ - sizeof("'': command not understood."), cbuf); + (int) (FTP_BUFSIZ - sizeof("'': command not understood.")), + cbuf); } +void delete_file(name) char *name; { @@ -1965,6 +1997,7 @@ done: ack("DELE"); } +void cwd(path) char *path; { @@ -1974,6 +2007,7 @@ cwd(path) ack("CWD"); } +void makedir(name) char *name; { @@ -1985,6 +2019,7 @@ makedir(name) reply(257, "MKD command successful."); } +void removedir(name) char *name; { @@ -1996,6 +2031,7 @@ removedir(name) ack("RMD"); } +void pwd() { if (getcwd(pathbuf, sizeof pathbuf) == (char *)NULL) @@ -2022,6 +2058,7 @@ renamefrom(name) return (name); } +void renamecmd(from, to) char *from, *to; { @@ -2034,6 +2071,7 @@ renamecmd(from, to) ack("RNTO"); } +static void dolog(sin) struct sockaddr_in *sin; { @@ -2073,6 +2111,7 @@ dolog(sin) * Record logout in wtmp file * and exit with supplied status. */ +void dologout(status) int status; { @@ -2120,9 +2159,11 @@ myoob() if (strcmp(cp, "STAT") == 0) { if (file_size != (off_t) -1) reply(213, "Status: %lu of %lu bytes transferred", - byte_count, file_size); + (unsigned long) byte_count, + (unsigned long) file_size); else - reply(213, "Status: %lu bytes transferred", byte_count); + reply(213, "Status: %lu bytes transferred", + (unsigned long) byte_count); } } @@ -2132,6 +2173,7 @@ myoob() * a legitimate response by Jon Postel in a telephone conversation * with Rick Adams on 25 Jan 89. */ +void passive() { int len; @@ -2209,6 +2251,7 @@ gunique(local) /* * Format and send reply containing system error number. */ +void perror_reply(code, string) int code; char *string; @@ -2226,12 +2269,13 @@ perror_reply(code, string) */ if (strlen(string) + extra_len > FTP_BUFSIZ) { reply(code, "(truncated)%.*s: %s.", - FTP_BUFSIZ - extra_len, string, err_string); + (int) (FTP_BUFSIZ - extra_len), string, err_string); } else { reply(code, "%s: %s.", string, err_string); } } +void auth(type) char *type; { @@ -2254,12 +2298,12 @@ char *type; reply(504, "Unknown authentication type: %s", type); } +int auth_data(data) char *data; { int kerror, length; #ifdef KRB5_KRB4_COMPAT - int i; static char **service=NULL; char instance[INST_SZ]; u_long cksum; @@ -2277,7 +2321,8 @@ char *data; } #ifdef KRB5_KRB4_COMPAT if (strcmp(temp_auth_type, "KERBEROS_V4") == 0) { - if (kerror = radix_encode(data, out_buf, &length, 1)) { + kerror = radix_encode(data, out_buf, &length, 1); + if (kerror) { reply(501, "Couldn't decode ADAT (%s)", radix_error(kerror)); syslog(LOG_ERR, "Couldn't decode ADAT (%s)", @@ -2315,7 +2360,9 @@ char *data; secure_error("ADAT: reply too long"); return(0); } - if (kerror = radix_encode(out_buf, buf, &length, 0)) { + + kerror = radix_encode(out_buf, buf, &length, 0); + if (kerror) { secure_error("Couldn't encode ADAT reply (%s)", radix_error(kerror)); return(0); @@ -2357,7 +2404,8 @@ char *data; chan.application_data.length = 0; chan.application_data.value = 0; - if (kerror = radix_encode(data, gout_buf, &length, 1)) { + kerror = radix_encode(data, gout_buf, &length, 1); + if (kerror) { reply(501, "Couldn't decode ADAT (%s)", radix_error(kerror)); syslog(LOG_ERR, "Couldn't decode ADAT (%s)", @@ -2459,7 +2507,9 @@ char *data; &deleg_creds); return(0); } - if (kerror = radix_encode(out_tok.value, gbuf, &out_tok.length, 0)) { + kerror = radix_encode(out_tok.value, gbuf, + &out_tok.length, 0); + if (kerror) { secure_error("Couldn't encode ADAT reply (%s)", radix_error(kerror)); syslog(LOG_ERR, "couldn't encode ADAT reply"); @@ -2546,6 +2596,7 @@ char *data; #endif /* GSSAPI */ /* Other auth types go here ... */ /* Also need to check authorization, but that is done in user() */ + return(0); } static char *onefile[] = { @@ -2562,8 +2613,10 @@ static char *onefile[] = { * FTP_BUFSIZ */ #ifdef STDARG +int secure_fprintf(FILE *stream, char *fmt, ...) #else +int secure_fprintf(stream, fmt, p1, p2, p3, p4, p5) FILE *stream; char *fmt; @@ -2591,6 +2644,7 @@ char *fmt; #endif } +void send_file_list(whichfiles) char *whichfiles; { @@ -2629,7 +2683,7 @@ send_file_list(whichfiles) (void)secure_flush(fileno(dout)); return; } - while (dirname = *dirlist++) { + while ((dirname = *dirlist++)) { if (stat(dirname, &st) < 0) { /* * If user typed "ls -l", etc, and the client @@ -2769,6 +2823,7 @@ char *buf; #endif /* SETPROCTITLE */ #ifdef GSSAPI +void reply_gss_error(code, maj_stat, min_stat, s) int code; OM_uint32 maj_stat, min_stat; @@ -2811,6 +2866,7 @@ char *s; reply(code, "GSSAPI error: %s", s); } +void secure_gss_error(maj_stat, min_stat, s) OM_uint32 maj_stat, min_stat; char *s; @@ -2821,6 +2877,7 @@ char *s; /* ftpd_gss_userok -- hide details of getting the name and verifying it */ /* returns 0 for OK */ +static int ftpd_gss_userok(client_name, name) gss_buffer_t client_name; char *name; @@ -2840,6 +2897,7 @@ ftpd_gss_userok(client_name, name) /* ftpd_gss_convert_creds -- write out forwarded creds */ /* (code lifted from login.krb5) */ +static void ftpd_gss_convert_creds(name, creds) char *name; gss_cred_id_t creds; @@ -2857,7 +2915,7 @@ ftpd_gss_convert_creds(name, creds) if (krb5_parse_name(kcontext, name, &me)) return; - sprintf(ccname, "FILE:/tmp/krb5cc_ftpd%d", getpid()); + sprintf(ccname, "FILE:/tmp/krb5cc_ftpd%ld", (long) getpid()); if (krb5_cc_resolve(kcontext, ccname, &ccache)) return; if (krb5_cc_initialize(kcontext, ccache, me)) @@ -2890,7 +2948,7 @@ ftpd_gss_convert_creds(name, creds) if (krb524_convert_creds_kdc(kcontext, v5creds, &v4creds)) goto cleanup; - sprintf(ccname, "%s_ftpd%d", TKT_ROOT, getpid()); + sprintf(ccname, "%s_ftpd%ld", TKT_ROOT, (long) getpid()); krb_set_tkt_string(ccname); if (in_tkt(v4creds.pname, v4creds.pinst) != KSUCCESS) diff --git a/src/appl/gssftp/ftpd/ftpd_var.h b/src/appl/gssftp/ftpd/ftpd_var.h new file mode 100644 index 000000000..12c4e853f --- /dev/null +++ b/src/appl/gssftp/ftpd/ftpd_var.h @@ -0,0 +1,93 @@ +/* + * appl/gssftp/ftpd/ftp_var.h + * + * Copyright 2001 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * + * Prototypes for various functions in the ftpd sources. + */ + +#ifndef FTPD_VAR_H__ +#define FTPD_VAR_H__ + +/* Prototypes */ + +#ifdef GSSAPI +#include +#include +#endif + +/* radix.c */ +char *radix_error PROTOTYPE((int)); +int radix_encode PROTOTYPE((unsigned char *, unsigned char *, int *, int)); + +/* ftpd.c */ +void ack(char *); +int auth_data(char *); +void auth(char *); +void cwd(char *); +void delete_file(char *); +void dologout(int); +void fatal(char *); +void makedir(char *); +void nack(char *); +void pass(char *); +void passive(void); +void perror_reply(int, char *); +void pwd(void); +void removedir(char *); +void renamecmd(char *, char *); +void retrieve(char *, char *); +void send_file_list(char *); +void setdlevel(int); +void statcmd(); +void statfilecmd(char *); +void store_file(char *, char *, int); +void user(char *); +void yyerror(char *); + +#ifdef GSSAPI +void +reply_gss_error(int, OM_uint32, OM_uint32, char *); +#endif + + +#if defined(STDARG) || (defined(__STDC__) && ! defined(VARARGS)) || defined(HAVE_STDARG_H) +extern void reply(int, char *, ...) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) + __attribute__ ((__format__ (__printf__, 2, 3))) +#endif + ; +extern void lreply(int, char *, ...) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) + __attribute__ ((__format__ (__printf__, 2, 3))) +#endif + ; +#endif + + +/* ftpcmd.y */ +void upper(char *); + +#endif /* FTPD_VAR_H__ */ + diff --git a/src/appl/gssftp/ftpd/popen.c b/src/appl/gssftp/ftpd/popen.c index d26746107..c594504fd 100644 --- a/src/appl/gssftp/ftpd/popen.c +++ b/src/appl/gssftp/ftpd/popen.c @@ -70,8 +70,9 @@ ftpd_popen(program, type) int argc, gargc, pdes[2], pid; char **pop, *argv[MAX_ARGV], *gargv[MAX_GARGV], *vv[2]; extern char **ftpglob(), **copyblk(); + extern void blkfree(char **); - if (*type != 'r' && *type != 'w' || type[1]) + if ((*type != 'r' && *type != 'w') || type[1]) return(NULL); if (!pids) { @@ -148,6 +149,7 @@ pfree: for (argc = 1; argv[argc] != NULL; argc++) { return(iop); } +int ftpd_pclose(iop) FILE *iop; {