summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-11-05 12:27:58 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-11-07 10:59:38 +0100
commit6469f42ca80bb9b955875d590485b0d9366491df (patch)
tree5c1c0a2175a51a997a6f5b9d137fb1231b2f1481
parent89fdf07e77054b2931673bd1f082cb459607c0ec (diff)
downloadsssd-6469f42ca80bb9b955875d590485b0d9366491df.tar.gz
sssd-6469f42ca80bb9b955875d590485b0d9366491df.tar.xz
sssd-6469f42ca80bb9b955875d590485b0d9366491df.zip
free idmapped binary SIDs correctly
Resolves: https://fedorahosted.org/sssd/ticket/2133
-rw-r--r--src/lib/cifs_idmap_sss/cifs_idmap_sss.c2
-rw-r--r--src/responder/nss/nsssrv_cmd.c2
-rw-r--r--src/tests/sss_idmap-tests.c10
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
index f9149177b..7968877ed 100644
--- a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
+++ b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
@@ -167,7 +167,7 @@ static int sid_to_cifs_sid(struct sssd_ctx *ctx, const char *sid,
}
memcpy(csid, bsid, length);
- free(bsid);
+ sss_idmap_free_bin_sid(ctx->idmap, bsid);
return 0;
}
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index f2f6e9068..715c27ba0 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -4335,7 +4335,7 @@ static int nss_cmd_getbysid(enum sss_cli_command cmd, struct cli_ctx *cctx)
/* If the body isn't a SID, fail */
err = sss_idmap_sid_to_bin_sid(nctx->idmap_ctx, sid_str,
&bin_sid, &bin_sid_length);
- talloc_free(bin_sid);
+ sss_idmap_free_bin_sid(nctx->idmap_ctx, bin_sid);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_OP_FAILURE, ("sss_idmap_sid_to_bin_sid failed for [%s].\n",
body));
diff --git a/src/tests/sss_idmap-tests.c b/src/tests/sss_idmap-tests.c
index 888be8224..f5ec68383 100644
--- a/src/tests/sss_idmap-tests.c
+++ b/src/tests/sss_idmap-tests.c
@@ -242,7 +242,7 @@ START_TEST(idmap_test_bin_sid2uid)
"sss_idmap_bin_sid_to_unix returned wrong id, "
"got [%d], expected [%d].", id, 1000 + IDMAP_RANGE_MIN);
- talloc_free(bin_sid);
+ sss_idmap_free_bin_sid(idmap_ctx, bin_sid);
}
END_TEST
@@ -331,7 +331,7 @@ START_TEST(idmap_test_uid2bin_sid)
"expected [%s], got [%s].", "S-1-5-21-1-2-3-1000", sid);
sss_idmap_free_sid(idmap_ctx, sid);
- talloc_free(bin_sid);
+ sss_idmap_free_bin_sid(idmap_ctx, bin_sid);
}
END_TEST
@@ -359,7 +359,7 @@ START_TEST(idmap_test_bin_sid2dom_sid)
"Binary SIDs do not match.");
sss_idmap_free_dom_sid(idmap_ctx, dom_sid);
- talloc_free(new_bin_sid);
+ sss_idmap_free_bin_sid(idmap_ctx, new_bin_sid);
}
END_TEST
@@ -437,7 +437,7 @@ START_TEST(idmap_test_sid2bin_sid)
fail_unless(memcmp(bin_sid, test_bin_sid, test_bin_sid_length) == 0,
"Binary SIDs do not match");
- talloc_free(bin_sid);
+ sss_idmap_free_bin_sid(idmap_ctx, bin_sid);
}
END_TEST
@@ -496,7 +496,7 @@ START_TEST(idmap_test_smb_sid2bin_sid)
fail_unless(memcmp(bin_sid, test_bin_sid, test_bin_sid_length) == 0,
"Binary SIDs do not match.");
- talloc_free(bin_sid);
+ sss_idmap_free_bin_sid(idmap_ctx, bin_sid);
}
END_TEST