change call to expand() to be more rational (and consistent!)
[unix-history] / usr / src / usr.sbin / sendmail / src / sendmail.h
index b4551ab..7201b3f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  8.95 (Berkeley) %G%
+ *     @(#)sendmail.h  8.103 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 8.95            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 8.103           %G%";
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -27,10 +27,13 @@ static char SmailSccsId[] = "@(#)sendmail.h 8.95            %G%";
 # include <stdio.h>
 # include <ctype.h>
 # include <setjmp.h>
 # include <stdio.h>
 # include <ctype.h>
 # include <setjmp.h>
-# include <sysexits.h>
 # include <string.h>
 # include <time.h>
 # include <errno.h>
 # include <string.h>
 # include <time.h>
 # include <errno.h>
+# ifdef EX_OK
+#  undef EX_OK
+# endif
+# include <sysexits.h>
 
 # include "conf.h"
 # include "conf.h"
 
 # include "conf.h"
 # include "conf.h"
@@ -73,8 +76,8 @@ static char SmailSccsId[] =   "@(#)sendmail.h 8.95            %G%";
 #define BYTEBITS       8       /* number of bits in a byte */
 
 /* internal macros */
 #define BYTEBITS       8       /* number of bits in a byte */
 
 /* internal macros */
-#define _BITWORD(bit)  (bit / (BYTEBITS * sizeof (int)))
-#define _BITBIT(bit)   (1 << (bit % (BYTEBITS * sizeof (int))))
+#define _BITWORD(bit)  ((bit) / (BYTEBITS * sizeof (int)))
+#define _BITBIT(bit)   (1 << ((bit) % (BYTEBITS * sizeof (int))))
 
 typedef int    BITMAP[BITMAPBYTES / sizeof (int)];
 
 
 typedef int    BITMAP[BITMAPBYTES / sizeof (int)];
 
@@ -201,6 +204,7 @@ typedef struct mailer       MAILER;
 # define M_PREHEAD     'H'     /* MAIL11V3: preview headers */
 # define M_UDBENVELOPE 'i'     /* do udbsender rewriting on envelope */
 # define M_INTERNAL    'I'     /* SMTP to another sendmail site */
 # define M_PREHEAD     'H'     /* MAIL11V3: preview headers */
 # define M_UDBENVELOPE 'i'     /* do udbsender rewriting on envelope */
 # define M_INTERNAL    'I'     /* SMTP to another sendmail site */
+# define M_UDBRECIPIENT        'j'     /* do udbsender rewriting on recipient lines */
 # define M_NOLOOPCHECK 'k'     /* don't check for loops in HELO command */
 # define M_LOCALMAILER 'l'     /* delivery is to this host */
 # define M_LIMITS      'L'     /* must enforce SMTP line limits */
 # define M_NOLOOPCHECK 'k'     /* don't check for loops in HELO command */
 # define M_LOCALMAILER 'l'     /* delivery is to this host */
 # define M_LIMITS      'L'     /* must enforce SMTP line limits */
@@ -464,37 +468,37 @@ EXTERN struct rewrite     *RewriteRules[MAXRWSETS];
 */
 
 /* left hand side items */
 */
 
 /* left hand side items */
-# define MATCHZANY     0220    /* match zero or more tokens */
-# define MATCHANY      0221    /* match one or more tokens */
-# define MATCHONE      0222    /* match exactly one token */
-# define MATCHCLASS    0223    /* match one token in a class */
-# define MATCHNCLASS   0224    /* match anything not in class */
-# define MATCHREPL     0225    /* replacement on RHS for above */
+# define MATCHZANY     ((u_char)0220)  /* match zero or more tokens */
+# define MATCHANY      ((u_char)0221)  /* match one or more tokens */
+# define MATCHONE      ((u_char)0222)  /* match exactly one token */
+# define MATCHCLASS    ((u_char)0223)  /* match one token in a class */
+# define MATCHNCLASS   ((u_char)0224)  /* match anything not in class */
+# define MATCHREPL     ((u_char)0225)  /* replacement on RHS for above */
 # define MATCHLOOKUP   '\035'  /* look up and replace a sequence */
 # define MATCHELOOKUP  '\036'  /* end of the sequence */
 
 /* right hand side items */
 # define MATCHLOOKUP   '\035'  /* look up and replace a sequence */
 # define MATCHELOOKUP  '\036'  /* end of the sequence */
 
 /* right hand side items */
-# define CANONNET      0226    /* canonical net, next token */
-# define CANONHOST     0227    /* canonical host, next token */
-# define CANONUSER     0230    /* canonical user, next N tokens */
-# define CALLSUBR      0231    /* call another rewriting set */
+# define CANONNET      ((u_char)0226)  /* canonical net, next token */
+# define CANONHOST     ((u_char)0227)  /* canonical host, next token */
+# define CANONUSER     ((u_char)0230)  /* canonical user, next N tokens */
+# define CALLSUBR      ((u_char)0231)  /* call another rewriting set */
 
 /* conditionals in macros */
 
 /* conditionals in macros */
-# define CONDIF                0232    /* conditional if-then */
-# define CONDELSE      0233    /* conditional else */
-# define CONDFI                0234    /* conditional fi */
+# define CONDIF                ((u_char)0232)  /* conditional if-then */
+# define CONDELSE      ((u_char)0233)  /* conditional else */
+# define CONDFI                ((u_char)0234)  /* conditional fi */
 
 /* bracket characters for host name lookup */
 
 /* bracket characters for host name lookup */
-# define HOSTBEGIN     0235    /* hostname lookup begin */
-# define HOSTEND       0236    /* hostname lookup end */
+# define HOSTBEGIN     ((u_char)0235)  /* hostname lookup begin */
+# define HOSTEND       ((u_char)0236)  /* hostname lookup end */
 
 /* bracket characters for generalized lookup */
 
 /* bracket characters for generalized lookup */
-# define LOOKUPBEGIN   0205    /* generalized lookup begin */
-# define LOOKUPEND     0206    /* generalized lookup end */
+# define LOOKUPBEGIN   ((u_char)0205)  /* generalized lookup begin */
+# define LOOKUPEND     ((u_char)0206)  /* generalized lookup end */
 
 /* macro substitution character */
 
 /* macro substitution character */
-# define MACROEXPAND   0201    /* macro expansion */
-# define MACRODEXPAND  0202    /* deferred macro expansion */
+# define MACROEXPAND   ((u_char)0201)  /* macro expansion */
+# define MACRODEXPAND  ((u_char)0202)  /* deferred macro expansion */
 
 /* to make the code clearer */
 # define MATCHZERO     CANONHOST
 
 /* to make the code clearer */
 # define MATCHZERO     CANONHOST
@@ -548,7 +552,7 @@ MAP
 {
        MAPCLASS        *map_class;     /* the class of this map */
        char            *map_mname;     /* name of this map */
 {
        MAPCLASS        *map_class;     /* the class of this map */
        char            *map_mname;     /* name of this map */
-       int             map_mflags;     /* flags, see below */
+       long            map_mflags;     /* flags, see below */
        char            *map_file;      /* the (nominal) filename */
        ARBPTR_T        map_db1;        /* the open database ptr */
        ARBPTR_T        map_db2;        /* an "extra" database pointer */
        char            *map_file;      /* the (nominal) filename */
        ARBPTR_T        map_db1;        /* the open database ptr */
        ARBPTR_T        map_db2;        /* an "extra" database pointer */
@@ -565,22 +569,23 @@ MAP
        short           map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */
 };
 
        short           map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */
 };
 
-/* bit values for map_flags */
-# define MF_VALID      0x0001          /* this entry is valid */
-# define MF_INCLNULL   0x0002          /* include null byte in key */
-# define MF_OPTIONAL   0x0004          /* don't complain if map not found */
-# define MF_NOFOLDCASE 0x0008          /* don't fold case in keys */
-# define MF_MATCHONLY  0x0010          /* don't use the map value */
-# define MF_OPEN       0x0020          /* this entry is open */
-# define MF_WRITABLE   0x0040          /* open for writing */
-# define MF_ALIAS      0x0080          /* this is an alias file */
-# define MF_TRY0NULL   0x0100          /* try with no null byte */
-# define MF_TRY1NULL   0x0200          /* try with the null byte */
-# define MF_LOCKED     0x0400          /* this map is currently locked */
-# define MF_ALIASWAIT  0x0800          /* alias map in aliaswait state */
-# define MF_IMPL_HASH  0x1000          /* implicit: underlying hash database */
-# define MF_IMPL_NDBM  0x2000          /* implicit: underlying NDBM database */
-# define MF_UNSAFEDB   0x4000          /* this map is world writable */
+/* bit values for map_mflags */
+# define MF_VALID      0x00000001      /* this entry is valid */
+# define MF_INCLNULL   0x00000002      /* include null byte in key */
+# define MF_OPTIONAL   0x00000004      /* don't complain if map not found */
+# define MF_NOFOLDCASE 0x00000008      /* don't fold case in keys */
+# define MF_MATCHONLY  0x00000010      /* don't use the map value */
+# define MF_OPEN       0x00000020      /* this entry is open */
+# define MF_WRITABLE   0x00000040      /* open for writing */
+# define MF_ALIAS      0x00000080      /* this is an alias file */
+# define MF_TRY0NULL   0x00000100      /* try with no null byte */
+# define MF_TRY1NULL   0x00000200      /* try with the null byte */
+# define MF_LOCKED     0x00000400      /* this map is currently locked */
+# define MF_ALIASWAIT  0x00000800      /* alias map in aliaswait state */
+# define MF_IMPL_HASH  0x00001000      /* implicit: underlying hash database */
+# define MF_IMPL_NDBM  0x00002000      /* implicit: underlying NDBM database */
+# define MF_UNSAFEDB   0x00004000      /* this map is world writable */
+# define MF_APPEND     0x00008000      /* append new entry on rebuiled */
 
 /* indices for map_actions */
 # define MA_NOTFOUND   0               /* member map returned "not found" */
 
 /* indices for map_actions */
 # define MA_NOTFOUND   0               /* member map returned "not found" */
@@ -814,6 +819,18 @@ struct prival
 #define SFF_NOPATHCHECK                0x0010  /* don't bother checking dir path */
 #define SFF_SETUIDOK           0x0020  /* setuid files are ok */
 #define SFF_CREAT              0x0040  /* ok to create file if necessary */
 #define SFF_NOPATHCHECK                0x0010  /* don't bother checking dir path */
 #define SFF_SETUIDOK           0x0020  /* setuid files are ok */
 #define SFF_CREAT              0x0040  /* ok to create file if necessary */
+#define SFF_REGONLY            0x0080  /* regular files only */
+
+/* flags that are actually specific to safefopen */
+#define SFF_OPENASROOT         0x1000  /* open as root instead of real user */
+
+
+/*
+**  Flags passed to mime8to7.
+*/
+
+#define M87F_OUTER             0       /* outer context */
+#define M87F_NO8BIT            0x0001  /* can't have 8-bit in this section */
 
 
 /*
 
 
 /*
@@ -1037,7 +1054,7 @@ extern char               *queuename __P((ENVELOPE *, int));
 extern time_t          curtime __P(());
 extern bool            transienterror __P((int));
 extern const char      *errstring __P((int));
 extern time_t          curtime __P(());
 extern bool            transienterror __P((int));
 extern const char      *errstring __P((int));
-extern void            expand __P((char *, char *, char *, ENVELOPE *));
+extern void            expand __P((char *, char *, size_t, ENVELOPE *));
 extern void            define __P((int, char *, ENVELOPE *));
 extern char            *macvalue __P((int, ENVELOPE *));
 extern char            *macname __P((int));
 extern void            define __P((int, char *, ENVELOPE *));
 extern char            *macvalue __P((int, ENVELOPE *));
 extern char            *macname __P((int));