From 6a7a44db5999af7262478eb1c186d784d6075beb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 5 Aug 2013 10:39:16 +0200 Subject: auth/gensec: avoid talloc_reference in gensec_security_mechs() We now always copy. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- auth/gensec/gensec_start.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'auth') diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c index 096ad36486..00e27596bf 100644 --- a/auth/gensec/gensec_start.c +++ b/auth/gensec/gensec_start.c @@ -140,28 +140,19 @@ _PUBLIC_ struct gensec_security_ops **gensec_security_mechs( struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx) { - struct gensec_security_ops **backends; - if (!gensec_security) { - backends = gensec_security_all(); - if (!talloc_reference(mem_ctx, backends)) { - return NULL; - } - return backends; - } else { - struct cli_credentials *creds = gensec_get_credentials(gensec_security); + struct cli_credentials *creds = NULL; + struct gensec_security_ops **backends = gensec_security_all(); + + if (gensec_security != NULL) { + creds = gensec_get_credentials(gensec_security); + if (gensec_security->settings->backends) { backends = gensec_security->settings->backends; - } else { - backends = gensec_security_all(); } - if (!creds) { - if (!talloc_reference(mem_ctx, backends)) { - return NULL; - } - return backends; - } - return gensec_use_kerberos_mechs(mem_ctx, backends, creds); } + + return gensec_use_kerberos_mechs(mem_ctx, backends, creds); + } static const struct gensec_security_ops *gensec_security_by_authtype(struct gensec_security *gensec_security, -- cgit