]> git.pld-linux.org Git - packages/sendmail.git/commitdiff
- updated to 8.16.1 (includes security fix) auto/th/sendmail-8.16.1-1
authorJakub Bogusz <qboosh@pld-linux.org>
Sat, 29 Aug 2020 13:29:02 +0000 (15:29 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Sat, 29 Aug 2020 13:29:02 +0000 (15:29 +0200)
- updated smrsh-paths patch
- updated bluelabs patch from upstream (for sendmail 8.14.3) + adjusted for current version
- removed obsolete format_string,openssl-1.1.0 patches
- added cyrus patch (fix cyrus deliver path, adjusted patch from Fedora)
- build with libnsl 1.x

bluelabs-smpgsql-8.14.3.patch [new file with mode: 0644]
bluelabs.patch-8.12.3 [deleted file]
openssl-1.1.0.patch [deleted file]
sendmail-cyrus.patch [new file with mode: 0644]
sendmail-format_string.patch [deleted file]
sendmail-smrsh-paths.patch
sendmail.spec

diff --git a/bluelabs-smpgsql-8.14.3.patch b/bluelabs-smpgsql-8.14.3.patch
new file mode 100644 (file)
index 0000000..e0e9ae5
--- /dev/null
@@ -0,0 +1,891 @@
+diff -ruN sendmail-8.14.3/cf/feature/pg_accessdb.m4 sendmail-8.14.3.pgsql/cf/feature/pg_accessdb.m4
+--- sendmail-8.14.3/cf/feature/pg_accessdb.m4  1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_accessdb.m4    2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,19 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_accessdb.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_ACCESS_TABLE_', `')
++define(`_PG_ACCESS_TABLE_', `')
++define(`_TAG_DELIM_', `:')dnl should be in OperatorChars
++
++LOCAL_CONFIG
++# PostgreSQL based access list
++Kaccess ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`access',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_aliases.m4 sendmail-8.14.3.pgsql/cf/feature/pg_aliases.m4
+--- sendmail-8.14.3/cf/feature/pg_aliases.m4   1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_aliases.m4     2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,19 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_aliases.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++undefine(`ALIAS_FILE')
++define(`_ALIASES_TABLE_', `')
++define(`_PG_ALIASES_TABLE_', `')
++
++LOCAL_CONFIG
++# PostgreSQL based local aliases
++Kaliases ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`aliases',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_domaintable.m4 sendmail-8.14.3.pgsql/cf/feature/pg_domaintable.m4
+--- sendmail-8.14.3/cf/feature/pg_domaintable.m4       1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_domaintable.m4 2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,18 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_domaintable.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_DOMAIN_TABLE_', `')
++define(`_PG_DOMAIN_TABLE', `')
++
++LOCAL_CONFIG
++# PostgreSQL based domain rewriting table
++Kdomaintable ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`domaintable',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_generics.m4 sendmail-8.14.3.pgsql/cf/feature/pg_generics.m4
+--- sendmail-8.14.3/cf/feature/pg_generics.m4  1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_generics.m4    2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,18 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_genericstable.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_GENERICS_TABLE_', `')
++define(`_PG_GENERICS_TABLE', `')
++
++LOCAL_CONFIG
++# PostgreSQL based generic domain mapping table, similar to userdb
++Kgenerics ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`generics',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_mailer.m4 sendmail-8.14.3.pgsql/cf/feature/pg_mailer.m4
+--- sendmail-8.14.3/cf/feature/pg_mailer.m4    1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_mailer.m4      2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,18 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_mailertable.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_MAILER_TABLE_', `')
++define(`_PG_MAILER_TABLE', `')
++
++LOCAL_CONFIG
++# PostgreSQL based mailer table, for overriding domain and MX
++Kmailertable ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`mailertable',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_usersdb.m4 sendmail-8.14.3.pgsql/cf/feature/pg_usersdb.m4
+--- sendmail-8.14.3/cf/feature/pg_usersdb.m4   1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_usersdb.m4     2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,18 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_usersdb.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_REWRITE_TABLE_', `')
++define(`_PG_REWRITE_TABLE_', `')
++
++LOCAL_CONFIG
++# PostgreSQL based user rewrite table (can turn "John.Doe" into "jdoe")
++Kusersdb ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`usersdb',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/cf/feature/pg_virtualusers.m4 sendmail-8.14.3.pgsql/cf/feature/pg_virtualusers.m4
+--- sendmail-8.14.3/cf/feature/pg_virtualusers.m4      1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/cf/feature/pg_virtualusers.m4        2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,18 @@
++divert(-1)
++# By using this file, you agree to be cool and share your knowledge
++#
++# David, http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++
++divert(0)
++VERSIONID(`$Id: pg_virtusertable.m4,v 2.0 2000/07/19 18:15:16 blu3 Exp $')
++divert(-1)
++
++define(`_VIRTUSER_TABLE_', `')
++define(`_PG_VIRTUSER_TABLE_', `')
++
++LOCAL_CONFIG
++# PostgreSQL based virtual user table (maps incoming users)
++Kvirtuser ifelse(defn(`_ARG_'), `',
++               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`virtusertable',
++               `_ARG_')
+diff -ruN sendmail-8.14.3/pgsql-build.mc sendmail-8.14.3.pgsql/pgsql-build.mc
+--- sendmail-8.14.3/pgsql-build.mc     1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/pgsql-build.mc       2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,32 @@
++######################################################################
++# This is the Blue Labs m4 file for the Sendmail w/ Postgres Tables patch.
++#
++# The website for building sendmail with this patch is at
++#   http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++# This patch may eventually be available to Gentoo (http://gentoo.org/)
++# users with the "USE=postgres" use flag
++#
++# !!! EDIT THE CONFIGURATION SETTINGS TO MATCH YOUR NEEDS !!!
++#
++# NOTE: This is a specialised .cf for the postgresql patch only
++#
++VERSIONID(`(#) Blue Labs bluelabs.mc   v 11.1 (Blue Labs) 12 Jan 2007')
++######################################################################
++
++##
++# See http://blue-labs.org/software/sm-pgsql/sendmail.php for detailed
++# instructions
++#
++# TODO: replace 'newaliases' and 'makemap' targets with "don't run this"
++#       update man pages also
++##
++
++# uncomment these two lines if you use /usr/local/pgsql
++# APPENDDEF(`confINCDIRS',`-I/usr/local/pgsql/include')dnl
++# APPENDDEF(`confLIBDIRS',`-L/usr/local/pgsql/lib')dnl
++
++APPENDDEF(`confLIBS',`-lpq')dnl
++APPENDDEF(`confMAPDEF',`-DPGSQLMAP')dnl
++APPENDDEF(`DATABASE_MAP_TYPE', `pgsql')dnl
++
+diff -ruN sendmail-8.14.3/pgsql-config.mc sendmail-8.14.3.pgsql/pgsql-config.mc
+--- sendmail-8.14.3/pgsql-config.mc    1969-12-31 16:00:00.000000000 -0800
++++ sendmail-8.14.3.pgsql/pgsql-config.mc      2007-03-26 13:19:46.000000000 -0700
+@@ -0,0 +1,51 @@
++######################################################################
++# This is the Blue Labs m4 file for the Sendmail w/ Postgres Tables patch.
++#
++# The website for building sendmail with this patch is at
++#   http://blue-labs.org/software/sm-pgsql/sendmail.php
++#
++# This patch may eventually be available to Gentoo (http://gentoo.org/)
++# users with the "USE=postgres" use flag
++#
++# !!! EDIT THE CONFIGURATION SETTINGS TO MATCH YOUR NEEDS !!!
++#
++# NOTE: This is a specialised .cf for the postgresql patch only
++#
++VERSIONID(`(#) Blue Labs bluelabs.mc   v 12.0 (Blue Labs) 12 Dec 2007')
++######################################################################
++
++##
++# See http://blue-labs.org/software/sm-pgsql/sendmail.php for detailed
++# instructions
++##
++
++dnl ##
++dnl # example line:
++dnl #  pgsql [-h <pgsql server>] -c <connection string> -s <query string>
++dnl ##
++
++#
++# PgSql
++#
++# add the flag -f to force case sensitive queries, by default both the
++# search and the value will be folded to lower case. by default %s will be
++# rewritten to by lower('%s').  if -f is specified, then it will only be
++# written as ('%s') and both the input value and the row value MUST match
++# case exactly.
++#
++
++define(`PG_CONNSTR', "host=localhost dbname=sendmail user=sendmail password=raisins")
++define(`SELECT', "select distinct s_out from )
++define(`WHERE', where ``lower'' (s_in) = %s")
++FEATURE(`pg_aliases',      pgsql -c `PG_CONNSTR' -s `SELECT' `aliases'       `WHERE')dnl
++FEATURE(`pg_virtualusers', pgsql -c `PG_CONNSTR' -s `SELECT' `virtualusers'  `WHERE')dnl
++FEATURE(`pg_usersdb',      pgsql -c `PG_CONNSTR' -s `SELECT' `userrewrite'   `WHERE')dnl
++FEATURE(`pg_accessdb',     pgsql -c `PG_CONNSTR' -s `SELECT' `access'        `WHERE')dnl
++FEATURE(`pg_domaintable',  pgsql -c `PG_CONNSTR' -s `SELECT' `domaintable'   `WHERE')dnl
++FEATURE(`pg_generics',     pgsql -c `PG_CONNSTR' -s `SELECT' `genericstable' `WHERE')dnl
++FEATURE(`pg_mailer',       pgsql -c `PG_CONNSTR' -s `SELECT' `mailertable'   `WHERE')dnl
++
++define(`confPROCESS_TITLE_PREFIX', `[Blue-PgSQL]')dnl
++define(`confSMTP_LOGIN_MSG', `Mail server\
++ \
++ Unauthorized use prohibited\
++ \
++ Spam is prohibited here and any detected spam may be used in prosecution\
++ against the spammer. This setup uses PgSQL (postgresql) for most of it''`s\
++ tables, for information on this, see\
++ http://blue-labs.org/software/sm-pgsql/sendmail.php\
++ Don''`t bitch if your MTA is busted and doesn''`t play well with others.\
++ \
++')dnl
++
++dnl # Don't attempt to rebuild an aliases file, sm-pgsql doesn't use files
++dnl # however if you have multiple alias tables and DO use files, remove this
++dnl # next line
++define(`confALIAS_WAIT', `0')dnl
+diff -ruN sendmail-8.14.3/sendmail/README sendmail-8.14.3.pgsql/sendmail/README
+--- sendmail-8.14.3/sendmail/README    2006-11-13 14:27:27.000000000 -0800
++++ sendmail-8.14.3.pgsql/sendmail/README      2007-03-26 13:19:46.000000000 -0700
+@@ -119,6 +119,11 @@
+               have to install the UMich or OpenLDAP
+               (http://www.openldap.org/) ldap and lber libraries to use
+               this flag.
++PGSQLMAP      PostgreSQL SQL query support.  You will need to have
++              PostgreSQL include files and libraries installed to use this
++              feature.  Information on PostgreSQL can be found at
++              http://www.postgresql.org/  Support for this map may be
++              found at http://blue-labs.org/software/sm-pgsql/sendmail.php
+ MAP_REGEX     Regular Expression support.  You will need to use an
+               operating system which comes with the POSIX regex()
+               routines or install a regexp library such as libregex from
+--- sendmail-8.16.1/sendmail/conf.c.orig       2020-06-04 08:27:49.000000000 +0200
++++ sendmail-8.16.1/sendmail/conf.c    2020-08-29 10:15:17.896341069 +0200
+@@ -576,6 +576,12 @@
+               ldapmap_lookup, null_map_store);
+ #endif
++#ifdef PGSQLMAP
++      MAPDEF("pgsql", NULL, MCF_ALIASOK|MCF_NOTPERSIST,
++              pgsql_map_parseargs, pgsql_map_open, pgsql_map_close,
++              pgsql_map_lookup, null_map_store);
++#endif
++
+ #if PH_MAP
+       MAPDEF("ph", NULL, MCF_NOTPERSIST,
+               ph_map_parseargs, ph_map_open, ph_map_close,
+@@ -5864,6 +5870,9 @@
+ #if LDAP_REFERRALS
+       "LDAP_REFERRALS",
+ #endif
++#if PGSQLMAP
++      "PGSQLMAP",
++#endif /* PGSQLMAP */
+ #if LOG
+       "LOG",
+ #endif
+--- sendmail-8.14.3/sendmail/map.c     2007-10-09 20:06:45.000000000 -0400
++++ sendmail-8.14.3.pgsql/sendmail/map.c       2009-11-09 19:54:47.214965897 -0500
+@@ -4706,6 +4706,588 @@
+       }
+ }
+ #endif /* LDAPMAP */
++
++#ifdef PGSQLMAP
++#include <libpq-fe.h>
++
++/* 
++ * PostgreSQL map functionality for Sendmail 8.14.3
++ * Portions Copyright (C) 2000 Jonathan Yarden <jyarden@bluegrass.net>
++ * Remainder copyright (c) 2000-2009 David Ford <david@blue-labs.org>
++ *
++ * For information on PostgreSQL, visit http://www.pgsql.com/
++ * Information on this patch and setup is at
++ * http://blue-labs.org/software/sm-pgsql/sendmail.php
++ *
++ * This patch, because it integrates with and is based on the existing
++ * prior work of Sendmail, is considered by me to be a "derivative
++ * work" subject to the Sendmail licensing terms. Sendmail, Inc. in not
++ * responsible for this code.
++ *
++ * USE AT YOUR OWN RISK. NO WARRANTY OF ANY KIND IS PROVIDED. PLEASE
++ * READ THE INSTRUCTIONS FOR USE OF THIS PATCH BEFORE CONTACTING THE
++ * AUTHOR OR SENDMAIL, INC.   NO SUPPORT OF ANY KIND WILL BE PROVIDED
++ * BY SENDMAIL, INC. FOR THIS PATCH.
++ */
++
++/*
++struct pgsqlmap
++{
++      struct pgsqlmap *p,*n;
++      char    *connstr;
++      PGconn  *conn;
++      pid_t    opener_pid;
++      char    *mapname;
++} *pgsqlmap = NULL; */
++
++char *pgsql_skip_quotes(char *p)
++{
++      p = strchr(p,'"');
++      if (p)
++      {
++              p++;
++              p = strchr(p,'"');
++              if (p) p++;
++      }
++      return p;
++}
++
++/*
++ * Parse PostgreSQL map definition args.
++ *
++ * Nothing really special here, since to be perfectly honest, I have never
++ * seen or used almost all of these options.  Most of this code was taken
++ * directly from existing Sendmail source code.
++ */
++bool pgsql_map_parseargs(MAP *map, char *args)
++{
++      register char *p = args;
++      register int done;
++
++      map->map_mflags |= MF_TRY0NULL | MF_TRY1NULL;
++      for (;;)
++      {
++              while (isascii(*p) && isspace(*p))
++                      p++;
++              if (*p != '-')
++                      break;
++              switch (*++p)
++              {
++                      case 'A':
++                              map->map_mflags |= MF_APPEND;
++                              break;
++
++                      case 'N':
++                              map->map_mflags |= MF_INCLNULL;
++                              map->map_mflags &= ~MF_TRY0NULL;
++                              break;
++
++                      case 'O':
++                              map->map_mflags &= ~MF_TRY1NULL;
++                              break;
++
++                      case 'T':
++                              map->map_tapp = ++p;
++                              break;
++
++                      case 'a':
++                              map->map_app = ++p;
++                              break;
++
++                      case 'f':
++                              map->map_mflags |= MF_NOFOLDCASE;
++                              break;
++
++                      case 'h':
++                              map->map_db2 = ++p;
++                              break;
++
++                      case 'm':
++                              map->map_mflags |= MF_MATCHONLY;
++                              break;
++
++                      case 'o':
++                              map->map_mflags |= MF_OPTIONAL;
++                              break;
++
++                      case 'q':
++                              map->map_mflags |= MF_KEEPQUOTES;
++                              break;
++
++                      case 't':
++                              map->map_mflags |= MF_NODEFER;
++                              break;
++
++/* 
++ * Start of PostgreSQL specific args. I cheat and use some existing
++ * Sendmail variables here since this map class makes no other use of them.
++ */
++
++                      case 'c':                       /* connection string */
++                              map->map_keycolnm = ++p;
++                              p = pgsql_skip_quotes(p);
++                              break;
++
++                      case 's':                       /* select statement */
++                              map->map_valcolnm = ++p;
++                              p = pgsql_skip_quotes(p);
++                              break;
++              }
++
++              if (*p != '\0')
++                      *p++ = '\0';
++      }
++
++      if (map->map_app != NULL)
++              map->map_app = newstr(map->map_app);
++
++      if (map->map_tapp != NULL)
++              map->map_tapp = newstr(map->map_tapp);
++      
++      if (map->map_keycolnm != NULL) { /* database connect string */
++              map->map_keycolnm = newstr(map->map_keycolnm);
++              stripquotes(map->map_keycolnm);
++              p = map->map_keycolnm;
++              while(*p==' ')
++                      p++;
++              map->map_keycolnm = p;
++      } else {
++              sm_syslog(LOG_WARNING, CurEnv->e_id, "No PostgreSQL connect string for %s map %s",
++                              map->map_class->map_cname, map->map_mname);
++              syserr("451 4.3.5 No PostgreSQL connect string for map %s",
++                              map->map_mname);
++              SM_SET_H_ERRNO(TRY_AGAIN);
++              errno = DB_NOTFOUND;
++              return false;
++      }
++
++      if (map->map_valcolnm != NULL) { /* select statement */
++              map->map_valcolnm = newstr(map->map_valcolnm);
++              stripquotes(map->map_valcolnm);
++              p = map->map_valcolnm;
++              while(*p==' ')
++                      p++;
++              map->map_valcolnm = p;
++      } else {
++              sm_syslog(LOG_WARNING, CurEnv->e_id, "No PostgreSQL select statement for %s map %s",
++                              map->map_class->map_cname, map->map_mname);
++              syserr("451 5.3.5 No PostgreSQL select statement for map %s",
++                              map->map_mname);
++              SM_SET_H_ERRNO(TRY_AGAIN);
++              errno = DB_NOTFOUND;
++              return false;
++      }
++
++      return true;
++}
++
++#if 0
++/*
++ * search our list of map connections for a entry that matches our
++ * connection.  it should have the same host and connection string, as well
++ * as the same PID.  someone can choose to put their maps on different
++ * databases, so we cannot share a connection.
++ */
++
++PGconn *pgsql_getconn(char *connstr, char *mapname)
++{
++      pid_t p = getpid();
++      
++      // if no map has been allocated, return immediately
++      if(!pgsqlmap) return NULL;
++
++      // rewind
++      while(pgsqlmap->p) pgsqlmap = pgsqlmap->p;
++
++      #ifdef PGSQLDEBUG
++      sm_syslog(LOG_INFO, CurEnv->e_id, "pgsql_getconn (connection string:%s, pid:%i)", connstr, p);
++      #endif
++
++      // only return connections that match everything                        
++      do
++      {
++              if(pgsqlmap->conn)
++                      if (!strncmp(connstr, pgsqlmap->connstr, strlen(connstr)+1))
++                              if (pgsqlmap->opener_pid == p)
++                                      if (!strncmp(pgsqlmap->mapname, mapname, strlen(mapname))
++                                              return pgsqlmap->conn;
++
++              // if there is more than one map and we're still searching, bump to the next one
++              if (pgsqlmap->n)
++                      pgsqlmap = pgsqlmap->n;
++              else
++                      break;
++      } while(1);
++
++      return NULL;
++}
++
++/*
++ * add a new map entry structure and populate it
++ */
++void pgsql_addconn(char *host, char *connstr, PGconn *conn, mapname)
++{
++      int count=1;
++      
++      if (!pgsqlmap)
++              // create a brand new map structure
++              pgsqlmap= (struct pgsqlmap *) xalloc(sizeof(struct pgsqlmap));
++      
++      else
++      {
++              // fast-forward to the end of the list
++              while(pgsqlmap->n)
++              {
++                      count++;
++                      pgsqlmap = pgsqlmap->n;
++              }
++
++              pgsqlmap->n     = (struct pgsqlmap *) xalloc(sizeof(struct pgsqlmap));
++              pgsqlmap->n->p  = pgsqlmap;
++              pgsqlmap        = pgsqlmap->n;
++      }
++
++      bzero(pgsqlmap, sizeof(struct pgsqlmap));
++      pgsqlmap->connstr       =connstr;
++      pgsqlmap->conn              =conn;
++      pgsqlmap->opener_pid    =getpid();
++      pgsqlmap->mapname       =mapname;
++
++      #ifdef PGSQLDEBUG
++      sm_syslog(LOG_INFO, CurEnv->e_id, "pgsql_ add map connection (connection string:%s, connptr:%p, pid:%i), maplist size is %i",
++                      pgsqlmap->connstr, pgsqlmap->conn, pgsqlmap->opener_pid, count);
++      #endif
++}
++
++int psql_removeconn(PGconn *conn, char *mapname)
++{
++      if(!pgsqlmap) return 0;
++
++      while(pgsqlmap->p) pgsqlmap = pgsqlmap->p;
++
++      do
++      {
++              if (pgsqlmap->conn == conn && !strncmp(pgsqlmap->mapname, mapname, strlen(mapname))
++              {
++                      // the map data doesn't belong to us, just deallocate the map pointer
++                      struct pgsqlmap *z = pgsqlmap;
++
++                      #ifdef PGSQLDEBUG
++                              sm_syslog(LOG_INFO, CurEnv->e_id, "pgsql_ delete map connection (connection string:%s, connptr:%p, pid:%i)",
++                       pgsqlmap->connstr, pgsqlmap->conn, pgsqlmap->opener_pid);
++                      #endif
++
++                      if (z->p && z->n)
++                      {
++                              z->p->n = z->n;
++                              z->n->p = z->p;
++                              free(z);
++                              pgsqlmap = pgsqlmap->n;
++                              return 1;
++                      }
++
++                      else if (z->p)
++                      {
++                              z->p->n = NULL;
++                              free(z);
++                              pgsqlmap = pgsqlmap->p;
++                              return 1;
++                      }
++
++                      else if (z->n)
++                      {
++                              z->n->p = NULL;
++                              free(z);
++                              pgsqlmap = pgsqlmap->n;
++                              return 1;
++                      }
++                      
++                      // only return 1 if no map references are left so the pgsql connection can be shut down
++                      else
++                      {
++                              free(z);
++                              pgsqlmap = NULL;
++                              return 1;
++                      }
++                              
++              }
++
++              if (pgsqlmap->n)
++                      pgsqlmap = pgsqlmap->n;
++              else
++                      break;
++      } while(1);
++      
++      // no maps found
++      return 0;
++}
++#endif
++
++/*
++ * Open a PostgreSQL database connection using the connection string, the
++ * mode parameter is entirely ignored - it has no purpose in SQL.
++ *
++ * Returns TRUE if the database was opened or FALSE if it choked
++ */
++bool pgsql_map_open(MAP *map, int mode)
++{
++      char *s= NULL;
++      int n, retries;
++
++      /*
++       * each map can have a different connection, so we can't easily share
++       * it.  further, each connection is protected between thread instances.
++       */
++
++      /*
++       * this is the most likely test so it comes first.  we have a connection
++       * to the server, if the status appears good, return.  note: the status
++       * may be misleading, the server may have crashed underneath us or
++       * terminated our connection for any of several reasons.  we won't know
++       * that until we actually use it however.
++       */
++      if (map->map_db1 && PQstatus(map->map_db1) == CONNECTION_OK)
++      {
++              // the connection is shared between all maps, we don't need to differentiate
++              #ifdef PGSQLDEBUG
++              sm_syslog(LOG_INFO, CurEnv->e_id, "Connection is good (connection string:%s, connptr:%p)",
++                              map->map_keycolnm, map->map_db1);
++              #endif
++              
++              return true;
++      }
++
++      #ifdef PGSQLDEBUG
++      if (!map->map_db1 || PQstatus(map->map_db1) == CONNECTION_BAD)
++              sm_syslog(LOG_INFO, CurEnv->e_id, "Connection to SQL server not found or stale for map:%s, looking for a new one", map->map_mname);
++      #endif
++
++      retries=10;
++      while ((!map->map_db1 || PQstatus(map->map_db1) == CONNECTION_BAD) && retries-- >0)
++      {
++              /*
++               * now either conn is still null (not yet allocated), or our connection
++               * is bad.  synchronous connections only have _OK or _BAD.  looks like
++               * we have to reset or make a new connection.  allocate space and try to
++               * connect
++               */
++              if (!map->map_db1)
++              {
++                      map->map_db1 = PQconnectdb(map->map_keycolnm);
++                      PQsetErrorVerbosity(map->map_db1, PQERRORS_VERBOSE);
++                      //pgsql_addconn(map->map_keycolnm, map->map_db1, map->map_mname);
++                      map->map_pid = getpid(); /* save PID for check on close */
++              }
++
++              else
++                      PQreset(map->map_db1);
++      
++              if (!map->map_db1)
++              {
++                      sm_syslog(LOG_WARNING, CurEnv->e_id, "Cannot open %s map %s using %s, attempt %i",
++                                      map->map_class->map_cname, map->map_mname, map->map_keycolnm, 10-retries);
++              }
++
++              if (PQstatus(map->map_db1) == CONNECTION_BAD)
++              {
++                      sm_syslog(LOG_WARNING, CurEnv->e_id, "Cannot open %s map %s using %s (%s), attempt %i",
++                                      map->map_class->map_cname, map->map_mname, map->map_keycolnm,
++                                      PQerrorMessage(map->map_db1), 10-retries);
++              }
++      }
++
++      if (!map->map_db1 || PQstatus(map->map_db1) == CONNECTION_BAD)
++      {
++              syserr("451 4.3.5 Map database unreachable");
++              if (map->map_db1)
++              {
++                      //psql_removeconn(conn, map->map_mname);
++                      PQfinish(map->map_db1);
++                      map->map_db1 = NULL;
++              }
++              
++              errno = DB_NOTFOUND;
++              SM_SET_H_ERRNO(TRY_AGAIN);
++              
++              return false;
++      }
++      
++      return true;
++}     
++
++/*
++ * Close the PostgreSQL database connection, check that the opening process
++ * is the closing process; ignore if not.
++ */
++void pgsql_map_close(MAP *map)
++{
++      int r;
++      
++      if (map->map_pid == getpid())
++      {
++              //conn = map->map_db1;
++/*
++              r = psql_removeconn(conn, map->map_mname);
++              if(r)
++              {
++*/                    PQfinish(map->map_db1);
++                      map->map_db1 = NULL;
++                      #ifdef PGSQLDEBUG
++                      sm_syslog(LOG_INFO, CurEnv->e_id, "Closed connection for map %s", map->map_mname);
++                      #endif
++/*            }
++
++              #ifdef PGSQLDEBUG
++              else
++                      sm_syslog(LOG_INFO, CurEnv->e_id, "No connection found for map: %s", map->map_mname);
++              #endif
++*/    }
++}
++
++/*
++** PGSQL_MAP_LOOKUP -- look up a datum in a PGSQL map
++**
++** Attempt to map an incoming key value with a PostgreSQL query.
++**
++** This performs the query specified in the Sendmail config file and
++** uses the value of the first row and column as the map data value.
++** All other rows and columns are ignored.
++*/
++char *
++pgsql_map_lookup(MAP *map, char *name, char **av, int *statp)
++{
++      int len,esc_len,ntuples,r,retries;
++      char *format,*workingbuf,*trustedbuf;
++      char sname[MAXNAME+1];
++      char resbuf[MAXNAME+1];
++      PGresult *res;
++
++      /*
++       * Check the backend to make sure it's still valid.     If it's not, try and
++       * reset the connection.
++       */
++      if (!map->map_db1 || PQstatus(map->map_db1) == CONNECTION_BAD)
++      {
++              #ifdef PGSQLDEBUG
++              sm_syslog(LOG_INFO, NOQID, "Connection bad for map: %s, reconnecting to SQL server using: %s", map->map_mname, map->map_keycolnm);
++              #endif
++              if (!pgsql_map_open(map, 0))
++              {
++                      #ifdef PGSQLDEBUG
++                      sm_syslog(LOG_INFO, CurEnv->e_id, "dbg> aborting map lookup");
++                      #endif
++                      return NULL;
++              }
++      }                               
++
++      bzero(sname,sizeof sname);
++      bzero(resbuf,sizeof resbuf);
++
++      /* Buffer overflow check. */
++      len = strlen(name);
++      if (len > MAXNAME)
++              len = MAXNAME;
++      bcopy(name,sname,len);
++      
++      if (!bitset(MF_NOFOLDCASE, map->map_mflags))
++      {
++              //#ifdef PGSQLDEBUG
++              //sm_syslog(LOG_INFO, CurEnv->e_id, "dbg> making querystring value lowercase");
++              //#endif
++              makelower(sname);
++      }
++
++      /* Allocate query buffer (select statement + key value) */
++      len                      = strlen(map->map_valcolnm);
++      esc_len      = strlen(sname);
++      workingbuf       = xalloc(esc_len*2+1+9);
++      trustedbuf   = xalloc(len+(esc_len*2)+1+9);
++      bzero(trustedbuf,len);
++
++      // escape untrusted data passed to us from network
++      PQescapeStringConn(map->map_db1, trustedbuf, sname, strlen(sname), NULL);
++      
++      // if MF_NOFOLDCASE is set, don't wrap this in lower()
++      if (!bitset(MF_NOFOLDCASE, map->map_mflags))
++              format="lower('%s')";
++      else
++              format="'%s'";
++      
++      sprintf(workingbuf, format, trustedbuf);
++      sprintf(trustedbuf, map->map_valcolnm, workingbuf);
++      free(workingbuf);
++      
++      #ifdef PGSQLDEBUG
++      sm_syslog(LOG_INFO, CurEnv->e_id, "dbg-sql> %s", trustedbuf);
++      #endif
++      
++      retries = 2;
++      while (retries--)
++      {
++              res = PQexec(map->map_db1, trustedbuf);
++              if (PQresultStatus(res) == PGRES_TUPLES_OK)
++                      break;
++
++              sm_syslog(LOG_WARNING, CurEnv->e_id, "Cannot query PGSQL database (attempt:%i) \"%s\" using \"%s\" because of: %s",
++                              10-retries, map->map_keycolnm, trustedbuf, PQresultErrorMessage(res));
++              PQclear(res);
++
++              // try to reset connection
++              if (!pgsql_map_open(map, 0))
++              {
++                      #ifdef PGSQLDEBUG
++                      sm_syslog(LOG_INFO, CurEnv->e_id, "dbg> aborting map lookup");
++                      #endif
++                      return NULL;
++              }
++      }
++
++      if (!map->map_db1 || PQresultStatus(res) != PGRES_TUPLES_OK)
++      {
++              syserr("451 4.3.1 Cannot query PGSQL database");
++              SM_SET_H_ERRNO(TRY_AGAIN);
++              errno = DB_NOTFOUND;
++              free(trustedbuf);
++              return NULL;
++      }
++
++      /*
++       * See if anything came back. If no rows were returned, nothing there for
++       * this query.
++       */
++      ntuples = PQntuples(res);
++      #ifdef PGSQLDEBUG
++      sm_syslog(LOG_INFO, CurEnv->e_id, "dbg> finishing map lookup, ntuples:%i", ntuples);
++      #endif
++
++      if (ntuples <= 0)
++      {
++              PQclear(res);
++              return NULL;
++      }
++
++      /*
++       * Get the result from column 0 and clear the rest of the result.
++       * If the result data is too big, then it's truncated.
++       */     
++      len = PQgetlength(res,0,0);
++      if (len > MAXNAME)
++              len = MAXNAME;
++      bcopy(PQgetvalue(res,0,0),resbuf,len);
++      PQclear(res);
++
++      /* Process results like the other map classes do. */
++
++      #ifdef PGSQLDEBUG
++      sm_syslog(LOG_INFO, CurEnv->e_id, "dbg> finishing map lookup, result:\"%s\"", resbuf);
++      #endif
++
++      if (bitset(MF_MATCHONLY, map->map_mflags))
++              return map_rewrite(map, name, strlen(name), NULL);
++      else
++              return map_rewrite(map, resbuf, len, av);
++}
++#endif /* PGSQLMAP */
+ /*
+ **  PH map
+ */
diff --git a/bluelabs.patch-8.12.3 b/bluelabs.patch-8.12.3
deleted file mode 100644 (file)
index 1e0b05a..0000000
+++ /dev/null
@@ -1,1018 +0,0 @@
-diff -urN sendmail-8.12.3/Makefile sendmail-8.12.3.patched/Makefile
---- sendmail-8.12.3/Makefile   Thu Aug 23 22:44:39 2001
-+++ sendmail-8.12.3.patched/Makefile   Fri Apr 26 17:10:37 2002
-@@ -2,7 +2,7 @@
- SHELL= /bin/sh
- SUBDIRS= libsm libsmutil libsmdb sendmail editmap mail.local \
--       mailstats makemap praliases rmail smrsh vacation
-+       mailstats rmail smrsh vacation
- # libmilter: requires pthread
- BUILD=   ./Build
- OPTIONS= $(CONFIG) $(FLAGS)
-diff -urN sendmail-8.12.3/bluelabs.mc sendmail-8.12.3.patched/bluelabs.mc
---- sendmail-8.12.3/bluelabs.mc        Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/bluelabs.mc        Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,243 @@
-+######################################################################
-+# This is the Blue Labs m4 file.
-+#
-+# A work-in-progress website for building sendmail with this patch is
-+# at http://blue-labs.org/clue/sendmail.php
-+#
-+# !!! EDIT THE CONFIGURATION SETTINGS TO MATCH YOUR DESIRES !!!
-+#
-+# NOTE: THIS IS A SPECIALISED .cf FOR THE POSTGRESQL PATCH ONLY
-+#
-+VERSIONID(`(#) Blue Labs bluelabs.mc   v 9.1 (Blue Labs) 10/13/2001')
-+######################################################################
-+
-+##
-+# See http://blue-labs.org/clue/sendmail.php for detailed instructions
-+#
-+# TODO: replace 'newaliases' and 'makemap' targets with "don't run this"
-+#       replace man pages also
-+##
-+
-+# compile options
-+divert(-1)dnl
-+OSTYPE(linux)dnl
-+define(`confBLDVARIANT',`OPTIMIZED') # optimize the binary
-+# note, there will be two -O flags as it compiles.  According to the gcc
-+# man page, the last one on the line is used in the compile
-+define(`confCCOPTS',`-O3 -pipe -mcpu=i686 -march=i686')dnl
-+APPENDDEF(`confENVDEF', `-DSM_CONF_SHM -DDNSMAP -DMILTER -DMAP_REGEX')dnl
-+
-+#####################################################################################
-+#
-+# BIG BOLD WARNING.  link -lcrypt BEFORE -lcrypto or your md5 salted
-+# passwords will handled as DES passwords and FAIL TO WORK.  Thank OpenSSL for
-+# this
-+#
-+#####################################################################################
-+
-+##
-+# SASL, be sure to link -lcrypt FIRST so it overrides the built-in crypt()
-+# in openssl, !@#$!@% that is so frustrating
-+##
-+APPENDDEF(`confENVDEF', `-DSASL')dnl
-+APPENDDEF(`confINCDIRS', `-I/usr/local/include -I/usr/local/include/sasl')dnl
-+APPENDDEF(`confLIBS', `-lsasl -lcrypt')dnl
-+APPENDDEF(`confLIBDIRS', `-L/usr/local/lib/sasl')dnl
-+define(`confDEF_AUTH_INFO', `/etc/mail/auth/auth-info')dnl
-+define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
-+TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
-+
-+##
-+# postgres items
-+##
-+APPENDDEF(`confMAPDEF',`-DPGSQLMAP')dnl
-+APPENDDEF(`confINCDIRS',`-I/usr/local/pgsql/include')dnl
-+APPENDDEF(`confLIBDIRS',`-L/usr/local/pgsql/lib')dnl
-+# if you have compiled/installed BIND, you need to add -lresolv
-+APPENDDEF(`confLIBS',`-lpq -lresolv')dnl
-+
-+##
-+# TLS (ssl) items
-+#
-+# Compile with -D_FFR_SASL_OPTS and set 'p' in AuthOptions. (p not done)
-+#
-+##
-+APPENDDEF(`confENVDEF',`-DSTARTTLS -D_FFR_SASL_OPTS')dnl
-+APPENDDEF(`confLIBS',`-lssl -lcrypto')dnl
-+define(`SSL_DIR', `/usr/ssl')dnl
-+define(`confCACERT_PATH', `SSL_DIR/certs')dnl
-+define(`confCACERT', `SSL_DIR/certs/cacert.pem')dnl
-+define(`confSERVER_CERT', `SSL_DIR/certs/mailcert.pem')dnl
-+define(`confSERVER_KEY', `SSL_DIR/private/mailkey.pem')dnl
-+define(`confCLIENT_CERT', `SSL_DIR/certs/mailcert.pem')dnl
-+define(`confCLIENT_KEY', `SSL_DIR/private/mailkey.pem')dnl
-+define(`confAUTH_OPTIONS',`p')
-+
-+FEclass-E-expose
-+FLclass-L-localusers
-+
-+##
-+# example line:
-+#  pgsql [-h <pgsql server>] -c <connection string> -s <query string>
-+##
-+
-+APPENDDEF(`DATABASE_MAP_TYPE', `pgsql')dnl
-+define(`PG_WHERE', where s_in='%s')
-+define(`PG_CONNSTR', "dbname=sendmail user=sendmail")
-+define(`PG_SOUT', "select distinct s_out from)
-+FEATURE(`pg_aliases', pgsql -c `PG_CONNSTR' -s `PG_SOUT' aliases `PG_WHERE'")dnl
-+FEATURE(`pg_virtualusers', pgsql -c `PG_CONNSTR' -s `PG_SOUT' virtualusers `PG_WHERE'")dnl
-+FEATURE(`pg_usersdb', pgsql -c `PG_CONNSTR' -s `PG_SOUT' userrewrite `PG_WHERE'")dnl
-+FEATURE(`pg_accessdb', pgsql -c `PG_CONNSTR' -s `PG_SOUT' access `PG_WHERE'")dnl
-+FEATURE(`pg_domaintable', pgsql -c `PG_CONNSTR' -s `PG_SOUT' domaintable `PG_WHERE'")dnl
-+FEATURE(`pg_generics', pgsql -c `PG_CONNSTR' -s `PG_SOUT' genericstable `PG_WHERE'")dnl
-+FEATURE(`pg_mailer', pgsql -c `PG_CONNSTR' -s `PG_SOUT' mailertable `PG_WHERE'")dnl
-+
-+define(`confPROCESS_TITLE_PREFIX', `[Blue-PgSQL]')dnl
-+define(`confMAX_MESSAGE_SIZE', `52428800')dnl  # 50 Megs
-+define(`confFORWARD_PATH', `$z/.forward:/etc/mail/forward-files/$u')dnl
-+define(`confHOST_STATUS_DIRECTORY', `/etc/mail/host-status/')dnl
-+define(`confDEF_USER_ID', `mail')dnl
-+define(`confMAX_DAEMON_CHILDREN', `40')dnl
-+define(`confCONNECTION_RATE_THROTTLE', `20')dnl
-+define(`confSINGLE_LINE_FROM_HEADER', `True')dnl
-+define(`confSMTP_LOGIN_MSG', `$j Sendmail $v/$Z; $b\
-+ \
-+ Spam is prohibited here and any detected spam may be used in prosecution\
-+ against the spammer. This sendmail setup uses PgSQL (postgres) for most of\
-+ it''`s tables, for information on this, see\
-+ http://blue-labs.org/clue/sendmail.php\
-+ \
-+')dnl
-+define(`confDONT_PROBE_INTERFACES', `True')dnl
-+define(`confREJECT_MSG', `550 Your mail is rejected.\
-+    Contact <admin@$m> to have this matter resolved.\
-+ ')dnl
-+define(`confTO_INITIAL', `1m')dnl
-+define(`confTO_CONNECT', `15s')dnl
-+define(`confTO_HELO', `4m')dnl
-+define(`confTO_HOSTSTATUS', `1m')dnl
-+define(`confTO_DATAINIT', `2m')dnl
-+define(`confTO_DATABLOCK', `5m')dnl
-+define(`confTO_DATAFINAL', `5m')dnl
-+define(`confCONNECTION_RATE_THROTTLE', `40')dnl
-+define(`confDIAL_DELAY', `15s')dnl
-+define(`confNO_RCPT_ACTION', `add-apparently-to')dnl
-+define(`confALIAS_WAIT', `0')dnl
-+define(`confMAX_HOP', `35')dnl
-+define(`confQUEUE_LA', `5')dnl
-+define(`confREFUSE_LA', `12')dnl
-+define(`confSEPARATE_PROC', `False')dnl
-+
-+define(`confCON_EXPENSIVE', `true')dnl
-+define(`confWORK_RECIPIENT_FACTOR', `1000')dnl
-+define(`confWORK_TIME_FACTOR', `3000')dnl
-+define(`confQUEUE_SORT_ORDER', `Time')dnl
-+
-+define(`confDEAD_LETTER_DROP', `/var/tmp/dead.letter')dnl
-+define(`confRRT_IMPLIES_DSN', `True')dnl
-+define(`confCONTROL_SOCKET_NAME', `/var/spool/mqueue/.control')dnl
-+define(`confMAX_HEADERS_LENGTH', `16384')dnl
-+define(`confMAX_ALIAS_RECURSION', `10')dnl
-+define(`confMAX_RCPTS_PER_MESSAGE', `50')dnl
-+define(`confSHAREDMEMORYKEY', `42')dnl
-+define(`confMCI_CACHE_SIZE', `4')dnl
-+define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
-+define(`STATUS_FILE', `/etc/mail/sendmail-status')dnl
-+
-+##
-+# queue groups
-+##
-+FEATURE(`queuegroup')dnl
-+define(`QUEUE_DIR', `/var/spool/mqueue')dnl
-+define(`LOCAL_PROG_QGRP', `local')dnl
-+define(`LOCAL_MAILER_QGRP', `local')dnl
-+define(`ESMTP_MAILER_QGRP', `smtp')dnl
-+define(`SMTP8_MAILER_QGRP', `smtp')dnl
-+define(`DSMTP_MAILER_QGRP', `smtp')dnl
-+define(`RELAY_MAILER_QGRP', `smtp')dnl
-+dnl QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, r=5, F=f, R=2')dnl
-+
-+dnl Nice is the nice(2) increment for queue groups
-+dnl Interval is the tiem between two queue runs
-+dnl Path..
-+dnl Runners is the number of parallel queue runners
-+dnl Jobs is the max number of messages delivered per queue run
-+dnl recipients is the max number of recipients per envelope
-+
-+QUEUE_GROUP(`local', `P=/var/spool/mqueue/local, N=0, I=30s, R=5, J=500, r=100, F=f')dnl
-+QUEUE_GROUP(`smtp', `P=/var/spool/mqueue/smtp, N=5, I=30s, R=10, J=500, r=100, F=f')dnl
-+QUEUE_GROUP(`relay', `P=/var/spool/mqueue/relay, N=10, I=1m, R=2, r=100, F=f')dnl
-+QUEUE_GROUP(`lmtp', `P=/var/spool/mqueue/lmtp, N=0, I=30s, R=2, r=100, F=f')dnl
-+QUEUE_GROUP(`expensive', `P=/var/spool/mqueue/expensive, F=e, N=19 I=5m R=1 r=200')dnl
-+
-+# HoldExpensive  [c] If an outgoing mailer is marked as being expensive, don't connect
-+# immediately. This requires that queueing be compiled in, since it will depend on a queue
-+# run process to actually send the mail.
-+
-+##
-+# distinguish case on names, Blu3 is different from blu3
-+##
-+MODIFY_MAILER_FLAGS(`LOCAL', `+u')dnl
-+
-+FEATURE(`always_add_domain')dnl
-+FEATURE(`blacklist_recipients')dnl
-+dnl FEATURE(`dnsbl',`rbl.maps.vix.com',` Mail from $&{client_addr} rejected; see http://mail-abuse.org/rbl/')dnl
-+dnl FEATURE(`dnsbl',`dul.maps.vix.com')dnl
-+
-+FEATURE(`dnsbl',`blackholes.mail-abuse.org',  `Mail from $&{client_addr} rejected; see http://mail-abuse.org/rbl/')dnl
-+FEATURE(`dnsbl',`dialups.mail-abuse.org',  `Mail from $&{client_addr} rejected; see http://mail-abuse.org/rbl/')dnl
-+FEATURE(`dnsbl',`relays.mail-abuse.org',  `Mail from $&{client_addr} rejected; see http://mail-abuse.org/rbl/')dnl
-+
-+FEATURE(`rhsbl',`dsn.rfc-ignorant.org', `550 You do not accept bounces violating RFC 821/2505/2821 - see http://www.rfc-ignorant.org/', `h')dnl
-+FEATURE(`rhsbl',`postmaster.rfc-ignorant.org', `550 Mail rejected as your domain does not have a working postmaster address - see http://www.rfc-ignorant.org/', `h')dnl
-+FEATURE(`rhsbl',`abuse.rfc-ignorant.org', `550 Mail rejected as your domain does not have a working abuse address - see http://www.rfc-ignorant.org/', `h')dnl
-+FEATURE(`rhsbl',`whois.rfc-ignorant.org', `550 Mail rejected as your whois information does not exist or is obviously fictitous - see http://www.rfc-ignorant.org/', `h')dnl
-+
-+FEATURE(`delay_checks')dnl
-+FEATURE(`generics_entire_domain')dnl
-+FEATURE(`local_procmail')dnl
-+FEATURE(`masquerade_envelope')dnl
-+FEATURE(`nouucp',`reject')dnl
-+FEATURE(`redirect')dnl
-+FEATURE(`relay_based_on_MX')dnl
-+FEATURE(`relay_entire_domain')dnl
-+FEATURE(`use_ct_file')dnl
-+FEATURE(`use_cw_file')dnl
-+FEATURE(`virtuser_entire_domain')dnl
-+FEATURE(`delay_checks',`friend')dnl
-+FEATURE(`lookupdotdomain')
-+
-+MASQUERADE_DOMAIN_FILE(`/etc/mail/masquerade-these-as-me')dnl
-+
-+MAILER(local)dnl
-+MAILER(smtp)dnl
-+
-+LOCAL_RULESETS
-+
-+#
-+# snow white
-+#
-+HFrom: $>CheckFrom
-+SCheckFrom
-+# Snow White Virus
-+R$* <hahaha@sexyfun.net> $*   $#error $: "553 Delivery blocked: Snow White virus"
-+
-+#
-+# sircam
-+#
-+Kchkcontent regex -a@REJ Outlook_Express_message_boundary
-+HContent-Type: $>CheckContent
-+SCheckContent
-+R$*           $: $(chkcontent $&({currHeader} $)
-+R@REJ         $error $: "553 Delivery blocked  ---  SirCam virus detected"
-+
-+#
-+# subject check
-+# subject encodings, non-ascii characters, and trailing numbers in subject
-+# with lots of spaces are spam
-+Kchksubject regex -a@REJ ^=\?|[\80-ÿ]{3,}| {9,}[0-9]{3,}| {9,}\[[A-Za-z0-9]{3,}\]
-+HSubject: $>CheckSubject
-+SCheckSubject
-+R$*           $: $(chksubject $&{currHeader} $)
-+R@REJ         $#error $: "553 Delivery blocked  ---  `Subject:' suggests spam"
-diff -urN sendmail-8.12.3/cf/feature/pg_accessdb.m4 sendmail-8.12.3.patched/cf/feature/pg_accessdb.m4
---- sendmail-8.12.3/cf/feature/pg_accessdb.m4  Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_accessdb.m4  Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,19 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_ACCESS_TABLE_', `')
-+define(`_PG_ACCESS_TABLE_', `')
-+define(`_TAG_DELIM_', `:')dnl should be in OperatorChars
-+
-+LOCAL_CONFIG
-+# PostgreSQL based access list
-+Kaccess ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`access',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_aliases.m4 sendmail-8.12.3.patched/cf/feature/pg_aliases.m4
---- sendmail-8.12.3/cf/feature/pg_aliases.m4   Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_aliases.m4   Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,19 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+undefine(`ALIAS_FILE')
-+define(`_ALIASES_TABLE_', `')
-+define(`_PG_ALIASES_TABLE_', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based local aliases
-+Kaliases ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`aliases',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_domaintable.m4 sendmail-8.12.3.patched/cf/feature/pg_domaintable.m4
---- sendmail-8.12.3/cf/feature/pg_domaintable.m4       Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_domaintable.m4       Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,18 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_DOMAIN_TABLE_', `')
-+define(`_PG_DOMAIN_TABLE', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based domain rewriting table
-+Kdomaintable ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`domaintable',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_generics.m4 sendmail-8.12.3.patched/cf/feature/pg_generics.m4
---- sendmail-8.12.3/cf/feature/pg_generics.m4  Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_generics.m4  Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,18 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_GENERICS_TABLE_', `')
-+define(`_PG_GENERICS_TABLE', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based generic domain mapping table, similar to userdb
-+Kgenerics ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`generics',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_mailer.m4 sendmail-8.12.3.patched/cf/feature/pg_mailer.m4
---- sendmail-8.12.3/cf/feature/pg_mailer.m4    Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_mailer.m4    Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,18 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_MAILER_TABLE_', `')
-+define(`_PG_MAILER_TABLE', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based mailer table, for overriding domain and MX
-+Kmailertable ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`mailertable',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_usersdb.m4 sendmail-8.12.3.patched/cf/feature/pg_usersdb.m4
---- sendmail-8.12.3/cf/feature/pg_usersdb.m4   Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_usersdb.m4   Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,18 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_REWRITE_TABLE_', `')
-+define(`_PG_REWRITE_TABLE_', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based user rewrite table (can turn "John.Doe" into "jdoe")
-+Kusersdb ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`usersdb',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/pg_virtualusers.m4 sendmail-8.12.3.patched/cf/feature/pg_virtualusers.m4
---- sendmail-8.12.3/cf/feature/pg_virtualusers.m4      Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/pg_virtualusers.m4      Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,18 @@
-+divert(-1)
-+# By using this file, you agree to be cool and share your knowledge
-+#
-+# David, http://blue-labs.org/clue/sendmail.php
-+#
-+
-+divert(0)
-+VERSIONID(`$Id$')
-+divert(-1)
-+
-+define(`_VIRTUSER_TABLE_', `')
-+define(`_PG_VIRTUSER_TABLE_', `')
-+
-+LOCAL_CONFIG
-+# PostgreSQL based virtual user table (maps incoming users)
-+Kvirtuser ifelse(defn(`_ARG_'), `',
-+               DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`virtusertable',
-+               `_ARG_')
-diff -urN sendmail-8.12.3/cf/feature/rhsbl.m4 sendmail-8.12.3.patched/cf/feature/rhsbl.m4
---- sendmail-8.12.3/cf/feature/rhsbl.m4        Thu Jan  1 01:00:00 1970
-+++ sendmail-8.12.3.patched/cf/feature/rhsbl.m4        Fri Apr 26 17:10:37 2002
-@@ -0,0 +1,43 @@
-+divert(-1)
-+#
-+# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
-+#     All rights reserved.
-+#
-+# By using this file, you agree to the terms and conditions set
-+# forth in the LICENSE file which can be found at the top level of
-+# the sendmail distribution.
-+#
-+#
-+
-+divert(0)
-+ifdef(`_DNSBL_R_',`dnl',`dnl
-+VERSIONID(`$Id$')
-+define(`_DNSBL_R_',`')
-+LOCAL_CONFIG
-+# map for DNS based blacklist lookups
-+Kdnsbl host -T<TMP>')
-+divert(-1)
-+define(`_DNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
-+
-+define(`_DNSBL_LOOKUP_', `ifelse(_ARG4_,`h',`client_name',`client_addr')')dnl
-+
-+define(`_DNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of "$`'&{_DNSBL_LOOKUP_} " at '_DNSBL_SRV_`"',`_ARG2_')')dnl
-+define(`_DNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{_DNSBL_LOOKUP_} " refused by blackhole site '_DNSBL_SRV_`"',`_ARG2_')')dnl
-+divert(8)
-+
-+dnl 
-+dnl the "dnsbl" listed below should be replaced with "host" on 8.11 systems
-+dnl
-+
-+ifelse(_ARG4_,`h',
-+`R$*                  $: $&{client_name}
-+R[ $* ]                       $: $1                   Get rid of square brackets
-+R$*                   $: <?> $(dnsbl $1.'_DNSBL_SRV_`. $: OK $)',
-+`R$*                  $: $&{client_addr}
-+R$-.$-.$-.$-          $: <?> $(dnsbl $4.$3.$2.$1.'_DNSBL_SRV_`. $: OK $)')
-+R<?>OK                        $: OKSOFAR
-+ifelse(len(X`'_ARG3_),`1',
-+`R<?>$+<TMP>          $: TMPOK',
-+`R<?>$+<TMP>          $#error $@ 4.7.1 $: _DNSBL_MSG_TMP_')
-+R<?>$+                        $#error $@ 5.7.1 $: _DNSBL_MSG_
-+divert(-1)
-diff -urN sendmail-8.12.3/include/libsmdb/smdb.h sendmail-8.12.3.patched/include/libsmdb/smdb.h
---- sendmail-8.12.3/include/libsmdb/smdb.h     Mon Nov 19 20:30:03 2001
-+++ sendmail-8.12.3.patched/include/libsmdb/smdb.h     Fri Apr 26 17:10:37 2002
-@@ -18,6 +18,14 @@
- # include <sm/gen.h>
- # include <sm/errstring.h>
-+# ifndef PGSQLMAP
-+#  ifndef NDBM
-+#   ifndef NEWDB
-+  ERROR       NDBM or NEWDB must be defined.
-+#   endif /* ! NEWDB */
-+#  endif /* ! NDBM */
-+# endif /* ! PGSQLMAP */
-+
- # ifdef NDBM
- #  include <ndbm.h>
- # endif /* NDBM */
-diff -urN sendmail-8.12.3/sendmail/Makefile.m4 sendmail-8.12.3.patched/sendmail/Makefile.m4
---- sendmail-8.12.3/sendmail/Makefile.m4       Sat Dec  1 00:32:02 2001
-+++ sendmail-8.12.3.patched/sendmail/Makefile.m4       Fri Apr 26 17:10:37 2002
-@@ -13,7 +13,7 @@
- define(`bldTARGET_INST_DEP', ifdef(`confINST_DEP', `confINST_DEP',
- `${DESTDIR}/etc/mail/submit.cf ${DESTDIR}${MSPQ}'))dnl
- define(`bldTARGET_LINKS', ifdef(`confLINKS', `confLINKS',
--`${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
-+`${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
- )dnl
- # location of sendmail statistics file (usually /etc/mail/ or /var/log)
-diff -urN sendmail-8.12.3/sendmail/README sendmail-8.12.3.patched/sendmail/README
---- sendmail-8.12.3/sendmail/README    Thu Apr  4 23:39:33 2002
-+++ sendmail-8.12.3.patched/sendmail/README    Fri Apr 26 17:10:37 2002
-@@ -117,6 +117,10 @@
-               have to install the UMich or OpenLDAP
-               (http://www.openldap.org/) ldap and lber libraries to use
-               this flag.
-+PGSQLMAP      PostgreSQL SQL query support.  You will need to have
-+              PostgreSQL include files and libraries installed to use this
-+              feature.  Information on PostgreSQL can be found at
-+              http://www.postgresql.org
- MAP_REGEX     Regular Expression support.  You will need to use an
-               operating system which comes with the POSIX regex()
-               routines or install a regexp library such as libregex from
-diff -urN sendmail-8.12.3/sendmail/conf.c sendmail-8.12.3.patched/sendmail/conf.c
---- sendmail-8.12.3/sendmail/conf.c    Thu Apr  4 23:32:14 2002
-+++ sendmail-8.12.3.patched/sendmail/conf.c    Fri Apr 26 17:10:37 2002
-@@ -491,6 +491,12 @@
-               ldapmap_lookup, null_map_store);
- #endif /* LDAPMAP */
-+#ifdef PGSQLMAP
-+      MAPDEF("pgsql", NULL, MCF_ALIASOK|MCF_NOTPERSIST,
-+              pgsql_map_parseargs, pgsql_map_open, pgsql_map_close,
-+              pgsql_map_lookup, null_map_store);
-+#endif
-+
- #if PH_MAP
-       MAPDEF("ph", NULL, MCF_NOTPERSIST,
-               ph_map_parseargs, ph_map_open, ph_map_close,
-@@ -5484,6 +5490,9 @@
- #if LDAPMAP
-       "LDAPMAP",
- #endif /* LDAPMAP */
-+#if PGSQL
-+      "PGSQL",
-+#endif /* PGSQL */
- #if LOG
-       "LOG",
- #endif /* LOG */
-diff -urN sendmail-8.12.3/sendmail/map.c sendmail-8.12.3.patched/sendmail/map.c
---- sendmail-8.12.3/sendmail/map.c     Tue Mar 26 23:56:36 2002
-+++ sendmail-8.12.3.patched/sendmail/map.c     Fri Apr 26 17:10:37 2002
-@@ -4839,6 +4839,482 @@
-       }
- }
- #endif /* LDAPMAP */
-+
-+#ifdef PGSQLMAP
-+#include <libpq-fe.h>
-+
-+struct pgsqlmap {
-+      struct pgsqlmap *p,*n;
-+      char *host;
-+      char *connstr;
-+      PGconn *conn;
-+      pid_t pid;
-+} *pgsqlmap=NULL;
-+
-+/*
-+ * search our structure for matching entries/add entry to struct
-+ */
-+
-+PGconn *getconn(char *host, char *connstr)
-+{
-+      pid_t p=getpid();
-+      
-+      if(!pgsqlmap)
-+              return NULL;
-+
-+      while(pgsqlmap->p)
-+              pgsqlmap=pgsqlmap->p;
-+
-+#if (PGSQLDEBUG)
-+      sm_syslog(LOG_MAIL, NOQID, "   HostSearch (host:%s, cstr:%s, pid:%i)",
-+              host, connstr, p);
-+#endif
-+
-+      // only return connections that match everything                
-+      do {
-+              if(pgsqlmap->conn) {
-+                      if (!strncmp(connstr, pgsqlmap->connstr, strlen(connstr)+1)) {
-+                              if ((!host && !pgsqlmap->host) || !strncmp(host, pgsqlmap->host, strlen(host)+1)) {
-+                                      if (pgsqlmap->pid == p) {
-+                                              return pgsqlmap->conn;
-+                                      }
-+                              }
-+                      }
-+              }
-+
-+              if (pgsqlmap->n)
-+                      pgsqlmap=pgsqlmap->n;
-+              else
-+                      break;
-+      } while(1);
-+
-+      return NULL;
-+}
-+
-+void addconn(char *host, char *connstr, PGconn *conn)
-+{
-+      if(pgsqlmap) {
-+              // advance, then alloc
-+              while(pgsqlmap->n)
-+                      pgsqlmap=pgsqlmap->n;
-+              pgsqlmap->n= (struct pgsqlmap *) xalloc(sizeof(struct pgsqlmap));
-+              bzero(pgsqlmap->n, sizeof(struct pgsqlmap));
-+              pgsqlmap->n->p=pgsqlmap;
-+              pgsqlmap=pgsqlmap->n;
-+      } else {
-+              // create
-+              pgsqlmap= (struct pgsqlmap *) xalloc(sizeof(struct pgsqlmap));
-+              bzero(pgsqlmap, sizeof(struct pgsqlmap));
-+      }
-+
-+      pgsqlmap->host=host;
-+      pgsqlmap->connstr=connstr;
-+      pgsqlmap->conn=conn;
-+      pgsqlmap->pid=getpid();
-+
-+#if (PGSQLDEBUG)
-+      sm_syslog(LOG_MAIL, NOQID, "      HostAdd (host:%s, cstr:%s, conn:%p, pid:%i)",
-+              host, connstr, conn, pgsqlmap->pid);
-+#endif
-+}
-+
-+int removeconn(PGconn *conn)
-+{
-+      if(!pgsqlmap)
-+              return 0;
-+
-+      while(pgsqlmap->p)
-+              pgsqlmap=pgsqlmap->p;
-+
-+      do {
-+              if (pgsqlmap->conn==conn) {
-+                      /*
-+                       * no pressing desire to remove it from the structure, sendmail will
-+                       * exit soon enough. just free the data and null the conn value
-+                       */
-+                      if(pgsqlmap->host) {
-+                              pgsqlmap->host=NULL;
-+                      }
-+                      if(pgsqlmap->connstr) {
-+                              pgsqlmap->connstr=NULL;
-+                      }
-+                      pgsqlmap->conn=NULL;
-+                      pgsqlmap->pid=0;
-+                      return 1;
-+              }
-+
-+              if (pgsqlmap->n)
-+                      pgsqlmap=pgsqlmap->n;
-+              else
-+                      break;
-+      } while(1);
-+      
-+      return 0;
-+}
-+
-+/* 
-+ * PostgreSQL map functionality for Sendmail 8.12.0
-+ * Portions Copyright (C) 2000 Jonathan Yarden <jyarden@bluegrass.net>
-+ * Remainder copyright (c) 2000,2001 David Ford <david@blue-labs.org>
-+ *
-+ * For information on PostgreSQL, visit http://www.pgsql.com/
-+ * Information on this patch and setup is at http://blue-labs.org/ under
-+ * sendmail link.
-+ *
-+ * This patch, because it integrates with and is based on the existing
-+ * prior work of Sendmail, is considered by me to be a "derivative
-+ * work" subject to the Sendmail licensing terms.  Sendmail, Inc. in not
-+ * responsable for this code.
-+ *
-+ * USE AT YOUR OWN RISK.  NO WARRANTY OF ANY KIND IS PROVIDED. PLEASE
-+ * READ THE INSTRUCTIONS FOR USE OF THIS PATCH BEFORE CONTACTING THE
-+ * AUTHOR OR SENDMAIL, INC.  NO SUPPORT OF ANY KIND WILL BE PROVIDED
-+ * BY SENDMAIL, INC. FOR THIS PATCH.
-+ */
-+
-+char *skip_quotes(char *p)
-+{
-+   p = strchr(p,'"');
-+   if (p) {
-+      p++;
-+      p = strchr(p,'"');
-+      if (p) p++;
-+   }
-+   return p;
-+}
-+/*
-+ * Parse PostgreSQL map definition args.
-+ *
-+ * Nothing really special here, since to be perfectly honest, I have never
-+ * seen or used almost all of these options.  Most of this code was taken
-+ * directly from existing Sendmail source code.
-+ */
-+bool
-+pgsql_map_parseargs(map,args)
-+      MAP *map;
-+      char *args;
-+{
-+      register char *p = args;
-+      register int done;
-+
-+      map->map_mflags |= MF_TRY0NULL | MF_TRY1NULL;
-+      for (;;) {
-+              while (isascii(*p) && isspace(*p))
-+                      p++;
-+              if (*p != '-')
-+                      break;
-+              switch (*++p) {
-+                      case 'N':
-+                              map->map_mflags |= MF_INCLNULL;
-+                              map->map_mflags &= ~MF_TRY0NULL;
-+                              break;
-+
-+                      case 'O':
-+                              map->map_mflags &= ~MF_TRY1NULL;
-+                              break;
-+
-+                      case 'o':
-+                              map->map_mflags |= MF_OPTIONAL;
-+                              break;
-+
-+                      case 'f':
-+                              map->map_mflags |= MF_NOFOLDCASE;
-+                              break;
-+
-+                      case 'm':
-+                              map->map_mflags |= MF_MATCHONLY;
-+                              break;
-+
-+                      case 'A':
-+                              map->map_mflags |= MF_APPEND;
-+                              break;
-+
-+                      case 'q':
-+                              map->map_mflags |= MF_KEEPQUOTES;
-+                              break;
-+
-+                      case 't':
-+                              map->map_mflags |= MF_NODEFER;
-+                              break;
-+
-+                      case 'a':
-+                              map->map_app = ++p;
-+                              break;
-+
-+                      case 'T':
-+                              map->map_tapp = ++p;
-+                              break;
-+
-+/* 
-+ * Start of PostgreSQL specific args.  I cheat and use some existing
-+ * Sendmail variables here since this map class makes no other use of them.
-+ */
-+
-+                      case 'c':               /* connection string */
-+                              map->map_keycolnm = ++p;
-+                              p = skip_quotes(p);
-+                              break;
-+
-+                      case 'h':               /* host string */
-+                              map->map_db2 = ++p;
-+                              p = skip_quotes(p);
-+                              break;
-+
-+                      case 's':               /* select statement */
-+                              map->map_valcolnm = ++p;
-+                              p = skip_quotes(p);
-+                              break;
-+              }
-+
-+              if (*p != '\0')
-+                      *p++ = '\0';
-+      }
-+
-+      if (map->map_app != NULL)
-+              map->map_app = newstr(map->map_app);
-+
-+      if (map->map_tapp != NULL)
-+              map->map_tapp = newstr(map->map_tapp);
-+      
-+      if(map->map_db2 != NULL) {
-+              map->map_db2 = newstr(map->map_db2);
-+              stripquotes(map->map_db2);
-+              p=map->map_db2;
-+              while(*p==' ')
-+                                      p++;
-+              map->map_db2=p;
-+      }
-+
-+      if (map->map_keycolnm != NULL) { /* database connect string */
-+              map->map_keycolnm = newstr(map->map_keycolnm);
-+              stripquotes(map->map_keycolnm);
-+              p=map->map_keycolnm;
-+              while(*p==' ')
-+                                      p++;
-+              map->map_keycolnm=p;
-+   } else {
-+      syserr("No PostgreSQL connect string for %s map %s",
-+             map->map_class->map_cname, map->map_mname);
-+      return false;
-+   }
-+
-+      if (map->map_valcolnm != NULL) { /* select statement */
-+              map->map_valcolnm = newstr(map->map_valcolnm);
-+              stripquotes(map->map_valcolnm);
-+              p=map->map_valcolnm;
-+              while(*p==' ')
-+                                      p++;
-+              map->map_valcolnm=p;
-+   } else {
-+      syserr("No PostgreSQL select statement for %s map %s",
-+             map->map_class->map_cname, map->map_mname);
-+      return false;
-+   }
-+
-+#if (PGSQLDEBUG)
-+      sm_syslog(LOG_MAIL, NOQID, "psqlinfo(%s, %s, %s)",
-+              map->map_db2, map->map_keycolnm, map->map_valcolnm);
-+#endif
-+      return true;
-+}
-+
-+/*
-+ * Open a PostgreSQL database connection using the connection string.
-+ *
-+ * Returns TRUE if the database was opened or FALSE if it choked. 
-+ *
-+ * - Changed to check return status better on open and save
-+ *   PID to fix Broken pipes from child processes closing the
-+ *   connection on us.
-+ */
-+bool
-+pgsql_map_open(map, mode)
-+      MAP *map;
-+      int mode;
-+{
-+      PGconn *conn;
-+       char *s;
-+       int n=0;
-+ 
-+      conn=(PGconn *) map->map_db1;
-+
-+      /*
-+       * check our list for an already established connection that
-+       * matches both the host and connection string
-+       * keycolnm is the connection string
-+       * file is the hostname
-+       */
-+      conn=getconn(map->map_db2, map->map_keycolnm);
-+
-+      /*
-+       * we already have a connection to the server
-+       */
-+      if (PQstatus(conn) == CONNECTION_OK) {
-+#if (PGSQLDEBUG)
-+              sm_syslog(LOG_MAIL, NOQID, "AlreadyExists (host:%s, cstr:%s, conn:%p)",
-+                      map->map_db2, map->map_keycolnm, conn);
-+#endif
-+              map->map_db1 = (ARBPTR_T) conn;
-+              return true;
-+      }
-+  
-+      if(map->map_db2)
-+              n+=strlen(map->map_db2);
-+      if(map->map_keycolnm)
-+              n+=strlen(map->map_keycolnm);
-+      
-+      s=malloc(n+2);
-+      sprintf(s, "%s %s",
-+              map->map_db2? map->map_db2:"",
-+              map->map_keycolnm? map->map_keycolnm:"");
-+
-+      conn=PQconnectdb(s);
-+      if (!conn || PQstatus(conn) == CONNECTION_BAD) {
-+              if (conn)
-+                      PQfinish(conn);
-+              syserr("Cannot open %s map \'%s\' using \"%s\" (%s)",
-+                      map->map_class->map_cname,
-+                      map->map_mname,
-+                      s,
-+                      PQerrorMessage(conn));
-+                      free(s);
-+              return false;
-+      }
-+      free(s);
-+
-+      addconn(map->map_db2, map->map_keycolnm, conn);
-+      map->map_db1 = (ARBPTR_T) conn;
-+      map->map_pid = getpid(); /* save PID for check on close */
-+      return true;
-+}   
-+
-+/*
-+ * Close the PostgreSQL database connection, check that the opening process
-+ * is the closing process; ignore if not.
-+ */
-+void
-+pgsql_map_close(map)
-+      MAP *map;
-+{
-+      PGconn *conn;
-+      int r;
-+      
-+      if (map->map_pid == getpid()) {
-+              conn= (PGconn *) map->map_db1;
-+              r=removeconn(conn);
-+              if(r)
-+                      PQfinish(conn);
-+#if (PGSQLDEBUG)
-+              sm_syslog(LOG_MAIL, NOQID, "Closed map %s", map->map_mname);
-+#endif
-+      }
-+}
-+
-+/*
-+** PGSQL_MAP_LOOKUP -- look up a datum in a PGSQL map
-+**
-+** Attempt to map an incoming key value with a PostgreSQL query.
-+**
-+** This performs the query specified in the Sendmail config file and
-+** uses the value of the first row and column as the map data value.
-+** All other rows and columns are ignored.
-+**
-+** July 8, 2000
-+** 
-+** - Modified to check the status of the PostgreSQL connection and reset it
-+**   if it looks like it has dropped.  This was done to flush out an error,
-+**   but it's a good idea to do this anyway just in case.
-+** 
-+*/
-+char *
-+pgsql_map_lookup(map, name, av, statp)
-+   MAP *map;
-+   char *name;
-+   char **av;
-+   int *statp;
-+{
-+   int len,ntuples,r;
-+   char *sbuf;
-+   char sname[MAXNAME+1];
-+   char resbuf[MAXNAME+1];
-+   PGconn *conn = (PGconn *) map->map_db1;
-+   PGresult *res;
-+
-+   bzero(sname,sizeof sname);
-+   bzero(resbuf,sizeof resbuf);
-+
-+      /* Buffer overflow check. */
-+   len = strlen(name);
-+   if (len > MAXNAME)
-+              len=MAXNAME;
-+   bcopy(name,sname,len);
-+   
-+   if (!bitset(MF_NOFOLDCASE, map->map_mflags))
-+      makelower(sname);
-+
-+      /* Allocate query buffer (select statement + key value) */
-+   len = strlen(map->map_valcolnm) + strlen(sname);
-+   sbuf = xalloc(len);
-+   bzero(sbuf,len);
-+
-+/*
-+ * Check the backend to make sure it's still valid.  If it's not, try and
-+ * reset the connection.  This is a good idea anyway, just in case
-+ * the backend died.  BTW this is how I discovered the "child close" bug.
-+ */
-+      r=PQstatus(conn);
-+   if (r == CONNECTION_BAD) {
-+#if (PGSQLDEBUG)
-+              sm_syslog(LOG_MAIL, NOQID, "CNX Bad, resetting (%i)", r);
-+#endif
-+      PQreset(conn); /* does this block?  I hope so */
-+      if (PQstatus(conn) == CONNECTION_BAD) {
-+         PQfinish(conn);
-+         syserr("Unable to reestablish closed PGSQL connection %s",map->map_keycolnm);
-+         return NULL;
-+      }
-+   }         
-+
-+      /* Create SQL query statement and execute it */   
-+   sprintf(sbuf,map->map_valcolnm,sname);
-+   
-+   /*syserr("starting map lookup, pid: %i", map->map_pid);*/
-+   res = PQexec(conn,sbuf);
-+   if (PQresultStatus(res) != PGRES_TUPLES_OK) {
-+      PQclear(res);
-+      syserr("Cannot query PGSQL database %s using %s",map->map_keycolnm,sbuf);
-+      return NULL;
-+   }
-+
-+/*
-+ * See if anything came back.  If no rows were returned, nothing there for
-+ * this query.
-+ */
-+   ntuples = PQntuples(res);
-+   if (ntuples <= 0) {
-+      PQclear(res);
-+      return NULL;
-+   }
-+
-+/*
-+ * Get the result from column 0 and clear the rest of the result.
-+ * If the result data is too big, then it's truncated.
-+ */   
-+   len = PQgetlength(res,0,0);
-+   if (len > MAXNAME) len=MAXNAME;
-+   bcopy(PQgetvalue(res,0,0),resbuf,len);
-+   PQclear(res);
-+
-+/*
-+ * Process results like the other map classes do.
-+ */
-+  /*syserr("finishing map lookup, pid: %i", map->map_pid);*/
-+      if (bitset(MF_MATCHONLY, map->map_mflags))
-+              return map_rewrite(map, name, strlen(name), NULL);
-+      else
-+              return map_rewrite(map, resbuf, len, av);
-+}
-+#endif /* PGSQLMAP */
- /*
- **  PH map
- */
diff --git a/openssl-1.1.0.patch b/openssl-1.1.0.patch
deleted file mode 100644 (file)
index 4507621..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
-Date: Sat, 10 Sep 2016 19:27:17 +0000
-Subject: [PATCH] sendmail: compile against openssl 1.1.0
-
-Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
----
-
---- a/sendmail/tls.c
-+++ b/sendmail/tls.c
-@@ -60,18 +60,58 @@ static unsigned char dh512_g[] =
-       0x02
- };
-+#if OPENSSL_VERSION_NUMBER < 0x10100000
-+
-+static inline int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
-+{
-+      /* If the fields p and g in d are NULL, the corresponding input
-+       * parameters MUST be non-NULL.  q may remain NULL.
-+       */
-+      if ((dh->p == NULL && p == NULL)
-+          || (dh->g == NULL && g == NULL))
-+              return 0;
-+
-+      if (p != NULL) {
-+              BN_free(dh->p);
-+              dh->p = p;
-+      }
-+      if (q != NULL) {
-+              BN_free(dh->q);
-+              dh->q = q;
-+      }
-+      if (g != NULL) {
-+              BN_free(dh->g);
-+              dh->g = g;
-+      }
-+
-+      if (q != NULL) {
-+              dh->length = BN_num_bits(q);
-+      }
-+
-+      return 1;
-+}
-+#endif
-+
- static DH *
- get_dh512()
- {
-       DH *dh = NULL;
-+      BIGNUM *p;
-+      BIGNUM *g;
--      if ((dh = DH_new()) == NULL)
--              return NULL;
--      dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
--      dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
--      if ((dh->p == NULL) || (dh->g == NULL))
--              return NULL;
-+      dh = DH_new();
-+      p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
-+      g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
-+      if (!dh || !p || !g)
-+              goto err;
-+      if (!DH_set0_pqg(dh, p, NULL, g))
-+              goto err;
-       return dh;
-+err:
-+      DH_free(dh);
-+      BN_free(p);
-+      BN_free(g);
-+      return NULL;
- }
- #  if 0
-@@ -117,17 +157,22 @@ get_dh2048()
-               };
-       static unsigned char dh2048_g[]={ 0x02, };
-       DH *dh;
-+      BIGNUM *p;
-+      BIGNUM *g;
--      if ((dh=DH_new()) == NULL)
--              return(NULL);
--      dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
--      dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
--      if ((dh->p == NULL) || (dh->g == NULL))
--      {
--              DH_free(dh);
--              return(NULL);
--      }
-+      dh = DH_new();
-+      p = BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
-+      g = BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
-+      if (!dh || !p || !g)
-+              goto err;
-+      if (!DH_set0_pqg(dh, p, NULL, g))
-+              goto err;
-       return(dh);
-+err:
-+      DH_free(dh);
-+      BN_free(p);
-+      BN_free(g);
-+      return NULL;
- }
- # endif /* !NO_DH */
-@@ -926,7 +971,7 @@ inittls(ctx, req, options, srv, certfile
-       {
-               /* get a pointer to the current certificate validation store */
-               store = SSL_CTX_get_cert_store(*ctx);   /* does not fail */
--              crl_file = BIO_new(BIO_s_file_internal());
-+              crl_file = BIO_new(BIO_s_file());
-               if (crl_file != NULL)
-               {
-                       if (BIO_read_filename(crl_file, CRLFile) >= 0)
-@@ -1000,26 +1045,43 @@ inittls(ctx, req, options, srv, certfile
-       **  maybe we should do it only on demand...
-       */
--      if (bitset(TLS_I_RSA_TMP, req)
- #  if SM_CONF_SHM
--          && ShmId != SM_SHM_NO_ID &&
--          (rsa_tmp = RSA_generate_key(RSA_KEYLENGTH, RSA_F4, NULL,
--                                      NULL)) == NULL
--#  else /* SM_CONF_SHM */
--          && 0        /* no shared memory: no need to generate key now */
--#  endif /* SM_CONF_SHM */
--         )
-+      if (bitset(TLS_I_RSA_TMP, req)
-+          && ShmId != SM_SHM_NO_ID)
-       {
--              if (LogLevel > 7)
-+              BIGNUM *bn;
-+
-+              bn = BN_new();
-+              rsa_tmp = RSA_new();
-+              if (!bn || !rsa_tmp || !BN_set_word(bn, RSA_F4)) {
-+                      RSA_free(rsa_tmp);
-+                      rsa_tmp = NULL;
-+              }
-+              if (rsa_tmp)
-               {
--                      sm_syslog(LOG_WARNING, NOQID,
--                                "STARTTLS=%s, error: RSA_generate_key failed",
--                                who);
--                      if (LogLevel > 9)
--                              tlslogerr(LOG_WARNING, who);
-+                      if (!RSA_generate_key_ex(rsa_tmp, RSA_KEYLENGTH, bn, NULL))
-+                      {
-+                              RSA_free(rsa_tmp);
-+                              rsa_tmp = NULL;
-+                      }
-+              }
-+              BN_free(bn);
-+              if (!rsa_tmp)
-+              {
-+                      if (LogLevel > 7)
-+                      {
-+                              sm_syslog(LOG_WARNING, NOQID,
-+                                        "STARTTLS=%s, error: RSA_generate_key failed",
-+                                        who);
-+                              if (LogLevel > 9)
-+                                      tlslogerr(LOG_WARNING, who);
-+                      }
-+                      return false;
-               }
--              return false;
-       }
-+#  else /* SM_CONF_SHM */
-+      /* no shared memory: no need to generate key now */
-+#  endif /* SM_CONF_SHM */
- # endif /* !TLS_NO_RSA */
-       /*
-@@ -1210,9 +1272,15 @@ inittls(ctx, req, options, srv, certfile
-                               sm_dprintf("inittls: Generating %d bit DH parameters\n", bits);
-                       /* this takes a while! */
--                      dsa = DSA_generate_parameters(bits, NULL, 0, NULL,
--                                                    NULL, 0, NULL);
--                      dh = DSA_dup_DH(dsa);
-+                      dsa = DSA_new();
-+                      if (dsa) {
-+                              int r;
-+
-+                              r = DSA_generate_parameters_ex(dsa, bits, NULL, 0,
-+                                                          NULL, NULL, NULL);
-+                              if (r != 0)
-+                                      dh = DSA_dup_DH(dsa);
-+                      }
-                       DSA_free(dsa);
-               }
-               else if (dh == NULL && bitset(TLS_I_DHFIXED, req))
-@@ -1733,6 +1801,9 @@ tmp_rsa_key(s, export, keylength)
-       int export;
-       int keylength;
- {
-+      BIGNUM *bn;
-+      int ret;
-+
- #   if SM_CONF_SHM
-       extern int ShmId;
-       extern int *PRSATmpCnt;
-@@ -1742,10 +1813,22 @@ tmp_rsa_key(s, export, keylength)
-               return rsa_tmp;
- #   endif /* SM_CONF_SHM */
--      if (rsa_tmp != NULL)
--              RSA_free(rsa_tmp);
--      rsa_tmp = RSA_generate_key(RSA_KEYLENGTH, RSA_F4, NULL, NULL);
--      if (rsa_tmp == NULL)
-+      if (rsa_tmp == NULL) {
-+              rsa_tmp = RSA_new();
-+              if (!rsa_tmp)
-+                      return NULL;
-+      }
-+
-+      bn = BN_new();
-+      if (!bn)
-+              return NULL;
-+      if (!BN_set_word(bn, RSA_F4)) {
-+              BN_free(bn);
-+              return NULL;
-+      }
-+      ret = RSA_generate_key_ex(rsa_tmp, RSA_KEYLENGTH, bn, NULL);
-+      BN_free(bn);
-+      if (!ret)
-       {
-               if (LogLevel > 0)
-                       sm_syslog(LOG_ERR, NOQID,
-@@ -1971,9 +2054,9 @@ x509_verify_cb(ok, ctx)
-       {
-               if (LogLevel > 13)
-                       tls_verify_log(ok, ctx, "x509");
--              if (ctx->error == X509_V_ERR_UNABLE_TO_GET_CRL)
-+              if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_UNABLE_TO_GET_CRL)
-               {
--                      ctx->error = 0;
-+                      X509_STORE_CTX_set_error(ctx, 0);
-                       return 1;       /* override it */
-               }
-       }
---- a/doc/op/op.me
-+++ b/doc/op/op.me
-@@ -10898,7 +10898,7 @@ C=FileName_of_CA_Certificate
- ln -s $C `openssl x509 -noout -hash < $C`.0
- .)b
- A better way to do this is to use the
--.b c_rehash
-+.b "openssl rehash"
- command that is part of the OpenSSL distribution
- because it handles subject hash collisions
- by incrementing the number in the suffix of the filename of the symbolic link,
diff --git a/sendmail-cyrus.patch b/sendmail-cyrus.patch
new file mode 100644 (file)
index 0000000..36942cb
--- /dev/null
@@ -0,0 +1,11 @@
+--- sendmail-8.13.0/cf/mailer/cyrus.m4.cyrus   2004-06-30 11:47:47.116910591 +0200
++++ sendmail-8.13.0/cf/mailer/cyrus.m4 2004-06-30 11:49:02.262556546 +0200
+@@ -36,7 +36,7 @@
+ #
+ _DEFIFNOT(`CYRUS_MAILER_FLAGS', `Ah5@/:|')
+-ifdef(`CYRUS_MAILER_PATH',, `define(`CYRUS_MAILER_PATH', /usr/cyrus/bin/deliver)')
++ifdef(`CYRUS_MAILER_PATH',, `define(`CYRUS_MAILER_PATH', /usr/sbin/deliver)')
+ ifdef(`CYRUS_MAILER_ARGS',, `define(`CYRUS_MAILER_ARGS', `deliver -e -m $h -- $u')')
+ ifdef(`CYRUS_MAILER_USER',, `define(`CYRUS_MAILER_USER', `cyrus:mail')')
+ _DEFIFNOT(`CYRUS_BB_MAILER_FLAGS', `u')
diff --git a/sendmail-format_string.patch b/sendmail-format_string.patch
deleted file mode 100644 (file)
index 8c0e704..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-diff -ruNp sendmail-8.15.2.orig/sendmail/envelope.c sendmail-8.15.2/sendmail/envelope.c
---- sendmail-8.15.2.orig/sendmail/envelope.c   2014-06-12 19:30:47.000000000 +0200
-+++ sendmail-8.15.2/sendmail/envelope.c        2018-02-21 12:59:15.364725322 +0100
-@@ -323,7 +323,7 @@ dropenvelope(e, fulldrop, split)
-                       /* don't free, allocated from e_rpool */
-                       e->e_message = sm_rpool_strdup_x(e->e_rpool, buf);
--                      message(buf);
-+                      message("%s", buf);
-                       e->e_flags |= EF_CLRQUEUE;
-               }
-               if (msg_timeout == MSG_NOT_BY)
-@@ -420,7 +420,7 @@ dropenvelope(e, fulldrop, split)
-                               /* don't free, allocated from e_rpool */
-                               e->e_message = sm_rpool_strdup_x(e->e_rpool,
-                                                                buf);
--                              message(buf);
-+                              message("%s", buf);
-                               e->e_flags |= EF_WARNING;
-                       }
-                       if (msg_timeout == MSG_WARN_BY)
-diff -ruNp sendmail-8.15.2.orig/sendmail/parseaddr.c sendmail-8.15.2/sendmail/parseaddr.c
---- sendmail-8.15.2.orig/sendmail/parseaddr.c  2015-03-18 12:47:12.000000000 +0100
-+++ sendmail-8.15.2/sendmail/parseaddr.c       2018-02-21 12:59:15.386725225 +0100
-@@ -218,7 +218,7 @@ parseaddr(addr, a, flags, delim, delimpt
-                       msg = "Deferring message until queue run";
-               if (tTd(20, 1))
-                       sm_dprintf("parseaddr: queueing message\n");
--              message(msg);
-+              message("%s", msg);
-               if (e->e_message == NULL && e->e_sendmode != SM_DEFER)
-                       e->e_message = sm_rpool_strdup_x(e->e_rpool, msg);
-               a->q_state = QS_QUEUEUP;
-diff -ruNp sendmail-8.15.2.orig/sendmail/srvrsmtp.c sendmail-8.15.2/sendmail/srvrsmtp.c
---- sendmail-8.15.2.orig/sendmail/srvrsmtp.c   2015-03-18 12:47:12.000000000 +0100
-+++ sendmail-8.15.2/sendmail/srvrsmtp.c        2018-02-21 12:59:15.409725123 +0100
-@@ -122,6 +122,26 @@ extern ENVELOPE   BlankEnvelope;
- #define SKIP_SPACE(s) while (isascii(*s) && isspace(*s))      \
-                               (s)++
-+static inline void
-+message1(fmt)
-+      char *fmt;
-+{
-+      if (strchr(fmt, '%') == NULL)
-+              message(fmt, NULL);
-+      else
-+              message("%s", fmt);
-+}
-+
-+static inline void
-+usrerr1(fmt)
-+      char *fmt;
-+{
-+      if (strchr(fmt, '%') == NULL)
-+              usrerr(fmt, NULL);
-+      else
-+              usrerr("%s", fmt);
-+}
-+
- /*
- **  PARSE_ESMTP_ARGS -- parse EMSTP arguments (for MAIL, RCPT)
- **
-@@ -578,13 +598,13 @@ static bool      smtp_data __P((SMTP_T *, ENV
-                               bool tsave = QuickAbort;                \
-                                                                       \
-                               QuickAbort = false;                     \
--                              usrerr(response);                       \
-+                              usrerr1(response);                      \
-                               QuickAbort = tsave;                     \
-                               e->e_sendqueue = NULL;                  \
-                               goto doquit;                            \
-                       }                                               \
-                       else                                            \
--                              usrerr(response);                       \
-+                              usrerr1(response);                      \
-                       break;                                          \
-                                                                       \
-                 case SMFIR_REJECT:                                    \
-@@ -931,7 +951,7 @@ smtp(nullserver, d_flags, e)
-       }
-       else if (strncmp(nullserver, "421 ", 4) == 0)
-       {
--              message(nullserver);
-+              message1(nullserver);
-               goto doquit;
-       }
-@@ -1849,7 +1869,7 @@ smtp(nullserver, d_flags, e)
-                               if (nullserver != NULL)
-                               {
-                                       if (ISSMTPREPLY(nullserver))
--                                              usrerr(nullserver);
-+                                              usrerr1(nullserver);
-                                       else
-                                               usrerr("550 5.0.0 %s",
-                                                      nullserver);
-@@ -2452,7 +2472,7 @@ smtp(nullserver, d_flags, e)
-                                       tempfail = true;
-                                       smtp.sm_milterize = false;
-                                       if (response != NULL)
--                                              usrerr(response);
-+                                              usrerr1(response);
-                                       else
-                                               message("421 4.7.0 %s closing connection",
-                                                       MyHostName);
-@@ -3659,7 +3679,7 @@ smtp_data(smtp, e)
-                               (void) extenhsc(response + 4, ' ', e->e_enhsc);
- #endif /* _FFR_MILTER_ENHSC */
--                      usrerr(response);
-+                      usrerr1(response);
-                       if (strncmp(response, "421 ", 4) == 0
-                           || strncmp(response, "421-", 4) == 0)
-                       {
-@@ -3779,7 +3799,7 @@ smtp_data(smtp, e)
-                       if (ISSMTPCODE(response))
-                               (void) extenhsc(response + 4, ' ', e->e_enhsc);
- #endif /* _FFR_MILTER_ENHSC */
--                      usrerr(response);
-+                      usrerr1(response);
-                       if (strncmp(response, "421 ", 4) == 0
-                           || strncmp(response, "421-", 4) == 0)
-                               rv = false;
index 17b2449fed8f8e00c55ac6f2622416d19471e352..114ff4d67ab6978773f3d2c49ce72fc7303fa038 100644 (file)
 +/etc/smrsh \- directory for restricted programs
  .PP
  /var/adm/sm.bin \- directory for restricted programs on HP UX and Solaris
 +/etc/smrsh \- directory for restricted programs
  .PP
  /var/adm/sm.bin \- directory for restricted programs on HP UX and Solaris
---- ./smrsh/smrsh.c.org        Tue Sep 30 10:12:59 2003
-+++ ./smrsh/smrsh.c    Tue Sep 30 10:14:02 2003
+--- sendmail-8.16.1/smrsh/smrsh.c.orig 2020-08-28 23:00:20.515734197 +0200
++++ sendmail-8.16.1/smrsh/smrsh.c      2020-08-29 09:13:31.036422852 +0200
 @@ -77,7 +77,7 @@
  # ifdef SMRSH_CMDDIR
  #  define CMDDIR      SMRSH_CMDDIR
 @@ -77,7 +77,7 @@
  # ifdef SMRSH_CMDDIR
  #  define CMDDIR      SMRSH_CMDDIR
- # else /* SMRSH_CMDDIR */
+ # else
 -#  define CMDDIR      "/usr/adm/sm.bin"
 +#  define CMDDIR      "/etc/smrsh"
 -#  define CMDDIR      "/usr/adm/sm.bin"
 +#  define CMDDIR      "/etc/smrsh"
- # endif /* SMRSH_CMDDIR */
+ # endif
  #endif /* ! CMDDIR */
  
 @@ -89,7 +89,7 @@
  # ifdef SMRSH_PATH
  #  define PATH                SMRSH_PATH
  #endif /* ! CMDDIR */
  
 @@ -89,7 +89,7 @@
  # ifdef SMRSH_PATH
  #  define PATH                SMRSH_PATH
- # else /* SMRSH_PATH */
+ # else
 -#  define PATH                "/bin:/usr/bin:/usr/ucb"
 +#  define PATH                "/bin:/usr/bin:/usr/sbin"
 -#  define PATH                "/bin:/usr/bin:/usr/ucb"
 +#  define PATH                "/bin:/usr/bin:/usr/sbin"
- # endif /* SMRSH_PATH */
+ # endif
  #endif /* ! PATH */
  
  #endif /* ! PATH */
  
index 6cdc5a2dbf78cc37d6c582383d867ddb57b77650..b54963b991a12574fc61db6d4db575c1fe3c7473 100644 (file)
@@ -2,9 +2,8 @@
 # - make sid-milter support:
 #   http://sourceforge.net/projects/sid-milter/
 #   http://www.sendmail.net/
 # - make sid-milter support:
 #   http://sourceforge.net/projects/sid-milter/
 #   http://www.sendmail.net/
-# - http://blue-labs.org/clue/bluelabs.patch-8.12.3 has been updated upstream
 # - fix re-entrancy of install
 # - fix re-entrancy of install
-# - add tests bcond and/or disable tests tha fail on (AC-)builders
+# - add tests bcond?
 #
 # Conditional build:
 %bcond_without ldap    # without LDAP support
 #
 # Conditional build:
 %bcond_without ldap    # without LDAP support
@@ -22,12 +21,12 @@ Summary(ru.UTF-8):  Почтовый транспортный агент sendmail
 Summary(tr.UTF-8):     Elektronik posta hizmetleri sunucusu
 Summary(uk.UTF-8):     Поштовий транспортний агент sendmail
 Name:          sendmail
 Summary(tr.UTF-8):     Elektronik posta hizmetleri sunucusu
 Summary(uk.UTF-8):     Поштовий транспортний агент sendmail
 Name:          sendmail
-Version:       8.15.2
-Release:       3
+Version:       8.16.1
+Release:       1
 License:       BSD
 Group:         Networking/Daemons/SMTP
 Source0:       ftp://ftp.sendmail.org/pub/sendmail/%{name}.%{version}.tar.gz
 License:       BSD
 Group:         Networking/Daemons/SMTP
 Source0:       ftp://ftp.sendmail.org/pub/sendmail/%{name}.%{version}.tar.gz
-# Source0-md5: a824fa7dea4d3341efb6462ccd816f00
+# Source0-md5: 055f1d76c8027993a01ab6425aea4ae7
 Source1:       %{name}.init
 Source2:       %{name}.sysconfig
 Source3:       %{name}.aliases
 Source1:       %{name}.init
 Source2:       %{name}.sysconfig
 Source3:       %{name}.aliases
@@ -50,18 +49,19 @@ Patch3:             %{name}-os-paths.patch
 Patch4:                %{name}-m4path.patch
 Patch5:                %{name}-redirect.patch
 Patch6:                %{name}-hprescan-dos.patch
 Patch4:                %{name}-m4path.patch
 Patch5:                %{name}-redirect.patch
 Patch6:                %{name}-hprescan-dos.patch
-Patch7:                %{name}-format_string.patch
-# originally from http://blue-labs.org/clue/bluelabs.patch-8.12.3
-Patch8:                bluelabs.patch-8.12.3
-Patch9:                openssl-1.1.0.patch
+Patch7:                %{name}-cyrus.patch
+# https://blue-labs.org/software/sm-pgsql/sendmail.php
+# https://blue-labs.org/software/sm-pgsql/bluelabs-smpgsql-8.14.3.patch.bz2
+Patch8:                bluelabs-smpgsql-8.14.3.patch
 URL:           http://www.sendmail.org/
 URL:           http://www.sendmail.org/
-BuildRequires: cyrus-sasl-devel
-BuildRequires: db-devel >= 4.1.25
+BuildRequires: cyrus-sasl-devel >= 2.1.21
+BuildRequires: db-devel >= 4.2
+BuildRequires: libnsl-devel
 # man or man-db
 BuildRequires: man-db
 %{?with_ldap:BuildRequires:    openldap-devel >= 2.3.0}
 # man or man-db
 BuildRequires: man-db
 %{?with_ldap:BuildRequires:    openldap-devel >= 2.3.0}
-%{?with_tls:BuildRequires:     openssl-devel >= 0.9.7d}
-%{?with_pgsql:BuildRequires:   postgresql-devel}
+%{?with_tls:BuildRequires:     openssl-devel >= 0.9.8}
+%{?with_pgsql:BuildRequires:   postgresql-devel >= 8.1}
 BuildRequires: rpmbuild(macros) >= 1.310
 BuildRequires: sed >= 4.0
 %ifarch sparc
 BuildRequires: rpmbuild(macros) >= 1.310
 BuildRequires: sed >= 4.0
 %ifarch sparc
@@ -185,24 +185,11 @@ Pliki nagłówkowe i statyczna biblioteka libmilter.
 %patch6 -p1
 %patch7 -p1
 %{?with_pgsql:%patch8 -p1}
 %patch6 -p1
 %patch7 -p1
 %{?with_pgsql:%patch8 -p1}
-%patch9 -p1
 
 sed -e 's|@@PATH@@|\.\.|' < %{SOURCE6} > cf/cf/pld.mc
 
 cp -p %{SOURCE7} config.m4
 
 
 sed -e 's|@@PATH@@|\.\.|' < %{SOURCE6} > cf/cf/pld.mc
 
 cp -p %{SOURCE7} config.m4
 
-# Ac-specific hack:
-# It's problem with _simultanous_ building when builders are on the same
-# machine. These are anonymous SHM tests (AFAIR) which must fail when called
-# simultanously...
-#
-# send on builders requests only for some arch - it won't fail.
-#- blues
-%ifarch i386 i586 athlon
-%{__sed} -i -e 's/^\(smtest.*t-shm\)/dnl \1/' libsm/Makefile.m4
-%{__sed} -i -e 's/^\(smtest.*t-sem\)/dnl \1/' libsm/Makefile.m4
-%endif
-
 %build
 echo "define(\`confLIBSEARCHPATH', \`/%{_lib} %{_prefix}/%{_lib}')" >> config.m4
 echo "define(\`confCC', \`%{__cc}')" >> config.m4
 %build
 echo "define(\`confLIBSEARCHPATH', \`/%{_lib} %{_prefix}/%{_lib}')" >> config.m4
 echo "define(\`confCC', \`%{__cc}')" >> config.m4
@@ -294,10 +281,6 @@ cp -p cf/cf/pld.cf $RPM_BUILD_ROOT%{_sysconfdir}/sendmail.cf
 sed -e 's|@@PATH@@|%{_datadir}/sendmail-cf|' < %{SOURCE6} \
        > $RPM_BUILD_ROOT%{_sysconfdir}/sendmail.mc
 
 sed -e 's|@@PATH@@|%{_datadir}/sendmail-cf|' < %{SOURCE6} \
        > $RPM_BUILD_ROOT%{_sysconfdir}/sendmail.mc
 
-%if %{with pgsql}
-cp -p bluelabs.mc $RPM_BUILD_ROOT%{_sysconfdir}/bluelabs.mc
-%endif
-
 # submit.mc (submit.cf is installed automatically)
 cp -p cf/cf/submit.mc $RPM_BUILD_ROOT%{_sysconfdir}
 
 # submit.mc (submit.cf is installed automatically)
 cp -p cf/cf/submit.mc $RPM_BUILD_ROOT%{_sysconfdir}
 
@@ -460,7 +443,6 @@ fi
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/submit.mc
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/local-host-names
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/aliases
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/submit.mc
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/local-host-names
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/aliases
-%{?with_pgsql:%{_sysconfdir}/bluelabs.mc}
 %attr(644,root,mail) %ghost %{_sysconfdir}/aliases.db
 %attr(770,root,smmsp) %dir /var/spool/clientmqueue
 %attr(750,root,mail) %dir /var/spool/mqueue
 %attr(644,root,mail) %ghost %{_sysconfdir}/aliases.db
 %attr(770,root,smmsp) %dir /var/spool/clientmqueue
 %attr(750,root,mail) %dir /var/spool/mqueue
This page took 0.176671 seconds and 4 git commands to generate.