Date: Mon, 21 Jul 2003 19:54:05 -0400 (EDT) From: micko <micko@verio.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/54733: PATCH Message-ID: <200307212354.h6LNs5l7016285@micko.boca.verio.net> Resent-Message-ID: <200307220000.h6M00JaO023474@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 54733 >Category: ports >Synopsis: PATCH >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Jul 21 17:00:19 PDT 2003 >Closed-Date: >Last-Modified: >Originator: micko >Release: FreeBSD 4.8-STABLE i386 >Organization: >Environment: System: FreeBSD micko.boca.verio.net 4.8-STABLE FreeBSD 4.8-STABLE #2: Wed Jun 4 21:45:39 GMT 2003 micko@mobilepunk.boca.verio.net:/usr/src/sys/compile/KILLER i386 >Description: 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. >How-To-Repeat: >Fix: --- 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 @@ 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, >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307212354.h6LNs5l7016285>