]> code.citadel.org Git - citadel.git/blobdiff - citadel/citmail.c
* citserver.c, msgbase.c, user_ops.c: hide the owner-prefix of mail
[citadel.git] / citadel / citmail.c
index fe2437f365d52438111b0567445d193b41fa07d5..9581ca1996d7e091ae58354224b09b49e2b7967b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * citmail.c v4.1
+ * $Id$
  *
  * This program may be used as a local mail delivery agent, which will allow
  * all Citadel users to receive Internet e-mail.  To enable this functionality,
@@ -55,7 +56,7 @@ int RUN_NETPROC = 1;
 long conv_date(char *sdbuf)
 {
        int a,b,cpos,tend,tval;
-       long now;
+       time_t now;
        struct tm *tmbuf;
        char dbuf[128];
 
@@ -131,7 +132,7 @@ char *strerror(int e)
 {
        static char buf[32];
 
-       sprintf(buf,"errno = %d",e);
+       snprintf(buf,sizeof buf,"errno = %d",e);
        return(buf);
        }
 #endif
@@ -335,7 +336,7 @@ void loopcopy(FILE *to, FILE *from) {
  */
 void do_citmail(char recp[], int dtype) {
 
-       long now;
+       time_t now;
        FILE *temp;
        int a;
        char buf[128];
@@ -371,13 +372,13 @@ void do_citmail(char recp[], int dtype) {
                strcpy(recp, "");
                }
        else {
-               strcpy(targetroom, "Mail");
+               strcpy(targetroom, MAILROOM);
                }
 
        time(&now);
-       sprintf(from, "postmaster@%s", config.c_nodename);
+       snprintf(from, sizeof from, "postmaster@%s", config.c_nodename);
 
-       sprintf(buf, "./network/spoolin/citmail.%d", getpid());
+       snprintf(buf, sizeof buf, "./network/spoolin/citmail.%d", getpid());
        temp = fopen(buf,"w");
 
        putc(255,temp); putc(MES_NORMAL,temp); putc(1,temp);
@@ -403,7 +404,7 @@ void do_citmail(char recp[], int dtype) {
                fprintf(temp, "O%s%c", targetroom, 0);
                }
        else {
-               fprintf(temp, "OMail%c", 0);
+               fprintf(temp, "O%s%c", MAILROOM, 0);
                }
 
        fprintf(temp,"N%s%c", nodebuf, 0);
@@ -431,7 +432,7 @@ void do_uudecode(char *target)
        static char buf[1024];
        FILE *fp;
        
-       sprintf(buf,"cd %s; uudecode",target);
+       snprintf(buf,sizeof buf,"cd %s; uudecode",target);
 
        fp=popen(buf,"w");
        if (fp==NULL) return;
@@ -608,7 +609,7 @@ int main(int argc, char **argv)
                
                                                        /* Otherwise, we're dealing with Citadel mail. */
                                                        else {
-                                                               sprintf(recp, "%s!%s", node, user);
+                                                               snprintf(recp, sizeof recp, "%s!%s", node, user);
                                                                deliver_to_ignet = 1;
                                                                printf("250 IGnet recipient.\n");
                                                                }
@@ -664,14 +665,14 @@ int main(int argc, char **argv)
                        * back to an external mail transport agent such as sendmail.
                        */
                        if (haschar(node, '.')) {
-                               sprintf(buf, SENDMAIL, recp);
+                               snprintf(buf, sizeof buf, SENDMAIL, recp);
                                system(buf);
                                exit(0);
                                }
        
                        /* Otherwise, we're dealing with Citadel mail. */
                        else {
-                               sprintf(recp, "%s!%s", node, user);
+                               snprintf(recp, sizeof recp, "%s!%s", node, user);
                                deliver_to_ignet = 1;
                                }