From 002689ed30d84921f4dda0145d055a2e0606da03 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Fri, 7 Mar 2003 14:55:53 +0000 Subject: [PATCH] The global callbacks set up in sasl_client_init are not copied by the SASL library, so they can't be allocated on the stack. This is the case with both versions of the SASL library, and I frankly don't understand why it hasn't caused problems before. Since it segfaults reliably on OS X for me now, I thought a patch would be in order. --- mutt_sasl.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/mutt_sasl.c b/mutt_sasl.c index 350cc307a..7fc07bbb1 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-1 Brendan Cully + * Copyright (C) 2000-3 Brendan Cully * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,23 +85,20 @@ int mutt_sasl_start (void) { static unsigned char sasl_init = 0; - sasl_callback_t* callback, callbacks[2]; + static sasl_callback_t callbacks[2]; int rc; if (sasl_init) return SASL_OK; /* set up default logging callback */ - callback = callbacks; + callbacks[0].id = SASL_CB_LOG; + callbacks[0].proc = mutt_sasl_cb_log; + callbacks[0].context = NULL; - callback->id = SASL_CB_LOG; - callback->proc = mutt_sasl_cb_log; - callback->context = NULL; - callback++; - - callback->id = SASL_CB_LIST_END; - callback->proc = NULL; - callback->context = NULL; + callbacks[1].id = SASL_CB_LIST_END; + callbacks[1].proc = NULL; + callbacks[1].context = NULL; rc = sasl_client_init (callbacks); -- 2.40.0