passwordserver_sasl-59.2 updated to work with mysql
passwordserver_sasl-59.2 updated to work with mysql
- Subject: passwordserver_sasl-59.2 updated to work with mysql
- From: Dale Walsh <email@hidden>
- Date: Mon, 16 May 2005 23:27:13 -0400
- Mta-interface: amavisd-new-2.3.1-rc3-E (2005-05-06) at daleenterprise.com
I could never get the libysql.so plugin to work, I guess the person
in charge of this project didn't examine the source closely or read
the changelog and notice that the mysql.c/mysql_init.c files are no
longer used and have been replaced with sql.c/sql_init.c and are
present in the plugins folder.
The following patch allows you to use mysql to authenticate virtual
users, as well, making a minor change to the 'Makefile' in
postfix-144 allows postfix to use mysql as a lookup table option
making it easier to obtain virtual user/domains who do not have
local account.
I have tested this configuration and have it currently installed, it
does not affect local user e-mail in any way.
I have added some debug lines to sql.c and the following smtpd.conf
file does work, I've tried using postfixAdmin (php based) and have
had good luck with it.
One thing to note, passwords stored in mysql must be plain text, not
encrypted in anyway.
After building the project in XCode 2.0, I replaced the libsql.so
file and the libsasl2.2.dylib and everything worked.
-- changes to /etc/postfix/master.cf --
# use -vv for very verbose logging info.
# IP of my virtual user/domains - smtpd_use_pw_server=no (default
value now)
192.168.1.11:smtp inet n - n - -
smtpd -vv
-o myhostname=mustangrestomods.com
-o smtp_helo_name=mustangrestomods.com
# IP of my local user/domains - smtpd_use_pw_server=yes (must specify)
192.168.1.12:smtp inet n - n - - smtpd
-o smtpd_use_pw_server=yes
-o smtp_helo_name=daleenterprise.com
# for trapping local stuff like amavis-new and saslfinger -s works
smtp inet n - n - - smtpd -vv
-- changes to /etc/postfix/main.cf --
smtpd_use_pw_server = no
#
#
========================================================================
==
# VIRTUAL USERS
#
========================================================================
==
#
local_transport = local
virtual_transport = virtual
virtual_mailbox_base = /var/mail/vhosts
virtual_transport = virtual
virtual_mailbox_base = /var/mail/vhosts
virtual_minimum_uid = 2000
virtual_gid_maps = static:2000
virtual_uid_maps = static:2000
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/
mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = mysql:/etc/postfix/
mysql_virtual_mailbox_limit_maps.cf
virtual_relay_maps = mysql:/etc/postfix/mysql_virtual_relay_maps.cf
-- content of /usr/lib/sasl2/smtpd.conf --
pwcheck_method: auxprop
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: localhost
sql_database: postfix
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_verbose: yes
sql_select: SELECT password FROM mailbox WHERE username = '%u@%r' AND
active='1'
-- content of passwordserver.diff --
diff -Naur passwordserver_sasl-59.2.orig/cyrus_sasl/config.h
passwordserver_sasl-59.2/cyrus_sasl/config.h
--- passwordserver_sasl-59.2.orig/cyrus_sasl/config.h 2004-05-12
20:16:19.000000000 -0400
+++ passwordserver_sasl-59.2/cyrus_sasl/config.h 2005-05-16
15:40:42.000000000 -0400
@@ -152,7 +152,7 @@
#define HAVE_MKDIR 1
/* Do we have mysql support? */
-/* #undef HAVE_MYSQL */
+#define HAVE_MYSQL 1
/* Define to 1 if you have the <ndir.h> header file, and it defines
`DIR'. */
/* #undef HAVE_NDIR_H */
@@ -364,7 +364,7 @@
/* #undef STATIC_SASLDB */
/* Link SQL plugin staticly */
-/* #undef STATIC_SQL */
+#define STATIC_SQL
/* Link SRP Staticly */
/* #undef STATIC_SRP */
diff -Naur passwordserver_sasl-59.2.orig/cyrus_sasl/lib/auxprop.c
passwordserver_sasl-59.2/cyrus_sasl/lib/auxprop.c
--- passwordserver_sasl-59.2.orig/cyrus_sasl/lib/auxprop.c
2005-03-02 21:29:14.000000000 -0500
+++ passwordserver_sasl-59.2/cyrus_sasl/lib/auxprop.c 2005-05-16
15:38:49.000000000 -0400
@@ -866,6 +866,9 @@
const char *plist = NULL;
auxprop_plug_list_t *ptr;
+ _sasl_log(sparams->utils->conn, SASL_LOG_DEBUG,
+ "(xxx) do auxprop lookup");
+
if(_sasl_getcallback(sparams->utils->conn,
SASL_CB_GETOPT, &getopt, &context) == SASL_OK) {
ret = getopt(context, NULL, "auxprop_plugin", &plist, NULL);
@@ -890,6 +893,10 @@
char *p;
int last=0;
+ _sasl_log(sparams->utils->conn, SASL_LOG_DEBUG,
+ "(xxx) Lookup for '%s'",
+ thisplugin );
+
while(*thisplugin && isspace((int)*thisplugin)) thisplugin++;
if(!(*thisplugin)) break;
@@ -898,6 +905,11 @@
else *p='\0';
for(ptr = auxprop_head; ptr; ptr = ptr->next) {
+
+ _sasl_log(sparams->utils->conn, SASL_LOG_DEBUG,
+ "(xxx) Comparing '%s'",
+ ptr->plug->name ? ptr->plug->name : "[null]");
+
/* Skip non-matching plugins */
if(!ptr->plug->name
|| strcasecmp(ptr->plug->name, thisplugin))
diff -Naur passwordserver_sasl-59.2.orig/cyrus_sasl/plugins/sql.c
passwordserver_sasl-59.2/cyrus_sasl/plugins/sql.c
--- passwordserver_sasl-59.2.orig/cyrus_sasl/plugins/sql.c
2005-01-10 14:01:39.000000000 -0500
+++ passwordserver_sasl-59.2/cyrus_sasl/plugins/sql.c 2005-05-16
19:42:02.000000000 -0400
@@ -62,7 +62,7 @@
#ifdef HAVE_MYSQL
-#include <mysql.h>
+#include <mysql/mysql.h>
static void *_mysql_open(char *host, char *port, int usessl,
const char *user, const char *password,
diff -Naur passwordserver_sasl-59.2.orig/sasl.pbproj/project.pbxproj
passwordserver_sasl-59.2/sasl.pbproj/project.pbxproj
--- passwordserver_sasl-59.2.orig/sasl.pbproj/project.pbxproj
2005-03-03 10:23:35.000000000 -0500
+++ passwordserver_sasl-59.2/sasl.pbproj/project.pbxproj
2005-05-16 21:43:47.000000000 -0400
@@ -525,6 +525,8 @@
};
777E7BBD0236DDED05DD284B = {
children = (
+ E437C8E9083966CF001D54B9,
+ E437C8EA083966CF001D54B9,
777E7BBE0236DDED05DD284B,
7733E7110238197D05DD284B,
777E7BBF0236DDED05DD284B,
@@ -1766,6 +1768,8 @@
};
77F5D69C0236D69405DD284B = {
buildSettings = {
+ MACOSX_DEPLOYMENT_TARGET = 10.4;
+ SDKROOT = /Developer/SDKs/MacOSX10.4.0.sdk;
};
buildStyles = (
77F5D69A0236D69405DD284B,
@@ -1826,6 +1830,7 @@
};
77F5D6A70236D6B705DD284B = {
children = (
+ E45C4A860839696F007F6B05,
BA9D61DD07A9C09100255A4E,
BA9D61DF07A9C09100255A4E,
BA9D61E007A9C09100255A4E,
@@ -2251,9 +2256,9 @@
84C98639054846870094A32F = {
buildActionMask = 2147483647;
files = (
- 84DECA0E054847FD00C45D20,
- 84DECA0F054847FD00C45D20,
84DECA100548480000C45D20,
+ E45C4A8A08396F09007F6B05,
+ E45C4A8B08396F0A007F6B05,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2262,6 +2267,7 @@
buildActionMask = 2147483647;
files = (
84DECA4305484A1500C45D20,
+ E45C4A870839696F007F6B05,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2284,7 +2290,7 @@
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
- INSTALL_PATH = /usr/lib/sasl2/disabled;
+ INSTALL_PATH = /usr/lib/sasl2;
LIBRARY_SEARCH_PATHS = /usr/lib/mysql;
LIBRARY_STYLE = BUNDLE;
OTHER_CFLAGS = "";
@@ -2348,18 +2354,6 @@
settings = {
};
};
- 84DECA0E054847FD00C45D20 = {
- fileRef = 84DECA07054847E400C45D20;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 84DECA0F054847FD00C45D20 = {
- fileRef = 84DECA06054847E400C45D20;
- isa = PBXBuildFile;
- settings = {
- };
- };
84DECA100548480000C45D20 = {
fileRef = 777E7BCB0236DDED05DD284B;
isa = PBXBuildFile;
@@ -2478,7 +2472,7 @@
AA16473207930EF20045A1BC = {
fileEncoding = 30;
isa = PBXFileReference;
- lastKnownFileType = text.plist.xml;
+ lastKnownFileType = text.xml;
path = passwordserver_sasl.plist;
refType = 2;
sourceTree = SOURCE_ROOT;
@@ -2743,6 +2737,58 @@
//BA2
//BA3
//BA4
+//E40
+//E41
+//E42
+//E43
+//E44
+ E437C8E9083966CF001D54B9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ path = sql_init.c;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E437C8EA083966CF001D54B9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ path = sql.c;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E45C4A860839696F007F6B05 = {
+ isa = PBXFileReference;
+ lastKnownFileType = "compiled.mach-o.dylib";
+ name = libz.1.2.2.dylib;
+ path = /usr/lib/libz.1.2.2.dylib;
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ E45C4A870839696F007F6B05 = {
+ fileRef = E45C4A860839696F007F6B05;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E45C4A8A08396F09007F6B05 = {
+ fileRef = E437C8EA083966CF001D54B9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E45C4A8B08396F0A007F6B05 = {
+ fileRef = E437C8E9083966CF001D54B9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+//E40
+//E41
+//E42
+//E43
+//E44
//F50
//F51
//F52
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden