Blame 0002-Use-strdup-if-offset-are-used.patch

461678c
From 4ba49015ca1ad98c03a209a11862f8e00d00fbd0 Mon Sep 17 00:00:00 2001
461678c
From: Sumit Bose <sbose@redhat.com>
461678c
Date: Wed, 24 Aug 2016 16:19:36 +0200
461678c
Subject: [PATCH 02/23] Use strdup() if offset are used
461678c
461678c
Strings with an offset to the original starting point must be copied
461678c
because otherwise they cannot be properly freed later.
461678c
---
461678c
 library/adenroll.c | 6 +++---
461678c
 1 file changed, 3 insertions(+), 3 deletions(-)
461678c
461678c
diff --git a/library/adenroll.c b/library/adenroll.c
461678c
index d1020e9..05885d0 100644
461678c
--- a/library/adenroll.c
461678c
+++ b/library/adenroll.c
461678c
@@ -1318,9 +1318,9 @@ load_keytab_entry (krb5_context k5,
461678c
 
461678c
 		} else if (!enroll->host_fqdn && _adcli_str_has_prefix (name, "host/") && strchr (name, '.')) {
461678c
 			/* Skip host/ prefix */
461678c
-			enroll->host_fqdn = name + 5;
461678c
-			_adcli_info ("Found host qualified name in keytab: %s", name);
461678c
-			name = NULL;
461678c
+			enroll->host_fqdn = strdup (name + 5);
461678c
+			return_val_if_fail (enroll->host_fqdn != NULL, FALSE);
461678c
+			_adcli_info ("Found host qualified name in keytab: %s", enroll->host_fqdn);
461678c
 		}
461678c
 	}
461678c
 
461678c
-- 
461678c
2.14.4
461678c