Bug 54733

Summary: PATCH
Product: Ports & Packages Reporter: micko <micko>
Component: Individual Port(s)Assignee: Anders Nordby <anders>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description micko 2003-07-22 01:00:19 UTC
Adds additional option for pam-mysql (stripuserdomain). When trying to smtp auth using Postfix + SASL + MySQL,
@domain.com (hostname of the server) is appended to the username passed by the user. If stripuserdomain is 
defined, it will strip the domain part.

Fix: 

if (sql == NULL)
		return PAM_BUF_ERR;
+
+	if (options.stripuserdomain == 1) {
+		char * t = strchr(escapeUser,'@');
+		if (t) {
+			*t = '\0';
+		}
+	}
         
	snprintf(sql, querysize, "SELECT %s FROM %s WHERE %s='%s'",
		options.passwdcolumn, options.table,--65h2cCAdW7DloIEslEEj0HCcmAGBuJaiPHizCZBOtbKBVLHs
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- pam_mysql.c.ORIG    Mon Jul 21 15:16:07 2003
+++ pam_mysql.c Mon Jul 21 15:23:08 2003
@@ -115,6 +115,7 @@
	int crypt;
	int md5;
	int sqllog;
+	int stripuserdomain;
	char logtable[17];
	char logmsgcolumn[17];
	char logpidcolumn[17];
@@ -139,6 +140,7 @@
	0,
	-1,
	-1,
+	0,
	"",
	"",
	"",
@@ -377,6 +379,13 @@
 #ifdef DEBUG
				syslog(LOG_ERR, "sqllog changed.");
 #endif
+			} else if (!strcasecmp("stripuserdomain", mybuf)) {
+				if ((!strcmp(myval, "1")) || (!strcasecmp(myval, "Y"))) {
+					options.stripuserdomain = 1;
+				}
+#ifdef DEBUG
+				syslog(LOG_ERR, "stripuserdomain selected.");
+#endif
			} else if (!strcasecmp("logtable", mybuf)) {
				strncpy(options.logtable, myval, 16);
 #ifdef DEBUG
@@ -520,6 +529,13 @@
Comment 1 Tilman Keskinoz freebsd_committer freebsd_triage 2003-07-22 10:03:19 UTC
Responsible Changed
From-To: freebsd-ports-bugs->anders

over to maintainer
Comment 2 Anders Nordby freebsd_committer freebsd_triage 2003-11-06 20:58:58 UTC
State Changed
From-To: open->closed

This patch belongs in the pam-mysql distribution, not in the FreeBSD 
port of it. I have sent a mail about this PR to their mailinglist.