From: Peter Maydell Date: Wed, 30 Apr 2008 18:47:02 +0000 (+0000) Subject: Provide SASL_CB_AUTHNAME callback (avoids problem with wrong username X-Git-Tag: PRE_POSIX_CONVERSION~68 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=11cf7b43a23ad3e3b7d80e485c90c4e0ab9b6066 Provide SASL_CB_AUTHNAME callback (avoids problem with wrong username being sent in some situations) --- diff --git a/ChangeLog b/ChangeLog index 7649ae0..620f47e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-04-30 Peter Maydell + + * mts/smtp/smtp.c: provide a callback for SASL_CB_AUTHNAME + (fixes issue with SASL sending the wrong username in some + circumstances). Thanks to + for the patch. + 2008-04-29 Peter Maydell * Revert previous attempt at fix for SASL issue as it diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 850693d..35eefb4 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -105,6 +105,8 @@ static sasl_callback_t callbacks[] = { #define SM_SASL_N_CB_USER 0 { SASL_CB_PASS, sm_get_pass, NULL }, #define SM_SASL_N_CB_PASS 1 + { SASL_CB_AUTHNAME, sm_get_user, NULL }, +#define SM_SASL_N_CB_AUTHNAME 2 { SASL_CB_LIST_END, NULL, NULL }, }; #endif /* CYRUS_SASL */ @@ -1084,6 +1086,7 @@ sm_auth_sasl(char *user, char *mechlist, char *host) user = getusername(); callbacks[SM_SASL_N_CB_USER].context = user; + callbacks[SM_SASL_N_CB_AUTHNAME].context = user; /* * This is a _bit_ of a hack ... but if the hostname wasn't supplied @@ -1293,7 +1296,7 @@ sm_get_user(void *context, int id, const char **result, unsigned *len) { char *user = (char *) context; - if (! result || id != SASL_CB_USER) + if (! result || ((id != SASL_CB_USER) && (id != SASL_CB_AUTHNAME))) return SASL_BADPARAM; *result = user;