summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2015-10-07 13:47:18 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-10-08 21:01:40 +0200
commit81b92281b3f30950d7c692a0882283a23ad3cec2 (patch)
tree619a5aff47178105f7acd0798673e739306f9236
parentd4a746b6aea9c9570508a683f2397e6e5547c6c7 (diff)
downloadsssd-81b92281b3f30950d7c692a0882283a23ad3cec2.tar.gz
sssd-81b92281b3f30950d7c692a0882283a23ad3cec2.tar.xz
sssd-81b92281b3f30950d7c692a0882283a23ad3cec2.zip
sss_override: steal msgs string to objs
Since msgs is attached to tmp_ctx then all the strings are freed with tmp_ctx. Now steal the strings to objs. Resolves: https://fedorahosted.org/sssd/ticket/2826 Reviewed-by: Pavel Reichl <preichl@redhat.com> (cherry picked from commit 3119225929463aecfbb1a7fc953263736955271e)
-rw-r--r--src/tools/sss_override.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/sss_override.c b/src/tools/sss_override.c
index 16b25b216..cf19e8287 100644
--- a/src/tools/sss_override.c
+++ b/src/tools/sss_override.c
@@ -1006,6 +1006,12 @@ list_user_overrides(TALLOC_CTX *mem_ctx,
objs[i].home = ldb_msg_find_attr_as_string(msgs[i], SYSDB_HOMEDIR, NULL);
objs[i].shell = ldb_msg_find_attr_as_string(msgs[i], SYSDB_SHELL, NULL);
objs[i].gecos = ldb_msg_find_attr_as_string(msgs[i], SYSDB_GECOS, NULL);
+
+ talloc_steal(objs, objs[i].orig_name);
+ talloc_steal(objs, objs[i].name);
+ talloc_steal(objs, objs[i].home);
+ talloc_steal(objs, objs[i].shell);
+ talloc_steal(objs, objs[i].gecos);
}
talloc_steal(mem_ctx, objs);
@@ -1061,6 +1067,9 @@ list_group_overrides(TALLOC_CTX *mem_ctx,
objs[i].name = ldb_msg_find_attr_as_string(msgs[i], SYSDB_NAME, NULL);
objs[i].gid = ldb_msg_find_attr_as_uint(msgs[i], SYSDB_GIDNUM, 0);
+
+ talloc_steal(objs, objs[i].orig_name);
+ talloc_steal(objs, objs[i].name);
}
talloc_steal(mem_ctx, objs);