head	2.1;
access;
symbols
	C_2:2.1
	C_1:1.12;
locks; strict;
comment	@ * @;


2.1
date	93.11.23.19.58.39;	author Aussem;	state Exp;
branches;
next	1.17;

1.17
date	93.11.22.20.19.05;	author Aussem;	state Exp;
branches;
next	1.16;

1.16
date	93.11.20.22.47.52;	author Aussem;	state Exp;
branches;
next	1.15;

1.15
date	93.11.20.22.15.28;	author Aussem;	state Exp;
branches;
next	1.14;

1.14
date	93.11.19.20.53.29;	author Aussem;	state Exp;
branches;
next	1.13;

1.13
date	93.11.19.00.17.40;	author Aussem;	state Exp;
branches;
next	1.12;

1.12
date	93.11.16.23.39.58;	author Aussem;	state Exp;
branches;
next	1.11;

1.11
date	93.11.13.23.13.20;	author Aussem;	state Exp;
branches;
next	1.10;

1.10
date	93.11.13.22.11.07;	author Aussem;	state Exp;
branches;
next	1.9;

1.9
date	93.11.13.21.44.00;	author Aussem;	state Exp;
branches;
next	1.8;

1.8
date	93.11.12.23.04.42;	author Aussem;	state Exp;
branches;
next	1.7;

1.7
date	93.10.18.19.58.28;	author Aussem;	state Exp;
branches;
next	1.6;

1.6
date	93.10.17.23.24.25;	author Aussem;	state Exp;
branches;
next	1.5;

1.5
date	93.10.17.21.48.50;	author Aussem;	state Exp;
branches;
next	1.4;

1.4
date	93.10.10.19.28.46;	author Aussem;	state Exp;
branches;
next	1.3;

1.3
date	93.09.18.16.47.47;	author Aussem;	state Exp;
branches;
next	1.2;

1.2
date	93.09.10.01.50.41;	author Aussem;	state Exp;
branches;
next	1.1;

1.1
date	93.09.08.16.25.48;	author Aussem;	state Exp;
branches;
next	;


desc
@defnition modul for smail
@


2.1
log
@Version 2.0 check in
@
text
@/*
 *
 *  Defs.h:  header file for rmail/smail.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Log: defs.h,v $
 * Revision 1.17  1993/11/22  20:19:05  Aussem
 * Version string updated to 2.0
 *
 * Revision 1.16  1993/11/20  22:47:52  Aussem
 * smail now uses stricmp() and strincmp()
 *
 * Revision 1.15  1993/11/20  22:15:28  Aussem
 * extended log output
 *
 * Revision 1.14  1993/11/19  20:53:29  Aussem
 * findconfig() is for netsupport.library a Macro
 *
 * Revision 1.13  1993/11/19  00:17:40  Aussem
 * malloc()/calloc()free() patch for Netsupport.library insert
 *
 * Revision 1.12  1993/11/16  23:39:58  Aussem
 * MAXPATH and MAXDOM make bigger
 *
 * Revision 1.11  1993/11/13  23:13:20  Aussem
 * MAXLINE inserted
 *
 * Revision 1.10  1993/11/13  22:11:07  Aussem
 * VERSION is now again in defs.h
 *
 * Revision 1.9  1993/11/13  21:44:00  Aussem
 * VERSION defined removed
 * now stored in global var version
 *
 * Revision 1.8  1993/11/12  23:04:42  Aussem
 * Version string rewritten
 *
 * Revision 1.7  1993/10/18  19:58:28  Aussem
 * insert BSMTPSITES and UUBATCH
 *
 * Revision 1.6  1993/10/17  23:24:25  Aussem
 * insert in BARG a \n
 *
 * Revision 1.5  1993/10/17  21:48:50  Aussem
 * BARG and BMAIL for bsmtp mails inserted
 *
 * Revision 1.4  1993/10/10  19:28:46  Aussem
 * define for uumail:
 *
 * Revision 1.3  1993/09/18  16:47:47  Aussem
 * insert GNU license text in the header
 *
 * Revision 1.2  1993/09/10  01:50:41  Aussem
 * moved uulib:-files to uulib:mail/-files
 * new support for wCNews styled logfile as MAILLOG
 *
 * Revision 1.1  1993/09/08  16:25:48  Aussem
 * Initial revision
 *
 *
 */

/* actual version */
#define SMAIL_VERSION "2.0"

#if defined(AMIGA)
#define GETHOSTNAME			/* use gethostname() */
#else
#define UNAME 				/* use uname() */
#endif

/* if defined, HOSTNAME overrides UNAME and GETHOSTNAME */
/*#define HOSTNAME	"nadia"		/* literal name */

/* #define HOSTDOMAIN	"host.dom"	/* overrides default HOSTNAME.MYDOM */

/*
 * .UUCP here is just for testing, GET REGISTERED in COM, EDU, etc.
 * See INFO.REGISTRY for details.
 */

/*#define MYDOM		".UUCP"		/* literal domain suffix */

/*
 * WARNING: DOMGATE is only for qualified gateways - use caution.
 * If you don't fully understand it - don't use it!
 * If you are not completely sure you need it - don't use it!
 * If you are not prepared to handle all addresses to MYDOM - don't use it!
 *
 * if defined, DOMGATE (DOMain GATEway) will cause addresses of the form
 *
 *	user@@MYDOM or MYDOM!user
 *
 * (with and without the leading '.' on MYDOM)
 * to be seen treated simply 'user' - a purely local address.
 * Then, it is left to the aliasing code to map it back to a
 * non-local address if necessary.
 */

/* #define DOMGATE		/* Act as Domain Gateway */

/*
 * HIDDENHOSTS allows hosts that serve as domain gateways to hide
 * the subdomains beneath them.  Mail that originates at any of
 * the hosts in the subdomain will appear to come from the gateway host.
 * Hence, mail from
 *
 * 		anything.hostdomain!user
 *
 * will appear to come from 
 *
 * 		hostdomain!user
 *
 * A consequence is that return mail to hostdomain!user would need to
 * be forwarded to the proper subdomain via aliases or other forwarding
 * facilities.
 *
 * If you're using sendmail, then if defined here,
 * it should be used in ruleset 4 of the sendmail.cf, too.
 */

/* #define HIDDENHOSTS			/* hide subdomains of hostdomain */

/*
 * Mail that would otherwise be undeliverable will be passed to the
 * aliased SMARTHOST for potential delivery.
 *
 * Be sure that the host you specify in your pathalias input knows that you're
 * using it as a relay, or you might upset somebody when they find out some
 * other way.  If you're using 'foovax' as your relay, and below you have
 * #define SMARTHOST "smart-host", then the pathalias alias would be:
 *
 *	smart-host = foovax
 * 
 * You can use SMSmarthost in uulib:config to determinate an smarthost
 */

/*#define SMARTHOST  "unido"	/* pathalias alias for relay host */

/*  SMARTMAIL
**  if no paths file does not exists or the path to smarthost
**  is not found, all mails will be directly be send to SMARTHOST
**  (or the SMSmarthost in uulib:config)
**           <smarthost>!<searched_domain>!<user>
*/
#define SMARTMAIL

/*
**  ALIAS and CASEALIAS are used only if SENDMAIL is NOT defined.
**  Sites using sendmail have to let sendmail do the aliasing.
**  LOWERLOGNAME maps all local login names into lower case.  This
**  helps sites who have only upper case send mail to mixed case sites.
*/

#define ALIAS	"uulib:Mail/aliases"	/* location of mail aliases       */
/* #define CASEALIAS			/* make aliases case sensitive    */
/* #define LOWERLOGNAME			/* map local logins to lower case */

/*
 * defining FULLNAME means that Full Name resolution
 * will be attempted when necessary.
 *
 * the Full Name information will be taken from a
 * list of {Full Name, address} pairs.
 * The names in the list must be sorted
 * without regard to upper/lower case.
 *
 * defining DOT_REQD says that the user name must contain a '.' for
 * the Full Name search to be done.
 *
 * All full name searches are case insensitive.
 *
 */

#define FULLNAME	"uulib:Mail/fullnames" /* list of Full Name, address pairs */

/* #define DOT_REQD			/* Must be George.P.Burdell@@gatech.EDU
					** not just  Burdell@@gatech.EDU
					*/

/*
**	PATHS is name of pathalias file.  This is mandatory.
**	Define LOG if you want a log of mail.  This can be handy for
**	debugging and traffic analysis.
**	Define RECORD for a copy of all mail.  This uses much time and
**	space and is only used for extreme debugging cases.
*/

#ifndef PATHS
#define PATHS	"uulib:Mail/paths" /* location of the path database */
#endif

/* Style ala DUUCP logfile */
#define LOG	"uuspool:maillog"	/* log of uucp mail */

/* Attenttion all mails are logged here */
#define RECORD	"NIL:"		/* record of uucp mail */

/* style ala wCNews logfile */
#define MAILLOG "uulib:Mail/logfile"

/* File for BSMTP sites you directly call */
#define BSMTPSITES "uulib:mail/bsmtp_sites"

/*
**  Mailer options:
**	RMAIL is the command to invoke rmail on machine sys.
**	RARG is how to insulate metacharacters from RMAIL.
**	LMAIL is the command to invoke the local mail transfer agent.
**	BMAIL is the command to invoke the bsmtp mail transfer agent.
**	LARG is how to insulate metacharacters from LMAIL.
**	BARG is how to insulate metacharacters from BMAIL.
**	RLARG is LARG with host! on the front - to pass a uux addr to sendmail.
**	SENDMAIL selects one of two sets of defines below for either
**	using sendmail or /bin/lmail.
*/	

#ifndef UUX
#define UUX		"uux"	/* location of uux command   */
#endif

#ifndef SMAIL
#define SMAIL		"smail"	/* location of smail command */
#endif

#ifndef UUMAIL
#define UUMAIL "uumail:"
#endif

#ifndef UUBATCH
#define UUBATCH "uuspool:batch/"
#endif

/*
** command used to retry failed mail, flag is used to set the routing level.
*/
#define VFLAG		((debug == VERBOSE)?"-v":"")
#define RETRY(flag)	"%s %s %s -F %s ", SMAIL, VFLAG, flag, spoolfile

/*
** use the -a if you have it.  This sometimes helps failed mail and warning
** messages get back to where the mail originated.
**
** some versions of uux can't do '-a' - pick one of the next two definitions
*/

/* #define RMAIL(flags,from,sys) "%s -a%s %s - %s!rmail",UUX,from,flags,sys /* */
/*#define RMAIL(flags,from,sys) "%s %s - %s!rmail",UUX,flags,sys /* */
#define RMAIL(flags,from,sys) "%s %s %%s \"%s!rmail",UUX,flags,sys /* */

#define RARG(user)		" %s",user
#define RFROM(frm,now,host) 	"From %s  %.24s remote from %s\n",frm,now,host

#define HANDLE	ALL
#define ROUTING REROUTE

#define LMAIL(frm,sys)		"mail %%s ",frm
#define BMAIL(sys,myhost)		"batch_smtp %%s %s %s",sys,myhost
#define LARG(user)		" %s",postmaster(user)
#define BARG(user)		"RCPT TO:<%s>\n",user
#define RLARG(sys,frm)		" %s!%s",sys,frm
#define LFROM(frm,now,host)	"From %s %.24s\n",frm,now

/*
**	The following definitions affect the queueing algorithm for uux.
**
**	DEFQUEUE	if defined the default is to queue uux mail
**
**	QUEUECOST	remote mail with a cost of less than QUEUECOST
**			will be handed to uux for immediate delivery.
**
**	MAXNOQUEUE	don't allow more than 'n' immediate delivery
**			jobs to be started on a single invocation of smail.
**	
**	GETCOST		if defined, the paths file will be searched for
**			each address to discover the cost of the route.
**			this allows informed decisions about whether to
**			use the queue flags when calling uux.  The price
**			is in the overhead of a paths file search for
**			addresses that are not going to be routed.
*/

#define DEFQUEUE			/* default is to queue uux jobs */

#define QUEUECOST		300	/* deliver immediately if the cost
					/* is DEMAND or better */

#define MAXNOQUEUE		2	/* max UUX_NOQUEUE jobs         */

#define GETCOST				/* search for cost		*/

#define UUX_QUEUE		""	/* uux flag for queueing	*/
#define UUX_NOQUEUE		""	/* uux with immediate delivery	*/

/*
** Normally, all mail destined for the local host is delivered with a single
** call to the local mailer, and all remote mail is delivered with one call
** to the remote mailer for each remote host.  This kind of 'batching' saves
** on the cpu overhead.
**
** MAXCLEN is used to limit the length of commands that are exec'd by smail.
** This is done to keep other program's buffers from overflowing, or to
** allow for less intelligent commands which can take only one argument
** at a time (e.g., 4.1 /bin/mail).  To disable the batching, set MAXCLEN
** a small value (like 0).
*/

#define MAXCLEN			0	/* longest command allowed (approx.)
					/* this is to keep other's buffers
					** from overflowing
					*/

/*
** PLEASE DON'T TOUCH THE REST
*/

#define SMLBUF	512	/* small buffer (handle one item) */
#define BIGBUF	4096	/* handle lots of items */
 
#define MAXPATH	128	/* number of elements in ! path */
#define MAXDOMS	64	/* number of subdomains in . domain */
#define MAXARGS	500	/* number of arguments */
#ifndef NULL
#define NULL	0
#endif

#define DEBUG 		if (debug==YES) (void) printf
#define ADVISE 		if (debug!=NO) (void) printf
#define error(stat,msg,a)	{ (void) fprintf(stderr, msg, a); exit(stat); }
#define lower(c) 		( isupper(c) ? c-'A'+'a' : c )
/* max line length */
#define MAXLINE 60

enum eform {	/* format of addresses */
	ERROR, 		/* bad or invalidated format */
	LOCAL, 		/* just a local name */
	DOMAIN, 	/* user@@domain or domain!user */
	UUCP,		/* host!address */
	ROUTE,		/* intermediate form - to be routed */
	SENT		/* sent to a mailer on a previous pass */
};

enum ehandle { 	/* what addresses can we handle? (don't kick to LMAIL) */
	ALL,		/* UUCP and DOMAIN addresses */
	JUSTUUCP,	/* UUCP only; set by -l  */
	NONE		/* all mail is LOCAL; set by -L */
};

enum erouting {	/* when to route A!B!C!D */
	JUSTDOMAIN,	/* route A if A is a domain */
	ALWAYS,		/* route A always; set by -r */
	REROUTE		/* route C, B, or A (whichever works); set by -R */
};

enum edebug {	/* debug modes */
	NO,		/* normal deliver */
	VERBOSE,	/* talk alot */
	YES		/* talk and don't deliver */
};

#define FONT_REV		"\033[7m"		/* font reverse */
#define FONT_ULIN		"\033[4m"		/* font underline */
#define FONT_BOLD		"\033[1m"		/* font bold */
#define FONT_NORM		"\033[0m"		/* font normal */

#define strncmpic(s1,s2,n) strnicmp(s1,s2,n)
#define strcmpic(s1,s2)    stricmp(s1,s2)


enum eclass {	/* debug classes     */
   NOTHING, /* no debug messages    */
   FATAL,   /* only fatal errors    */
   WARNING, /* all above + warnings */
	NOTICE,  /* all above + notices  */
	INTERN,   /* all above + debug information  */
};


#include <string.h>
#include "sysexits.h"

#ifndef GENPROTO
#include "pwd.h"
typedef struct alias_node node;
typedef struct pw_node pwlist;

#include "protos.h"
#endif

/* 
 * redefining malloc()/calloc() and free()
 * to use the netsupport.library
 *
 */
#ifdef NETSUPPORT
#include <proto/netsupport.h>
#include <pragmas/netsupport_pragmas.h>
#include <exec/memory.h>
#define malloc(size)    AllocMemPooled((size), MEMF_PUBLIC)
#define calloc(size,nr) AllocMemPooled((size)*(nr), MEMF_CLEAR|MEMF_PUBLIC)
#define free(ptr)       FreeMemPooled(ptr)
#define findconfig(field,default_string) GetConfigEntry(NULL, field, default_string)
#endif
@


1.17
log
@Version string updated to 2.0
@
text
@d20 3
@


1.16
log
@smail now uses stricmp() and strincmp()
@
text
@d20 3
d74 1
a74 1
#define SMAIL_VERSION "1.0"
@


1.15
log
@extended log output
@
text
@d20 3
d372 3
@


1.14
log
@findconfig() is for netsupport.library a Macro
@
text
@d20 3
d365 14
d382 1
@


1.13
log
@malloc()/calloc()free() patch for Netsupport.library insert
@
text
@d20 3
d385 1
@


1.12
log
@MAXPATH and MAXDOM make bigger
@
text
@d20 3
d368 14
@


1.11
log
@MAXLINE inserted
@
text
@d20 3
d315 2
a316 2
#define MAXPATH	32	/* number of elements in ! path */
#define MAXDOMS	16	/* number of subdomains in . domain */
@


1.10
log
@VERSION is now again in defs.h
@
text
@d20 3
d323 2
a324 1

@


1.9
log
@VERSION defined removed
now stored in global var version
@
text
@d20 4
d52 2
a53 1
/*#define SENDMAIL "sendmail"	/* Turn off to use /bin/(l)mail only */
a242 12
#ifdef SENDMAIL

#define HANDLE	JUSTUUCP	/* see HANDLE definition below */
#define ROUTING JUSTDOMAIN	/* see ROUTING definition below */

#define LMAIL(frm,sys) 	"%s -em -f%s",SENDMAIL,frm
#define LARG(user)		" %s",postmaster(user)
#define RLARG(sys,frm)		" %s!%s",sys,frm
#define LFROM(frm,now,host)	"From %s %.24s\n",frm,now

#else

a251 2

#endif
@


1.8
log
@Version string rewritten
@
text
@d20 3
a46 5


#ifndef VERSION
#define	VERSION	"Smail Amiga"
#endif
@


1.7
log
@insert BSMTPSITES and UUBATCH
@
text
@d20 3
d47 1
a47 1
#define	VERSION	"smail 2.5/Amiga"
@


1.6
log
@insert in BARG a \n
@
text
@d20 3
d185 3
d211 4
@


1.5
log
@BARG and BMAIL for bsmtp mails inserted
@
text
@d20 3
d245 1
a245 1
#define BARG(user)		"RCPT TO:<%s>",user
@


1.4
log
@define for uumail:
@
text
@d20 3
d184 1
d186 1
d240 1
d242 1
@


1.3
log
@insert GNU license text in the header
@
text
@d20 3
d181 1
a181 1
**	LARG is how to insulate metacharacters from LMAIL. 
d193 4
@


1.2
log
@moved uulib:-files to uulib:mail/-files
new support for wCNews styled logfile as MAILLOG
@
text
@d5 4
a8 5
 *  Configuration options for rmail/smail.
 *	default configuration is:
 *	full domain name is 'hostname.uucp' (get registered!)
 *	path file is /usr/lib/uucp/paths.
 *	no log, no record, use sendmail.
d10 4
a13 1
 *  You can change these in the next few blocks.
d15 4
d20 4
@


1.1
log
@Initial revision
@
text
@d13 3
a15 1
 * $Log$
d17 1
d116 1
a116 1
#define ALIAS	"uulib:aliases"	/* location of mail aliases       */
d136 1
a136 1
#define FULLNAME	"uulib:fullnames" /* list of Full Name, address pairs */
d151 1
a151 1
#define PATHS	"uulib:paths" /* location of the path database */
d154 1
d156 2
d159 3
@
