added __attribute__ ((format (printf)

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1707 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-05-11 11:04:38 +00:00
parent c76c05eb3b
commit 327a4d2bd9
16 changed files with 82 additions and 31 deletions

View File

@@ -93,8 +93,16 @@ void enc(char*);
int auth_read(int, void*, int); int auth_read(int, void*, int);
int auth_write(int, void*, int); int auth_write(int, void*, int);
void auth_vprintf(const char *fmt, va_list ap); void auth_vprintf(const char *fmt, va_list ap)
void auth_printf(const char *fmt, ...); #ifdef __GNUC__
__attribute__ ((format (printf, 1, 0)))
#endif
;
void auth_printf(const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
void new_ftp_command(char *command); void new_ftp_command(char *command);

View File

@@ -65,10 +65,18 @@ int ftpd_pclose(FILE *);
FILE *ftpd_popen(char *, char *, int, int); FILE *ftpd_popen(char *, char *, int, int);
char *getline(char *, int); char *getline(char *, int);
void logwtmp(char *, char *, char *); void logwtmp(char *, char *, char *);
void lreply(int, const char *, ...); void lreply(int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
;
void makedir(char *); void makedir(char *);
void nack(char *); void nack(char *);
void nreply(const char *, ...); void nreply(const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
void pass(char *); void pass(char *);
void passive(void); void passive(void);
void perror_reply(int, char *); void perror_reply(int, char *);
@@ -76,10 +84,18 @@ void pwd(void);
void removedir(char *); void removedir(char *);
void renamecmd(char *, char *); void renamecmd(char *, char *);
char *renamefrom(char *); char *renamefrom(char *);
void reply(int, const char *, ...); void reply(int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
;
void retrieve(char *, char *); void retrieve(char *, char *);
void send_file_list(char *); void send_file_list(char *);
void setproctitle(const char *, ...); void setproctitle(const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
void statcmd(void); void statcmd(void);
void statfilecmd(char *); void statfilecmd(char *);
void do_store(char *, char *, int); void do_store(char *, char *, int);

View File

@@ -1373,7 +1373,7 @@ sizecmd(char *filename)
if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
reply(550, "%s: not a plain file.", filename); reply(550, "%s: not a plain file.", filename);
else else
reply(213, "%qu", stbuf.st_size); reply(213, "%lu", (unsigned long)stbuf.st_size);
break; } break; }
case TYPE_A: { case TYPE_A: {
FILE *fin; FILE *fin;

View File

@@ -1542,6 +1542,13 @@ fatal(char *s)
/* NOTREACHED */ /* NOTREACHED */
} }
static void
int_reply(int, char *, const char *, va_list)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 0)))
#endif
;
static void static void
int_reply(int n, char *c, const char *fmt, va_list ap) int_reply(int n, char *c, const char *fmt, va_list ap)
{ {

View File

@@ -57,6 +57,15 @@ childhandler (int sig)
SIGRETURN(0); SIGRETURN(0);
} }
static void
fatal(int, des_cblock *, des_key_schedule,
struct sockaddr_in *, struct sockaddr_in *,
char *format, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 6, 7)))
#endif
;
static void static void
fatal (int fd, des_cblock *key, des_key_schedule schedule, fatal (int fd, des_cblock *key, des_key_schedule schedule,
struct sockaddr_in *thisaddr, struct sockaddr_in *thisaddr,

View File

@@ -36,8 +36,9 @@ pop_dele (POP *p)
#ifdef DEBUG #ifdef DEBUG
if(p->debug) if(p->debug)
pop_log(p,POP_DEBUG,"Deleting message %u at offset %u of length %u\n", pop_log(p, POP_DEBUG,
mp->number,mp->offset,mp->length); "Deleting message %u at offset %ld of length %ld\n",
mp->number, mp->offset, mp->length);
#endif /* DEBUG */ #endif /* DEBUG */
/* Update the messages_deleted and bytes_deleted counters */ /* Update the messages_deleted and bytes_deleted counters */

View File

@@ -71,7 +71,10 @@ pop_dropcopy(POP *p, struct passwd *pwp)
setgid(pwp->pw_gid); setgid(pwp->pw_gid);
} }
#ifdef DEBUG #ifdef DEBUG
if(p->debug)pop_log(p,POP_DEBUG,"uid = %d, gid = %d",getuid(),getgid()); if(p->debug)
pop_log(p, POP_DEBUG,"uid = %u, gid = %u",
(unsigned)getuid(),
(unsigned)getgid());
#endif /* DEBUG */ #endif /* DEBUG */
/* Open for append, this solves the crash recovery problem */ /* Open for append, this solves the crash recovery problem */

View File

@@ -133,7 +133,7 @@ pop_dropinfo(POP *p)
#ifdef DEBUG #ifdef DEBUG
if(p->debug) if(p->debug)
pop_log(p, POP_DEBUG, pop_log(p, POP_DEBUG,
"Msg %d at offset %u being added to list", "Msg %d at offset %ld being added to list",
mp->number, mp->offset); mp->number, mp->offset);
#endif /* DEBUG */ #endif /* DEBUG */
}else if(in_header){ }else if(in_header){
@@ -191,8 +191,8 @@ pop_dropinfo(POP *p)
int i; int i;
for (i = 0, mp = p->mlp; i < p->msg_count; i++, mp++) for (i = 0, mp = p->mlp; i < p->msg_count; i++, mp++)
#ifdef UIDL #ifdef UIDL
pop_log(p,POP_DEBUG, pop_log(p,POP_DEBUG,
"Msg %d at offset %d is %d octets long and has %u lines and id %s.", "Msg %d at offset %ld is %ld octets long and has %u lines and id %s.",
mp->number,mp->offset,mp->length,mp->lines, mp->msg_id); mp->number,mp->offset,mp->length,mp->lines, mp->msg_id);
#else #else
pop_log(p,POP_DEBUG, pop_log(p,POP_DEBUG,

View File

@@ -36,13 +36,14 @@ pop_list (POP *p)
"Message %d has been deleted.",msg_num)); "Message %d has been deleted.",msg_num));
/* Display message information */ /* Display message information */
return (pop_msg(p,POP_SUCCESS,"%u %u",msg_num,mp->length)); return (pop_msg(p,POP_SUCCESS,"%d %ld",msg_num,mp->length));
} }
/* Display the entire list of messages */ /* Display the entire list of messages */
pop_msg(p,POP_SUCCESS, pop_msg(p,POP_SUCCESS,
"%u messages (%u octets)", "%d messages (%ld octets)",
p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); p->msg_count-p->msgs_deleted,
p->drop_size-p->bytes_deleted);
/* Loop through the message information list. Skip deleted messages */ /* Loop through the message information list. Skip deleted messages */
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) { for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {

View File

@@ -93,6 +93,6 @@ pop_pass (POP *p)
/* Authorization completed successfully */ /* Authorization completed successfully */
return (pop_msg (p, POP_SUCCESS, return (pop_msg (p, POP_SUCCESS,
"%s has %d message(s) (%d octets).", "%s has %d message(s) (%ld octets).",
p->user, p->msg_count, p->drop_size)); p->user, p->msg_count, p->drop_size));
} }

View File

@@ -28,6 +28,6 @@ pop_rset (POP *p)
/* Reset the last-message-access flag */ /* Reset the last-message-access flag */
p->last_msg = 0; p->last_msg = 0;
return (pop_msg(p,POP_SUCCESS,"Maildrop has %u messages (%u octets)", return (pop_msg(p,POP_SUCCESS,"Maildrop has %u messages (%ld octets)",
p->msg_count,p->drop_size)); p->msg_count, p->drop_size));
} }

View File

@@ -84,7 +84,7 @@ pop_send(POP *p)
} }
/* Display the number of bytes in the message */ /* Display the number of bytes in the message */
pop_msg(p,POP_SUCCESS,"%u octets",mp->length); pop_msg(p, POP_SUCCESS, "%ld octets", mp->length);
/* Position to the start of the message */ /* Position to the start of the message */
fseek(p->drop,mp->offset,0); fseek(p->drop,mp->offset,0);

View File

@@ -15,10 +15,12 @@ int
pop_stat (POP *p) pop_stat (POP *p)
{ {
#ifdef DEBUG #ifdef DEBUG
if (p->debug) pop_log(p,POP_DEBUG,"%d message(s) (%d octets).", if (p->debug) pop_log(p,POP_DEBUG,"%d message(s) (%ld octets).",
p->msg_count-p->msgs_deleted, p->msg_count-p->msgs_deleted,
p->drop_size-p->bytes_deleted); p->drop_size-p->bytes_deleted);
#endif /* DEBUG */ #endif /* DEBUG */
return (pop_msg (p,POP_SUCCESS, return (pop_msg (p,POP_SUCCESS,
"%u %u",p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted)); "%d %ld",
p->msg_count-p->msgs_deleted,
p->drop_size-p->bytes_deleted));
} }

View File

@@ -74,8 +74,9 @@ pop_uidl (POP *p)
/* Display the entire list of messages */ /* Display the entire list of messages */
pop_msg(p,POP_SUCCESS, pop_msg(p,POP_SUCCESS,
"%u messages (%u octets)", "%d messages (%ld octets)",
p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); p->msg_count-p->msgs_deleted,
p->drop_size-p->bytes_deleted);
/* Loop through the message information list. Skip deleted messages */ /* Loop through the message information list. Skip deleted messages */
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) { for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {

View File

@@ -9,8 +9,9 @@ pop_xover (POP *p)
int i; int i;
pop_msg(p,POP_SUCCESS, pop_msg(p,POP_SUCCESS,
"%u messages (%u octets)", "%d messages (%ld octets)",
p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); p->msg_count-p->msgs_deleted,
p->drop_size-p->bytes_deleted);
/* Loop through the message information list. Skip deleted messages */ /* Loop through the message information list. Skip deleted messages */
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) { for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {

View File

@@ -75,14 +75,16 @@ main (int argc, char **argv)
for (p.CurrentState=auth1;p.CurrentState!=halt&&p.CurrentState!=error;) { for (p.CurrentState=auth1;p.CurrentState!=halt&&p.CurrentState!=error;) {
if (hangup) { if (hangup) {
pop_msg(&p,POP_FAILURE,"POP hangup",p.myhost); pop_msg(&p, POP_FAILURE, "POP hangup: %s", p.myhost);
if (p.CurrentState > auth2 && !pop_updt(&p)) if (p.CurrentState > auth2 && !pop_updt(&p))
pop_msg(&p,POP_FAILURE,"POP mailbox update failed.",p.myhost); pop_msg(&p, POP_FAILURE,
"POP mailbox update failed: %s", p.myhost);
p.CurrentState = error; p.CurrentState = error;
} else if (tgets(message,MAXLINELEN,p.input,pop_timeout) == NULL) { } else if (tgets(message, MAXLINELEN, p.input, pop_timeout) == NULL) {
pop_msg(&p,POP_FAILURE,"POP timeout",p.myhost); pop_msg(&p, POP_FAILURE, "POP timeout: %s", p.myhost);
if (p.CurrentState > auth2 && !pop_updt(&p)) if (p.CurrentState > auth2 && !pop_updt(&p))
pop_msg(&p,POP_FAILURE,"POP mailbox update failed!",p.myhost); pop_msg(&p,POP_FAILURE,
"POP mailbox update failed: %s", p.myhost);
p.CurrentState = error; p.CurrentState = error;
} }
else { else {