* Reverted database changes because the cull_logs function wasn't working
authorArt Cancro <ajc@citadel.org>
Wed, 13 Apr 2005 17:03:07 +0000 (17:03 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 13 Apr 2005 17:03:07 +0000 (17:03 +0000)
  with the separate log directory.
* citmail.c: started some fixes to make it able to work from

citadel/ChangeLog
citadel/citmail.c
citadel/database_sleepycat.c

index 10b69d585b03e841fac5c23481164510cb3054ef..ee0b43eeaa2c433a3c5ef70c42b590b527ec0fd2 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 645.3  2005/04/13 17:03:07  ajc
+ * Reverted database changes because the cull_logs function wasn't working
+   with the separate log directory.
+ * citmail.c: started some fixes to make it able to work from
+
  Revision 645.2  2005/04/12 21:19:52  ajc
  * 'make install' now installs citadel-openldap.schema
 
@@ -6586,4 +6591,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 d657e9e88cf55ab66e90d17997d76c146f52e132..e51428187929df17d6acf18d1d21e6d2d2762204 100644 (file)
@@ -171,15 +171,24 @@ int main(int argc, char **argv) {
        char buf[1024];
        char fromline[1024];
        FILE *fp;
+       int i;
+       struct passwd *pw;
 
        get_config();
 
+       pw = getpwuid(getuid());
+
        fp = tmpfile();
        if (fp == NULL) return(errno);
-       snprintf(fromline, sizeof fromline, "From: someone@somewhere.org");
+       snprintf(fromline, sizeof fromline, "From: %s@%s",
+               pw->pw_name,
+               config.c_fqdn
+       );
        while (fgets(buf, 1024, stdin) != NULL) {
                fprintf(fp, "%s", buf);
-               if (!strncasecmp(buf, "From:", 5)) strcpy(fromline, buf);
+               if (!strncasecmp(buf, "From:", 5)) {
+                       strcpy(fromline, buf);
+               }
        }
        strip_trailing_nonprint(fromline);
 
@@ -199,10 +208,14 @@ int main(int argc, char **argv) {
        serv_gets(buf);
        if (buf[0]!='2') cleanup(1);
 
-       snprintf(buf, sizeof buf, "RCPT To: %s", argv[1]);
-       serv_puts(buf);
-       serv_gets(buf);
-       if (buf[0]!='2') cleanup(1);
+       for (i=1; i<argc; ++i) {
+               if (argv[i][0] != '-') {
+                       snprintf(buf, sizeof buf, "RCPT To: %s", argv[i]);
+                       serv_puts(buf);
+                       serv_gets(buf);
+                       /* if (buf[0]!='2') cleanup(1); */
+               }
+       }
 
        serv_puts("DATA");
        serv_gets(buf);
index fb9d6a53a4716d0cc495658b7e21006459a2c8e0..193a327b02fdd99459b65236bab78510c662b002 100644 (file)
@@ -55,7 +55,6 @@
 #include "database.h"
 #include "msgbase.h"
 #include "sysdep_decls.h"
-#include "tools.h"
 #include "config.h"
 
 static DB *dbp[MAXCDB];                /* One DB handle for each Citadel database */
@@ -285,7 +284,6 @@ void open_databases(void)
        char dbfilename[SIZ];
        u_int32_t flags = 0;
        char dbdirname[PATH_MAX];
-       char dblogname[PATH_MAX];
        DIR *dp;
        struct dirent *d;
        char filename[PATH_MAX];
@@ -293,8 +291,6 @@ void open_databases(void)
 
        getcwd(dbdirname, sizeof dbdirname);
        strcat(dbdirname, "/data");
-       getcwd(dblogname, sizeof dblogname);
-       strcat(dblogname, "/data_logs");
 
        lprintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n");
        lprintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING);
@@ -311,13 +307,6 @@ void open_databases(void)
        chmod(dbdirname, 0700);
        chown(dbdirname, BBSUID, (-1) );
 
-       /*      
-        * By default, keep database logs in the same directory.  A savvy
-        * system administrator will know what to do if he/she wants to put
-        * them elsewhere.
-        */
-       symlink("data", dblogname);
-
        lprintf(CTDL_DEBUG, "cdb_*: Setting up DB environment\n");
        db_env_set_func_yield(sched_yield);
        ret = db_env_create(&dbenv, 0);
@@ -345,22 +334,10 @@ void open_databases(void)
                exit(ret);
        }
 
-       if ((ret = dbenv->set_data_dir(dbenv, dbdirname))) {
-               lprintf(CTDL_EMERG, "cdb_*: set_data_dir: %s\n", db_strerror(ret));
-               dbenv->close(dbenv, 0);
-               exit(ret);
-       }
-
-       if ((ret = dbenv->set_lg_dir(dbenv, dblogname))) {
-               lprintf(CTDL_EMERG, "cdb_*: set_lg_dir: %s\n", db_strerror(ret));
-               dbenv->close(dbenv, 0);
-               exit(ret);
-       }
-
         flags = DB_CREATE|DB_RECOVER|DB_INIT_MPOOL|DB_PRIVATE|DB_INIT_TXN|
                DB_INIT_LOCK|DB_THREAD;
-       lprintf(CTDL_DEBUG, "dbenv->open(dbenv, NULL, %d, 0)\n", flags);
-        ret = dbenv->open(dbenv, NULL, flags, 0);
+       lprintf(CTDL_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", dbdirname, flags);
+        ret = dbenv->open(dbenv, dbdirname, flags, 0);
        if (ret) {
                lprintf(CTDL_DEBUG, "cdb_*: dbenv->open: %s\n", db_strerror(ret));
                 dbenv->close(dbenv, 0);