summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-08-05 10:39:16 +0200
committerStefan Metzmacher <metze@samba.org>2013-08-10 09:19:03 +0200
commit6a7a44db5999af7262478eb1c186d784d6075beb (patch)
tree30d8f9bfb211daec3f4f9af07e505464458fae54 /auth
parent3e3534f882651880093381f5a7846c0938df6501 (diff)
downloadsamba-6a7a44db5999af7262478eb1c186d784d6075beb.tar.gz
auth/gensec: avoid talloc_reference in gensec_security_mechs()
We now always copy. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/gensec/gensec_start.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c
index 096ad364868..00e27596bfe 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,