From d91d50a1fa086545bcf44a9ec9afa5e9786ec935 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 14 Oct 1996 12:00:58 +0000 Subject: [PATCH] * ftpd.c (secure_fprintf): Use STDARG routines if present. [krb5-appl/108] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9168 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/ChangeLog | 5 +++++ src/appl/gssftp/ftpd/ftpd.c | 28 +++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index a510b6b44..9b7f36cf6 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 14 07:54:17 1996 Ezra Peisach + + * ftpd.c (secure_fprintf): Use STDARG routines if + present. [krb5-appl/108] + Tue Sep 10 14:07:36 1996 Tom Yu * ftpd.M: remove ".so man1/header.doc" diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index 046077099..df29b8f1d 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -2078,16 +2078,34 @@ static char *onefile[] = { * -1 on error * -2 on security error */ +#ifdef STDARG +secure_fprintf(FILE *stream, char *fmt, ...) +#else secure_fprintf(stream, fmt, p1, p2, p3, p4, p5) FILE *stream; char *fmt; +#endif { - char s[FTP_BUFSIZ]; + char s[FTP_BUFSIZ]; + int rval; +#ifdef STDARG + va_list ap; - if (level == PROT_C) - return(fprintf(stream, fmt, p1, p2, p3, p4, p5)); - sprintf(s, fmt, p1, p2, p3, p4, p5); - return(secure_write(fileno(stream), s, strlen(s))); + va_start(ap, fmt); + if (level == PROT_C) rval = vfprintf(stream, fmt, ap); + else { + vsprintf(s, fmt, ap); + rval = secure_write(fileno(stream), s, strlen(s)); + } + va_end(ap); + + return(rval); +#else + if (level == PROT_C) + return(fprintf(stream, fmt, p1, p2, p3, p4, p5)); + sprintf(s, fmt, p1, p2, p3, p4, p5); + return(secure_write(fileno(stream), s, strlen(s))); +#endif } send_file_list(whichfiles) -- 2.26.2