extern char *mktemp();
#endif
-extern int command(char *, ...);
+extern int command(char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
char *remglob (char **, int);
int another (int *, char ***, char *);
int secure_read (int, char *, unsigned int);
void secure_gss_error (OM_uint32 maj_stat, OM_uint32 min_stat, char *s);
-void secure_error(char *, ...);
+void secure_error(char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
* XXX callers need to limit total length of output string to
* FTP_BUFSIZ
*/
-#ifdef STDARG
void
secure_error(char *fmt, ...)
-#else
-/* VARARGS1 */
-void
-secure_error(fmt, p1, p2, p3, p4, p5)
- char *fmt;
-#endif
{
char buf[FTP_BUFSIZ];
-#ifdef STDARG
va_list ap;
va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
-#else
- sprintf(buf, fmt, p1, p2, p3, p4, p5);
-#endif
reply(535, "%s", buf);
syslog(LOG_ERR, "%s", buf);
}
* XXX callers need to limit total length of output string to
* FTP_BUFSIZ
*/
-#ifdef STDARG
static int
secure_fprintf(FILE *stream, char *fmt, ...)
-#else
-static int
-secure_fprintf(stream, fmt, p1, p2, p3, p4, p5)
-FILE *stream;
-char *fmt;
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 2, 3)))
#endif
+ ;
+
+static int
+secure_fprintf(FILE *stream, char *fmt, ...)
{
char s[FTP_BUFSIZ];
int rval;
-#ifdef STDARG
va_list ap;
va_start(ap, fmt);
if (dlevel == PROT_C) rval = vfprintf(stream, fmt, ap);
else {
- vsprintf(s, fmt, ap);
+ vsnprintf(s, sizeof(s), fmt, ap);
rval = secure_write(fileno(stream), s, strlen(s));
}
va_end(ap);
return(rval);
-#else
- if (dlevel == 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
}
void
int secure_read (int, char *, unsigned int);
void secure_gss_error (OM_uint32 maj_stat, OM_uint32 min_stat, char *s);
-#if defined(STDARG) || (defined(__STDC__) && ! defined(VARARGS)) || defined(HAVE_STDARG_H)
-void secure_error(char *, ...);
-#else
-void secure_error();
+void secure_error(char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
#endif
+ ;
willoption (int),
wontoption (int);
-extern void netprintf (const char *, ...);
-extern void netprintf_urg (const char *fmt, ...);
-extern void netprintf_noflush (const char *fmt, ...);
+extern void netprintf (const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
+extern void netprintf_urg (const char *fmt, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
+extern void netprintf_noflush (const char *fmt, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
extern int netwrite (const unsigned char *, size_t);
extern void netputs (const char *);
*/
static void
netprintf_ext(int noflush, int seturg, const char *fmt, va_list args)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 0)))
+#endif
+ ;
+
+static void
+netprintf_ext(int noflush, int seturg, const char *fmt, va_list args)
{
size_t remain;
size_t maxoutlen;
if (maxoutlen >= sizeof(buf))
return; /* highly unlikely */
-#ifdef HAVE_VSNPRINTF
len = vsnprintf(buf, sizeof(buf), fmt, args);
-#else
- len = vsprintf(buf, fmt, args); /* XXX need to fix for SunOS? */
-#endif
/*
* The return value from sprintf()-like functions may be the
/*
* include/krb5/adm_proto.h
*
- * Copyright 1995 by the Massachusetts Institute of Technology.
+ * Copyright 1995, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
char *,
krb5_boolean);
void krb5_klog_close (krb5_context);
-int krb5_klog_syslog (int, const char *, ...);
+int krb5_klog_syslog (int, const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 2, 3)))
+#endif
+ ;
void krb5_klog_reopen (krb5_context);
/* alt_prof.c */
/*
* include/k5-err.h
*
- * Copyright 2006 Massachusetts Institute of Technology.
+ * Copyright 2006, 2007 Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
void
krb5int_set_error (struct errinfo *ep,
long code,
- const char *fmt, ...);
+ const char *fmt, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 4)))
+#endif
+ ;
void
krb5int_vset_error (struct errinfo *ep, long code,
- const char *fmt, va_list args);
+ const char *fmt, va_list args)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 0)))
+#endif
+ ;
const char *
krb5int_get_error (struct errinfo *ep, long code);
void
/* -*- c -*-
* include/krb5.h
*
- * Copyright 1989,1990,1995,2001, 2003 by the Massachusetts Institute of Technology.
+ * Copyright 1989,1990,1995,2001, 2003, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
/* Error reporting */
void KRB5_CALLCONV_C
-krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...);
+krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 4)))
+#endif
+ ;
void KRB5_CALLCONV
-krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list);
+krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 0)))
+#endif
+ ;
/*
* The behavior of krb5_get_error_message is only defined the first
* time it is called after a failed call to a krb5 function using the
/*
* kdc/kerberos_v4.c
*
- * Copyright 1985, 1986, 1987, 1988,1991 by the Massachusetts Institute
+ * Copyright 1985, 1986, 1987, 1988,1991,2007 by the Massachusetts Institute
* of Technology.
* All Rights Reserved.
*
static int check_princ (char *, char *, int, Principal *,
krb5_keyblock *, int, krb5_deltat *);
-char * v4_klog (int, const char *, ...);
+static char * v4_klog (int, const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 2, 3)))
+#endif
+ ;
#define klog v4_klog
/* take this out when we don't need it anymore */
return(retval);
}
-char * v4_klog( int type, const char *format, ...)
+static char * v4_klog( int type, const char *format, ...)
{
int logpri = LOG_INFO;
va_list pvar;
/*
* lib/kadm/logger.c
*
- * Copyright 1995 by the Massachusetts Institute of Technology.
+ * Copyright 1995, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* profile.
*/
static krb5_context err_context;
+
+static void
+klog_com_err_proc(const char *whoami, long int code, const char *format, va_list ap)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 0)))
+#endif
+ ;
+
static void
klog_com_err_proc(const char *whoami, long int code, const char *format, va_list ap)
{
#endif /* HAVE_SYSLOG */
/* Now format the actual message */
-#if HAVE_VSNPRINTF
vsnprintf(cp, sizeof(outbuf) - (cp - outbuf), actual_format, ap);
-#elif HAVE_VSPRINTF
- vsprintf(cp, actual_format, ap);
-#else /* HAVE_VSPRINTF */
- sprintf(cp, actual_format, ((int *) ap)[0], ((int *) ap)[1],
- ((int *) ap)[2], ((int *) ap)[3],
- ((int *) ap)[4], ((int *) ap)[5]);
-#endif /* HAVE_VSPRINTF */
-
+
/*
* Now that we have the message formatted, perform the output to each
* logging specification.
*/
static int
klog_vsyslog(int priority, const char *format, va_list arglist)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 2, 0)))
+#endif
+ ;
+
+static int
+klog_vsyslog(int priority, const char *format, va_list arglist)
{
char outbuf[KRB5_KLOG_MAX_ERRMSG_SIZE];
int lindex;
syslogp = &outbuf[strlen(outbuf)];
/* Now format the actual message */
-#ifdef HAVE_VSNPRINTF
vsnprintf(syslogp, sizeof(outbuf) - (syslogp - outbuf), format, arglist);
-#elif HAVE_VSPRINTF
- vsprintf(syslogp, format, arglist);
-#else /* HAVE_VSPRINTF */
- sprintf(syslogp, format, ((int *) arglist)[0], ((int *) arglist)[1],
- ((int *) arglist)[2], ((int *) arglist)[3],
- ((int *) arglist)[4], ((int *) arglist)[5]);
-#endif /* HAVE_VSPRINTF */
/*
* If the user did not use krb5_klog_init() instead of dropping
/*
* lib/krb4/krb4int.h
*
- * Copyright 2001-2002 by the Massachusetts Institute of Technology.
+ * Copyright 2001-2002, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
void kset_logfile(char *);
/* log.c */
-void krb_log(const char *, ...);
+void krb_log(const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+ ;
void krb_set_logfile(char *);
/* Public interfaces */
extern void KRB5_CALLCONV_C com_err
- (const char *, errcode_t, const char *, ...);
+ (const char *, errcode_t, const char *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 4)))
+#endif
+ ;
extern void KRB5_CALLCONV com_err_va
(const char *whoami, errcode_t code, const char *fmt,
- va_list ap);
+ va_list ap)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 0)))
+#endif
+ ;
extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV error_message
(errcode_t)
/*@modifies internalState@*/;
void ss_quit __SS_PROTO;
char *ss_current_request();
char *ss_name(int);
-void ss_error (int, long, char const *, ...);
+void ss_error (int, long, char const *, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 3, 4)))
+#endif
+ ;
void ss_perror (int, long, char const *);
int ss_listen (int);
int ss_create_invocation(char *, char *, char *, ss_request_table *, int *);