Browse Source

allow for secrets in mysql containing NUL-Bytes, so now we can store non-clear passwords in mysql using cmusaslsecretMECH schemes

Michael van Elst 22 years ago
parent
commit
69ea7de04d
2 changed files with 40 additions and 19 deletions
  1. 39 18
      sasl/sasl.patch
  2. 1 1
      sasl/sasl.spec

+ 39 - 18
sasl/sasl.patch

@@ -1,21 +1,3 @@
---- plugins/mysql.c.dist	Fri Mar  7 13:26:42 2003
-+++ plugins/mysql.c	Fri Mar  7 13:30:38 2003
-@@ -325,8 +325,15 @@
- 	    sparams->utils->log(NULL, SASL_LOG_WARN,
- 				"mysql plugin try and connect to %s\n",
- 				cur_host);
-+#ifdef HAVE_MYSQL_REAL_CONNECT
-+    mysql_init(&mysql);
-+	sock = mysql_real_connect(&mysql,cur_host,settings->mysql_user,
-+			     settings->mysql_passwd,
-+                 NULL,0,NULL,CLIENT_COMPRESS);
-+#else
- 	sock = mysql_connect(&mysql,cur_host,settings->mysql_user,
- 			     settings->mysql_passwd);
-+#endif
- 	if (sock) break;
- 	
- 	cur_host = db_host;
 --- saslauthd/lak.c.dist	Wed Mar 12 11:39:22 2003
 +++ saslauthd/lak.c	Wed Mar 12 11:39:22 2003
 @@ -532,8 +532,6 @@
@@ -62,3 +44,42 @@
  				ldap_unbind_s(lak->ld);
  
  				lak->ld = NULL;
+--- plugins/mysql.c.dist	Fri Mar  7 13:26:42 2003
++++ plugins/mysql.c	Fri Apr  4 16:55:38 2003
+@@ -254,6 +254,7 @@
+     MYSQL mysql,*sock = NULL;
+     MYSQL_RES *result;
+     MYSQL_ROW row;
++    unsigned long *rlen;
+     
+     /* setup the settings */
+     settings = (struct mysql_settings *)glob_context;
+@@ -325,8 +326,15 @@
+ 	    sparams->utils->log(NULL, SASL_LOG_WARN,
+ 				"mysql plugin try and connect to %s\n",
+ 				cur_host);
++#ifdef HAVE_MYSQL_REAL_CONNECT
++    mysql_init(&mysql);
++	sock = mysql_real_connect(&mysql,cur_host,settings->mysql_user,
++			     settings->mysql_passwd,
++                 NULL,0,NULL,CLIENT_COMPRESS);
++#else
+ 	sock = mysql_connect(&mysql,cur_host,settings->mysql_user,
+ 			     settings->mysql_passwd);
++#endif
+ 	if (sock) break;
+ 	
+ 	cur_host = db_host;
+@@ -405,8 +413,10 @@
+ 	/* now get the result set value and value_len */
+ 	/* we only fetch one becuse we dont car about the rest */
+ 	row = mysql_fetch_row(result);
+-	strncpy(value,row[0],8190);
+-	value_len = strlen(value);
++    rlen = mysql_fetch_lengths(result);
++    value_len = rlen[0] > 8190 ? 8190 : rlen[0];
++    memcpy(value, row[0], value_len);
++    value[value_len] = '\0';
+ 	
+ 	sparams->utils->prop_set(sparams->propctx, cur->name,
+ 				 value, value_len);

+ 1 - 1
sasl/sasl.spec

@@ -33,7 +33,7 @@ Distribution: OpenPKG [PLUS]
 Group:        Cryptography
 License:      BSD
 Version:      2.1.12
-Release:      20030316
+Release:      20030404
 
 #   package options
 %option       with_fsl    no