Howard Chu
17 years ago
This is a multi-part message in MIME format.
--------------020706040108040002040308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
connection state when it should be leaving it intact. The attached patch will
fix the problem. (Verified using saslauthd and most of the above components.)
--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--------------020706040108040002040308
Content-Type: text/plain;
name="dif.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dif.txt"
Index: server.c
===================================================================
RCS file: /cvs/src/sasl/lib/server.c,v
retrieving revision 1.147
diff -u -r1.147 server.c
--- server.c 3 Jul 2006 14:43:16 -0000 1.147
+++ server.c 23 Dec 2007 01:52:25 -0000
@@ -129,6 +129,7 @@
int result = SASL_OK, tmpresult;
sasl_server_conn_t *s_conn = (sasl_server_conn_t *) conn;
const char *password_request[] = { SASL_AUX_PASSWORD_PROP, NULL };
+ struct propctx *propctx = NULL;
sasl_server_userdb_setpass_t *setpass_cb = NULL;
void *context = NULL;
int tried_setpass = 0;
@@ -172,14 +173,18 @@
pass = NULL;
passlen = 0;
}
-
- result = prop_request(s_conn->sparams->propctx, password_request);
+
+ propctx = prop_new(0);
+ if ( !propctx ) {
+ RETURN(conn, SASL_NOMEM);
+ }
+ result = prop_request(propctx, password_request);
if (result == SASL_OK) {
- result = prop_set(s_conn->sparams->propctx, SASL_AUX_PASSWORD_PROP,
+ result = prop_set(propctx, SASL_AUX_PASSWORD_PROP,
pass, passlen);
}
if (result == SASL_OK) {
- result = sasl_auxprop_store(conn, s_conn->sparams->propctx, user);
+ result = sasl_auxprop_store(conn, propctx, user);
}
if (result != SASL_OK) {
_sasl_log(conn, SASL_LOG_ERR,
@@ -189,6 +194,7 @@
_sasl_log(conn, SASL_LOG_NOTE,
"setpass succeeded for %s", user);
}
+ prop_dispose(&propctx);
}
/* We want to preserve the current value of result, so we use tmpresult below */
--------------020706040108040002040308--
--------------020706040108040002040308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
...
This is a bug in Cyrus SASL; the setpass function is zeroing out theconnection state when it should be leaving it intact. The attached patch will
fix the problem. (Verified using saslauthd and most of the above components.)
--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--------------020706040108040002040308
Content-Type: text/plain;
name="dif.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dif.txt"
Index: server.c
===================================================================
RCS file: /cvs/src/sasl/lib/server.c,v
retrieving revision 1.147
diff -u -r1.147 server.c
--- server.c 3 Jul 2006 14:43:16 -0000 1.147
+++ server.c 23 Dec 2007 01:52:25 -0000
@@ -129,6 +129,7 @@
int result = SASL_OK, tmpresult;
sasl_server_conn_t *s_conn = (sasl_server_conn_t *) conn;
const char *password_request[] = { SASL_AUX_PASSWORD_PROP, NULL };
+ struct propctx *propctx = NULL;
sasl_server_userdb_setpass_t *setpass_cb = NULL;
void *context = NULL;
int tried_setpass = 0;
@@ -172,14 +173,18 @@
pass = NULL;
passlen = 0;
}
-
- result = prop_request(s_conn->sparams->propctx, password_request);
+
+ propctx = prop_new(0);
+ if ( !propctx ) {
+ RETURN(conn, SASL_NOMEM);
+ }
+ result = prop_request(propctx, password_request);
if (result == SASL_OK) {
- result = prop_set(s_conn->sparams->propctx, SASL_AUX_PASSWORD_PROP,
+ result = prop_set(propctx, SASL_AUX_PASSWORD_PROP,
pass, passlen);
}
if (result == SASL_OK) {
- result = sasl_auxprop_store(conn, s_conn->sparams->propctx, user);
+ result = sasl_auxprop_store(conn, propctx, user);
}
if (result != SASL_OK) {
_sasl_log(conn, SASL_LOG_ERR,
@@ -189,6 +194,7 @@
_sasl_log(conn, SASL_LOG_NOTE,
"setpass succeeded for %s", user);
}
+ prop_dispose(&propctx);
}
/* We want to preserve the current value of result, so we use tmpresult below */
--------------020706040108040002040308--