From f6df762979437d12004feb37bd1535f4880094ff Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 27 Dec 2000 20:19:52 +0000 Subject: [PATCH] * The size constant "256" which shows up everywhere as a buffer size has now been changed to SIZ. And, SIZ has been defined now as 1024, not 256, because we need 1024 byte buffers for most Internet protocols. --- citadel/ChangeLog | 6 +- citadel/Makefile.in | 10 +- citadel/base64.c | 2 +- citadel/chkpwd.c | 2 +- citadel/citadel.c | 36 +-- citadel/citadel_decls.h | 4 +- citadel/citserver.c | 18 +- citadel/client_chat.c | 18 +- citadel/client_passwords.c | 13 +- citadel/commands.c | 18 +- citadel/commands.h | 4 +- citadel/control.c | 6 +- citadel/database_sleepycat.c | 2 +- citadel/domain.c | 4 +- citadel/dynloader.c | 4 +- citadel/file_ops.c | 28 +-- citadel/html.c | 6 +- citadel/imap_fetch.c | 10 +- citadel/internet_addressing.c | 20 +- citadel/internet_addressing.h | 6 +- citadel/internetmail.c | 4 +- citadel/ipc_c_tcp.c | 10 +- citadel/mailinglist.c | 2 +- citadel/messages.c | 24 +- citadel/mime_parser.c | 22 +- citadel/msgbase.c | 60 ++--- citadel/msgbase.h | 4 +- citadel/netmailer.c | 4 +- citadel/netpoll.c | 6 +- citadel/netproc.c | 2 +- citadel/netsetup.c | 24 +- citadel/policy.c | 4 +- citadel/proxy.c | 416 ---------------------------------- citadel/readlog.c | 6 +- citadel/room_ops.c | 36 +-- citadel/rooms.c | 60 ++--- citadel/routines.c | 14 +- citadel/routines2.c | 68 +++--- citadel/sendcommand.c | 8 +- citadel/serv_bio.c | 8 +- citadel/serv_chat.c | 12 +- citadel/serv_expire.c | 10 +- citadel/serv_imap.c | 18 +- citadel/serv_imap.h | 2 +- citadel/serv_inetcfg.c | 2 +- citadel/serv_info.c | 2 +- citadel/serv_network.c | 18 +- citadel/serv_network.h | 2 +- citadel/serv_pas2.c | 2 +- citadel/serv_pop3.c | 8 +- citadel/serv_rwho.c | 6 +- citadel/serv_smtp.c | 44 ++-- citadel/serv_vandelay.c | 34 +-- citadel/serv_vcard.c | 24 +- citadel/server.h | 10 +- citadel/setup.c | 8 +- citadel/stats.c | 8 +- citadel/support.c | 2 +- citadel/sysconfig.h | 5 + citadel/sysdep.c | 4 +- citadel/tools.c | 5 +- citadel/user_ops.c | 16 +- citadel/userlist.c | 8 +- citadel/whobbs.c | 14 +- 64 files changed, 427 insertions(+), 836 deletions(-) delete mode 100644 citadel/proxy.c diff --git a/citadel/ChangeLog b/citadel/ChangeLog index a1f0afc01..bd410dd3f 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 573.59 2000/12/27 20:19:51 ajc + * The size constant "256" which shows up everywhere as a buffer size has now + been changed to SIZ. And, SIZ has been defined now as 1024, not 256, because + we need 1024 byte buffers for most Internet protocols. + Revision 573.58 2000/12/27 05:09:58 ajc * Added a skeleton IMAP "SEARCH" command (based on the FETCH logic) @@ -2248,4 +2253,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/Makefile.in b/citadel/Makefile.in index c32cd5bdc..8ba00452b 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -41,7 +41,6 @@ SERV_MODULES=modules/serv_chat$(SO) modules/serv_vcard$(SO) \ UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \ stats citmail netpoll mailinglist userlist sendcommand \ base64 qpdecode -PROXY_TARGETS=proxy prefix=@prefix@ srcdir=@srcdir@ @@ -81,7 +80,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \ config.c control.c $(DATABASE) dynloader.c file_ops.c \ housekeeping.c internetmail.c ipc_c_tcp.c locate_host.c \ logging.c mailinglist.c messages.c msgbase.c msgform.c netmailer.c \ - netpoll.c netproc.c netsetup.c policy.c proxy.c rcit.c readlog.c \ + netpoll.c netproc.c netsetup.c policy.c rcit.c readlog.c \ room_ops.c rooms.c routines.c routines2.c serv_chat.c \ serv_info.c serv_test.c setup.c snprintf.c stats.c serv_vcard.c \ support.c sysdep.c tools.c user_ops.c userlist.c serv_expire.c \ @@ -292,9 +291,6 @@ chkpwd: chkpwd.o auth.o config.o netsetup: netsetup.o config.o $(CC) netsetup.o config.o $(LDFLAGS) -o netsetup -proxy: proxy.o ipc_c_tcp.o - $(CC) proxy.o ipc_c_tcp.o $(LDFLAGS) -o proxy $(NETLIBS) - whobbs$(EXEEXT): whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS) $(CC) whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS) $(LDFLAGS) -o whobbs $(NETLIBS) @@ -355,7 +351,7 @@ install-exec: all weekly $(srcdir)/mkinstalldirs $(root)$(prefix)/$$i; \ done @for i in $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \ - $(PROXY_TARGETS) $(SERV_MODULES) ; do \ + $(SERV_MODULES) ; do \ if test -f $$i; then \ echo $(INSTALL) $$i $(root)$(prefix)/$$i; \ $(INSTALL) $$i $(root)$(prefix)/$$i; \ @@ -377,7 +373,7 @@ clean: cleaner: clean rm -f $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \ - modules/*.[ms]o $(PROXY_TARGETS) so_locations + modules/*.[ms]o so_locations distclean: cleaner find . -name '*~' -o -name '.#*' | xargs rm -f diff --git a/citadel/base64.c b/citadel/base64.c index 53965bd43..8addb3826 100644 --- a/citadel/base64.c +++ b/citadel/base64.c @@ -40,7 +40,7 @@ static int inbuf(void) if (ateof) { return FALSE; } - l = fread(iobuf, 1, 256, fi); /* Read input buffer */ + l = fread(iobuf, 1, sizeof iobuf, fi); /* Read input buffer */ if (l <= 0) { if (ferror(fi)) { exit(1); diff --git a/citadel/chkpwd.c b/citadel/chkpwd.c index b96ac7392..efcbb674b 100644 --- a/citadel/chkpwd.c +++ b/citadel/chkpwd.c @@ -23,7 +23,7 @@ int main(void) { uid_t uid; struct passwd *pw; - char buf[256]; + char buf[SIZ]; get_config(); uid = getuid(); diff --git a/citadel/citadel.c b/citadel/citadel.c index 0a152672d..eb965e427 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -60,8 +60,8 @@ struct march *march = NULL; char temp[PATH_MAX]; /* Name of general temp file */ char temp2[PATH_MAX]; /* Name of general temp file */ char tempdir[PATH_MAX]; /* Name of general temp dir */ -char editor_path[256]; /* path to external editor */ -char printcmd[256]; /* print command */ +char editor_path[SIZ]; /* path to external editor */ +char printcmd[SIZ]; /* print command */ int editor_pid = (-1); char fullname[32]; jmp_buf nextbuf; @@ -86,12 +86,12 @@ char sigcaught = 0; char have_xterm = 0; /* are we running on an xterm? */ char rc_username[32]; char rc_password[32]; -char hostbuf[256]; -char portbuf[256]; +char hostbuf[SIZ]; +char portbuf[SIZ]; char rc_floor_mode; char floor_mode; char curr_floor = 0; /* number of current floor */ -char floorlist[128][256]; /* names of floors */ +char floorlist[128][SIZ]; /* names of floors */ char express_msgs = 0; /* express messages waiting! */ int termn8 = 0; /* Set to nonzero to cause a logoff */ @@ -159,7 +159,7 @@ void catch_sigcont(int signum) void formout(char *name) { /* display a file */ - char cmd[256]; + char cmd[SIZ]; snprintf(cmd, sizeof cmd, "MESG %s", name); serv_puts(cmd); serv_gets(cmd); @@ -175,8 +175,8 @@ void formout(char *name) void userlist(char *patn) { - char buf[256]; - char fl[256]; + char buf[SIZ]; + char fl[SIZ]; struct tm *tmbuf; time_t lc; @@ -303,7 +303,7 @@ char *pop_march(int desired_floor) */ void dotgoto(char *towhere, int display_name) { - char aaa[256], bbb[256], psearch[256]; + char aaa[SIZ], bbb[SIZ], psearch[SIZ]; static long ls = 0L; int newmailcount; static int oldmailcount = (-1); @@ -430,7 +430,7 @@ void dotgoto(char *towhere, int display_name) */ void gotonext(void) { - char buf[256]; + char buf[SIZ]; struct march *mptr, *mptr2; char next_room[ROOMNAMELEN]; @@ -490,7 +490,7 @@ void gotonext(void) */ void forget_all_rooms_on(int ffloor) { - char buf[256]; + char buf[SIZ]; struct march *flist, *fptr; printf("Forgetting all rooms on %s...\r", &floorlist[ffloor][0]); @@ -557,7 +557,7 @@ void gotofloor(char *towhere, int mode) { int a, tofloor; struct march *mptr; - char buf[256], targ[256]; + char buf[SIZ], targ[SIZ]; if (floorlist[0][0] == 0) load_floorlist(); @@ -680,7 +680,7 @@ int set_password(void) { char pass1[20]; char pass2[20]; - char buf[256]; + char buf[SIZ]; if (strlen(rc_password) > 0) { strcpy(pass1, rc_password); @@ -742,10 +742,10 @@ void get_serv_info(char *supplied_hostname) */ void who_is_online(int longlist) { - char buf[256], username[256], roomname[256], fromhost[256]; - char flags[256]; - char actual_user[256], actual_room[256], actual_host[256]; - char tbuf[256], clientsoft[256]; + char buf[SIZ], username[SIZ], roomname[SIZ], fromhost[SIZ]; + char flags[SIZ]; + char actual_user[SIZ], actual_room[SIZ], actual_host[SIZ]; + char tbuf[SIZ], clientsoft[SIZ]; time_t timenow = 0; time_t idletime, idlehours, idlemins, idlesecs; int last_session = (-1); @@ -862,7 +862,7 @@ int main(int argc, char **argv) char *sptr, *sptr2; /* USed to extract the nonce */ char hexstring[MD5_HEXSTRING_SIZE]; int stored_password = 0; - char password[256]; + char password[SIZ]; sttybbs(SB_SAVE); /* Store the old terminal parameters */ load_command_set(); /* parse the citadel.rc file */ diff --git a/citadel/citadel_decls.h b/citadel/citadel_decls.h index 9f3833239..9cbff442b 100644 --- a/citadel/citadel_decls.h +++ b/citadel/citadel_decls.h @@ -7,8 +7,8 @@ extern char axlevel; extern char is_room_aide; extern unsigned userflags; extern char sigcaught; -extern char editor_path[256]; -extern char printcmd[256]; +extern char editor_path[SIZ]; +extern char printcmd[SIZ]; extern char have_xterm; extern char rc_username[32]; extern char rc_password[32]; diff --git a/citadel/citserver.c b/citadel/citserver.c index c4bcd50e5..e4d76c02b 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -378,7 +378,7 @@ static int hostnames_match(const char *realname, const char *testname) { */ int is_public_client(char *where) { - char buf[256]; + char buf[SIZ]; FILE *fp; lprintf(9, "Checking whether %s is a public client\n", where); @@ -389,7 +389,7 @@ int is_public_client(char *where) fp = fopen("public_clients","r"); if (fp == NULL) return(0); - while (fgets(buf,256,fp)!=NULL) { + while (fgets(buf, sizeof buf, fp)!=NULL) { while (isspace((buf[strlen(buf)-1]))) buf[strlen(buf)-1] = 0; if (hostnames_match(where,buf)) { @@ -411,8 +411,8 @@ void cmd_iden(char *argbuf) int dev_code; int cli_code; int rev_level; - char desc[256]; - char from_host[256]; + char desc[SIZ]; + char from_host[SIZ]; struct in_addr addr; int do_lookup = 0; @@ -477,8 +477,8 @@ void cmd_iden(char *argbuf) void cmd_mesg(char *mname) { FILE *mfp; - char targ[256]; - char buf[256]; + char targ[SIZ]; + char buf[SIZ]; char *dirs[2]; extract(buf,mname,0); @@ -523,8 +523,8 @@ void cmd_mesg(char *mname) void cmd_emsg(char *mname) { FILE *mfp; - char targ[256]; - char buf[256]; + char targ[SIZ]; + char buf[SIZ]; char *dirs[2]; int a; @@ -829,7 +829,7 @@ void citproto_begin_session() { * This loop recognizes all server commands. */ void do_command_loop(void) { - char cmdbuf[256]; + char cmdbuf[SIZ]; time(&CC->lastcmd); memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ diff --git a/citadel/client_chat.c b/citadel/client_chat.c index 849b94fc3..8a9140296 100644 --- a/citadel/client_chat.c +++ b/citadel/client_chat.c @@ -42,12 +42,12 @@ void getline(char *, int); void chatmode(void) { - char wbuf[256]; - char buf[256]; - char c_user[256]; - char c_text[256]; - char c_room[256]; - char last_user[256]; + char wbuf[SIZ]; + char buf[SIZ]; + char c_user[SIZ]; + char c_text[SIZ]; + char c_room[SIZ]; + char last_user[SIZ]; int send_complete_line; int recv_complete_line; char ch; @@ -217,7 +217,7 @@ void chatmode(void) void page_user() { static char last_paged[32] = ""; - char buf[256], touser[256], msg[256]; + char buf[SIZ], touser[SIZ], msg[SIZ]; FILE *pagefp; strcpy(touser, last_paged); @@ -255,7 +255,7 @@ void page_user() serv_gets(buf); if (buf[0] == '4') { strcpy(last_paged, touser); - while (fgets(buf, 256, pagefp) != NULL) { + while (fgets(buf, sizeof buf, pagefp) != NULL) { buf[strlen(buf) - 1] = 0; serv_puts(buf); } @@ -274,7 +274,7 @@ void page_user() void quiet_mode(void) { int qstate; - char buf[256]; + char buf[SIZ]; serv_puts("DEXP 2"); serv_gets(buf); diff --git a/citadel/client_passwords.c b/citadel/client_passwords.c index 0f13555d5..a70bcc4fa 100644 --- a/citadel/client_passwords.c +++ b/citadel/client_passwords.c @@ -16,6 +16,7 @@ #include #include #include +#include "citadel.h" #include "tools.h" #include "commands.h" @@ -42,9 +43,9 @@ void get_stored_password( char pwfile[PATH_MAX]; FILE *fp; - char buf[256]; - char buf64[256]; - char hostbuf[256], portbuf[256], ubuf[256], pbuf[256]; + char buf[SIZ]; + char buf64[SIZ]; + char hostbuf[SIZ], portbuf[SIZ], ubuf[SIZ], pbuf[SIZ]; strcpy(username, ""); strcpy(password, ""); @@ -83,9 +84,9 @@ void set_stored_password( char pwfile[PATH_MAX]; FILE *fp, *oldfp; - char buf[256]; - char buf64[256]; - char hostbuf[256], portbuf[256], ubuf[256], pbuf[256]; + char buf[SIZ]; + char buf64[SIZ]; + char hostbuf[SIZ], portbuf[SIZ], ubuf[SIZ], pbuf[SIZ]; determine_pwfilename(pwfile); if (strlen(pwfile)==0) return; diff --git a/citadel/commands.c b/citadel/commands.c index 8a2cf2d28..3a67eb77e 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -56,15 +56,15 @@ struct citcmd { int rc_exp_beep; -char rc_exp_cmd[256]; +char rc_exp_cmd[1024]; int rc_allow_attachments; int rc_display_message_numbers; int rc_force_mail_prompts; int rc_remember_passwords; int rc_ansi_color; int num_urls = 0; -char urls[MAXURLS][256]; -char rc_url_cmd[256]; +char urls[MAXURLS][1024]; +char rc_url_cmd[1024]; char *gl_string; int next_lazy_cmd = 5; @@ -183,7 +183,7 @@ void pprintf(const char *format, ...) { */ void print_express(void) { - char buf[256]; + char buf[1024]; FILE *outpipe; time_t timestamp; struct tm *stamp; @@ -314,7 +314,7 @@ void set_keepalives(int s) static time_t idlet = 0; static void really_do_keepalive(void) { - char buf[256]; + char buf[1024]; time(&idlet); if (keepalives_enabled == KA_YES) { @@ -657,7 +657,7 @@ int lkey(void) void load_command_set(void) { FILE *ccfile; - char buf[256]; + char buf[1024]; struct citcmd *cptr; struct citcmd *lastcmd = NULL; int a, d; @@ -701,7 +701,7 @@ void load_command_set(void) perror("commands: cannot open citadel.rc"); logoff(errno); } - while (fgets(buf, 256, ccfile) != NULL) { + while (fgets(buf, sizeof buf, ccfile) != NULL) { while ((strlen(buf) > 0) ? (isspace(buf[strlen(buf) - 1])) : 0) buf[strlen(buf) - 1] = 0; @@ -829,7 +829,7 @@ char *cmd_expand(char *strbuf, int mode) { int a; static char exp[64]; - char buf[256]; + char buf[1024]; strcpy(exp, strbuf); @@ -1409,7 +1409,7 @@ char keymenu(char *menuprompt, char *menustring) { int i, c, a; int choices; int do_prompt = 0; - char buf[256]; + char buf[1024]; int ch; int display_prompt = 1; diff --git a/citadel/commands.h b/citadel/commands.h index 26e870638..9a7067881 100644 --- a/citadel/commands.h +++ b/citadel/commands.h @@ -60,7 +60,7 @@ void pprintf(const char *format, ...); extern int num_urls; -extern char urls[MAXURLS][256]; -extern char rc_url_cmd[256]; +extern char urls[MAXURLS][SIZ]; +extern char rc_url_cmd[SIZ]; extern int lines_printed; extern int rc_remember_passwords; diff --git a/citadel/control.c b/citadel/control.c index 26ea7d330..7666c53ab 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -126,11 +126,11 @@ long get_new_room_number(void) { * Get or set global configuration options */ void cmd_conf(char *argbuf) { - char cmd[256]; - char buf[256]; + char cmd[SIZ]; + char buf[SIZ]; int a; char *confptr; - char confname[256]; + char confname[SIZ]; if (!(CC->logged_in)) { cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN); diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index fd0f2f6c5..f522fd1ae 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -87,7 +87,7 @@ void open_databases(void) { int ret; int i; - char dbfilename[256]; + char dbfilename[SIZ]; u_int32_t flags = 0; lprintf(9, "open_databases() starting\n"); diff --git a/citadel/domain.c b/citadel/domain.c index 52d57665f..89108f653 100644 --- a/citadel/domain.c +++ b/citadel/domain.c @@ -27,8 +27,8 @@ int get_smarthosts(char *mxbuf) { int config_lines; int i; - char buf[256]; - char host[256], type[256]; + char buf[SIZ]; + char host[SIZ], type[SIZ]; int total_smarthosts = 0; if (inetcfg == NULL) return(0); diff --git a/citadel/dynloader.c b/citadel/dynloader.c index 1087be5c5..52ce3e46f 100644 --- a/citadel/dynloader.c +++ b/citadel/dynloader.c @@ -82,7 +82,7 @@ int DLoader_Exec_Cmd(char *cmdbuf) void DLoader_Init(char *pathname) { void *fcn_handle; - char dl_error[256]; + char dl_error[SIZ]; DIR *dir; int i; struct dirent *dptr; @@ -240,7 +240,7 @@ void CtdlRegisterServiceHook(int tcp_port, void (*h_command_function) (void) ) { struct ServiceFunctionHook *newfcn; - char message[256]; + char message[SIZ]; newfcn = (struct ServiceFunctionHook *) mallok(sizeof(struct ServiceFunctionHook)); diff --git a/citadel/file_ops.c b/citadel/file_ops.c index fed2c0d89..7f7da3d5e 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -62,11 +62,11 @@ void cmd_delf(char *filename) */ void cmd_movf(char *cmdbuf) { - char filename[256]; - char pathname[256]; - char newpath[256]; - char newroom[256]; - char buf[256]; + char filename[SIZ]; + char pathname[SIZ]; + char newpath[SIZ]; + char newroom[SIZ]; + char buf[SIZ]; int a; struct quickroom qrbuf; @@ -130,7 +130,7 @@ void cmd_movf(char *cmdbuf) */ void cmd_netf(char *cmdbuf) { - char pathname[256],filename[256],destsys[256],buf[256],outfile[256]; + char pathname[SIZ],filename[SIZ],destsys[SIZ],buf[SIZ],outfile[SIZ]; int a,e; time_t now; FILE *ofp; @@ -229,8 +229,8 @@ void OpenCmdResult(char *filename, char *mime_type) { */ void cmd_open(char *cmdbuf) { - char filename[256]; - char pathname[256]; + char filename[SIZ]; + char pathname[SIZ]; int a; extract(filename,cmdbuf,0); @@ -274,8 +274,8 @@ void cmd_open(char *cmdbuf) */ void cmd_oimg(char *cmdbuf) { - char filename[256]; - char pathname[256]; + char filename[SIZ]; + char pathname[SIZ]; struct usersupp usbuf; char which_user[32]; int which_floor; @@ -390,7 +390,7 @@ void cmd_uopn(char *cmdbuf) void cmd_uimg(char *cmdbuf) { int is_this_for_real; - char basenm[256]; + char basenm[SIZ]; int which_floor; int a; @@ -459,7 +459,7 @@ void cmd_uimg(char *cmdbuf) * close the download file */ void cmd_clos(void) { - char buf[256]; + char buf[SIZ]; if (CC->download_fp == NULL) { cprintf("%d You don't have a download file open.\n",ERROR); @@ -610,7 +610,7 @@ void cmd_writ(char *cmdbuf) */ void cmd_netp(char *cmdbuf) { - char buf[256]; + char buf[SIZ]; extract(buf,cmdbuf,1); if (strcasecmp(buf,config.c_net_password)) { @@ -626,7 +626,7 @@ void cmd_netp(char *cmdbuf) */ void cmd_ndop(char *cmdbuf) { - char pathname[256]; + char pathname[SIZ]; struct stat statbuf; if (strlen(CC->net_node)==0) { diff --git a/citadel/html.c b/citadel/html.c index 5c95524e4..323fa0523 100644 --- a/citadel/html.c +++ b/citadel/html.c @@ -36,8 +36,8 @@ * do_citaformat = set to 1 to indent newlines with spaces */ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) { - char inbuf[256]; - char outbuf[256]; + char inbuf[SIZ]; + char outbuf[SIZ]; char tag[1024]; int done_reading = 0; char *inptr; @@ -50,7 +50,7 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) { strcpy(inbuf, ""); strcpy(outbuf, ""); - outptr = mallok(strlen(inptr) + 256); + outptr = mallok(strlen(inptr) + SIZ); if (outptr == NULL) return NULL; strcpy(outptr, ""); outlen = 0; diff --git a/citadel/imap_fetch.c b/citadel/imap_fetch.c index e97704866..1e1890ef8 100644 --- a/citadel/imap_fetch.c +++ b/citadel/imap_fetch.c @@ -45,7 +45,7 @@ struct imap_fetch_part { - char desired_section[256]; + char desired_section[SIZ]; FILE *output_fp; }; @@ -64,7 +64,7 @@ void imap_fetch_flags(struct CtdlMessage *msg) { } void imap_fetch_internaldate(struct CtdlMessage *msg) { - char buf[256]; + char buf[SIZ]; time_t msgdate; if (msg->cm_fields['T'] != NULL) { @@ -256,7 +256,7 @@ void imap_output_envelope_from(struct CtdlMessage *msg) { * so we don't have to check for that condition like we do elsewhere. */ void imap_fetch_envelope(long msgnum, struct CtdlMessage *msg) { - char datestringbuf[256]; + char datestringbuf[SIZ]; time_t msgdate; char *fieldptr = NULL; @@ -791,7 +791,7 @@ void imap_pick_range(char *range, int is_uid) { */ void imap_fetch(int num_parms, char *parms[]) { char items[1024]; - char *itemlist[256]; + char *itemlist[SIZ]; int num_items; int i; @@ -823,7 +823,7 @@ void imap_fetch(int num_parms, char *parms[]) { */ void imap_uidfetch(int num_parms, char *parms[]) { char items[1024]; - char *itemlist[256]; + char *itemlist[SIZ]; int num_items; int i; int have_uid_item = 0; diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 00fde5ca6..7db812b4a 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -35,8 +35,8 @@ struct trynamebuf { - char buffer1[256]; - char buffer2[256]; + char buffer1[SIZ]; + char buffer2[SIZ]; }; char *inetcfg = NULL; @@ -49,8 +49,8 @@ char *inetcfg = NULL; int CtdlHostAlias(char *fqdn) { int config_lines; int i; - char buf[256]; - char host[256], type[256]; + char buf[SIZ]; + char host[SIZ], type[SIZ]; if (!strcasecmp(fqdn, config.c_fqdn)) return(hostalias_localhost); if (!strcasecmp(fqdn, config.c_nodename)) return(hostalias_localhost); @@ -305,14 +305,14 @@ void try_name(struct usersupp *us, void *data) { */ int convert_internet_address(char *destuser, char *desthost, char *source) { - char user[256]; - char node[256]; - char name[256]; + char user[SIZ]; + char node[SIZ]; + char name[SIZ]; struct quickroom qrbuf; int i; int hostalias; struct trynamebuf tnb; - char buf[256]; + char buf[SIZ]; int passes = 0; char sourcealias[1024]; @@ -400,7 +400,7 @@ int convert_field(struct CtdlMessage *msg, int beg, int end) { int i; int colonpos = (-1); int processed = 0; - char buf[256]; + char buf[SIZ]; char user[1024]; char node[1024]; char name[1024]; @@ -495,7 +495,7 @@ struct CtdlMessage *convert_internet_message(char *rfc822) { struct CtdlMessage *msg; int pos, beg, end; int done; - char buf[256]; + char buf[SIZ]; int converted; msg = mallok(sizeof(struct CtdlMessage)); diff --git a/citadel/internet_addressing.h b/citadel/internet_addressing.h index 1d16aa782..dcdafeaec 100644 --- a/citadel/internet_addressing.h +++ b/citadel/internet_addressing.h @@ -5,9 +5,9 @@ struct internet_address_list { struct internet_address_list *next; - char ial_user[256]; - char ial_node[256]; - char ial_name[256]; + char ial_user[SIZ]; + char ial_node[SIZ]; + char ial_name[SIZ]; }; diff --git a/citadel/internetmail.c b/citadel/internetmail.c index 36dbecc7c..861aeb5c2 100644 --- a/citadel/internetmail.c +++ b/citadel/internetmail.c @@ -41,7 +41,7 @@ void StripLeadingAndTrailingWhitespace(char *str) void LoadInternetConfig(void) { - char ParamName[256], ParamValue[256], buf[256]; + char ParamName[SIZ], ParamValue[SIZ], buf[SIZ]; FILE *conf; int a, eqpos; @@ -51,7 +51,7 @@ void LoadInternetConfig(void) syslog(LOG_NOTICE, "Couldn't load internetmail.config"); exit(1); } - while (fgets(buf, 256, conf) != NULL) { + while (fgets(buf, sizeof buf, conf) != NULL) { if (strlen(buf) > 0) buf[strlen(buf) - 1] = 0; strcpy(ParamName, ""); diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index 9ae19f389..b49c6f1f2 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -272,14 +272,14 @@ void serv_puts(char *buf) void attach_to_server(int argc, char **argv, char *hostbuf, char *portbuf) { int a; - char cithost[256]; + char cithost[SIZ]; int host_copied = 0; - char citport[256]; + char citport[SIZ]; int port_copied = 0; - char socks4[256]; - char buf[256]; + char socks4[SIZ]; + char buf[SIZ]; struct passwd *p; - char sockpath[256]; + char sockpath[SIZ]; strcpy(cithost, DEFAULT_HOST); /* default host */ strcpy(citport, DEFAULT_PORT); /* default port */ diff --git a/citadel/mailinglist.c b/citadel/mailinglist.c index 4c5112fcd..b91d15f1d 100644 --- a/citadel/mailinglist.c +++ b/citadel/mailinglist.c @@ -77,7 +77,7 @@ int main(void) int in_header; int is_good; char listaddr[512]; - char mailcmd[256]; + char mailcmd[SIZ]; FILE *nm; char tempfile[64]; diff --git a/citadel/messages.c b/citadel/messages.c index 778f25ae1..a89e55aba 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -29,7 +29,7 @@ #include "snprintf.h" #endif -#define MAXWORDBUF 256 +#define MAXWORDBUF SIZ #define MAXMSGS 512 struct cittext { @@ -78,7 +78,7 @@ extern int editor_pid; void ka_sigcatch(int signum) { - char buf[256]; + char buf[SIZ]; alarm(S_KEEPALIVE); signal(SIGALRM, ka_sigcatch); serv_puts("NOOP"); @@ -335,10 +335,10 @@ int read_message( long num, /* message number */ char pagin) /* 0 = normal read, 1 = read with pagination, 2 = header */ { - char buf[256]; - char m_subject[256]; - char from[256], node[256], rfca[256]; - char now[256]; + char buf[SIZ]; + char m_subject[SIZ]; + char from[SIZ], node[SIZ], rfca[SIZ]; + char now[SIZ]; int format_type = 0; int fr = 0; int nhdr = 0; @@ -762,7 +762,7 @@ MEABT2: unlink(filename); */ void transmit_message(FILE *fp) { - char buf[256]; + char buf[SIZ]; int ch, a; long msglen; time_t lasttick; @@ -820,7 +820,7 @@ int entmsg(int is_reply, /* nonzero if this was a eply command */ int c) /* */ { char buf[300]; - char cmd[256]; + char cmd[SIZ]; int a, b; int need_recp = 0; int mode; @@ -1027,7 +1027,7 @@ void process_quote(void) void list_urls() { int i; - char cmd[256]; + char cmd[SIZ]; if (num_urls == 0) { printf("There were no URL's in the previous message.\n\n"); @@ -1062,9 +1062,9 @@ void readmsgs( int hold_color = 0; char prtfile[PATH_MAX]; char pagin; - char cmd[256]; + char cmd[SIZ]; char targ[ROOMNAMELEN]; - char filename[256]; + char filename[SIZ]; if (c < 0) b = (MAXMSGS - 1); @@ -1408,7 +1408,7 @@ void edit_system_message(char *which_message) */ void check_message_base(void) { - char buf[256]; + char buf[SIZ]; printf ("Please read the documentation before running this command.\n" diff --git a/citadel/mime_parser.c b/citadel/mime_parser.c index 64e646703..a463b0dbe 100644 --- a/citadel/mime_parser.c +++ b/citadel/mime_parser.c @@ -231,21 +231,21 @@ void the_mime_parser(char *partnum, char *ptr; char *part_start, *part_end; - char buf[256]; - char header[256]; - char boundary[256]; - char startary[256]; - char endary[256]; - char content_type[256]; - char encoding[256]; - char disposition[256]; - char name[256]; - char filename[256]; + char buf[SIZ]; + char header[SIZ]; + char boundary[SIZ]; + char startary[SIZ]; + char endary[SIZ]; + char content_type[SIZ]; + char encoding[SIZ]; + char disposition[SIZ]; + char name[SIZ]; + char filename[SIZ]; int is_multipart; int part_seq = 0; int i; size_t length; - char nested_partnum[256]; + char nested_partnum[SIZ]; lprintf(9, "the_mime_parser() called\n"); ptr = content_start; diff --git a/citadel/msgbase.c b/citadel/msgbase.c index e21bcd22e..4b50a464c 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -385,10 +385,10 @@ int CtdlForEachMessage(int mode, long ref, void cmd_msgs(char *cmdbuf) { int mode = 0; - char which[256]; - char buf[256]; - char tfield[256]; - char tvalue[256]; + char which[SIZ]; + char buf[SIZ]; + char tfield[SIZ]; + char tvalue[SIZ]; int cm_ref = 0; int i; int with_template = 0; @@ -452,7 +452,7 @@ void cmd_msgs(char *cmdbuf) */ void help_subst(char *strbuf, char *source, char *dest) { - char workbuf[256]; + char workbuf[SIZ]; int p; while (p = pattern2(strbuf, source), (p >= 0)) { @@ -499,7 +499,7 @@ void memfmout( int old = 0; CIT_UBYTE ch; char aaa[140]; - char buffer[256]; + char buffer[SIZ]; strcpy(aaa, ""); old = 255; @@ -708,7 +708,7 @@ void CtdlFreeMessage(struct CtdlMessage *msg) if (is_valid_message(msg) == 0) return; - for (i = 0; i < 256; ++i) + for (i = 0; i < SIZ; ++i) if (msg->cm_fields[i] != NULL) { phree(msg->cm_fields[i]); } @@ -845,19 +845,19 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage, int i, k; char buf[1024]; CIT_UBYTE ch; - char allkeys[256]; - char display_name[256]; + char allkeys[SIZ]; + char display_name[SIZ]; char *mptr; char *nl; /* newline string */ /* buffers needed for RFC822 translation */ - char suser[256]; - char luser[256]; - char fuser[256]; - char snode[256]; - char lnode[256]; - char mid[256]; - char datestamp[256]; + char suser[SIZ]; + char luser[SIZ]; + char fuser[SIZ]; + char snode[SIZ]; + char lnode[SIZ]; + char mid[SIZ]; + char datestamp[SIZ]; /* */ sprintf(mid, "%ld", msg_num); @@ -969,7 +969,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage, strcpy(lnode, HUMANNODE); if (mode == MT_RFC822) { cprintf("X-UIDL: %ld%s", msg_num, nl); - for (i = 0; i < 256; ++i) { + for (i = 0; i < SIZ; ++i) { if (TheMessage->cm_fields[i]) { mptr = TheMessage->cm_fields[i]; @@ -1215,7 +1215,7 @@ void cmd_opna(char *cmdbuf) { long msgid; - CtdlAllocUserData(SYM_DESIRED_SECTION, 256); + CtdlAllocUserData(SYM_DESIRED_SECTION, SIZ); msgid = extract_long(cmdbuf, 0); extract(desired_section, cmdbuf, 1); @@ -1359,7 +1359,7 @@ long send_message(struct CtdlMessage *msg, /* pointer to buffer */ { long newmsgid; long retval; - char msgidbuf[256]; + char msgidbuf[SIZ]; struct ser_ret smr; /* Get a new message number */ @@ -1537,8 +1537,8 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */ char hold_rm[ROOMNAMELEN]; char actual_rm[ROOMNAMELEN]; char force_room[ROOMNAMELEN]; - char content_type[256]; /* We have to learn this */ - char recipient[256]; + char content_type[SIZ]; /* We have to learn this */ + char recipient[SIZ]; long newmsgid; char *mptr = NULL; struct usersupp userbuf; @@ -1823,7 +1823,7 @@ char *CtdlReadMessageBody(char *terminator, /* token signalling EOT */ char *exist /* if non-null, append to it; exist is ALWAYS freed */ ) { - char buf[256]; + char buf[SIZ]; int linelen; size_t message_len = 0; size_t buffer_len = 0; @@ -1907,7 +1907,7 @@ struct CtdlMessage *make_message( int a; char dest_node[32]; - char buf[256]; + char buf[SIZ]; struct CtdlMessage *msg; msg = mallok(sizeof(struct CtdlMessage)); @@ -1980,16 +1980,16 @@ struct CtdlMessage *make_message( void cmd_ent0(char *entargs) { int post = 0; - char recipient[256]; + char recipient[SIZ]; int anon_flag = 0; int format_type = 0; - char newusername[256]; + char newusername[SIZ]; struct CtdlMessage *msg; int a, b; int e = 0; int mtsflag = 0; struct usersupp tempUS; - char buf[256]; + char buf[SIZ]; post = extract_int(entargs, 0); extract(recipient, entargs, 1); @@ -2127,7 +2127,7 @@ void cmd_ent0(char *entargs) */ void cmd_ent3(char *entargs) { - char recp[256]; + char recp[SIZ]; int a; int e = 0; int valid_msg = 1; @@ -2338,7 +2338,7 @@ void cmd_dele(char *delstr) void cmd_move(char *args) { long num; - char targ[256]; + char targ[SIZ]; struct quickroom qtemp; int err; int is_copy = 0; @@ -2480,7 +2480,7 @@ void CtdlWriteObject(char *req_room, /* Room to stuff it in */ FILE *fp, *tempfp; char filename[PATH_MAX]; - char cmdbuf[256]; + char cmdbuf[SIZ]; char ch; struct quickroom qrbuf; char roomname[ROOMNAMELEN]; @@ -2579,7 +2579,7 @@ char *CtdlGetSysConfig(char *sysconfname) { long msgnum; char *conf; struct CtdlMessage *msg; - char buf[256]; + char buf[SIZ]; strcpy(hold_rm, CC->quickroom.QRname); if (getroom(&CC->quickroom, SYSCONFIGROOM) != 0) { diff --git a/citadel/msgbase.h b/citadel/msgbase.h index 50db62bfa..c713b8556 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -32,14 +32,14 @@ enum { struct ma_info { - char prefix[256]; /* Prefix for a multipart/alternative */ + char prefix[SIZ]; /* Prefix for a multipart/alternative */ int is_ma; /* Set to 1 if we are using this stuff */ int did_print; /* One alternative has been displayed */ }; struct repl { /* Info for replication checking */ - char extended_id[256]; + char extended_id[SIZ]; time_t highest; }; diff --git a/citadel/netmailer.c b/citadel/netmailer.c index b0a28e200..874e21761 100644 --- a/citadel/netmailer.c +++ b/citadel/netmailer.c @@ -197,8 +197,8 @@ int main(int argc, char **argv) FILE *fp, *rmail; char sbuf[200], rbuf[200], cstr[100], fstr[128]; char nbuf[64], pbuf[128], rmname[128], buf[128]; - char datestamp[256]; - char subject[256]; + char datestamp[SIZ]; + char subject[SIZ]; time_t mid_buf; time_t now; int mlist = 0; diff --git a/citadel/netpoll.c b/citadel/netpoll.c index a8b1a14c8..527c7610f 100644 --- a/citadel/netpoll.c +++ b/citadel/netpoll.c @@ -45,7 +45,7 @@ void receive_spool(void) { long download_len; long bytes_received; - char buf[256]; + char buf[SIZ]; static char pbuf[IGNET_PACKET_SIZE]; char tempfilename[PATH_MAX]; long plen; @@ -95,7 +95,7 @@ void receive_spool(void) */ void transmit_spool(char *remote_nodename) { - char buf[256]; + char buf[SIZ]; char pbuf[4096]; long plen; long bytes_to_write, thisblock; @@ -148,7 +148,7 @@ ABORTUPL: int main(int argc, char **argv) { - char buf[256]; + char buf[SIZ]; char remote_nodename[32]; int a; diff --git a/citadel/netproc.c b/citadel/netproc.c index b614d92ac..6a8877681 100644 --- a/citadel/netproc.c +++ b/citadel/netproc.c @@ -408,7 +408,7 @@ void load_filterlist(void) fp = fopen("./network/filterlist", "r"); if (fp == NULL) return; - while (fgets(sbuf, 256, fp) != NULL) { + while (fgets(sbuf, sizeof sbuf, fp) != NULL) { if (sbuf[0] != '#') { sbuf[strlen(sbuf) - 1] = 0; fbuf = (struct filterlist *) diff --git a/citadel/netsetup.c b/citadel/netsetup.c index 20785aecc..c11df8c4f 100644 --- a/citadel/netsetup.c +++ b/citadel/netsetup.c @@ -21,7 +21,7 @@ struct roomshare { struct netnode { char nn_nodename[32]; - char nn_spoolcmd[256]; + char nn_spoolcmd[SIZ]; struct roomshare *nn_first; }; @@ -33,8 +33,8 @@ struct config config; struct netnode *load_node(char *nodename) { FILE *fp; - char buf[256]; - char filename[256]; + char buf[SIZ]; + char filename[SIZ]; struct netnode *newnn; struct roomshare *newrs; @@ -73,7 +73,7 @@ void save_node(struct netnode *nnptr) { FILE *fp; - char filename[256]; + char filename[SIZ]; struct roomshare *rsptr = NULL; sprintf(filename, "./network/systems/%s", nnptr->nn_nodename); @@ -118,7 +118,7 @@ void display_usage(void) { */ void display_nodelist(void) { FILE *ls; - char buf[256]; + char buf[SIZ]; ls = (FILE *) popen("cd ./network/systems; ls", "r"); if (ls == NULL) { @@ -141,7 +141,7 @@ void display_nodelist(void) { void add_node(char *NewNodeName) { FILE *fp; - char sysfilename[256]; + char sysfilename[SIZ]; sprintf(sysfilename, "./network/systems/%s", NewNodeName); @@ -169,8 +169,8 @@ void add_node(char *NewNodeName) void delete_node(char *NodeName) { FILE *fp; - char sysfilename[256]; - char spooloutfilename[256]; + char sysfilename[SIZ]; + char spooloutfilename[SIZ]; sprintf(sysfilename, "./network/systems/%s", NodeName); sprintf(spooloutfilename, "./network/spoolout/%s", NodeName); @@ -197,8 +197,8 @@ void delete_node(char *NodeName) void do_roomlist(char *NodeName) { FILE *fp; - char sysfilename[256]; - char buf[256]; + char sysfilename[SIZ]; + char buf[SIZ]; sprintf(sysfilename, "./network/systems/%s", NodeName); @@ -225,8 +225,8 @@ void do_roomlist(char *NodeName) void show_spool_cmd(char *NodeName) { FILE *fp; - char sysfilename[256]; - char buf[256]; + char sysfilename[SIZ]; + char buf[SIZ]; sprintf(sysfilename, "./network/systems/%s", NodeName); diff --git a/citadel/policy.c b/citadel/policy.c index 2415c124f..1ae97f38b 100644 --- a/citadel/policy.c +++ b/citadel/policy.c @@ -55,7 +55,7 @@ void GetExpirePolicy(struct ExpirePolicy *epbuf, struct quickroom *qrbuf) { void cmd_gpex(char *argbuf) { struct ExpirePolicy exp; struct floor flbuf; - char which[256]; + char which[SIZ]; extract(which, argbuf, 0); if (!strcasecmp(which, "room")) { @@ -83,7 +83,7 @@ void cmd_gpex(char *argbuf) { void cmd_spex(char *argbuf) { struct ExpirePolicy exp; struct floor flbuf; - char which[256]; + char which[SIZ]; memset(&exp, 0, sizeof(struct ExpirePolicy)); extract(which, argbuf, 0); diff --git a/citadel/proxy.c b/citadel/proxy.c deleted file mode 100644 index c50144286..000000000 --- a/citadel/proxy.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * $Id$ - * - * A partially functional session layer proxy for Citadel - * (c) 1998 by Art Cancro, All Rights Reserved, released under GNU GPL v2 - * NOTE: this isn't finished, so don't use it!! - * - */ - -/* Directory to put the message cache in */ -#define CACHE_DIR "/var/citadelproxy" - -/* Number of days to keep messages in the cache */ -#define CACHE_EXPIRE 60 - -/* Uncomment to enable prefetch */ -/* #define ENABLE_PREFETCH */ - -/* Name and password to use for caching */ -#define PREFETCH_USER_NAME "cypherpunks" -#define PREFETCH_USER_PASSWORD "cypherpunks" - - -#include -#include -#include -#include -#include -#include -#include "citadel.h" - -struct RoomList { - struct RoomList *next; - char roomname[32]; - }; - -struct MsgList { - struct MsgList *next; - long msgnum; - }; - - -/* - * num_parms() - discover number of parameters... - */ -int num_parms(char *source) -{ - int a; - int count = 1; - - for (a=0; a= n) { - strcpy(dest,""); - return; - } - strcpy(buf,source); - if ( (parmnum == 0) && (n == 1) ) { - strcpy(dest,buf); - return; - } - - while (count++ < parmnum) do { - strcpy(buf,&buf[1]); - } while( (strlen(buf)>0) && (buf[0]!='|') ); - if (buf[0]=='|') strcpy(buf,&buf[1]); - for (count = 0; countnext = rl; - rl = rlptr; - extract(rlptr->roomname, buf, 0); - } - - /* Go to each room, fetching new messages */ - while (rl != NULL) { - sprintf(buf, "GOTO %s", rl->roomname); - serv_puts(buf); - serv_gets(buf); - if (buf[0]=='2') { - serv_puts("MSGS NEW"); - serv_gets(buf); - ml = NULL; - if (buf[0]=='1') { - while (serv_gets(buf), strcmp(buf, "000")) { - mlptr = (struct mlptr *) - malloc(sizeof(struct MsgList)); - mlptr->next = ml; - ml = mlptr; - mlptr->msgnum = atol(buf); - } - } - } - - /* Fetch each message */ - while (ml != NULL) { - fetch_message(ml->msgnum); - mlptr = ml; - ml = ml->next; - free(mlptr); - } - - /* Free the room list pointer */ - rlptr = rl; - rl = rl->next; - free(rlptr); - } - - /* Now log out. */ - serv_puts("QUIT"); - exit(0); - } - -void do_msg0(char cmd[]) { - long msgnum; - char filename[32]; - char temp[32]; - char buf[256]; - FILE *fp; - - msgnum = atol(&cmd[5]); - sprintf(filename, "%ld", msgnum); - - /* If the message is cached, use the copy on disk */ - fp = fopen(filename, "r"); - if (fp != NULL) { - printf("%d Cached message %ld:\n", LISTING_FOLLOWS, msgnum); - while (fgets(buf, 256, fp) != NULL) { - buf[strlen(buf)-1]=0; - printf("%s\n", buf); - } - fclose(fp); - printf("000\n"); - fflush(stdout); - } - - /* Otherwise, fetch the message from the server and cache it */ - else { - sprintf(buf, "MSG0 %ld", msgnum); - serv_puts(buf); - serv_gets(buf); - printf("%s\n", buf); - fflush(stdout); - if (buf[0] != '1') { - return; - } - - /* The message is written to a file with a temporary name, in - * order to avoid another user accidentally fetching a - * partially written message from the cache. - */ - sprintf(temp, "%ld.%d", msgnum, getpid()); - fp = fopen(temp, "w"); - while (serv_gets(buf), strcmp(buf, "000")) { - printf("%s\n", buf); - fprintf(fp, "%s\n", buf); - } - printf("%s\n", buf); - fflush(stdout); - fclose(fp); - - /* Now that the message is complete, it can be renamed to the - * filename that the cache manager will recognize it with. - */ - link(temp, filename); - unlink(temp); - } - - } - - -void do_mainloop() { - char cmd[256]; - char resp[256]; - char buf[4096]; - int bytes; - - while(1) { - fflush(stdout); - if (fgets(cmd, 256, stdin) == NULL) { - serv_puts("QUIT"); - exit(1); - } - cmd[strlen(cmd)-1] = 0; - - /* QUIT commands are handled specially */ - if (!strncasecmp(cmd, "QUIT", 4)) { - serv_puts("QUIT"); - printf("%d Proxy says: Bye!\n", OK); - fflush(stdout); - sprintf(buf, - "/usr/bin/find %s -mtime +%d -exec rm -f {} \\; &", - CACHE_DIR, CACHE_EXPIRE); - system(buf); - exit(0); - } - - else if (!strncasecmp(cmd, "CHAT", 4)) { - printf("%d Can't chat through the proxy ... yet.\n", - ERROR); - } - - else if (!strncasecmp(cmd, "MSG0", 4)) { - do_msg0(cmd); - } - - /* Other commands, just pass through. */ - else { - - serv_puts(cmd); - serv_gets(resp); - printf("%s\n", resp); - fflush(stdout); - - /* Simple command-response... */ - if ( (resp[0]=='2')||(resp[0]=='3')||(resp[0]=='5') ) { - } - - /* Textual input... */ - else if (resp[0] == '4') { - do { - if (fgets(buf, 256, stdin) == NULL) { - exit(errno); - } - buf[strlen(buf)-1] = 0; - serv_puts(buf); - } while (strcmp(buf, "000")); - } - - /* Textual output... */ - else if (resp[0] == '1') { - do { - serv_gets(buf); - printf("%s\n", buf); - } while (strcmp(buf, "000")); - } - - /* Binary output... */ - else if (resp[0] == '6') { - bytes = atol(&resp[4]); - serv_read(buf, bytes); - fwrite(buf, bytes, 1, stdout); - fflush(stdout); - } - - /* Binary input... */ - else if (resp[0] == '7') { - bytes = atol(&resp[4]); - fread(buf, bytes, 1, stdin); - serv_write(buf, bytes); - } - - /* chat... */ - else if (resp[0] == '8') { - sleep(2); - serv_puts("/quit"); - do { - fgets(buf, 256, stdin); - buf[strlen(buf)-1] = 0; - serv_puts(buf); - } while (strcmp(buf, "000")); - } - - - } - } - } - - - -void main(int argc, char *argv[]) { - char buf[256]; - int pid; - - /* Create the cache directory. Die on any error *except* EEXIST - * because it's perfectly ok if the cache already exists. - */ - if (mkdir(CACHE_DIR, 0700)!=0) { - if (errno != EEXIST) { - printf("%d Error creating cache directory: %s\n", - ERROR+INTERNAL_ERROR, - strerror(errno)); - exit(errno); - } - } - - /* Now go there */ - if (chdir(CACHE_DIR) != 0) exit(errno); - -#ifdef ENABLE_PREFETCH - pid = fork(); -#endif - attach_to_server(argc, argv, NULL, NULL); -#ifdef ENABLE_PREFETCH - if (pid == 0) do_prefetch(); -#endif - - serv_gets(buf); - strcat(buf, " (VIA PROXY)"); - printf("%s\n", buf); - fflush(stdout); - if (buf[0] != '2') exit(0); - - do_mainloop(); - } diff --git a/citadel/readlog.c b/citadel/readlog.c index 1964f9dc3..4a221b4d8 100644 --- a/citadel/readlog.c +++ b/citadel/readlog.c @@ -21,9 +21,9 @@ main (int argc, char **argv) { time_t LogTime; unsigned int LogType; - char LogName[256]; + char LogName[SIZ]; - char buf[256]; + char buf[SIZ]; char aaa[100]; struct tm *tm; char *tstring; @@ -39,7 +39,7 @@ main (int argc, char **argv) } else { - while (fgets (buf, 256, logfp) != NULL) + while (fgets (buf, sizeof buf, logfp) != NULL) { buf[strlen (buf) - 1] = 0; strcat(buf, " "); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index a879e02a2..e8e0df69b 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -714,9 +714,9 @@ void cmd_goto(char *gargs) int c; int ok = 0; int ra; - char augmented_roomname[256]; - char towhere[256]; - char password[256]; + char augmented_roomname[SIZ]; + char towhere[SIZ]; + char password[SIZ]; if (CtdlAccessCheck(ac_logged_in)) return; @@ -815,9 +815,9 @@ void cmd_whok(void) */ void cmd_rdir(void) { - char buf[256]; - char flnm[256]; - char comment[256]; + char buf[SIZ]; + char flnm[SIZ]; + char comment[SIZ]; FILE *ls, *fd; struct stat statbuf; @@ -849,7 +849,7 @@ void cmd_rdir(void) fd = fopen("/dev/null", "r"); ls = fopen(CC->temp, "r"); - while (fgets(flnm, 256, ls) != NULL) { + while (fgets(flnm, sizeof flnm, ls) != NULL) { flnm[strlen(flnm) - 1] = 0; if (strcasecmp(flnm, "filedir")) { sprintf(buf, "%s/files/%s/%s", @@ -857,7 +857,7 @@ void cmd_rdir(void) stat(buf, &statbuf); strcpy(comment, ""); fseek(fd, 0L, 0); - while ((fgets(buf, 256, fd) != NULL) + while ((fgets(buf, sizeof buf, fd) != NULL) && (strlen(comment) == 0)) { buf[strlen(buf) - 1] = 0; if ((!strncasecmp(buf, flnm, strlen(flnm))) @@ -907,7 +907,7 @@ void cmd_getr(void) */ void cmd_setr(char *args) { - char buf[256]; + char buf[SIZ]; struct floor flbuf; char old_name[ROOMNAMELEN]; int old_floor; @@ -1041,7 +1041,7 @@ void cmd_seta(char *new_ra) { struct usersupp usbuf; long newu; - char buf[256]; + char buf[SIZ]; int post_notice; if (CtdlAccessCheck(ac_room_aide)) return; @@ -1086,7 +1086,7 @@ void assoc_file_name(char *buf, struct quickroom *qrbuf, char *prefix) void cmd_rinf(void) { char filename[128]; - char buf[256]; + char buf[SIZ]; FILE *info_fp; assoc_file_name(filename, &CC->quickroom, "info"); @@ -1097,7 +1097,7 @@ void cmd_rinf(void) return; } cprintf("%d Info:\n", LISTING_FOLLOWS); - while (fgets(buf, 256, info_fp) != NULL) { + while (fgets(buf, sizeof buf, info_fp) != NULL) { if (strlen(buf) > 0) buf[strlen(buf) - 1] = 0; cprintf("%s\n", buf); @@ -1257,11 +1257,11 @@ unsigned create_room(char *new_room_name, void cmd_cre8(char *args) { int cre8_ok; - char new_room_name[256]; + char new_room_name[SIZ]; int new_room_type; - char new_room_pass[256]; + char new_room_pass[SIZ]; int new_room_floor; - char aaa[256]; + char aaa[SIZ]; unsigned newflags; struct quickroom qrbuf; struct floor flbuf; @@ -1363,8 +1363,8 @@ void cmd_cre8(char *args) void cmd_einf(char *ok) { /* enter info file for current room */ FILE *fp; - char infofilename[256]; - char buf[256]; + char infofilename[SIZ]; + char buf[SIZ]; if (CtdlAccessCheck(ac_room_aide)) return; @@ -1428,7 +1428,7 @@ void cmd_lflr(void) */ void cmd_cflr(char *argbuf) { - char new_floor_name[256]; + char new_floor_name[SIZ]; struct floor flbuf; int cflr_ok; int free_slot = (-1); diff --git a/citadel/rooms.c b/citadel/rooms.c index f46a4ee61..3e276edc2 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -65,12 +65,12 @@ extern int ugnum; extern long uglsn; extern char ugname[]; -extern char floorlist[128][256]; +extern char floorlist[128][SIZ]; void load_floorlist(void) { int a; - char buf[256]; + char buf[SIZ]; for (a=0; a<128; ++a) floorlist[a][0] = 0; @@ -155,7 +155,7 @@ int rordercmp(struct roomlisting *r1, struct roomlisting *r2) */ void listrms(char *variety) { - char buf[256]; + char buf[SIZ]; struct roomlisting *rl = NULL; struct roomlisting *rp; @@ -228,7 +228,7 @@ void list_other_floors(void) { */ void knrooms(int kn_floor_mode) { - char buf[256]; + char buf[SIZ]; int a; load_floorlist(); @@ -305,7 +305,7 @@ int set_room_attr(int ibuf, char *prompt, unsigned int sbit) int select_floor(int rfloor) { int a, newfloor; - char floorstr[256]; + char floorstr[SIZ]; if (floor_mode == 1) { if (floorlist[(int)curr_floor][0]==0) load_floorlist(); @@ -313,7 +313,7 @@ int select_floor(int rfloor) do { newfloor = (-1); safestrncpy(floorstr,floorlist[rfloor],sizeof floorstr); - strprompt("Which floor",floorstr,256); + strprompt("Which floor",floorstr,SIZ); for (a=0; a<128; ++a) { if (!strcasecmp(floorstr,&floorlist[a][0])) newfloor = a; @@ -349,7 +349,7 @@ void editthisroom(void) { unsigned rflags; int rbump; char raide[32]; - char buf[256]; + char buf[SIZ]; int rfloor; int rorder; int expire_mode = 0; @@ -512,7 +512,7 @@ void editthisroom(void) { * un-goto the previous room */ void ungoto(void) { - char buf[256]; + char buf[SIZ]; if (!strcmp(ugname,"")) return; snprintf(buf,sizeof buf,"GOTO %s",ugname); @@ -539,14 +539,14 @@ void ungoto(void) { */ void download_to_local_disk(char *supplied_filename, long total_bytes) { - char buf[256]; + char buf[SIZ]; char dbuf[4096]; long transmitted_bytes = 0L; long aa,bb; FILE *savefp; int broken = 0; int packet; - char filename[256]; + char filename[SIZ]; strcpy(filename, supplied_filename); if (strlen(filename)==0) { @@ -556,7 +556,7 @@ void download_to_local_disk(char *supplied_filename, long total_bytes) printf("Enter the name of the directory to save '%s'\n", filename); printf("to, or press return for the current directory.\n"); - newprompt("Directory: ",dbuf,256); + newprompt("Directory: ", dbuf, sizeof dbuf); if (strlen(dbuf)==0) strcpy(dbuf,"."); strcat(dbuf,"/"); strcat(dbuf,filename); @@ -607,10 +607,10 @@ void download_to_local_disk(char *supplied_filename, long total_bytes) */ void download(int proto) { - char buf[256]; - char filename[256]; - char tempname[256]; - char transmit_cmd[256]; + char buf[SIZ]; + char filename[SIZ]; + char tempname[SIZ]; + char transmit_cmd[SIZ]; long total_bytes = 0L; char dbuf[4096]; long transmitted_bytes = 0L; @@ -691,10 +691,10 @@ void download(int proto) * read directory of this room */ void roomdir(void) { - char flnm[256]; + char flnm[SIZ]; char flsz[32]; - char comment[256]; - char buf[256]; + char comment[SIZ]; + char buf[SIZ]; serv_puts("RDIR"); serv_gets(buf); @@ -723,7 +723,7 @@ void roomdir(void) { * add a user to a private room */ void invite(void) { - char aaa[31],bbb[256]; + char aaa[31],bbb[SIZ]; if ((room_flags & QR_PRIVATE)==0) { printf("This is not a private room.\n"); @@ -744,7 +744,7 @@ void invite(void) { * kick a user out of a room */ void kickout(void) { - char aaa[31],bbb[256]; + char aaa[31],bbb[SIZ]; newprompt("Name of user? ",aaa,30); if (aaa[0]==0) return; @@ -780,7 +780,7 @@ void killroom(void) { } void forget(void) { /* forget the current room */ - char cmd[256]; + char cmd[SIZ]; printf("Are you sure you want to forget this room? "); if (yesno()==0) return; @@ -801,7 +801,7 @@ void forget(void) { /* forget the current room */ * create a new room */ void entroom(void) { - char cmd[256]; + char cmd[SIZ]; char new_room_name[ROOMNAMELEN]; int new_room_type; char new_room_pass[10]; @@ -873,7 +873,7 @@ void entroom(void) { void readinfo(void) { /* read info file for current room */ - char cmd[256]; + char cmd[SIZ]; sprintf(cmd,"RINF"); serv_puts(cmd); @@ -891,7 +891,7 @@ void readinfo(void) { /* read info file for current room */ * ho knows room... */ void whoknows(void) { - char buf[256]; + char buf[SIZ]; serv_puts("WHOK"); serv_gets(buf); if (buf[0]!='1') { @@ -907,7 +907,7 @@ void whoknows(void) { void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd) { FILE *fp; - char cmd[256]; + char cmd[SIZ]; int b,cksum,editor_exit; @@ -994,7 +994,7 @@ void enterinfo(void) { /* edit info file for current room */ } void enter_bio(void) { - char cmd[256]; + char cmd[SIZ]; snprintf(cmd,sizeof cmd,"RBIO %s",fullname); do_edit("your Bio",cmd,"NOOP","EBIO"); } @@ -1003,8 +1003,8 @@ void enter_bio(void) { * create a new floor */ void create_floor(void) { - char buf[256]; - char newfloorname[256]; + char buf[SIZ]; + char newfloorname[SIZ]; serv_puts("CFLR xx|0"); serv_gets(buf); @@ -1029,7 +1029,7 @@ void create_floor(void) { * edit the current floor */ void edit_floor(void) { - char buf[256]; + char buf[SIZ]; int expire_mode = 0; int expire_value = 0; @@ -1098,7 +1098,7 @@ void edit_floor(void) { */ void kill_floor(void) { int floornum_to_delete,a; - char buf[256]; + char buf[SIZ]; if (floorlist[(int)curr_floor][0]==0) load_floorlist(); do { diff --git a/citadel/routines.c b/citadel/routines.c index 9166bbb94..00a74088d 100644 --- a/citadel/routines.c +++ b/citadel/routines.c @@ -88,9 +88,9 @@ void hit_any_key(void) { /* hit any key to continue */ */ void edituser(void) { - char buf[256]; - char who[256]; - char pass[256]; + char buf[SIZ]; + char who[SIZ]; + char pass[SIZ]; int flags; int timescalled; int posted; @@ -372,7 +372,7 @@ void progress(long int curr, long int cmax) void locate_host(char *hbuf) { #ifndef HAVE_UTMP_H - char buf[256]; + char buf[SIZ]; FILE *who; int a,b; @@ -381,7 +381,7 @@ void locate_host(char *hbuf) strcpy(hbuf,serv_info.serv_fqdn); return; } - fgets(buf,256,who); + fgets(buf,sizeof buf,who); pclose(who); b = 0; @@ -450,7 +450,7 @@ void locate_host(char *hbuf) * miscellaneous server commands (testing, etc.) */ void misc_server_cmd(char *cmd) { - char buf[256]; + char buf[SIZ]; serv_puts(cmd); serv_gets(buf); @@ -503,7 +503,7 @@ int nukedir(char *dirname) { DIR *dp; struct dirent *d; - char filename[256]; + char filename[SIZ]; dp = opendir(dirname); if (dp == NULL) { diff --git a/citadel/routines2.c b/citadel/routines2.c index fd4fd0104..114fbd08f 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -78,15 +78,15 @@ int room_prompt(int qrflags) void entregis(void) { /* register with name and address */ - char buf[256]; - char tmpname[256]; - char tmpaddr[256]; - char tmpcity[256]; - char tmpstate[256]; - char tmpzip[256]; - char tmpphone[256]; - char tmpemail[256]; - char tmpcountry[256]; + char buf[SIZ]; + char tmpname[SIZ]; + char tmpaddr[SIZ]; + char tmpcity[SIZ]; + char tmpstate[SIZ]; + char tmpzip[SIZ]; + char tmpphone[SIZ]; + char tmpemail[SIZ]; + char tmpcountry[SIZ]; int a; strcpy(tmpname, ""); @@ -152,7 +152,7 @@ void entregis(void) void updatels(void) { /* make all messages old in current room */ - char buf[256]; + char buf[SIZ]; serv_puts("SLRP HIGHEST"); serv_gets(buf); if (buf[0] != '2') @@ -164,7 +164,7 @@ void updatels(void) */ void updatelsa(void) { - char buf[256]; + char buf[SIZ]; sprintf(buf, "SLRP %ld", highest_msg_read); serv_puts(buf); serv_gets(buf); @@ -178,7 +178,7 @@ void updatelsa(void) */ void do_upload(int fd) { - char buf[256]; + char buf[SIZ]; char tbuf[4096]; long transmitted_bytes, total_bytes; int bytes_to_send; @@ -220,10 +220,10 @@ void do_upload(int fd) */ void cli_upload(void) { - char flnm[256]; + char flnm[SIZ]; char desc[151]; - char buf[256]; - char tbuf[256]; + char buf[SIZ]; + char tbuf[SIZ]; int a; int fd; @@ -268,8 +268,8 @@ void cli_upload(void) */ void cli_image_upload(char *keyname) { - char flnm[256]; - char buf[256]; + char flnm[SIZ]; + char buf[SIZ]; int fd; sprintf(buf, "UIMG 0|%s", keyname); @@ -301,9 +301,9 @@ void cli_image_upload(char *keyname) */ void upload(int c) { /* c = upload mode */ - char flnm[256]; + char flnm[SIZ]; char desc[151]; - char buf[256]; + char buf[SIZ]; char tbuf[4096]; int xfer_pid; int a, b; @@ -384,7 +384,7 @@ void upload(int c) sprintf(buf, "cd %s; ls", tempdir); lsfp = popen(buf, "r"); if (lsfp != NULL) { - while (fgets(flnm, 256, lsfp) != NULL) { + while (fgets(flnm, sizeof flnm, lsfp) != NULL) { flnm[strlen(flnm) - 1] = 0; sprintf(buf, "%s/%s", tempdir, flnm); fd = open(buf, O_RDONLY); @@ -427,8 +427,8 @@ void upload(int c) void val_user(char *user, int do_validate) { int a; - char cmd[256]; - char buf[256]; + char cmd[SIZ]; + char buf[SIZ]; int ax = 0; sprintf(cmd, "GREG %s", user); @@ -482,8 +482,8 @@ void val_user(char *user, int do_validate) void validate(void) { /* validate new users */ - char cmd[256]; - char buf[256]; + char cmd[SIZ]; + char buf[SIZ]; int finished = 0; do { @@ -524,7 +524,7 @@ void subshell(void) void deletefile(void) { char filename[32]; - char cmd[256]; + char cmd[SIZ]; newprompt("Filename: ", filename, 31); if (strlen(filename) == 0) @@ -540,7 +540,7 @@ void deletefile(void) */ void netsendfile(void) { - char filename[32], destsys[20], cmd[256]; + char filename[32], destsys[20], cmd[SIZ]; newprompt("Filename: ", filename, 31); if (strlen(filename) == 0) @@ -560,7 +560,7 @@ void movefile(void) { char filename[64]; char newroom[ROOMNAMELEN]; - char cmd[256]; + char cmd[SIZ]; newprompt("Filename: ", filename, 63); if (strlen(filename) == 0) @@ -579,7 +579,7 @@ void movefile(void) */ void list_bio(void) { - char buf[256]; + char buf[SIZ]; int pos = 1; serv_puts("LBIO"); @@ -605,8 +605,8 @@ void list_bio(void) */ void read_bio(void) { - char who[256]; - char buf[256]; + char who[SIZ]; + char buf[SIZ]; do { newprompt("Read bio for who ('?' for list) : ", who, 25); @@ -632,8 +632,8 @@ void read_bio(void) */ void do_system_configuration(void) { - char buf[256]; - char sc[28][256]; + char buf[SIZ]; + char sc[28][SIZ]; int expire_mode = 0; int expire_value = 0; int a; @@ -794,7 +794,7 @@ void get_inet_rec_type(char *buf) { * Internet mail configuration */ void do_internet_configuration(void) { - char buf[256]; + char buf[SIZ]; int num_recs = 0; char **recs = NULL; char ch; @@ -810,7 +810,7 @@ void do_internet_configuration(void) { ++num_recs; if (num_recs == 1) recs = malloc(sizeof(char *)); else recs = realloc(recs, (sizeof(char *)) * num_recs); - recs[num_recs-1] = malloc(256); + recs[num_recs-1] = malloc(SIZ); strcpy(recs[num_recs-1], buf); } diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index 811775535..061d0b44f 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -93,8 +93,8 @@ void logoff(int e) */ void np_attach_to_server(void) { - char hostbuf[256], portbuf[256]; - char buf[256]; + char hostbuf[SIZ], portbuf[SIZ]; + char buf[SIZ]; char *args[] = {"sendcommand", NULL}; @@ -119,8 +119,8 @@ void np_attach_to_server(void) int main(int argc, char **argv) { int a; - char cmd[256]; - char buf[256]; + char cmd[SIZ]; + char buf[SIZ]; strcpy(bbs_home_directory, BBSDIR); diff --git a/citadel/serv_bio.c b/citadel/serv_bio.c index 6ac1f2998..37543c89c 100644 --- a/citadel/serv_bio.c +++ b/citadel/serv_bio.c @@ -42,7 +42,7 @@ * enter user bio */ void cmd_ebio(char *cmdbuf) { - char buf[256]; + char buf[SIZ]; FILE *fp; if (!(CC->logged_in)) { @@ -69,7 +69,7 @@ void cmd_ebio(char *cmdbuf) { void cmd_rbio(char *cmdbuf) { struct usersupp ruser; - char buf[256]; + char buf[SIZ]; FILE *fp; extract(buf,cmdbuf,0); @@ -86,7 +86,7 @@ void cmd_rbio(char *cmdbuf) return; } cprintf("%d \n",LISTING_FOLLOWS); - while (fgets(buf,256,fp)!=NULL) cprintf("%s",buf); + while (fgets(buf,sizeof buf,fp)!=NULL) cprintf("%s",buf); fclose(fp); cprintf("000\n"); } @@ -95,7 +95,7 @@ void cmd_rbio(char *cmdbuf) * list of users who have entered bios */ void cmd_lbio(char *cmdbuf) { - char buf[256]; + char buf[SIZ]; FILE *ls; struct usersupp usbuf; diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index 69acb059d..08a450b48 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -45,7 +45,7 @@ extern struct CitContext *ContextList; void allwrite(char *cmdbuf, int flag, char *username) { FILE *fp; - char bcast[256]; + char bcast[SIZ]; char *un; struct ChatLine *clptr, *clnew; time_t now; @@ -217,7 +217,7 @@ void do_chat_listing(int allflag) void cmd_chat(char *argbuf) { - char cmdbuf[256]; + char cmdbuf[SIZ]; char *un; char *strptr1; int MyLastMsg, ThisLastMsg; @@ -583,8 +583,8 @@ int send_express_message(char *lun, char *x_user, char *x_msg) void cmd_sexp(char *argbuf) { int message_sent = 0; - char x_user[256]; - char x_msg[256]; + char x_user[SIZ]; + char x_msg[SIZ]; char *lun; /* */ char *x_big_msgbuf = NULL; @@ -621,8 +621,8 @@ void cmd_sexp(char *argbuf) } cprintf("%d Transmit message (will deliver to %d users)\n", SEND_LISTING, message_sent); - x_big_msgbuf = mallok(256); - memset(x_big_msgbuf, 0, 256); + x_big_msgbuf = mallok(SIZ); + memset(x_big_msgbuf, 0, SIZ); while (client_gets(x_msg), strcmp(x_msg, "000")) { x_big_msgbuf = reallok(x_big_msgbuf, strlen(x_big_msgbuf) + strlen(x_msg) + 4); diff --git a/citadel/serv_expire.c b/citadel/serv_expire.c index dd1f812e8..2019d5861 100644 --- a/citadel/serv_expire.c +++ b/citadel/serv_expire.c @@ -284,12 +284,12 @@ int PurgeRooms(void) { } - transcript = mallok(256); + transcript = mallok(SIZ); strcpy(transcript, "The following rooms have been auto-purged:\n"); while (RoomPurgeList != NULL) { if (getroom(&qrbuf, RoomPurgeList->name) == 0) { - transcript=reallok(transcript, strlen(transcript)+256); + transcript=reallok(transcript, strlen(transcript)+SIZ); sprintf(&transcript[strlen(transcript)], " %s\n", qrbuf.QRname); delete_room(&qrbuf); @@ -383,11 +383,11 @@ int PurgeUsers(void) { ForEachUser(do_user_purge, NULL); } - transcript = mallok(256); + transcript = mallok(SIZ); strcpy(transcript, "The following users have been auto-purged:\n"); while (UserPurgeList != NULL) { - transcript=reallok(transcript, strlen(transcript)+256); + transcript=reallok(transcript, strlen(transcript)+SIZ); sprintf(&transcript[strlen(transcript)], " %s\n", UserPurgeList->name); purge_user(UserPurgeList->name); @@ -505,7 +505,7 @@ int PurgeVisits(void) { void cmd_expi(char *argbuf) { - char cmd[256]; + char cmd[SIZ]; int retval; if (CtdlAccessCheck(ac_aide)) return; diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index 62a3ba95b..53491a284 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -162,7 +162,7 @@ void imap_login(int num_parms, char *parms[]) { * Implements the AYTHENTICATE command */ void imap_authenticate(int num_parms, char *parms[]) { - char buf[256]; + char buf[SIZ]; if (num_parms != 3) { cprintf("%s BAD incorrect number of parameters\r\n", parms[0]); @@ -184,7 +184,7 @@ void imap_authenticate(int num_parms, char *parms[]) { } void imap_auth_login_user(char *cmd) { - char buf[256]; + char buf[SIZ]; decode_base64(buf, cmd); CtdlLoginExistingUser(buf); @@ -195,7 +195,7 @@ void imap_auth_login_user(char *cmd) { } void imap_auth_login_pass(char *cmd) { - char buf[256]; + char buf[SIZ]; decode_base64(buf, cmd); if (CtdlTryPassword(buf) == pass_ok) { @@ -226,8 +226,8 @@ void imap_capability(int num_parms, char *parms[]) { * implements the SELECT command */ void imap_select(int num_parms, char *parms[]) { - char towhere[256]; - char augmented_roomname[256]; + char towhere[SIZ]; + char augmented_roomname[SIZ]; int c = 0; int ok = 0; int ra = 0; @@ -323,7 +323,7 @@ void imap_close(int num_parms, char *parms[]) { * may or may not be the desired behavior in the future. */ void imap_lsub_listroom(struct quickroom *qrbuf, void *data) { - char buf[256]; + char buf[SIZ]; int ra; /* Only list rooms to which the user has access!! */ @@ -351,7 +351,7 @@ void imap_lsub(int num_parms, char *parms[]) { * Back end for imap_list() */ void imap_list_listroom(struct quickroom *qrbuf, void *data) { - char buf[256]; + char buf[SIZ]; int ra; /* Only list rooms to which the user has access!! */ @@ -380,8 +380,8 @@ void imap_list(int num_parms, char *parms[]) { * Main command loop for IMAP sessions. */ void imap_command_loop(void) { - char cmdbuf[256]; - char *parms[256]; + char cmdbuf[SIZ]; + char *parms[SIZ]; int num_parms; time(&CC->lastcmd); diff --git a/citadel/serv_imap.h b/citadel/serv_imap.h index 217b62f6f..c03ce5376 100644 --- a/citadel/serv_imap.h +++ b/citadel/serv_imap.h @@ -11,7 +11,7 @@ void imap_command_loop(void); struct citimap { int authstate; - char authseq[256]; + char authseq[SIZ]; int selected; /* set to 1 if in the SELECTED state */ int readonly; /* mailbox is open read only */ int num_msgs; /* Number of messages being mapped */ diff --git a/citadel/serv_inetcfg.c b/citadel/serv_inetcfg.c index bedcd965d..922841bbe 100644 --- a/citadel/serv_inetcfg.c +++ b/citadel/serv_inetcfg.c @@ -41,7 +41,7 @@ void inetcfg_setTo(struct CtdlMessage *msg) { char *conf; - char buf[256]; + char buf[SIZ]; if (msg->cm_fields['M']==NULL) return; conf = strdoop(msg->cm_fields['M']); diff --git a/citadel/serv_info.c b/citadel/serv_info.c index 338985523..48c701022 100644 --- a/citadel/serv_info.c +++ b/citadel/serv_info.c @@ -17,7 +17,7 @@ #include "serv_info.h" void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) { - char buf[256]; + char buf[SIZ]; int a; /* fetch info */ diff --git a/citadel/serv_network.c b/citadel/serv_network.c index e4d6ae4bd..9f7382bb2 100644 --- a/citadel/serv_network.c +++ b/citadel/serv_network.c @@ -39,8 +39,8 @@ void cmd_gnet(char *argbuf) { - char filename[256]; - char buf[256]; + char filename[SIZ]; + char buf[SIZ]; FILE *fp; if (CtdlAccessCheck(ac_room_aide)) return; @@ -63,9 +63,9 @@ void cmd_gnet(char *argbuf) { void cmd_snet(char *argbuf) { - char tempfilename[256]; - char filename[256]; - char buf[256]; + char tempfilename[SIZ]; + char filename[SIZ]; + char buf[SIZ]; FILE *fp; if (CtdlAccessCheck(ac_room_aide)) return; @@ -137,7 +137,7 @@ void network_spool_msg(long msgnum, void *userdata) { /* Generate delivery instructions for each recipient */ for (nptr = sc->listrecps; nptr != NULL; nptr = nptr->next) { - if (instr_len - strlen(instr) < 256) { + if (instr_len - strlen(instr) < SIZ) { instr_len = instr_len * 2; instr = reallok(instr, instr_len); } @@ -160,9 +160,9 @@ void network_spool_msg(long msgnum, void *userdata) { * Batch up and send all outbound traffic from the current room */ void network_spoolout_current_room(void) { - char filename[256]; - char buf[256]; - char instr[256]; + char filename[SIZ]; + char buf[SIZ]; + char instr[SIZ]; FILE *fp; struct SpoolControl sc; /* struct namelist *digestrecps = NULL; */ diff --git a/citadel/serv_network.h b/citadel/serv_network.h index 8a8057824..3fed171cf 100644 --- a/citadel/serv_network.h +++ b/citadel/serv_network.h @@ -1,7 +1,7 @@ struct namelist { struct namelist *next; - char name[256]; + char name[SIZ]; }; struct SpoolControl { diff --git a/citadel/serv_pas2.c b/citadel/serv_pas2.c index f5dd1532d..7a38bf0ad 100644 --- a/citadel/serv_pas2.c +++ b/citadel/serv_pas2.c @@ -23,7 +23,7 @@ void cmd_pas2(char *argbuf) { - char pw[256]; + char pw[SIZ]; char hexstring[MD5_HEXSTRING_SIZE]; diff --git a/citadel/serv_pop3.c b/citadel/serv_pop3.c index b8273f897..b658e3edd 100644 --- a/citadel/serv_pop3.c +++ b/citadel/serv_pop3.c @@ -98,7 +98,7 @@ void pop3_greeting(void) { * Specify user name (implements POP3 "USER" command) */ void pop3_user(char *argbuf) { - char username[256]; + char username[SIZ]; if (CC->logged_in) { cprintf("-ERR You are already logged in.\r\n"); @@ -189,7 +189,7 @@ void pop3_login(void) void pop3_apop(char *argbuf) { - char username[256]; + char username[SIZ]; char userdigest[MD5_HEXSTRING_SIZE]; char realdigest[MD5_HEXSTRING_SIZE]; char *sptr; @@ -245,7 +245,7 @@ void pop3_apop(char *argbuf) * Authorize with password (implements POP3 "PASS" command) */ void pop3_pass(char *argbuf) { - char password[256]; + char password[SIZ]; strcpy(password, argbuf); striplt(password); @@ -525,7 +525,7 @@ void pop3_uidl(char *argbuf) { * Main command loop for POP3 sessions. */ void pop3_command_loop(void) { - char cmdbuf[256]; + char cmdbuf[SIZ]; time(&CC->lastcmd); memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ diff --git a/citadel/serv_rwho.c b/citadel/serv_rwho.c index 5f39d9be7..a58380f7f 100644 --- a/citadel/serv_rwho.c +++ b/citadel/serv_rwho.c @@ -150,7 +150,7 @@ void cmd_rwho(char *argbuf) { */ void cmd_rchg(char *argbuf) { - char newroomname[256]; + char newroomname[SIZ]; extract(newroomname, argbuf, 0); newroomname[ROOMNAMELEN-1] = 0; @@ -169,7 +169,7 @@ void cmd_rchg(char *argbuf) */ void cmd_hchg(char *argbuf) { - char newhostname[256]; + char newhostname[SIZ]; extract(newhostname, argbuf, 0); if (strlen(newhostname) > 0) { @@ -189,7 +189,7 @@ void cmd_hchg(char *argbuf) void cmd_uchg(char *argbuf) { - char newusername[256]; + char newusername[SIZ]; extract(newusername, argbuf, 0); diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 0e372056a..927d8206d 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -43,11 +43,11 @@ struct citsmtp { /* Information about the current session */ int command_state; - char helo_node[256]; + char helo_node[SIZ]; struct usersupp vrfy_buffer; int vrfy_count; - char vrfy_match[256]; - char from[256]; + char vrfy_match[SIZ]; + char from[SIZ]; int number_of_recipients; int delivery_mode; int message_originated_locally; @@ -88,7 +88,7 @@ void smtp_greeting(void) { CC->internal_pgm = 1; CC->cs_flags |= CS_STEALTH; CtdlAllocUserData(SYM_SMTP, sizeof(struct citsmtp)); - CtdlAllocUserData(SYM_SMTP_RECP, 256); + CtdlAllocUserData(SYM_SMTP_RECP, SIZ); sprintf(SMTP_RECP, "%s", ""); cprintf("220 Welcome to the Citadel/UX ESMTP server at %s\r\n", @@ -139,8 +139,8 @@ void smtp_help(void) { * */ void smtp_get_user(char *argbuf) { - char buf[256]; - char username[256]; + char buf[SIZ]; + char username[SIZ]; decode_base64(username, argbuf); lprintf(9, "Trying <%s>\n", username); @@ -160,7 +160,7 @@ void smtp_get_user(char *argbuf) { * */ void smtp_get_pass(char *argbuf) { - char password[256]; + char password[SIZ]; decode_base64(password, argbuf); lprintf(9, "Trying <%s>\n", password); @@ -181,7 +181,7 @@ void smtp_get_pass(char *argbuf) { * */ void smtp_auth(char *argbuf) { - char buf[256]; + char buf[SIZ]; if (strncasecmp(argbuf, "login", 5) ) { cprintf("550 We only support LOGIN authentication.\r\n"); @@ -311,8 +311,8 @@ void smtp_data_clear(void) { * Implements the "MAIL From:" command */ void smtp_mail(char *argbuf) { - char user[256]; - char node[256]; + char user[SIZ]; + char node[SIZ]; int cvt; if (strlen(SMTP->from) != 0) { @@ -377,9 +377,9 @@ void smtp_mail(char *argbuf) { */ void smtp_rcpt(char *argbuf) { int cvt; - char user[256]; - char node[256]; - char recp[256]; + char user[SIZ]; + char node[SIZ]; + char recp[SIZ]; if (strlen(SMTP->from) == 0) { cprintf("503 Need MAIL before RCPT\r\n"); @@ -469,7 +469,7 @@ void smtp_deliver_ignet(struct CtdlMessage *msg, char *user, char *dest) { struct ser_ret smr; char *hold_R, *hold_D, *hold_O; FILE *fp; - char filename[256]; + char filename[SIZ]; static int seq = 0; lprintf(9, "smtp_deliver_ignet(msg, %s, %s)\n", user, dest); @@ -622,7 +622,7 @@ void smtp_data(void) { char *body; struct CtdlMessage *msg; int retval; - char nowstamp[256]; + char nowstamp[SIZ]; if (strlen(SMTP->from) == 0) { cprintf("503 Need MAIL command first.\r\n"); @@ -688,7 +688,7 @@ void smtp_data(void) { * Main command loop for SMTP sessions. */ void smtp_command_loop(void) { - char cmdbuf[256]; + char cmdbuf[SIZ]; time(&CC->lastcmd); memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ @@ -786,7 +786,7 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) int num_mxhosts; int mx; int i; - char user[256], node[256], name[256]; + char user[SIZ], node[SIZ], name[SIZ]; char buf[1024]; char mailfrom[1024]; int lp, rp; @@ -867,7 +867,7 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) lprintf(9, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts); if (num_mxhosts < 1) { *status = 5; - snprintf(dsn, 256, "No MX hosts found for <%s>", node); + snprintf(dsn, SIZ, "No MX hosts found for <%s>", node); return; } @@ -875,9 +875,9 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) extract(buf, mxhosts, mx); lprintf(9, "Trying <%s>\n", buf); sock = sock_connect(buf, "25", "tcp"); - snprintf(dsn, 256, "Could not connect: %s", strerror(errno)); + snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno)); if (sock >= 0) lprintf(9, "Connected!\n"); - if (sock < 0) snprintf(dsn, 256, "%s", strerror(errno)); + if (sock < 0) snprintf(dsn, SIZ, "%s", strerror(errno)); if (sock >= 0) break; } @@ -1404,9 +1404,9 @@ void smtp_do_procmsg(long msgnum, void *userdata) { msg->cm_magic = CTDLMESSAGE_MAGIC; msg->cm_anon_type = MES_NORMAL; msg->cm_format_type = FMT_RFC822; - msg->cm_fields['M'] = malloc(strlen(instr)+256); + msg->cm_fields['M'] = malloc(strlen(instr)+SIZ); snprintf(msg->cm_fields['M'], - strlen(instr)+256, + strlen(instr)+SIZ, "Content-type: %s\n\n%s\n" "attempted|%ld\n" "retry|%ld\n", diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 58af5f115..3534a1836 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -35,8 +35,8 @@ #define END_OF_MESSAGE "---eom---dbd---" -char artv_tempfilename1[256]; -char artv_tempfilename2[256]; +char artv_tempfilename1[PATH_MAX]; +char artv_tempfilename2[PATH_MAX]; FILE *artv_global_message_list; void artv_export_users_backend(struct usersupp *usbuf, void *data) { @@ -99,7 +99,7 @@ void artv_export_rooms_backend(struct quickroom *qrbuf, void *data) { void artv_export_rooms(void) { - char cmd[256]; + char cmd[SIZ]; artv_global_message_list = fopen(artv_tempfilename1, "w"); ForEachRoom(artv_export_rooms_backend, NULL); fclose(artv_global_message_list); @@ -168,8 +168,8 @@ void artv_export_message(long msgnum) { struct CtdlMessage *msg; struct ser_ret smr; FILE *fp; - char buf[256]; - char tempfile[256]; + char buf[SIZ]; + char tempfile[SIZ]; msg = CtdlFetchMessage(msgnum); if (msg == NULL) return; /* fail silently */ @@ -206,7 +206,7 @@ void artv_export_message(long msgnum) { void artv_export_messages(void) { - char buf[256]; + char buf[SIZ]; long msgnum; int count = 0; @@ -289,7 +289,7 @@ void artv_do_export(void) { void artv_import_config(void) { - char buf[256]; + char buf[SIZ]; lprintf(9, "Importing config file\n"); client_gets(config.c_nodename); @@ -335,7 +335,7 @@ void artv_import_config(void) { void artv_import_control(void) { - char buf[256]; + char buf[SIZ]; lprintf(9, "Importing control file\n"); client_gets(buf); CitControl.MMhighest = atol(buf); @@ -349,7 +349,7 @@ void artv_import_control(void) { void artv_import_user(void) { - char buf[256]; + char buf[SIZ]; struct usersupp usbuf; client_gets(buf); usbuf.version = atoi(buf); @@ -371,7 +371,7 @@ void artv_import_user(void) { void artv_import_room(void) { - char buf[256]; + char buf[SIZ]; struct quickroom qrbuf; long msgnum; int msgcount = 0; @@ -406,7 +406,7 @@ void artv_import_room(void) { void artv_import_floor(void) { struct floor flbuf; int i; - char buf[256]; + char buf[SIZ]; client_gets(buf); i = atoi(buf); client_gets(buf); flbuf.f_flags = atoi(buf); @@ -423,7 +423,7 @@ void artv_import_floor(void) { */ void artv_import_visit(void) { struct visit vbuf; - char buf[256]; + char buf[SIZ]; client_gets(buf); vbuf.v_roomnum = atol(buf); client_gets(buf); vbuf.v_roomgen = atol(buf); @@ -442,8 +442,8 @@ void artv_import_message(void) { long msgnum; int msglen; FILE *fp; - char buf[256]; - char tempfile[256]; + char buf[SIZ]; + char tempfile[SIZ]; char *mbuf; memset(&smi, 0, sizeof(struct SuppMsgInfo)); @@ -489,8 +489,8 @@ void artv_import_message(void) { void artv_do_import(void) { - char buf[256]; - char s_version[256]; + char buf[SIZ]; + char s_version[SIZ]; int version; cprintf("%d sock it to me\n", SEND_LISTING); @@ -523,7 +523,7 @@ void artv_do_import(void) { void cmd_artv(char *cmdbuf) { - char cmd[256]; + char cmd[SIZ]; static int is_running = 0; if (CtdlAccessCheck(ac_aide)) return; /* FIXME should be intpgm */ diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 6f1efad76..be8d89c84 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -57,7 +57,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) { char *ptr; int linelen; char config_rm[ROOMNAMELEN]; - char buf[256]; + char buf[SIZ]; if (!CC->logged_in) return(0); /* Only do this if logged in. */ @@ -276,15 +276,15 @@ void vcard_write_user(struct usersupp *u, struct vCard *v) { */ void cmd_regi(char *argbuf) { int a,b,c; - char buf[256]; + char buf[SIZ]; struct vCard *my_vcard; - char tmpaddr[256]; - char tmpcity[256]; - char tmpstate[256]; - char tmpzip[256]; - char tmpaddress[512]; - char tmpcountry[256]; + char tmpaddr[SIZ]; + char tmpcity[SIZ]; + char tmpstate[SIZ]; + char tmpzip[SIZ]; + char tmpaddress[SIZ]; + char tmpcountry[SIZ]; if (!(CC->logged_in)) { cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN); @@ -347,9 +347,9 @@ void cmd_greg(char *argbuf) struct usersupp usbuf; struct vCard *v; char *s; - char who[256]; - char adr[256]; - char buf[256]; + char who[SIZ]; + char adr[SIZ]; + char buf[SIZ]; extract(who, argbuf, 0); @@ -420,7 +420,7 @@ void cmd_greg(char *argbuf) */ void vcard_purge(char *username, long usernum) { struct CtdlMessage *msg; - char buf[256]; + char buf[SIZ]; msg = (struct CtdlMessage *) mallok(sizeof(struct CtdlMessage)); if (msg == NULL) return; diff --git a/citadel/server.h b/citadel/server.h index 1e44a2e43..55d81c747 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -87,10 +87,10 @@ struct CitContext { FILE *download_fp; /* Fields relating to file transfer */ FILE *upload_fp; - char upl_file[256]; - char upl_path[256]; - char upl_comment[256]; - char upl_filedir[256]; + char upl_file[SIZ]; + char upl_path[SIZ]; + char upl_comment[SIZ]; + char upl_filedir[SIZ]; char dl_is_net; char upload_type; @@ -150,7 +150,7 @@ struct ChatLine { struct ChatLine *next; int chat_seq; time_t chat_time; - char chat_text[256]; + char chat_text[SIZ]; char chat_username[USERNAME_SIZE]; char chat_room[ROOMNAMELEN]; }; diff --git a/citadel/setup.c b/citadel/setup.c index a64ee0767..fb6cb0333 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -460,8 +460,8 @@ void check_services_entry(void) void check_inittab_entry(void) { FILE *infp; - char buf[256]; - char looking_for[256]; + char buf[SIZ]; + char looking_for[SIZ]; char question[128]; char *ptr; int have_entry = 0; @@ -477,7 +477,7 @@ void check_inittab_entry(void) if (infp == NULL) { return; } else { - while (fgets(buf, 256, infp) != NULL) { + while (fgets(buf, sizeof buf, infp) != NULL) { buf[strlen(buf) - 1] = 0; ptr = strtok(buf, ":"); ptr = strtok(NULL, ":"); @@ -539,7 +539,7 @@ void set_str_val(int msgpos, char str[]) { char buf[4096]; char tempfile[64]; - char setupmsg[256]; + char setupmsg[SIZ]; strcpy(tempfile, tmpnam(NULL)); strcpy(setupmsg, ""); diff --git a/citadel/stats.c b/citadel/stats.c index 214ac436b..c940c054d 100644 --- a/citadel/stats.c +++ b/citadel/stats.c @@ -90,10 +90,10 @@ void progress(long int curr, long int max) int main(int argc, char **argv) { - char hostbuf[256], portbuf[256]; + char hostbuf[SIZ], portbuf[SIZ]; time_t LogTime, now; unsigned int LogType; - char LogName[256]; + char LogName[SIZ]; int a, b, lowest; float p, q; long timeon[72]; @@ -112,7 +112,7 @@ int main(int argc, char **argv) FILE *sortpipe; char thegraph[GRANULARITY][73]; int pc_only = 0; - char buf[256]; + char buf[SIZ]; FILE *logfp; char *fakeargs[4]; @@ -160,7 +160,7 @@ int main(int argc, char **argv) if (!batch_mode) { printf("Scanning call log, please wait...\n"); } - while (fgets(buf, 256, logfp) != NULL) { + while (fgets(buf, sizeof buf, logfp) != NULL) { buf[strlen(buf) - 1] = 0; strcat(buf, "| "); diff --git a/citadel/support.c b/citadel/support.c index 3c068ceda..c876ca218 100644 --- a/citadel/support.c +++ b/citadel/support.c @@ -102,7 +102,7 @@ int pattern2(char *search, char *patn) void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs) { int a; - char buf[256]; + char buf[SIZ]; FILE *ls; for (a=0; ausersupp.axlevel < 6) { cprintf("%d Higher access required.\n", diff --git a/citadel/tools.c b/citadel/tools.c index b96b264bd..4a5ee52c7 100644 --- a/citadel/tools.c +++ b/citadel/tools.c @@ -12,6 +12,7 @@ #include #include #include "tools.h" +#include "citadel.h" #define TRUE 1 #define FALSE 0 @@ -143,7 +144,7 @@ void remove_token(char *source, int parmnum, char separator) */ int extract_int(char *source, int parmnum) { - char buf[256]; + char buf[SIZ]; extract_token(buf, source, parmnum, '|'); return(atoi(buf)); @@ -154,7 +155,7 @@ int extract_int(char *source, int parmnum) */ long extract_long(char *source, long int parmnum) { - char buf[256]; + char buf[SIZ]; extract_token(buf, source, parmnum, '|'); return(atol(buf)); diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 6dc5ff8a2..cdff7ca70 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -286,7 +286,7 @@ int getuserbynumber(struct usersupp *usbuf, long int number) */ int CtdlLoginExistingUser(char *username) { - char autoname[256]; + char autoname[SIZ]; int found_user = 0; struct passwd *p; int a; @@ -326,7 +326,7 @@ int CtdlLoginExistingUser(char *username) */ void cmd_user(char *cmdbuf) { - char username[256]; + char username[SIZ]; int a; extract(username, cmdbuf, 0); @@ -521,7 +521,7 @@ int CtdlTryPassword(char *password) void cmd_pass(char *buf) { - char password[256]; + char password[SIZ]; int a; extract(password, buf, 0); @@ -684,7 +684,7 @@ int create_user(char *newusername) void cmd_newu(char *cmdbuf) { int a; - char username[256]; + char username[SIZ]; if ((CC->logged_in)) { cprintf("%d Already logged in.\n", ERROR); @@ -852,7 +852,7 @@ void cmd_invt_kick(char *iuser, int op) /* user name */ { /* 1 = invite, 0 = kick out */ struct usersupp USscratch; - char bbb[256]; + char bbb[SIZ]; struct visit vbuf; if (CtdlAccessCheck(ac_room_aide)) @@ -974,7 +974,7 @@ void cmd_gnur(void) */ void cmd_vali(char *v_args) { - char user[256]; + char user[SIZ]; int newax; struct usersupp userbuf; @@ -1116,7 +1116,7 @@ void cmd_qusr(char *who) void cmd_agup(char *cmdbuf) { struct usersupp usbuf; - char requested_user[256]; + char requested_user[SIZ]; if (CtdlAccessCheck(ac_aide)) { return; @@ -1148,7 +1148,7 @@ void cmd_agup(char *cmdbuf) void cmd_asup(char *cmdbuf) { struct usersupp usbuf; - char requested_user[256]; + char requested_user[SIZ]; int np; int newax; int deleted = 0; diff --git a/citadel/userlist.c b/citadel/userlist.c index db120a9f1..5354722a7 100644 --- a/citadel/userlist.c +++ b/citadel/userlist.c @@ -21,8 +21,8 @@ void logoff(int code) } void userlist(void) { - char buf[256]; - char fl[256]; + char buf[SIZ]; + char fl[SIZ]; struct tm *tmbuf; time_t lc; @@ -54,8 +54,8 @@ void userlist(void) { int main(int argc, char **argv) { - char buf[256]; - char hostbuf[256], portbuf[256]; + char buf[SIZ]; + char hostbuf[SIZ], portbuf[SIZ]; attach_to_server(argc, argv, hostbuf, portbuf); serv_gets(buf); diff --git a/citadel/whobbs.c b/citadel/whobbs.c index 95674a71e..f22c8f031 100644 --- a/citadel/whobbs.c +++ b/citadel/whobbs.c @@ -43,17 +43,17 @@ void escapize(char buf[]) { int main(int argc, char **argv) { char buf[512]; - char nodetitle[256]; + char nodetitle[SIZ]; int a; int www = 0; int s_pid = 0; int my_pid = 0; - char hostbuf[256]; - char portbuf[256]; - char s_user[256]; - char s_room[256]; - char s_host[256]; - char s_client[256]; + char hostbuf[SIZ]; + char portbuf[SIZ]; + char s_user[SIZ]; + char s_room[SIZ]; + char s_host[SIZ]; + char s_client[SIZ]; /* If this environment variable is set, we assume that the program * is being called as a cgi-bin from a webserver and will output -- 2.30.2