summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-03-18 17:35:03 +1100
committerGünther Deschner <gd@samba.org>2009-04-06 15:54:41 +0200
commit20501876735fc4656083747ba8aa0de9da8fb820 (patch)
treed75bfbfe09fca5c751855d5bde0e255358d71383 /source3/utils
parent9d9f9452815f99dae61976b843af14f54c42009c (diff)
downloadsamba-20501876735fc4656083747ba8aa0de9da8fb820.tar.gz
samba-20501876735fc4656083747ba8aa0de9da8fb820.tar.bz2
samba-20501876735fc4656083747ba8aa0de9da8fb820.zip
s3:libads Make ads_get_dn() take a talloc context
Also remove ads_memfree(), which was only ever a wrapper around SAFE_FREE, used only to free the DN from ads_get_ds(). This actually makes libgpo more consistant, as it mixed a talloc and a malloc based string on the same element. Andrew Bartlett Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c16
-rw-r--r--source3/utils/net_ads_gpo.c6
2 files changed, 10 insertions, 12 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 2a66619438..8ff0cdfcf4 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -503,9 +503,9 @@ static int ads_user_add(struct net_context *c, int argc, const char **argv)
ads_msgfree(ads, res);
status=ads_find_user_acct(ads, &res, argv[0]);
if (ADS_ERR_OK(status)) {
- userdn = ads_get_dn(ads, res);
+ userdn = ads_get_dn(ads, NULL, res);
ads_del_dn(ads, userdn);
- ads_memfree(ads, userdn);
+ TALLOC_FREE(userdn);
}
done:
@@ -598,10 +598,10 @@ static int ads_user_delete(struct net_context *c, int argc, const char **argv)
ads_destroy(&ads);
return -1;
}
- userdn = ads_get_dn(ads, res);
+ userdn = ads_get_dn(ads, NULL, res);
ads_msgfree(ads, res);
rc = ads_del_dn(ads, userdn);
- ads_memfree(ads, userdn);
+ TALLOC_FREE(userdn);
if (ADS_ERR_OK(rc)) {
d_printf("User %s deleted\n", argv[0]);
ads_destroy(&ads);
@@ -757,10 +757,10 @@ static int ads_group_delete(struct net_context *c, int argc, const char **argv)
ads_destroy(&ads);
return -1;
}
- groupdn = ads_get_dn(ads, res);
+ groupdn = ads_get_dn(ads, NULL, res);
ads_msgfree(ads, res);
rc = ads_del_dn(ads, groupdn);
- ads_memfree(ads, groupdn);
+ TALLOC_FREE(groupdn);
if (ADS_ERR_OK(rc)) {
d_printf("Group %s deleted\n", argv[0]);
ads_destroy(&ads);
@@ -1740,10 +1740,10 @@ static int net_ads_printer_remove(struct net_context *c, int argc, const char **
return -1;
}
- prt_dn = ads_get_dn(ads, res);
+ prt_dn = ads_get_dn(ads, NULL, res);
ads_msgfree(ads, res);
rc = ads_del_dn(ads, prt_dn);
- ads_memfree(ads, prt_dn);
+ TALLOC_FREE(prt_dn);
if (!ADS_ERR_OK(rc)) {
d_fprintf(stderr, "ads_del_dn: %s\n", ads_errstr(rc));
diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c
index 181cba221d..910c78d05a 100644
--- a/source3/utils/net_ads_gpo.c
+++ b/source3/utils/net_ads_gpo.c
@@ -257,7 +257,7 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar
msg;
msg = ads_next_entry(ads, msg)) {
- if ((dn = ads_get_dn(ads, msg)) == NULL) {
+ if ((dn = ads_get_dn(ads, mem_ctx, msg)) == NULL) {
goto out;
}
@@ -266,18 +266,16 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar
if (!ADS_ERR_OK(status)) {
d_printf("ads_parse_gpo failed: %s\n",
ads_errstr(status));
- ads_memfree(ads, dn);
goto out;
}
dump_gpo(ads, mem_ctx, &gpo, 0);
- ads_memfree(ads, dn);
}
out:
ads_msgfree(ads, res);
- talloc_destroy(mem_ctx);
+ TALLOC_FREE(mem_ctx);
ads_destroy(&ads);
return 0;