* client_gets(char *buf) has been replaced by
authorArt Cancro <ajc@citadel.org>
Tue, 8 Feb 2005 03:33:49 +0000 (03:33 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 8 Feb 2005 03:33:49 +0000 (03:33 +0000)
  client_getln(char *buf, int maxbytes)

16 files changed:
citadel/ChangeLog
citadel/citserver.c
citadel/control.c
citadel/imap_misc.c
citadel/msgbase.c
citadel/room_ops.c
citadel/serv_bio.c
citadel/serv_chat.c
citadel/serv_imap.c
citadel/serv_network.c
citadel/serv_pop3.c
citadel/serv_smtp.c
citadel/serv_vandelay.c
citadel/serv_vcard.c
citadel/sysdep.c
citadel/sysdep_decls.h

index 474a6f131e18772f803736a833a156001efec1d4..93c1d9e379adcbcad6580f0a3e7df5721f92b26c 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 630.15  2005/02/08 03:33:49  ajc
+ * client_gets(char *buf) has been replaced by
+   client_getln(char *buf, int maxbytes)
+
  Revision 630.14  2005/02/05 22:56:31  ajc
  * More reliable handling of conversion of vCard UID to Citadel Extended ID
    (necessary for GroupDAV URL's to be generated properly in WebCit)
@@ -6356,4 +6360,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 10fc7be9205f25a8ccceef8494cfc87d2ed9ce17..ffeea2170b74f12803e6468177abd63477106cb5 100644 (file)
@@ -622,7 +622,7 @@ void cmd_emsg(char *mname)
        }
        cprintf("%d %s\n", SEND_LISTING, targ);
 
-       while (client_gets(buf), strcmp(buf, "000")) {
+       while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
                fprintf(mfp, "%s\n", buf);
        }
 
@@ -944,7 +944,7 @@ void do_command_loop(void) {
 
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
-       if (client_gets(cmdbuf) < 1) {
+       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
                lprintf(CTDL_ERR, "Client socket is broken; ending session\n");
                CC->kill_me = 1;
                return;
index ef507f6f3461fab89364e9d5625e54be4147e34f..9cd1128e79a9e97130a54e6851d4a8f7dce03edf 100644 (file)
@@ -218,7 +218,7 @@ void cmd_conf(char *argbuf)
                unbuffer_output();
                cprintf("%d Send configuration...\n", SEND_LISTING);
                a = 0;
-               while (client_gets(buf), strcmp(buf, "000")) {
+               while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
                        switch (a) {
                        case 0:
                                safestrncpy(config.c_nodename, buf,
index 5bf63ff6b0504a87bf49e022df16b28c139d83d4..74057e8c691a1724c417b792660029b71ea50e80 100644 (file)
@@ -283,10 +283,10 @@ void imap_append(int num_parms, char *parms[]) {
 
        /* I think there's supposed to be a trailing CRLF after the
         * literal (the message text) is received.  This call to
-        * client_gets() absorbs it.
+        * client_getln() absorbs it.
         */
        flush_output();
-       client_gets(buf);
+       client_getln(buf, sizeof buf);
        lprintf(CTDL_DEBUG, "Trailing CRLF: %s\n", buf);
 
        /* Convert RFC822 newlines (CRLF) to Unix newlines (LF) */
index 8f1849e08716c795b7065923c1cf2f4dc53d1345..956ea3d6a09890fa68029ce785502f2b6d2d7fc3 100644 (file)
@@ -568,7 +568,7 @@ void cmd_msgs(char *cmdbuf)
                template = (struct CtdlMessage *)
                        malloc(sizeof(struct CtdlMessage));
                memset(template, 0, sizeof(struct CtdlMessage));
-               while(client_gets(buf), strcmp(buf,"000")) {
+               while(client_getln(buf, sizeof buf), strcmp(buf,"000")) {
                        extract(tfield, buf, 0);
                        extract(tvalue, buf, 1);
                        for (i='A'; i<='Z'; ++i) if (msgkeys[i]!=NULL) {
@@ -2254,7 +2254,7 @@ char *CtdlReadMessageBody(char *terminator,       /* token signalling EOT */
 
        /* read in the lines of message text one by one */
        do {
-               if (client_gets(buf) < 1) finished = 1;
+               if (client_getln(buf, sizeof buf) < 1) finished = 1;
                if (!strcmp(buf, terminator)) finished = 1;
                if (crlf) {
                        strcat(buf, "\r\n");
index 1b00fe4859352340cf4c9125b93efe8f98e3e353..7a1eed03fb28ef6fedad2e86fc82ef23611effd9 100644 (file)
@@ -1841,7 +1841,7 @@ void cmd_einf(char *ok)
        cprintf("%d Send info...\n", SEND_LISTING);
 
        do {
-               client_gets(buf);
+               client_getln(buf, sizeof buf);
                if (strcmp(buf, "000"))
                        fprintf(fp, "%s\n", buf);
        } while (strcmp(buf, "000"));
index 788693bdf205363ac2bc30793a5dfef84b08a699..987e1df788571e87b48beb8ca3ad86002a55b6f5 100644 (file)
@@ -70,7 +70,7 @@ void cmd_ebio(char *cmdbuf) {
                return;
        }
        cprintf("%d  \n",SEND_LISTING);
-       while(client_gets(buf), strcmp(buf,"000")) {
+       while(client_getln(buf, sizeof buf), strcmp(buf,"000")) {
                if (ftell(fp) < config.c_maxmsglen) {
                        fprintf(fp,"%s\n",buf);
                }
index 0c2e9135be1d50e9dcbc725561a5a6256cd02ea1..f03e4e00b630972260e04b97935b94c39ffa613b 100644 (file)
@@ -713,7 +713,8 @@ void cmd_sexp(char *argbuf)
                        SEND_LISTING, message_sent);
                x_big_msgbuf = malloc(SIZ);
                memset(x_big_msgbuf, 0, SIZ);
-               while (client_gets(x_msg), strcmp(x_msg, "000")) {
+               while (client_getln(x_msg, sizeof x_msg),
+                     strcmp(x_msg, "000")) {
                        x_big_msgbuf = realloc(x_big_msgbuf,
                               strlen(x_big_msgbuf) + strlen(x_msg) + 4);
                        if (strlen(x_big_msgbuf) > 0)
index aabf7ba17e3a399a9ef1532663a4cda900018898..d9402ef35ebbb7f17832b3f3d71b8c17a3754c15 100644 (file)
@@ -1260,7 +1260,7 @@ void imap_command_loop(void)
        CC->lastcmd = time(NULL);
        memset(cmdbuf, 0, sizeof cmdbuf);       /* Clear it, just in case */
        flush_output();
-       if (client_gets(cmdbuf) < 1) {
+       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
                lprintf(CTDL_ERR, "IMAP socket is broken.  Ending session.\r\n");
                CC->kill_me = 1;
                return;
index f32bc78d6af71b83db81215e3f2598f93878c3eb..66fe1c8642219608c2923f93a86d84b8e78f06e9 100644 (file)
@@ -395,7 +395,7 @@ void cmd_snet(char *argbuf) {
        }
 
        cprintf("%d %s\n", SEND_LISTING, tempfilename);
-       while (client_gets(buf), strcmp(buf, "000")) {
+       while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
                fprintf(fp, "%s\n", buf);
        }
        fclose(fp);
index 8e10bbf1f3a88787c428f026cfa54ddbf994294e..46f2d7f2b2b89573984b20aa24001e3064ad53a3 100644 (file)
@@ -567,7 +567,7 @@ void pop3_command_loop(void) {
 
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
-       if (client_gets(cmdbuf) < 1) {
+       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
                lprintf(CTDL_ERR, "POP3 socket is broken.  Ending session.\r\n");
                CC->kill_me = 1;
                return;
index 03c3e1251b2dde0f65af3645a62b374c927aea29..5c0767acd1d8cfe2f351458b14665d7ee33ee579 100644 (file)
@@ -783,7 +783,7 @@ void smtp_command_loop(void) {
 
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
-       if (client_gets(cmdbuf) < 1) {
+       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
                lprintf(CTDL_CRIT, "SMTP socket is broken.  Ending session.\n");
                CC->kill_me = 1;
                return;
index 272476a450fa454c23b3531768b6511b469bdb7f..372b1e2555b823ba228b74a37f53ae8960469a70 100644 (file)
@@ -324,47 +324,45 @@ void artv_import_config(void) {
        char buf[SIZ];
 
        lprintf(CTDL_DEBUG, "Importing config file\n");
-       client_gets(config.c_nodename);
-       lprintf(CTDL_DEBUG, "c_nodename = %s\n", config.c_nodename);
-       client_gets(config.c_fqdn);
-       client_gets(config.c_humannode);
-       client_gets(config.c_phonenum);
-       client_gets(buf);       config.c_bbsuid = atoi(buf);
-       client_gets(buf);       config.c_creataide = atoi(buf);
-       client_gets(buf);       config.c_sleeping = atoi(buf);
-       client_gets(buf);       config.c_initax = atoi(buf);
-       client_gets(buf);       config.c_regiscall = atoi(buf);
-       client_gets(buf);       config.c_twitdetect = atoi(buf);
-       client_gets(config.c_twitroom);
-       client_gets(config.c_moreprompt);
-       client_gets(buf);       config.c_restrict = atoi(buf);
-       client_gets(config.c_bbs_city);
-       client_gets(config.c_sysadm);
-       lprintf(CTDL_DEBUG, "c_sysadm = %s\n", config.c_sysadm);
-       client_gets(buf);       config.c_setup_level = atoi(buf);
-       client_gets(buf);       config.c_maxsessions = atoi(buf);
-       client_gets(buf);       config.c_port_number = atoi(buf);
-       client_gets(buf);       config.c_ep.expire_mode = atoi(buf);
-       client_gets(buf);       config.c_ep.expire_value = atoi(buf);
-       client_gets(buf);       config.c_userpurge = atoi(buf);
-       client_gets(buf);       config.c_roompurge = atoi(buf);
-       client_gets(config.c_logpages);
-       client_gets(buf);       config.c_createax = atoi(buf);
-       client_gets(buf);       config.c_maxmsglen = atol(buf);
-       client_gets(buf);       config.c_min_workers = atoi(buf);
-       client_gets(buf);       config.c_max_workers = atoi(buf);
-       client_gets(buf);       config.c_pop3_port = atoi(buf);
-       client_gets(buf);       config.c_smtp_port = atoi(buf);
-       client_gets(buf);       config.c_purge_hour = atoi(buf);
-       client_gets(buf);       config.c_mbxep.expire_mode = atoi(buf);
-       client_gets(buf);       config.c_mbxep.expire_value = atoi(buf);
-       client_gets(config.c_ldap_host);
-       client_gets(buf);       config.c_ldap_port = atoi(buf);
-       client_gets(config.c_ldap_base_dn);
-       client_gets(config.c_ldap_bind_dn);
-       client_gets(config.c_ldap_bind_pw);
-       client_gets(config.c_ip_addr);
-       client_gets(buf);       config.c_msa_port = atoi(buf);
+       client_getln(config.c_nodename, sizeof config.c_nodename);
+       client_getln(config.c_fqdn, sizeof config.c_fqdn);
+       client_getln(config.c_humannode, sizeof config.c_humannode);
+       client_getln(config.c_phonenum, sizeof config.c_phonenum);
+       client_getln(buf, sizeof buf);  config.c_bbsuid = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_creataide = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_sleeping = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_initax = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_regiscall = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_twitdetect = atoi(buf);
+       client_getln(config.c_twitroom, sizeof config.c_twitroom);
+       client_getln(config.c_moreprompt, sizeof config.c_moreprompt);
+       client_getln(buf, sizeof buf);  config.c_restrict = atoi(buf);
+       client_getln(config.c_bbs_city, sizeof config.c_bbs_city);
+       client_getln(config.c_sysadm, sizeof config.c_sysadm);
+       client_getln(buf, sizeof buf);  config.c_setup_level = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_maxsessions = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_port_number = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_ep.expire_mode = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_ep.expire_value = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_userpurge = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_roompurge = atoi(buf);
+       client_getln(config.c_logpages, sizeof config.c_logpages);
+       client_getln(buf, sizeof buf);  config.c_createax = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_maxmsglen = atol(buf);
+       client_getln(buf, sizeof buf);  config.c_min_workers = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_max_workers = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_pop3_port = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_smtp_port = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_purge_hour = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_mbxep.expire_mode = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_mbxep.expire_value = atoi(buf);
+       client_getln(config.c_ldap_host, sizeof config.c_ldap_host);
+       client_getln(buf, sizeof buf);  config.c_ldap_port = atoi(buf);
+       client_getln(config.c_ldap_base_dn, sizeof config.c_ldap_base_dn);
+       client_getln(config.c_ldap_bind_dn, sizeof config.c_ldap_bind_dn);
+       client_getln(config.c_ldap_bind_pw, sizeof config.c_ldap_bind_pw);
+       client_getln(config.c_ip_addr, sizeof config.c_ip_addr);
+       client_getln(buf, sizeof buf);  config.c_msa_port = atoi(buf);
        put_config();
        lprintf(CTDL_INFO, "Imported config file\n");
 }
@@ -375,11 +373,11 @@ void artv_import_control(void) {
        char buf[SIZ];
 
        lprintf(CTDL_DEBUG, "Importing control file\n");
-       client_gets(buf);       CitControl.MMhighest = atol(buf);
-       client_gets(buf);       CitControl.MMflags = atoi(buf);
-       client_gets(buf);       CitControl.MMnextuser = atol(buf);
-       client_gets(buf);       CitControl.MMnextroom = atol(buf);
-       client_gets(buf);       CitControl.version = atoi(buf);
+       client_getln(buf, sizeof buf);  CitControl.MMhighest = atol(buf);
+       client_getln(buf, sizeof buf);  CitControl.MMflags = atoi(buf);
+       client_getln(buf, sizeof buf);  CitControl.MMnextuser = atol(buf);
+       client_getln(buf, sizeof buf);  CitControl.MMnextroom = atol(buf);
+       client_getln(buf, sizeof buf);  CitControl.version = atoi(buf);
        put_control();
        lprintf(CTDL_INFO, "Imported control file\n");
 }
@@ -389,19 +387,19 @@ void artv_import_user(void) {
        char buf[SIZ];
        struct ctdluser usbuf;
 
-       client_gets(buf);       usbuf.version = atoi(buf);
-       client_gets(buf);       usbuf.uid = atoi(buf);
-       client_gets(usbuf.password);
-       client_gets(buf);       usbuf.flags = atoi(buf);
-       client_gets(buf);       usbuf.timescalled = atol(buf);
-       client_gets(buf);       usbuf.posted = atol(buf);
-       client_gets(buf);       usbuf.axlevel = atoi(buf);
-       client_gets(buf);       usbuf.usernum = atol(buf);
-       client_gets(buf);       usbuf.lastcall = atol(buf);
-       client_gets(buf);       usbuf.USuserpurge = atoi(buf);
-       client_gets(usbuf.fullname);
-       client_gets(buf);       usbuf.USscreenwidth = atoi(buf);
-       client_gets(buf);       usbuf.USscreenheight = atoi(buf);
+       client_getln(buf, sizeof buf);  usbuf.version = atoi(buf);
+       client_getln(buf, sizeof buf);  usbuf.uid = atoi(buf);
+       client_getln(usbuf.password, sizeof usbuf.password);
+       client_getln(buf, sizeof buf);  usbuf.flags = atoi(buf);
+       client_getln(buf, sizeof buf);  usbuf.timescalled = atol(buf);
+       client_getln(buf, sizeof buf);  usbuf.posted = atol(buf);
+       client_getln(buf, sizeof buf);  usbuf.axlevel = atoi(buf);
+       client_getln(buf, sizeof buf);  usbuf.usernum = atol(buf);
+       client_getln(buf, sizeof buf);  usbuf.lastcall = atol(buf);
+       client_getln(buf, sizeof buf);  usbuf.USuserpurge = atoi(buf);
+       client_getln(usbuf.fullname, sizeof usbuf.fullname);
+       client_getln(buf, sizeof buf);  usbuf.USscreenwidth = atoi(buf);
+       client_getln(buf, sizeof buf);  usbuf.USscreenheight = atoi(buf);
        putuser(&usbuf);
 }
 
@@ -412,28 +410,28 @@ void artv_import_room(void) {
        long msgnum;
        int msgcount = 0;
 
-       client_gets(qrbuf.QRname);
-       client_gets(qrbuf.QRpasswd);
-       client_gets(buf);       qrbuf.QRroomaide = atol(buf);
-       client_gets(buf);       qrbuf.QRhighest = atol(buf);
-       client_gets(buf);       qrbuf.QRgen = atol(buf);
-       client_gets(buf);       qrbuf.QRflags = atoi(buf);
-       client_gets(qrbuf.QRdirname);
-       client_gets(buf);       qrbuf.QRinfo = atol(buf);
-       client_gets(buf);       qrbuf.QRfloor = atoi(buf);
-       client_gets(buf);       qrbuf.QRmtime = atol(buf);
-       client_gets(buf);       qrbuf.QRep.expire_mode = atoi(buf);
-       client_gets(buf);       qrbuf.QRep.expire_value = atoi(buf);
-       client_gets(buf);       qrbuf.QRnumber = atol(buf);
-       client_gets(buf);       qrbuf.QRorder = atoi(buf);
-       client_gets(buf);       qrbuf.QRflags2 = atoi(buf);
-       client_gets(buf);       qrbuf.QRdefaultview = atoi(buf);
+       client_getln(qrbuf.QRname, sizeof qrbuf.QRname);
+       client_getln(qrbuf.QRpasswd, sizeof qrbuf.QRpasswd);
+       client_getln(buf, sizeof buf);  qrbuf.QRroomaide = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRhighest = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRgen = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRflags = atoi(buf);
+       client_getln(qrbuf.QRdirname, sizeof qrbuf.QRdirname);
+       client_getln(buf, sizeof buf);  qrbuf.QRinfo = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRfloor = atoi(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRmtime = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRep.expire_mode = atoi(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRep.expire_value = atoi(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRnumber = atol(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRorder = atoi(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRflags2 = atoi(buf);
+       client_getln(buf, sizeof buf);  qrbuf.QRdefaultview = atoi(buf);
        putroom(&qrbuf);
        lprintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname);
        /* format of message list export is all message numbers output
         * one per line terminated by a 0.
         */
-       while (client_gets(buf), msgnum = atol(buf), msgnum > 0) {
+       while (client_getln(buf, sizeof buf), msgnum = atol(buf), msgnum > 0) {
                CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0);
                ++msgcount;
        }
@@ -446,12 +444,12 @@ void artv_import_floor(void) {
         int i;
        char buf[SIZ];
 
-       client_gets(buf);               i = atoi(buf);
-       client_gets(buf);               flbuf.f_flags = atoi(buf);
-       client_gets(flbuf.f_name);
-       client_gets(buf);               flbuf.f_ref_count = atoi(buf);
-       client_gets(buf);               flbuf.f_ep.expire_mode = atoi(buf);
-       client_gets(buf);               flbuf.f_ep.expire_value = atoi(buf);
+       client_getln(buf, sizeof buf);  i = atoi(buf);
+       client_getln(buf, sizeof buf);  flbuf.f_flags = atoi(buf);
+       client_getln(flbuf.f_name, sizeof flbuf.f_name);
+       client_getln(buf, sizeof buf);  flbuf.f_ref_count = atoi(buf);
+       client_getln(buf, sizeof buf);  flbuf.f_ep.expire_mode = atoi(buf);
+       client_getln(buf, sizeof buf);  flbuf.f_ep.expire_value = atoi(buf);
        putfloor(&flbuf, i);
        lprintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name);
 }
@@ -465,18 +463,18 @@ void artv_import_visit(void) {
        int i;
        int is_textual_seen = 0;
 
-       client_gets(buf);       vbuf.v_roomnum = atol(buf);
-       client_gets(buf);       vbuf.v_roomgen = atol(buf);
-       client_gets(buf);       vbuf.v_usernum = atol(buf);
+       client_getln(buf, sizeof buf);  vbuf.v_roomnum = atol(buf);
+       client_getln(buf, sizeof buf);  vbuf.v_roomgen = atol(buf);
+       client_getln(buf, sizeof buf);  vbuf.v_usernum = atol(buf);
 
-       client_gets(buf);
+       client_getln(buf, sizeof buf);
        vbuf.v_lastseen = atol(buf);
        for (i=0; i<strlen(buf); ++i) if (!isdigit(buf[i])) is_textual_seen = 1;
        if (is_textual_seen)    strcpy(vbuf.v_seen, buf);
 
-       client_gets(vbuf.v_answered);
-       client_gets(buf);       vbuf.v_flags = atoi(buf);
-       client_gets(buf);       vbuf.v_view = atoi(buf);
+       client_getln(vbuf.v_answered, sizeof vbuf.v_answered);
+       client_getln(buf, sizeof buf);  vbuf.v_flags = atoi(buf);
+       client_getln(buf, sizeof buf);  vbuf.v_view = atoi(buf);
        put_visit(&vbuf);
        lprintf(CTDL_INFO, "Imported visit %ld/%ld/%ld\n",
                vbuf.v_roomnum, vbuf.v_roomgen, vbuf.v_usernum);
@@ -494,10 +492,10 @@ void artv_import_message(void) {
        char *mbuf;
 
        memset(&smi, 0, sizeof(struct MetaData));
-       client_gets(buf);       msgnum = atol(buf);
+       client_getln(buf, sizeof buf);  msgnum = atol(buf);
                                smi.meta_msgnum = msgnum;
-       client_gets(buf);       smi.meta_refcount = atoi(buf);
-       client_gets(smi.meta_content_type);
+       client_getln(buf, sizeof buf);  smi.meta_refcount = atoi(buf);
+       client_getln(smi.meta_content_type, sizeof smi.meta_content_type);
 
        lprintf(CTDL_INFO, "message #%ld\n", msgnum);
 
@@ -505,7 +503,7 @@ void artv_import_message(void) {
        strcpy(tempfile, tmpnam(NULL));
        snprintf(buf, sizeof buf, "./base64 -d >%s", tempfile);
        fp = popen(buf, "w");
-       while (client_gets(buf), strcasecmp(buf, END_OF_MESSAGE)) {
+       while (client_getln(buf, sizeof buf), strcasecmp(buf, END_OF_MESSAGE)) {
                fprintf(fp, "%s\n", buf);
        }
        pclose(fp);
@@ -540,12 +538,12 @@ void artv_do_import(void) {
        unbuffer_output();
 
        cprintf("%d sock it to me\n", SEND_LISTING);
-       while (client_gets(buf), strcmp(buf, "000")) {
+       while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
 
                lprintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
 
                if (!strcasecmp(buf, "version")) {
-                       client_gets(s_version);
+                       client_getln(s_version, sizeof s_version);
                        version = atoi(s_version);
                        if ((version<EXPORT_REV_MIN) || (version>REV_LEVEL)) {
                                lprintf(CTDL_ERR, "Version mismatch in ARTV import; aborting\n");
@@ -563,7 +561,7 @@ void artv_do_import(void) {
 
        }
        lprintf(CTDL_INFO, "Invalid keyword <%s>.  Flushing input.\n", buf);
-       while (client_gets(buf), strcmp(buf, "000"))  ;;
+       while (client_getln(buf, sizeof buf), strcmp(buf, "000"))  ;;
 }
 
 
index f1b16f7e9b4ea6babbaba922083fd4c5cb033842..8500c9c194a8dde8303e1aee6e9f0331b44083da 100644 (file)
@@ -604,7 +604,7 @@ void cmd_regi(char *argbuf) {
 
        cprintf("%d Send registration...\n", SEND_LISTING);
        a=0;
-       while (client_gets(buf), strcmp(buf,"000")) {
+       while (client_getln(buf, sizeof buf), strcmp(buf,"000")) {
                if (a==0) vcard_set_prop(my_vcard, "n", buf, 0);
                if (a==1) strcpy(tmpaddr, buf);
                if (a==2) strcpy(tmpcity, buf);
index 7a0d5b0d1f1c9afa610b2e07fa5aa9b8ecfc6376..61f7c363b1fe8273489f077347276637ef8846ec 100644 (file)
@@ -612,11 +612,11 @@ INLINE int client_read(char *buf, int bytes)
 
 
 /*
- * client_gets()   ...   Get a LF-terminated line of text from the client.
+ * client_getln()   ...   Get a LF-terminated line of text from the client.
  * (This is implemented in terms of client_read() and could be
  * justifiably moved out of sysdep.c)
  */
-int client_gets(char *buf)
+int client_getln(char *buf, int bufsize)
 {
        int i, retval;
 
@@ -624,13 +624,13 @@ int client_gets(char *buf)
         */
        for (i = 0;;i++) {
                retval = client_read(&buf[i], 1);
-               if (retval != 1 || buf[i] == '\n' || i == (SIZ-1))
+               if (retval != 1 || buf[i] == '\n' || i == (bufsize-1))
                        break;
        }
 
        /* If we got a long line, discard characters until the newline.
         */
-       if (i == (SIZ-1))
+       if (i == (bufsize-1))
                while (buf[i] != '\n' && retval == 1)
                        retval = client_read(&buf[i], 1);
 
index 94d98d5dad0379f997429cba6f009de56533dc80..191be0f5ef1346b63e49261df78880e4a748e710 100644 (file)
@@ -55,7 +55,7 @@ void flush_output(void);
 void client_write (char *buf, int nbytes);
 int client_read_to (char *buf, int bytes, int timeout);
 int client_read (char *buf, int bytes);
-int client_gets (char *buf);
+int client_getln (char *buf, int maxbytes);
 void sysdep_master_cleanup (void);
 void kill_session (int session_to_kill);
 void *sd_context_loop (struct CitContext *con);