* The size constant "256" which shows up everywhere as a buffer size has now
authorArt Cancro <ajc@citadel.org>
Wed, 27 Dec 2000 20:19:52 +0000 (20:19 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Dec 2000 20:19:52 +0000 (20:19 +0000)
  been changed to SIZ.  And, SIZ has been defined now as 1024, not 256, because
  we need 1024 byte buffers for most Internet protocols.

64 files changed:
citadel/ChangeLog
citadel/Makefile.in
citadel/base64.c
citadel/chkpwd.c
citadel/citadel.c
citadel/citadel_decls.h
citadel/citserver.c
citadel/client_chat.c
citadel/client_passwords.c
citadel/commands.c
citadel/commands.h
citadel/control.c
citadel/database_sleepycat.c
citadel/domain.c
citadel/dynloader.c
citadel/file_ops.c
citadel/html.c
citadel/imap_fetch.c
citadel/internet_addressing.c
citadel/internet_addressing.h
citadel/internetmail.c
citadel/ipc_c_tcp.c
citadel/mailinglist.c
citadel/messages.c
citadel/mime_parser.c
citadel/msgbase.c
citadel/msgbase.h
citadel/netmailer.c
citadel/netpoll.c
citadel/netproc.c
citadel/netsetup.c
citadel/policy.c
citadel/proxy.c [deleted file]
citadel/readlog.c
citadel/room_ops.c
citadel/rooms.c
citadel/routines.c
citadel/routines2.c
citadel/sendcommand.c
citadel/serv_bio.c
citadel/serv_chat.c
citadel/serv_expire.c
citadel/serv_imap.c
citadel/serv_imap.h
citadel/serv_inetcfg.c
citadel/serv_info.c
citadel/serv_network.c
citadel/serv_network.h
citadel/serv_pas2.c
citadel/serv_pop3.c
citadel/serv_rwho.c
citadel/serv_smtp.c
citadel/serv_vandelay.c
citadel/serv_vcard.c
citadel/server.h
citadel/setup.c
citadel/stats.c
citadel/support.c
citadel/sysconfig.h
citadel/sysdep.c
citadel/tools.c
citadel/user_ops.c
citadel/userlist.c
citadel/whobbs.c

index a1f0afc01775c66634f2c84bd954092c7d449e4a..bd410dd3f91101d1f930fc702e549ca87e1eed0a 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index c32cd5bdc71a1e5d68cc7d78ee8a8d83a496b405..8ba00452b37a275f2a3e00a328d7177482859a5d 100644 (file)
@@ -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
index 53965bd438e7af08af81deda8624c50e9a7c98ba..8addb382611feea0649435ae0bdf501c9cfbfbc3 100644 (file)
@@ -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);
index b96ac7392a54845d964fbd9572ffdde486864d24..efcbb674bb230b66d2d956e2a7f4572a9800af57 100644 (file)
@@ -23,7 +23,7 @@ int main(void)
 {
   uid_t uid;
   struct passwd *pw;
-  char buf[256];
+  char buf[SIZ];
 
   get_config();
   uid = getuid();
index 0a152672dc9dec427b7a30558d068fe53bcfd641..eb965e427ff36cfe7c6c7fbab12391c24bae9fbd 100644 (file)
@@ -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 */
index 9f3833239dcd59362085f7a5b138463e95f279ca..9cbff442b64e8bb0eeb581a16908abd918ffc00c 100644 (file)
@@ -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];
index c4bcd50e5f56bbdc0207de66753d6299af858d98..e4d76c02b50c2f68379413d5ca332941fa7d2c52 100644 (file)
@@ -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 */
index 849b94fc3dab76167f0e321586b03a0ae15a64b5..8a91402961327abb26980ce327e7d45d5c55d17e 100644 (file)
@@ -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);
index 0f13555d58a2ae923d4fecf18c302ddc269f489a..a70bcc4faf41de7e4b1390b1e1f497da1c694aa0 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/stat.h>
 #include <limits.h>
 #include <stdio.h>
+#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;
index 8a2cf2d28e6aaf077519c17e2187b553f448bfac..3a67eb77eff00991902fe841f57841fef638d30b 100644 (file)
@@ -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;
 
index 26e8706389db1d0c5bcd95806ae753e46ffbb5da..9a70678815c502c6719b9596c90727ce523039fb 100644 (file)
@@ -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;
index 26ea7d3304419b8dbca1b5224b08f037fd56ab42..7666c53ab38c3762418498be4b491c757b866d8d 100644 (file)
@@ -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);
index fd0f2f6c5fc56fb99f4e059009346742e7f6afc3..f522fd1aec5adbe61478db19bf5f6d95d68e5b85 100644 (file)
@@ -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");
index 52d57665f6fb81e23aa57bd4dd591c6ffe6abbe9..89108f6533456603643c147e4c3f83fe6ceee1bb 100644 (file)
@@ -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);
index 1087be5c5a02ba15468098e9c78210df9ce20d80..52ce3e46f337980d0eab66115671b86cca822d52 100644 (file)
@@ -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));
index fed2c0d890c4532137fa095958d8af768d1e0b3a..7f7da3d5eabd20fc95b7d0788783ac164d3226d2 100644 (file)
@@ -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) {
index 5c95524e490e645378bf9d41867a5bca02b97c76..323fa0523023bee62b25cc303058b6bc1e43264e 100644 (file)
@@ -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;
index e97704866eba13cc99a811255b931e19295ca73e..1e1890ef8d42d3b050fbdf0e0b490c6f15b3762b 100644 (file)
@@ -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;
index 00fde5ca64b38fb5e3d86e7760a47e908ebf1da8..7db812b4ab74803c2bfecb2d4245986c524e9aaa 100644 (file)
@@ -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));
index 1d16aa782bc79121d6ceed37b518c629cb285f0b..dcdafeaecf5aaeaf12d1d625c7c604344a8c6d35 100644 (file)
@@ -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];
 };
 
 
index 36dbecc7c43488b528a1bb550d6dd0a760caed2f..861aeb5c2bd194cd5f6ed703c6253b0f7bf981ed 100644 (file)
@@ -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, "");
index 9ae19f389e3c6d3fb2b357b04e93b1eb64099191..b49c6f1f2f5cf47074edd473486a32930fee8bb4 100644 (file)
@@ -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 */
index 4c5112fcd032aedaadf6d8f9507087860a526377..b91d15f1dd28520396bca41d0c8277ff7dd6f496 100644 (file)
@@ -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];
 
index 778f25ae1a14920d8c4c2426fdd0c0120bba1843..a89e55aba5c1d05d78d933a125cc9611f79595e5 100644 (file)
@@ -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 <R>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"
index 64e64670397ebd28661950242cf14b3274ccba8e..a463b0dbebbc1a6f359bc51aa1f098d0b4204686 100644 (file)
@@ -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;
index e21bcd22ec6939e5c6edc5fce1e9a11e9a361f96..4b50a464ce6c86a9f36d91ad94d3149bbe878723 100644 (file)
@@ -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) {
index 50db62bfa5e466ec9c286a3ab6629351ca3d9a5a..c713b8556a8b20ac2136191a3a157a6c6a52f771 100644 (file)
@@ -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;
 };
 
index b0a28e200ffdcfa540e71897c882d3ec333a3cc6..874e21761078c0429504dabbcc81e232a893faed 100644 (file)
@@ -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;
index a8b1a14c8ba29d3c803bb8f199066def29fa973b..527c7610f2cec3d2b793ccdff0ba6af37a51cf0a 100644 (file)
@@ -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;
 
index b614d92ac580c7a1e1a9424b0eb48f8330d79f90..6a887768145540ce268a6f116a74c37ad3238203 100644 (file)
@@ -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 *)
index 20785aeccd7b4514f42215779e178947d2f1717e..c11df8c4fed52be2e08089a61e1b2d6036106dcd 100644 (file)
@@ -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);
 
index 2415c124fe024cdfca4e91b02def5a5d63633859..1ae97f38b78a48edfc717269742b78e89965843f 100644 (file)
@@ -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 (file)
index c501442..0000000
+++ /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 <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#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<strlen(source); ++a)
-                if (source[a]=='|') ++count;
-        return(count);
-        }
-
-
-/*
- * extract()  -  extract a parameter from a series of "|" separated...
- */
-void extract(char *dest, char *source, int parmnum)
-{
-        char buf[256];
-        int count = 0;
-        int n;
-
-        n = num_parms(source);
-
-        if (parmnum >= 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; count<strlen(buf); ++count)
-                if (buf[count] == '|') buf[count] = 0;
-        strcpy(dest,buf);
-        }
-
-
-
-
-
-
-
-void logoff(int code) {
-       exit(code);
-       }
-
-
-/* Fetch a message (or check its status in the cache)
- */
-void fetch_message(long msgnum) {
-       char filename[64];
-       char temp[64];
-       FILE *fp;
-       char buf[256];
-
-       sprintf(filename, "%ld", msgnum);
-
-       if (access(filename, F_OK)==0) {
-               return;                         /* Already on disk */
-               }
-
-       /* 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(buf, "MSG0 %ld", msgnum);
-       serv_puts(buf);
-       serv_gets(buf);
-       if (buf[0] != '1') return;
-        sprintf(temp, "%ld.%d", msgnum, getpid());
-        fp = fopen(temp, "w");
-        while (serv_gets(buf), strcmp(buf, "000")) {
-                fprintf(fp, "%s\n", buf);
-                }
-        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);
-       }
-
-
-/*
- * This loop pre-fetches lots of messages
- */
-void do_prefetch() {
-       char buf[256];
-       struct RoomList *rl = NULL;
-       struct RoomList *rlptr;
-       struct MsgList *ml = NULL;
-       struct MsgList *mlptr;
-
-       close(0);
-       close(1);
-       close(2);
-
-       serv_gets(buf);
-       if (buf[0] != '2') {
-               exit(0);
-               }
-
-       /* Log in (this is kind of arbitrary) */
-       sprintf(buf, "USER %s", PREFETCH_USER_NAME);
-       serv_puts(buf);
-       serv_gets(buf);
-       if (buf[0]=='3') {
-               sprintf(buf, "PASS %s", PREFETCH_USER_PASSWORD);
-               serv_puts(buf);
-               serv_gets(buf);
-               if (buf[0] != '2') exit(1);
-               }
-       else {
-               sprintf(buf, "NEWU %s", PREFETCH_USER_NAME);
-               serv_puts(buf);
-               serv_gets(buf);
-               if (buf[0] != '2') exit(1);
-               sprintf(buf, "SETP %s", PREFETCH_USER_PASSWORD);
-               serv_puts(buf);
-               serv_gets(buf);
-               if (buf[0] != '2') exit(1);
-               }
-
-       /* Fetch the roomlist (rooms with new messages only) */
-       serv_puts("LKRN");
-       serv_gets(buf);
-       if (buf[0] != '1') exit(2);
-       while (serv_gets(buf), strcmp(buf, "000")) {
-               rlptr = (struct rlptr *) malloc(sizeof(struct RoomList));
-               rlptr->next = 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();
-       }
index 1964f9dc386a404fb46f4f42f020f398035939e4..4a221b4d8649d02314ae2faa8fe29a017d9c7fe4 100644 (file)
@@ -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, " ");
index a879e02a22aed8ee2c1b6a7db649c3396a67fd1d..e8e0df69b3270ea98133ee93805895b35bf477fe 100644 (file)
@@ -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);
index f46a4ee61f6429232e945dd8de76e1cc48f3aad9..3e276edc2bd42010752dc3b134a4ce9bb4e06e51 100644 (file)
@@ -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 */
  * <W>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 {
index 9166bbb945c7c7b47e72addbaa6e3fd6009d1729..00a74088dcade3f576714a68ba31d410a37c8f6e 100644 (file)
@@ -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) {
index fd4fd01040ef4a2a0c6cf56b5b0225ecfd329c9e..114fbd08f691f3f04cec6c3bee192ba2083c5eab 100644 (file)
@@ -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);
        }
 
index 811775535b0bc2433ff4ae567a19dad15586e076..061d0b44fab62cbd4c87e0f5b3c5799b2d98e04f 100644 (file)
@@ -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);
 
index 6ac1f2998df995fc882bba525fae90d0653baf36..37543c89c60cb3f208b8ee6bb8127c83b8154bf6 100644 (file)
@@ -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;
 
index 69acb059d7e6717e46f3a28e13f0b0bbd91b0e20..08a450b48820126a600660a466bb26331c1b8b21 100644 (file)
@@ -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;              /* <bc> */
        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);
index dd1f812e8c7984006b8b7a95c93a0d7823ba55b1..2019d58613ced93ea6f0542cb7ee63407dea0d73 100644 (file)
@@ -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;
index 62a3ba95b186cc3ed0c3052416938a039e0843cc..53491a28495660bdbcaa19ed47f4d9d52ca02684 100644 (file)
@@ -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);
index 217b62f6f9ccd05a522071d7e6d918f249b7465d..c03ce5376e0c4d9c5aab23bbe7e6b65c38fb5804 100644 (file)
@@ -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 */
index bedcd965d01e320a2bb90fe489be08bb822c86cd..922841bbe8ed4d6b149e4973f6e5927bc6ea52a9 100644 (file)
@@ -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']);
index 33898552392f97ecb0bb7c969c65491f75490cc0..48c701022e621bf98b85bf0c100b6a6db42874b7 100644 (file)
@@ -17,7 +17,7 @@
 #include "serv_info.h"
 
 void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) {
-       char buf[256];
+       char buf[SIZ];
        int a;
 
        /* fetch info */        
index e4d6ae4bd4e831334732f1225a496f493c45b28d..9f7382bb25c00245ef0599a9829639f482fcdf32 100644 (file)
@@ -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; */
index 8a80578240d39113d39f6eeaf7db9f7e1e263316..3fed171cf3b259ccb3bf8aa87a62863d70846da7 100644 (file)
@@ -1,7 +1,7 @@
 
 struct namelist {
        struct namelist *next;
-       char name[256];
+       char name[SIZ];
 };
 
 struct SpoolControl {
index f5dd1532d9a1100bf845f336c886b47be0d6efdd..7a38bf0ad1d49db0adb28201614de033f9ac0f1c 100644 (file)
@@ -23,7 +23,7 @@
 
 void cmd_pas2(char *argbuf)
 {
-       char pw[256];
+       char pw[SIZ];
        char hexstring[MD5_HEXSTRING_SIZE];
        
 
index b8273f89716aa1d7599fcb41f3883a1e40922add..b658e3edd75b1e1b669a89a9297feae376ea5ab0 100644 (file)
@@ -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 */
index 5f39d9be70ae30d0730c9c7803c224e1841891a7..a58380f7faf842f9caeb3907ffe3fbffd9ca959f 100644 (file)
@@ -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);
 
index 0e372056adedd3325f53878ef7561e4c2e930447..927d8206d4fd7ac95bb9f95d3d05e7704304bdec 100644 (file)
 
 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",
index 58af5f115cc3f35510134b86fb432e95d5f97bc8..3534a183695fda95b0c2432cfd96f2613c18b008 100644 (file)
@@ -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 */
index 6f1efad76aab90642d86ceddd6cd0e8e5b821a56..be8d89c840ca871b7b01fd166aa1ca1fbdffbbee 100644 (file)
@@ -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;
index 1e44a2e439505b2159052e4efba19b5cf3e6c78e..55d81c747df76c1639e6a1822a2cef5e23d4147a 100644 (file)
@@ -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];
 };
index a64ee076794ae14387aa0b293052eb88c5047ee4..fb6cb0333d57fd57432e8f0b51e5f7247939086c 100644 (file)
@@ -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, "");
index 214ac436b1c20a7f70c071d5c799e59993ae3648..c940c054d1b58de1a6571853fdacfb85fc60b336 100644 (file)
@@ -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, "| ");
 
index 3c068ceda9e12352651147864412d31684f24116..c876ca218c630fe5c2756614af7660b5e3c89356 100644 (file)
@@ -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; a<numdirs; ++a) {
index d582ed1d5fd51e050c60c4ac0eef88254f4c80a7..b5581ea775298e055cc80510e349e4abb681dcf9 100644 (file)
 #define MAXFLOORS      16
 
 
+/*
+ * Command buffer size (do not change!)
+ */
+#define SIZ            1024
+
 /*
  * SMTP delivery retry and give-up times
  */
index c2a4ca37f46f754a48adc6a7507e773f87e30f7b..a50bb0818fe0f7a9d3a8c561f0439d536aafb425 100644 (file)
@@ -461,7 +461,7 @@ void client_write(char *buf, int nbytes)
  */
 void cprintf(const char *format, ...) {   
         va_list arg_ptr;   
-        char buf[256];   
+        char buf[SIZ];   
    
         va_start(arg_ptr, format);   
         if (vsnprintf(buf, sizeof buf, format, arg_ptr) == -1)
@@ -636,7 +636,7 @@ void cmd_nset(char *cmdbuf)
        FILE *netsetup;
        int ch;
        int a, b;
-       char netsetup_args[3][256];
+       char netsetup_args[3][SIZ];
 
        if (CC->usersupp.axlevel < 6) {
                cprintf("%d Higher access required.\n", 
index b96b264bd894c4a8614271573da8548e52db417a..4a5ee52c7a9d66d7bfc55e4cf97dbb80c80b16c0 100644 (file)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <sys/time.h>
 #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));
index 6dc5ff8a2c98dc0b88761ceb2250ecc3953149bb..cdff7ca70a92e752e15b65a56a8f1273a9ff9401 100644 (file)
@@ -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;
index db120a9f16ec1f69a6151955bd192489a8caf448..5354722a7728c3604023e1fe9b67565e26ae0995 100644 (file)
@@ -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);
index 95674a71efcbde48ef838cc705bffdfe7024d3d9..f22c8f0310a10458781659852b542cdbdc27c814 100644 (file)
@@ -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