Package: ssmtp
Version: 2.61

The ssmtp header file contains a hard-coded cutoff to define system id's versus user id's, which is 1000. This is sufficient for many systems, but often user ids dip below this limit for other systems. For example, on a system I partially administer, I have several legacy user ids that are well below 1000, like 220, 383, etc.

For such cases, it is convenient to expose the header definition for MAXSYSID as a ssmtp.conf setting. The following tiny patch (ssmtp.c and ssmtp.conf) exposes this setting. The convention is exposed as a minimum user id setting to enable a "round number" of 1000 as the default, instead of 999 as used by ssmtp.h.

I have found this helpful for my system. Maybe others will find it helpful also. I hope you will consider adding this patch to the mainline.

(BTW, I am a Gentoo user.  Sorry for the email submission.)

Thanks,

Trevor

ssmtp-2.61-maxsysuid.patch

--- ssmtp-2.61.conf     2004-07-23 00:58:48.000000000 -0500
+++ ssmtp.conf  2008-07-14 14:11:34.000000000 -0500
@@ -2,10 +2,13 @@
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#

-# The person who gets all mail for userids < 1000
+# The person who gets all mail for userids < MinUserId
# Make this empty to disable rewriting.
root=postmaster

+# All mail delivered to userid >= MinUserId goes to user, not root.
+#MinUserId=1000
+
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.

--- ssmtp.orig.c        2004-07-23 00:58:48.000000000 -0500
+++ ssmtp.c     2008-07-14 16:03:08.000000000 -0500
@@ -76,6 +76,7 @@ int log_level = 1;
#else
int log_level = 0;
#endif
+int minuserid = MAXSYSUID+1;
int port = 25;
#ifdef INET6
int p_family = PF_UNSPEC; /* Protocol family used in SMTP connection */
@@ -641,7 +642,7 @@ char *rcpt_remap(char *str)
{
       struct passwd *pw;
       if((root==NULL) || strlen(root)==0 || strchr(str, '@') ||
- ((pw = getpwnam(str)) == NULL) || (pw->pw_uid > MAXSYSUID)) { + ((pw = getpwnam(str)) == NULL) || (pw->pw_uid >= minuserid)) { return(append_domain(str)); /* It's not a local systems-level user */
       }
       else {
@@ -814,6 +815,17 @@ bool_t read_config()
log_event(LOG_INFO, "Set Root=\"%s\"\n", root);
                               }
                       }
+                       else if(strcasecmp(p, "MinUserId") == 0) {
+                               if((r = strdup(q)) == (char *)NULL) {
+ die("parse_config() -- strdup() failed");
+                               }
+
+                               minuserid = atoi(r);
+
+                               if(log_level > 0) {
+ log_event(LOG_INFO, "Set MinUserId=\"%d\"\n", minuserid);
+                               }
+                       }
                       else if(strcasecmp(p, "MailHub") == 0) {
                               if((mailhost = strdup(q)) == (char *)NULL) {
die("parse_config() -- strdup() failed");





--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to