From: Ken Hornstein Date: Fri, 23 Sep 2016 19:07:51 +0000 (-0400) Subject: Move things around so you can still initialize netsec with SASL X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/96170cff6dc485c44c89a949cc9f407db7079451?ds=sidebyside Move things around so you can still initialize netsec with SASL parameters even if you don't have Cyrus-SASL enabled. --- diff --git a/sbr/netsec.c b/sbr/netsec.c index a3be37ee..c56de845 100644 --- a/sbr/netsec.c +++ b/sbr/netsec.c @@ -948,6 +948,13 @@ netsec_set_sasl_params(netsec_context *nsc, const char *hostname, return NOTOK; } + nsc->sasl_hostname = getcpy(hostname); +#else /* CYRUS_SASL */ + NMH_UNUSED(hostname); + NMH_UNUSED(service); + NMH_UNUSED(errstr); +#endif /* CYRUS_SASL */ + /* * According to the RFC, mechanisms can only be uppercase letter, numbers, * and a hypen or underscore. So make sure we uppercase any letters @@ -964,20 +971,8 @@ netsec_set_sasl_params(netsec_context *nsc, const char *hostname, } nsc->sasl_proto_cb = callback; - nsc->sasl_hostname = getcpy(hostname); return OK; -#else /* CYRUS_SASL */ - NMH_UNUSED(nsc); - NMH_UNUSED(hostname); - NMH_UNUSED(service); - NMH_UNUSED(mechanism); - NMH_UNUSED(callback); - - netsec_err(errstr, "SASL is not supported"); - - return NOTOK; -#endif /* CYRUS_SASL */ } #ifdef CYRUS_SASL @@ -1386,6 +1381,8 @@ netsec_get_sasl_mechanism(netsec_context *nsc) #ifdef CYRUS_SASL return nsc->sasl_chosen_mech; #else /* CYRUS_SASL */ + NMH_UNUSED(nsc); + return NULL; #endif /* CYRUS_SASL */ }