rpms/ssmtp/F-9 ssmtp-aliases.patch,NONE,1.1 ssmtp.spec,1.17,1.18

Manuel Wolfshant wolfy at fedoraproject.org
Fri Dec 26 15:40:09 UTC 2008


Author: wolfy

Update of /cvs/pkgs/rpms/ssmtp/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19784

Modified Files:
	ssmtp.spec 
Added Files:
	ssmtp-aliases.patch 
Log Message:
add support for aliasing

ssmtp-aliases.patch:

--- NEW FILE ssmtp-aliases.patch ---
--- ssmtp-2.61/Makefile.in   2008-06-07 14:41:15.000000000 -0400
+++ ssmtp-2.61.new/Makefile.in   2008-06-07 14:41:46.000000000 -0400
@@ -17,6 +17,7 @@
 # Configuration files
 CONFIGURATION_FILE=$(SSMTPCONFDIR)/ssmtp.conf
 REVALIASES_FILE=$(SSMTPCONFDIR)/revaliases
+ALIASES_FILE=/etc/aliases
 
 INSTALLED_CONFIGURATION_FILE=$(CONFIGURATION_FILE)
 INSTALLED_REVALIASES_FILE=$(REVALIASES_FILE)
@@ -34,6 +35,7 @@
 -DSSMTPCONFDIR=\"$(SSMTPCONFDIR)\" \
 -DCONFIGURATION_FILE=\"$(CONFIGURATION_FILE)\" \
 -DREVALIASES_FILE=\"$(REVALIASES_FILE)\" \
+-DALIASES_FILE=\"$(ALIASES_FILE)\" \
 
 
 CFLAGS=@DEFS@ $(EXTRADEFS) @CFLAGS@
diff -u -r -N ssmtp-2.61/ssmtp.c ssmtp-2.61.new/ssmtp.c
--- ssmtp-2.61/ssmtp.c   2008-06-07 14:41:15.000000000 -0400
+++ ssmtp-2.61.new/ssmtp.c   2008-06-07 14:41:51.000000000 -0400
@@ -429,6 +429,50 @@
 }
 
 /* 
+ * Eugene:
+ *
+ * simple aliases support:
+ * lookup aliases file and remap rcpt
+ */
+char *aliases_lookup(char *str)
+{
+	char buf[(BUF_SZ + 1)], *p;
+	char name[(BUF_SZ + 1)];
+	FILE *fp;
+	char *saveptr = NULL;
+
+	if((fp = fopen(ALIASES_FILE, "r"))) {
+		strncpy(name, str, BUF_SZ);
+		while(fgets(buf, sizeof(buf), fp)) {
+			/* Make comments invisible */
+			if((p = strchr(buf, '#'))) {
+				*p = (char)NULL;
+			}
+
+			/* Ignore malformed lines and comments */
+			if(strchr(buf, ':') == (char *)NULL) {
+				continue;
+			}
+
+			/* Parse the alias */
+			if( (p = strtok_r(buf, ": \t\r\n", &saveptr) ) && !strncmp(p, name, BUF_SZ) &&
+				(p = strtok_r(NULL, ": \t\r\n", &saveptr) )) {
+				if(log_level > 0) log_event(LOG_INFO, "Remapping: \"%s\" --> \"%s\"\n", name, p);
+				strncpy(name, p, BUF_SZ);
+			}
+		}
+
+		fclose(fp);
+		if( strcmp( str, name ) == 0 ) {
+			return strdup(name);
+		} else {
+			return aliases_lookup(name);
+		}
+
+	} else  return str; /* can't read aliases? it's not a problem */
+}
+
+/*
 from_strip() -- Transforms "Name <login at host>" into "login at host" or "login at host (Real name)"
 */
 char *from_strip(char *str)
@@ -654,9 +698,14 @@
 char *rcpt_remap(char *str)
 {
 	struct passwd *pw;
-	if((root==NULL) || strlen(root)==0 || strchr(str, '@') ||
-		((pw = getpwnam(str)) == NULL) || (pw->pw_uid > MAXSYSUID)) {
-		return(append_domain(str));	/* It's not a local systems-level user */
+	char *rcpt;
+
+	/* before all other mappings */
+	rcpt = aliases_lookup(str);
+
+	if((root==NULL) || strlen(root)==0 || strchr(rcpt, '@') ||
+		((pw = getpwnam(rcpt)) == NULL) || (pw->pw_uid > MAXSYSUID)) {
+		return(append_domain(rcpt));   /* It's not a local systems-level user */
 	}
 	else {
 		return(append_domain(root));
diff -up ssmtp-2.61/README.old ssmtp-2.61/README
--- ssmtp-2.61/README.old	2008-12-26 16:38:31.000000000 +0200
+++ ssmtp-2.61/README	2008-12-26 16:33:29.000000000 +0200
@@ -3,12 +3,12 @@ Purpose and value:
  send their mail via the departmental mailhub from which they pick up their
  mail (via pop, imap, rsmtp, pop_fetch, NFS... or the like).  This program
  accepts mail and sends it to the mailhub, optionally replacing the domain in
- the From: line with a different one.
+ the From: line with a different one and expanding aliases.
 
- WARNING: the above is all it does. It does not receive mail, expand aliases
- or manage a queue.  That belongs on a mailhub with a system administrator.
- The man page (ssmtp.8) and the program logic manual (ssmtp_plm) discuss the
- limitations in more detail.
+ WARNING: the above is all it does. It does not receive mail, or manage a
+ queue.  That belongs on a mailhub with a system administrator.  The man page
+ (ssmtp.8) and the program logic manual (ssmtp_plm) discuss the limitations in
+ more detail. Expanding aliases is only available after release 2.61-11.8.
 
  It uses a minimum of external configuration information, and so can be
  installed by copying the (right!) binary and an optional four-line config
diff -up ssmtp-2.61/ssmtp.8.old ssmtp-2.61/ssmtp.8
--- ssmtp-2.61/ssmtp.8.old	2008-12-26 16:38:49.000000000 +0200
+++ ssmtp-2.61/ssmtp.8	2008-12-26 16:46:33.000000000 +0200
@@ -22,7 +22,8 @@ placed in dead.letter in the sender's ho
 .PP
 Config files allow one to specify the address to receive mail from
 root, daemon, etc.; a default mailhub; a default domain to be used in
-From: lines; and per-user From: addresses and mailhub names.
+From: lines; per-user From: addresses and mailhub names; and aliases in the
+traditional format used by sendmail for the /etc/aliases file.
 .sp
 .PP
 It does not attempt to provide all the functionality of sendmail: it is
@@ -32,9 +33,8 @@ spool option for non-Sun machines, for m
 difficult (or various) to configure, for machines with known disfeatures in
 their sendmails or for ones where there are ``mysterious problems''. 
 .PP
-It does not do aliasing, which must be done either in the user agent
-or on the mailhub. Nor does it honor .forwards, which have to be done
-on the recieving host.  It especially does not deliver to pipelines.
+It does not honor .forwards, which have to be done on the recieving host.  It
+especially does not deliver to pipelines.
 
 .SH OPTIONS
 Most sendmail options are irrelevent to sSMTP. Those marked ``ignored'' or
@@ -271,6 +271,8 @@ through mail.isp.com.
  /etc/ssmtp/ssmtp.conf - configuration file
 .br
  /etc/ssmtp/revaliases - reverse aliases file
+.br
+ /etc/aliases - aliases file
 
 .SH SEE ALSO
 RFC821, RFC822, ssmtp.conf(5).


Index: ssmtp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ssmtp/F-9/ssmtp.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ssmtp.spec	26 Nov 2008 16:45:58 -0000	1.17
+++ ssmtp.spec	26 Dec 2008 15:39:38 -0000	1.18
@@ -1,6 +1,6 @@
 Name:		ssmtp
 Version:	2.61
-Release:	11.7%{?dist}
+Release:	11.8%{?dist}
 Summary:	Extremely simple MTA to get mail off the system to a Mailhub
 Group:		Applications/Internet
 License:	GPLv2+
@@ -18,6 +18,7 @@
 Patch6:		%{name}-md5auth-non-rsa
 Patch7:		%{name}-unitialized-strdup.patch
 Patch8:		%{name}-authpass.patch
+Patch9:		%{name}-aliases.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 #hack around wrong requires for mutt and mdadm
@@ -54,6 +55,7 @@
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
 
 
 %build
@@ -127,6 +129,11 @@
 
 
 %changelog
+* Fri Dec 26 2008 Manuel "lonely wolf" Wolfshant <wolfy at nobugconsulting.ro> 2.61-11.8
+- integrate patch adding support for aliases; initial version received from Tako 
+  Schotanus <tako at codejive.org>, who adapted it from "eatnumber1"
+- README and the man page now reflect that aliases are expanded and used
+
 * Wed Nov 26 2008 Manuel "lonely wolf" Wolfshant <wolfy at nobugconsulting.ro> 2.61-11.7
 - integrate patch from Andreas Dilger, fixes https://bugzilla.redhat.com/show_bug.cgi?id=430608
 




More information about the fedora-extras-commits mailing list