diff -ru cyrus-sasl-1.5.15.old/lib/Makefile.in cyrus-sasl-1.5.15/lib/Makefile.in
--- cyrus-sasl-1.5.15.old/lib/Makefile.in	Fri Jan 14 06:01:08 2000
+++ cyrus-sasl-1.5.15/lib/Makefile.in	Fri Apr 28 22:02:29 2000
@@ -142,10 +142,10 @@
 LTLIBRARIES =  $(lib_LTLIBRARIES)
 
 
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DHAVE_MYSQL -I/usr/include/mysql
 CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LDFLAGS = @LDFLAGS@ 
+LIBS = @LIBS@ -lmysqlclient
 libsasl_la_OBJECTS =  common.lo saslutil.lo server.lo client.lo md5.lo \
 dlopen.lo checkpw.lo config.lo
 CFLAGS = @CFLAGS@
Only in cyrus-sasl-1.5.15/lib: Makefile.in.orig
diff -ru cyrus-sasl-1.5.15.old/lib/checkpw.c cyrus-sasl-1.5.15/lib/checkpw.c
--- cyrus-sasl-1.5.15.old/lib/checkpw.c	Sun Dec 12 23:31:14 1999
+++ cyrus-sasl-1.5.15/lib/checkpw.c	Fri Apr 28 22:02:49 2000
@@ -335,6 +335,107 @@
 
 }
 
+#ifdef HAVE_MYSQL
+/* DMZ mysql auth 12/29/1999 */
+#include "mysql.h"
+//#define QUERY_STRING    "select %s from %s where %s = '%s' and %s = password('%s') and %s"
+/* append to Query String by Manon Goo */
+#define QUERY_STRING    "select %s from %s where %s = '%s' and %s = '%s' %s"
+
+int _sasl_mysql_verify_password(sasl_conn_t *conn __attribute__((unused)),
+                                 const char *userid,
+                                 const char *password,
+                                 const char **reply)
+{
+  unsigned int numrows;
+  MYSQL mysql,*sock;
+  MYSQL_RES *result;
+  char qbuf[300];
+  char *db_user="",
+       *db_passwd="",
+       *db_host="",
+       *db_uidcol="",
+       *db_pwcol="",
+       *db_database="",
+       *db_table="",
+       *sqlappend="";
+  sasl_getopt_t *getopt;
+  void *context;
+
+  if (!userid || !password) {
+      return SASL_BADPARAM;
+  }
+  if (reply) { *reply = NULL; }
+
+  /* check to see if the user configured a mysqluser/passwd/host/etc */
+  if (_sasl_getcallback(conn, SASL_CB_GETOPT, &getopt, &context)
+      == SASL_OK) {
+      getopt(context, NULL, "mysqluser", (const char **) &db_user, NULL);
+      if (!db_user) db_user = "";
+      getopt(context, NULL, "mysqlpasswd", (const char **) &db_passwd, NULL);
+      if (!db_passwd) db_passwd = "";
+      getopt(context, NULL, "mysqlhost", (const char **) &db_host, NULL);
+      if (!db_host) db_host = "";
+      getopt(context, NULL, "mysqldatabase", (const char **) &db_database, NULL);
+      if (!db_database) db_database = "";
+      getopt(context, NULL, "mysqltable", (const char **) &db_table, NULL);
+      if (!db_table) db_table = "";
+      getopt(context, NULL, "mysqluidcol", (const char **) &db_uidcol, NULL);
+      if (!db_uidcol) db_uidcol = "";
+      getopt(context, NULL, "mysqlpwcol", (const char **) &db_pwcol, NULL);
+      if (!db_pwcol) db_pwcol = "";
+      /* Query Append */
+      getopt(context, NULL, "mysqlappend", (const char **) &sqlappend, NULL);
+      if (!sqlappend) sqlappend = "";
+  }
+
+  //if (!(sock = mysql_connect(&mysql,NULL,0,0)))
+  if (!(sock = mysql_connect(&mysql,db_host,db_user,db_passwd)))
+  {
+    return SASL_FAIL;
+  }
+
+  if (mysql_select_db(sock,db_database) < 0)
+  {
+    mysql_close(sock);
+    return SASL_FAIL;
+  }
+  /* select DB_UIDCOL from DB_TABLE where DB_UIDCOL = 'userid' AND DB_PWCOL = password('password') [ further stuff ]*/
+  
+  sprintf(qbuf,QUERY_STRING,db_uidcol,db_table,db_uidcol,userid,db_pwcol,password,sqlappend);
+    if (mysql_query(sock,qbuf) < 0 || !(result=mysql_store_result(sock)))
+    {
+      mysql_close(sock);
+      return SASL_FAIL;
+    }
+
+   if (result) //There were some rows found
+   {
+           numrows = mysql_affected_rows(&mysql);
+           if (numrows > 1) // dupes !!
+           {
+                   mysql_free_result(result);
+                   mysql_close(sock);
+                   return SASL_BADAUTH;
+           }
+
+           if (numrows == 0) {
+                   mysql_free_result(result);
+                   mysql_close(sock);
+                   return SASL_BADAUTH;
+           }
+
+           if (numrows == 1) {
+                   mysql_free_result(result);
+                   mysql_close(sock);
+                   return SASL_OK; }
+   }
+  mysql_free_result(result);
+  mysql_close(sock);
+  return SASL_BADAUTH;
+}
+#endif
+
 int _sasl_passwd_verify_password(sasl_conn_t *conn __attribute__((unused)),
 				 const char *userid,
 				 const char *password,
diff -ru cyrus-sasl-1.5.15.old/lib/saslint.h cyrus-sasl-1.5.15/lib/saslint.h
--- cyrus-sasl-1.5.15.old/lib/saslint.h	Mon Sep 20 20:35:01 1999
+++ cyrus-sasl-1.5.15/lib/saslint.h	Fri Apr 28 22:02:29 2000
@@ -188,6 +188,10 @@
 				     const char *password, 
 				     const char *service,
 				     const char **reply);
+extern int _sasl_mysql_verify_password(sasl_conn_t *conn,
+                                   const char *userid,
+                                   const char *password,
+                                   const char **reply);
 extern int _sasl_sasldb_verify_password(sasl_conn_t *conn,
 					const char *userid, 
 					const char *passwd,
diff -ru cyrus-sasl-1.5.15.old/lib/server.c cyrus-sasl-1.5.15/lib/server.c
--- cyrus-sasl-1.5.15.old/lib/server.c	Fri Dec 31 05:39:50 1999
+++ cyrus-sasl-1.5.15/lib/server.c	Fri Apr 28 22:02:29 2000
@@ -1105,6 +1105,12 @@
 						service, NULL);
     } else
 #endif
+#ifdef HAVE_MYSQL
+/* Added by dmz 12/29/1999 */
+    if (is_mech(mech, "mysql")) {
+        result = _sasl_mysql_verify_password(conn, user, pass, NULL);
+    } else
+#endif
 #ifdef HAVE_PWCHECK
     if (is_mech(mech, "pwcheck")) {
 	/* check against pwcheck daemon */
Only in cyrus-sasl-1.5.15/lib: server.c.orig
