Home | History | Annotate | Line # | Download | only in global
      1 /*	$NetBSD: cleanup_user.h,v 1.5 2026/05/09 18:49:15 christos Exp $	*/
      2 
      3 #ifndef _CLEANUP_USER_H_INCLUDED_
      4 #define _CLEANUP_USER_H_INCLUDED_
      5 
      6 /*++
      7 /* NAME
      8 /*	cleanup_user 3h
      9 /* SUMMARY
     10 /*	cleanup user interface codes
     11 /* SYNOPSIS
     12 /*	#include <cleanup_user.h>
     13 /* DESCRIPTION
     14 /* .nf
     15 
     16  /*
     17   * Client processing options. Flags 16- are reserved for cleanup.h.
     18   */
     19 #define CLEANUP_FLAG_NONE	0	/* No special features */
     20 #define CLEANUP_FLAG_BOUNCE	(1<<0)	/* Bounce bad messages */
     21 #define CLEANUP_FLAG_FILTER	(1<<1)	/* Enable header/body checks */
     22 #define CLEANUP_FLAG_HOLD	(1<<2)	/* Place message on hold */
     23 #define CLEANUP_FLAG_DISCARD	(1<<3)	/* Discard message silently */
     24 #define CLEANUP_FLAG_BCC_OK	(1<<4)	/* Ok to add auto-BCC addresses */
     25 #define CLEANUP_FLAG_MAP_OK	(1<<5)	/* Ok to map addresses */
     26 #define CLEANUP_FLAG_MILTER	(1<<6)	/* Enable Milter applications */
     27 #define CLEANUP_FLAG_SMTP_REPLY	(1<<7)	/* Enable SMTP reply */
     28 #define CLEANUP_FLAG_SMTPUTF8	(1<<8)	/* SMTPUTF8 requested */
     29 #define CLEANUP_FLAG_AUTOUTF8	(1<<9)	/* Autodetect SMTPUTF8 */
     30 #define CLEANUP_FLAG_REQTLS	(1<<10)	/* REQUIRETLS requested */
     31 
     32 #define CLEANUP_FLAG_FILTER_ALL	(CLEANUP_FLAG_FILTER | CLEANUP_FLAG_MILTER)
     33 
     34  /*
     35   * These are normally set when receiving mail from outside.
     36   */
     37 #define CLEANUP_FLAG_MASK_EXTERNAL \
     38 	(CLEANUP_FLAG_FILTER_ALL | CLEANUP_FLAG_BCC_OK | CLEANUP_FLAG_MAP_OK)
     39 
     40  /*
     41   * These are normally set when generating notices or when forwarding mail
     42   * internally.
     43   */
     44 #define CLEANUP_FLAG_MASK_INTERNAL CLEANUP_FLAG_MAP_OK
     45 
     46  /*
     47   * These are set on the fly while processing SMTP envelopes or message
     48   * content.
     49   */
     50 #define CLEANUP_FLAG_MASK_EXTRA \
     51 	(CLEANUP_FLAG_HOLD | CLEANUP_FLAG_DISCARD)
     52 
     53  /*
     54   * Diagnostics.
     55   *
     56   * CLEANUP_STAT_CONT and CLEANUP_STAT_DEFER both update the reason attribute,
     57   * but CLEANUP_STAT_DEFER takes precedence. It terminates queue record
     58   * processing, and prevents bounces from being sent.
     59   */
     60 #define CLEANUP_STAT_OK		0	/* Success. */
     61 #define CLEANUP_STAT_BAD	(1<<0)	/* Internal protocol error */
     62 #define CLEANUP_STAT_WRITE	(1<<1)	/* Error writing message file */
     63 #define CLEANUP_STAT_SIZE	(1<<2)	/* Message file too big */
     64 #define CLEANUP_STAT_CONT	(1<<3)	/* Message content rejected */
     65 #define CLEANUP_STAT_HOPS	(1<<4)	/* Too many hops */
     66 #define CLEANUP_STAT_RCPT	(1<<6)	/* No recipients found */
     67 #define CLEANUP_STAT_PROXY	(1<<7)	/* Proxy reject */
     68 #define CLEANUP_STAT_DEFER	(1<<8)	/* Temporary reject */
     69 #define CLEANUP_STAT_NOPERM	(1<<9)	/* Denied by non-content policy */
     70 
     71  /*
     72   * Non-cleanup errors that live in the same bitmask space, to centralize
     73   * error handling.
     74   */
     75 #define CLEANUP_STAT_BARE_LF   (1<<16)	/* Bare <LF> received */
     76 
     77  /*
     78   * These are set when we can't bounce even if we were asked to.
     79   */
     80 #define CLEANUP_STAT_MASK_CANT_BOUNCE \
     81 	(CLEANUP_STAT_BAD | CLEANUP_STAT_WRITE | CLEANUP_STAT_DEFER \
     82 	    | CLEANUP_STAT_RCPT)
     83 
     84  /*
     85   * These are set when we can't examine every record of a message.
     86   */
     87 #define CLEANUP_STAT_MASK_INCOMPLETE \
     88 	(CLEANUP_STAT_BAD | CLEANUP_STAT_WRITE | CLEANUP_STAT_SIZE \
     89 	    | CLEANUP_STAT_DEFER)
     90 
     91  /*
     92   * Mapping from status code to DSN detail and free text.
     93   */
     94 typedef struct {
     95     const unsigned status;		/* CLEANUP_STAT_MUMBLE */
     96     const int smtp;			/* RFC 821 */
     97     const char *dsn;			/* RFC 3463 */
     98     const char *text;			/* free text */
     99 } CLEANUP_STAT_DETAIL;
    100 
    101 extern const char *cleanup_strerror(unsigned);
    102 extern const CLEANUP_STAT_DETAIL *cleanup_stat_detail(unsigned);
    103 extern const char *cleanup_strflags(unsigned);
    104 
    105 /* LICENSE
    106 /* .ad
    107 /* .fi
    108 /*	The Secure Mailer license must be distributed with this software.
    109 /* AUTHOR(S)
    110 /*	Wietse Venema
    111 /*	IBM T.J. Watson Research
    112 /*	P.O. Box 704
    113 /*	Yorktown Heights, NY 10598, USA
    114 /*
    115 /*	Wietse Venema
    116 /*	Google, Inc.
    117 /*	111 8th Avenue
    118 /*	New York, NY 10011, USA
    119 /*--*/
    120 
    121 #endif
    122