Index: ChangeLog
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/ChangeLog,v
retrieving revision 1.159
diff -u -r1.159 ChangeLog
--- ChangeLog   1999/06/07 05:26:07     1.159
+++ ChangeLog   1999/06/08 00:08:15
@@ -1,5 +1,29 @@
1999-06-07  Matti Aarnio  <[email protected]>

+       * lib/selfmatch.c:
+           Revoke the change I did while tinkering with
+           autodetecting <foo@[1.2.3.4]> address being
+           our local one..
+
+       * utils/vacation/Makefile.in:
+           "test -e ..." is perhaps POSIX thing, but not at
+           Solaris /bin/sh :-/
+
+       * router/rfc822.c:
+           A case of NULL pointer referral in form which I hadn't
+           encountered before...  (fqalias.ldap induced case)
+
+       * Makefile.in:
+           'make dist' should dump also symlinks! Boo!
+
+       * ChangeLog, configure.in, acconfig.h, router/libdb/bsdbtree.c,
+         router/libdb/bsdhash.c, smtpserver/policytest.c,
+         utils/makedb/makedb.c, utils/makedb/dblook.c, README.UPGRADING,
+         utils/vacation/vacation.c:
+           BSD DB 2.* interface had subtle difference; KEY and DATA
+           "DBT"s must be  memset(&key,0,sizeof(key))  to avoid nasty
+           surprises...  Wow, that API is -- versatile ...
+
       * router/libdb/bsdhash.c:
           Fix of old BSD DB 1.85 type behaviour.

Index: Makefile.in
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/Makefile.in,v
retrieving revision 1.30
diff -u -r1.30 Makefile.in
--- Makefile.in 1999/06/06 23:08:58     1.30
+++ Makefile.in 1999/06/07 15:01:53
@@ -202,7 +202,7 @@
dist:
       @echo 'Did you run "make scrub" first?' ; sleep 2
       chmod -R a+rX .
-       find . -type d -o -type f -print | \
+       find . -type l -o -type d -o -type f -print | \
         egrep -v -e '/(private[/$$]|config.cache|config.status|CVS[/$$]|RCS[/$$]|ID$$|.*\.o$$|fc[/$$]|.*\.a$$)' | \
         CWD=`pwd` sed -e '/\.tar.*/d' -e "s/^\./`sh -c 'basename \`pwd\`'`/" | \
         sort -t/ > MANIFEST
@@ -213,7 +213,7 @@
distprivate:
       @echo 'Did you run "make scrub" first?' ; sleep 2
       chmod -R a+rX .
-       find . -type d -o -type f -print | \
+       find . -type l -o -type d -o -type f -print | \
         egrep -v -e '/(config.cache|config.status|CVS[/$$]|RCS[/$$]|ID$$|.*\.o$$|fc[/$$]|.*\.a$$)' | \
         CWD=`pwd` sed -e '/\.tar.*/d' -e "s/^\./`sh -c 'basename \`pwd\`'`/" | \
         sort -t/ > MANIFEST
Index: TODO
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/TODO,v
retrieving revision 1.42
diff -u -r1.42 TODO
--- TODO        1999/06/03 23:17:07     1.42
+++ TODO        1999/06/07 15:15:05
@@ -1,5 +1,9 @@
Known/suspected bugs/Missing Features on current Zmailer sources

+libc: "make install" is "crazy"
+proto: "make install" -- nothing goes in ???
+               --> MAILSHARE/proto/ !!
+
smtpserver:
       Implement policy analysis of %-hack addresses..
       (And !-paths too ?)
Index: lib/selfaddrs.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/lib/selfaddrs.c,v
retrieving revision 1.6
diff -u -r1.6 selfaddrs.c
--- lib/selfaddrs.c     1999/06/03 16:19:08     1.6
+++ lib/selfaddrs.c     1999/06/07 22:42:02
@@ -451,10 +451,12 @@
       for (i = 0; i < nmyaddrs; ++i) {
         /* if this is myself, skip to next MX host */
         if (sa->sa_family == myaddrs[i]->sa_family) {
-           if (sa->sa_family == AF_INET && memcmp(sa, myaddrs[i], 4) == 0)
+           if (sa->sa_family == AF_INET &&
+               memcmp(sa, myaddrs[i], sizeof(struct sockaddr_in)) == 0)
             return 1;
#if defined(AF_INET6) && defined(INET6)
-           if (sa->sa_family == AF_INET6 && memcmp(sa, myaddrs[i], 16) == 0)
+           if (sa->sa_family == AF_INET6 &&
+               memcmp(sa, myaddrs[i], sizeof(struct sockaddr_in6)) == 0)
             return 1;
#endif
         }
Index: router/rfc822.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/router/rfc822.c,v
retrieving revision 1.31
diff -u -r1.31 rfc822.c
--- router/rfc822.c     1999/05/30 01:31:48     1.31
+++ router/rfc822.c     1999/06/07 19:02:36
@@ -2184,7 +2184,8 @@
                       ofperrors |= ferror(ofp);
                       if (ofperrors) break; /* Sigh.. */

-                       if (!iserrmessage()  &&  nsp->errto != NULL) {
+                       if (!iserrmessage() && nsp->errto &&
+                           nsp->errto->string) {
                               /* print envelope sender address */
                               putc(_CF_ERRORADDR, ofp);
                               putc(_CFTAG_NORMAL, ofp);
Index: router/libdb/bsdbtree.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/router/libdb/bsdbtree.c,v
retrieving revision 1.8
diff -u -r1.8 bsdbtree.c
--- router/libdb/bsdbtree.c     1999/06/06 20:13:59     1.8
+++ router/libdb/bsdbtree.c     1999/06/07 23:54:18
@@ -130,8 +130,12 @@
       if (db == NULL)
         return NULL; /* Huh! */

+       memset(&key, 0, sizeof(key));
+       memset(&val, 0, sizeof(val));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
+
#ifdef HAVE_DB_OPEN2
       rc = (db->get)(db, NULL, &key, &val, 0);
#else
@@ -166,8 +170,12 @@
       if (db == NULL)
               return EOF;

+       memset(&key, 0, sizeof(key));
+       memset(&val, 0, sizeof(val));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
+
       val.data = (void*)value;
       val.size = strlen(value)+1;
#ifdef HAVE_DB_OPEN2
@@ -201,6 +209,8 @@
       if (db == NULL)
               return EOF;

+       memset(&key, 0, sizeof(key));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
#ifdef HAVE_DB_OPEN2
@@ -242,6 +252,10 @@
#else
       rc = (db->cursor)(db, NULL, &curs);
#endif
+
+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       if (rc == 0 && curs)
         rc = (curs->c_get)(curs, &key, &val, DB_FIRST);
       for ( ; rc == 0 ; ) {
@@ -251,6 +265,10 @@
                       fprintf(outfp, "%s\n", key.data);
               else
                       fprintf(outfp, "%s\t%s\n", key.data, val.data);
+
+               memset(&val, 0, sizeof(val));
+               memset(&key, 0, sizeof(key));
+
               rc = (curs->c_get)(curs, &key, &val, DB_NEXT);
       }
       (curs->c_close)(curs);
@@ -260,6 +278,9 @@
       if (db == NULL)
               return;

+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       rc = (db->seq)(db, &key, &val, R_FIRST);
       for ( ; rc == 0 ; ) {
               if (val.data == NULL)
@@ -268,6 +289,10 @@
                       fprintf(outfp, "%s\n", key.data);
               else
                       fprintf(outfp, "%s\t%s\n", key.data, val.data);
+
+               memset(&val, 0, sizeof(val));
+               memset(&key, 0, sizeof(key));
+
               rc = (db->seq)(db, &key, &val, R_NEXT);
       }
#endif
@@ -298,12 +323,20 @@
#else
         rc = (db->cursor)(db, NULL, &curs);
#endif
+
+         memset(&val, 0, sizeof(val));
+         memset(&key, 0, sizeof(key));
+
         if (rc == 0 && curs)
           rc = (curs->c_get)(curs, &key, &val, DB_FIRST);
         while (rc == 0) {
           if (val.data == NULL) /* ???? When this would happen ? */
             continue;
           ++cnt;
+
+           memset(&val, 0, sizeof(val));
+           memset(&key, 0, sizeof(key));
+
           rc = (curs->c_get)(curs, &key, &val, DB_NEXT);
         }
       }
Index: router/libdb/bsdhash.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/router/libdb/bsdhash.c,v
retrieving revision 1.8
diff -u -r1.8 bsdhash.c
--- router/libdb/bsdhash.c      1999/06/07 05:26:10     1.8
+++ router/libdb/bsdhash.c      1999/06/07 23:55:10
@@ -127,6 +127,9 @@
       if (db == NULL)
         return NULL; /* Huh! */

+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
#ifdef HAVE_DB_OPEN2
@@ -162,8 +165,13 @@
       db = open_bhash(sip, O_RDWR, "add_bhash");
       if (db == NULL)
               return EOF;
+
+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
+
       val.data = (void*)value;
       val.size = strlen(value)+1;
#ifdef HAVE_DB_OPEN2
@@ -196,6 +204,9 @@
       db = open_bhash(sip, O_RDWR, "remove_bhash");
       if (db == NULL)
               return EOF;
+
+       memset(&key, 0, sizeof(key));
+
       key.data = (void*)sip->key;
       key.size = strlen(sip->key) + 1;
#ifdef HAVE_DB_OPEN2
@@ -237,6 +248,9 @@
#else
       rc = (db->cursor)(db, NULL, &curs);
#endif
+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       if (rc == 0 && curs)
         rc = (curs->c_get)(curs, &key, &val, DB_FIRST);
       for ( ; rc == 0 ; ) {
@@ -246,6 +260,10 @@
                       fprintf(outfp, "%s\n", key.data);
               else
                       fprintf(outfp, "%s\t%s\n", key.data, val.data);
+
+               memset(&val, 0, sizeof(val));
+               memset(&key, 0, sizeof(key));
+
               rc = (curs->c_get)(curs, &key, &val, DB_NEXT);
       }
       (curs->c_close)(curs);
@@ -255,6 +273,9 @@
       if (db == NULL)
               return;

+       memset(&val, 0, sizeof(val));
+       memset(&key, 0, sizeof(key));
+
       rc = (db->seq)(db, &key, &val, R_FIRST);
       for ( ; rc == 0 ; ) {
               if (val.data == NULL)
@@ -263,6 +284,10 @@
                       fprintf(outfp, "%s\n", key.data);
               else
                       fprintf(outfp, "%s\t%s\n", key.data, val.data);
+
+               memset(&val, 0, sizeof(val));
+               memset(&key, 0, sizeof(key));
+
               rc = (db->seq)(db, &key, &val, R_NEXT);
       }
#endif
@@ -294,12 +319,20 @@
#else
         rc = (db->cursor)(db, NULL, &curs);
#endif
+
+         memset(&val, 0, sizeof(val));
+         memset(&key, 0, sizeof(key));
+
         if (rc == 0 && curs)
           rc = (curs->c_get)(curs, &key, &val, DB_FIRST);
         while (rc == 0) {
           if (val.data == NULL) /* ???? When this would happen ? */
             continue;
           ++cnt;
+
+           memset(&val, 0, sizeof(val));
+           memset(&key, 0, sizeof(key));
+
           rc = (curs->c_get)(curs, &key, &val, DB_NEXT);
         }
       }
@@ -307,11 +340,19 @@
#else
       db = open_bhash(sip, O_RDONLY, "count_bhash");
       if (db != NULL) {
+
+         memset(&val, 0, sizeof(val));
+         memset(&key, 0, sizeof(key));
+
         rc = (db->seq)(db, &key, &val, R_FIRST);
         while (rc == 0) {
           if (val.data == NULL) /* ???? When this would happen ? */
             continue;
           ++cnt;
+
+           memset(&val, 0, sizeof(val));
+           memset(&key, 0, sizeof(key));
+
           rc = (db->seq)(db, &key, &val, R_NEXT);
         }
       }
Index: smtpserver/policytest.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/smtpserver/policytest.c,v
retrieving revision 1.38
diff -u -r1.38 policytest.c
--- smtpserver/policytest.c     1999/06/06 20:14:00     1.38
+++ smtpserver/policytest.c     1999/06/07 23:56:06
@@ -264,6 +264,9 @@
    case _dbt_btree:


+       memset(&Bkey, 0, sizeof(Bkey));
+       memset(&Bresult, 0, sizeof(Bresult));
+
       Bkey.data = (void *) qptr;
       Bkey.size = qlen;

@@ -285,6 +288,9 @@
                 without this... */

    case _dbt_bhash:
+
+       memset(&Bkey, 0, sizeof(Bkey));
+       memset(&Bresult, 0, sizeof(Bresult));

       Bkey.data = (void *) qptr;
       Bkey.size = qlen;
Index: utils/makedb/dblook.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/utils/makedb/dblook.c,v
retrieving revision 1.5
diff -u -r1.5 dblook.c
--- utils/makedb/dblook.c       1999/06/06 20:14:02     1.5
+++ utils/makedb/dblook.c       1999/06/07 23:44:34
@@ -215,6 +215,8 @@
      }
      (curs->c_close)(curs);
    } else {
+      memset(&key,    0, sizeof(key));
+      memset(&result, 0, sizeof(result));
      key.data = argv[3];
      key.size = strlen(argv[3]) +1;

@@ -260,6 +262,8 @@
      }
      (curs->c_close)(curs);
    } else {
+      memset(&key,    0, sizeof(key));
+      memset(&result, 0, sizeof(result));
      key.data = argv[3];
      key.size = strlen(argv[3]) +1;

Index: utils/makedb/makedb.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/utils/makedb/makedb.c,v
retrieving revision 1.11
diff -u -r1.11 makedb.c
--- utils/makedb/makedb.c       1999/06/06 20:14:02     1.11
+++ utils/makedb/makedb.c       1999/06/07 23:56:47
@@ -151,10 +151,16 @@
#ifdef HAVE_DB_H
       if (typ == 3 || typ == 4) {
               DBT Bkey, Bdat;
+
+               memset(&Bkey,0,sizeof(Bkey));
+               memset(&Bdat,0,sizeof(Bdat));
+
               Bkey.data = (void*)t;
               Bkey.size = tlen;
+
               Bdat.data = (void*)s;
               Bdat.size = slen;
+
#ifdef HAVE_DB_OPEN2
               rc = (dbfile->put) (dbfile, NULL, &Bkey, &Bdat,
                                   overwritemode ? 0: DB_NOOVERWRITE);
@@ -200,6 +206,10 @@
#ifdef HAVE_DB_H
         if (typ == 3 || typ == 4) {
           DBT Bkey, Bdat;
+
+           memset(&Bkey,0,sizeof(Bkey));
+           memset(&Bdat,0,sizeof(Bdat));
+
           Bkey.data = (void*)t;
           Bkey.size = tlen;
#ifdef HAVE_DB_OPEN2
Index: utils/vacation/Makefile.in
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/utils/vacation/Makefile.in,v
retrieving revision 1.11
diff -u -r1.11 Makefile.in
--- utils/vacation/Makefile.in  1999/06/06 23:09:02     1.11
+++ utils/vacation/Makefile.in  1999/06/07 22:46:42
@@ -52,8 +52,9 @@
       rm -f Makefile vacation.sh $(TOPDIR)/man/vacation.1

install: vacation-inst
-       @VACATIONDIR=`echo $(VACATIONPATH) | sed -e 's!/[^/]*$$!!'` ;   \
-       if [ ! -e "$${VACATIONDIR}" ] ; then                            \
+       -VACATIONDIR=`echo $(VACATIONPATH) | sed -e 's!/[^/]*$$!!'` ;   \
+       if [ ! -f "$${VACATIONDIR}" -a ! -l "$${VACATIONDIR}" -a        \
+            ! -d "$${VACATIONDIR}" ] ; then                            \
               mkdir -p -m 755 "$${VACATIONDIR}" ; fi
       @if [ $(LN_S) = "ln -s" -a                                      \
            "$(VACATIONPATH)" != "$(MAILBIN)/vacation.sh" ]; then      \
Index: utils/vacation/vacation.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/utils/vacation/vacation.c,v
retrieving revision 1.9
diff -u -r1.9 vacation.c
--- utils/vacation/vacation.c   1999/06/06 20:14:04     1.9
+++ utils/vacation/vacation.c   1999/06/07 23:58:28
@@ -658,6 +658,9 @@

       if (!dblog) return 0;

+       memset(&key, 0, sizeof(key));
+       memset(&data, 0, sizeof(data));
+
       /* get interval time */
       key.dptr = VIT;
       key.dsize = sizeof(VIT);
@@ -681,6 +684,9 @@
       else
               memcpy(&next, data.dptr, sizeof(next));

+       memset(&key, 0, sizeof(key));
+       memset(&data, 0, sizeof(data));
+
       /* get record for this address */
       key.dptr = from;
       key.dsize = strlen(from);
@@ -719,10 +725,15 @@

       if (!dblog) return;

+       memset(&key, 0, sizeof(key));
+       memset(&data, 0, sizeof(data));
+
       key.dptr = VIT;
       key.dsize = sizeof(VIT);
+
       data.dptr = (void*)&interval;
       data.dsize = sizeof(interval);
+
#ifdef HAVE_NDBM_H
       dbm_store(db, key, data, DBM_REPLACE);
#else
@@ -750,11 +761,16 @@

       if (!dblog) return;

+       memset(&key, 0, sizeof(key));
+       memset(&data, 0, sizeof(data));
+
       key.dptr = from;
       key.dsize = strlen(from);
+
       time(&now);
       data.dptr = (void*)&now;
       data.dsize = sizeof(now);
+
#ifdef HAVE_NDBM_H
       dbm_store(db, key, data, DBM_REPLACE);
#else