From d71dec9259366e99beca69fcd9397bd38ed82c71 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 7 Apr 2009 00:40:46 +0200 Subject: s3-libads: avoid NULL talloc context with ads_get_dn(). Guenther --- source3/libads/ldap.c | 16 ++++++++-------- source3/printing/nt_printing.c | 2 +- source3/utils/net_ads.c | 8 ++++---- source3/winbindd/idmap_adex/likewise_cell.c | 2 +- source3/winbindd/idmap_adex/provider_unified.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index d274377259..841ea8caae 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -1629,7 +1629,7 @@ char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid) } /* substitute the bind-path from the well-known-guid-search result */ - wkn_dn = ads_get_dn(ads, NULL, res); + wkn_dn = ads_get_dn(ads, talloc_tos(), res); if (!wkn_dn) { goto out; } @@ -1731,7 +1731,7 @@ uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name) return kvno; } - dn_string = ads_get_dn(ads, NULL, res); + dn_string = ads_get_dn(ads, talloc_tos(), res); if (!dn_string) { DEBUG(0,("ads_get_kvno: out of memory.\n")); ads_msgfree(ads, res); @@ -1826,7 +1826,7 @@ ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machin talloc_destroy(ctx); return ret; } - dn_string = ads_get_dn(ads, NULL, res); + dn_string = ads_get_dn(ads, talloc_tos(), res); if (!dn_string) { talloc_destroy(ctx); ads_msgfree(ads, res); @@ -2041,7 +2041,7 @@ ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name, goto done; } - computer_dn = ads_get_dn(ads, NULL, res); + computer_dn = ads_get_dn(ads, talloc_tos(), res); if (!computer_dn) { rc = ADS_ERROR(LDAP_NO_MEMORY); goto done; @@ -3129,7 +3129,7 @@ ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads, char *dn = NULL; - dn = ads_get_dn(ads, NULL, msg); + dn = ads_get_dn(ads, talloc_tos(), msg); if (!dn) { ads_msgfree(ads, res); return ADS_ERROR(LDAP_NO_MEMORY); @@ -3483,7 +3483,7 @@ ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname) return ADS_ERROR_SYSTEM(ENOENT); } - hostnameDN = ads_get_dn(ads, NULL, (LDAPMessage *)msg); + hostnameDN = ads_get_dn(ads, talloc_tos(), (LDAPMessage *)msg); rc = ldap_delete_ext_s(ads->ldap.ld, hostnameDN, pldap_control, NULL); if (rc) { @@ -3514,7 +3514,7 @@ ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname) char *dn = NULL; - if ((dn = ads_get_dn(ads, NULL, msg_sub)) == NULL) { + if ((dn = ads_get_dn(ads, talloc_tos(), msg_sub)) == NULL) { SAFE_FREE(host); TALLOC_FREE(hostnameDN); return ADS_ERROR(LDAP_NO_MEMORY); @@ -3712,7 +3712,7 @@ ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads, goto out; } - dn = ads_get_dn(ads, NULL, res); + dn = ads_get_dn(ads, talloc_tos(), res); if (dn == NULL) { status = ADS_ERROR(LDAP_NO_MEMORY); goto out; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 40d7cd6347..c20171b049 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -3357,7 +3357,7 @@ static WERROR nt_printer_unpublish_ads(ADS_STRUCT *ads, printer->info_2->sharename, global_myname()); if (ADS_ERR_OK(ads_rc) && res && ads_count_replies(ads, res)) { - prt_dn = ads_get_dn(ads, NULL, res); + prt_dn = ads_get_dn(ads, talloc_tos(), res); if (!prt_dn) { ads_msgfree(ads, res); return WERR_NOMEM; diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 8ff0cdfcf4..8e927becbe 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -503,7 +503,7 @@ 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, NULL, res); + userdn = ads_get_dn(ads, talloc_tos(), res); ads_del_dn(ads, userdn); TALLOC_FREE(userdn); } @@ -598,7 +598,7 @@ static int ads_user_delete(struct net_context *c, int argc, const char **argv) ads_destroy(&ads); return -1; } - userdn = ads_get_dn(ads, NULL, res); + userdn = ads_get_dn(ads, talloc_tos(), res); ads_msgfree(ads, res); rc = ads_del_dn(ads, userdn); TALLOC_FREE(userdn); @@ -757,7 +757,7 @@ static int ads_group_delete(struct net_context *c, int argc, const char **argv) ads_destroy(&ads); return -1; } - groupdn = ads_get_dn(ads, NULL, res); + groupdn = ads_get_dn(ads, talloc_tos(), res); ads_msgfree(ads, res); rc = ads_del_dn(ads, groupdn); TALLOC_FREE(groupdn); @@ -1740,7 +1740,7 @@ static int net_ads_printer_remove(struct net_context *c, int argc, const char ** return -1; } - prt_dn = ads_get_dn(ads, NULL, res); + prt_dn = ads_get_dn(ads, talloc_tos(), res); ads_msgfree(ads, res); rc = ads_del_dn(ads, prt_dn); TALLOC_FREE(prt_dn); diff --git a/source3/winbindd/idmap_adex/likewise_cell.c b/source3/winbindd/idmap_adex/likewise_cell.c index 7354a367b8..d666d8c01a 100644 --- a/source3/winbindd/idmap_adex/likewise_cell.c +++ b/source3/winbindd/idmap_adex/likewise_cell.c @@ -400,7 +400,7 @@ done: e!=NULL; e = ads_next_entry(c->conn, e)) { - char *dn = ads_get_dn(c->conn, NULL, e); + char *dn = ads_get_dn(c->conn, talloc_tos(), e); DEBUGADD(10,(" dn: %s\n", dn ? dn : "")); TALLOC_FREE(dn); diff --git a/source3/winbindd/idmap_adex/provider_unified.c b/source3/winbindd/idmap_adex/provider_unified.c index 9134eb4e64..f9d73f5f95 100644 --- a/source3/winbindd/idmap_adex/provider_unified.c +++ b/source3/winbindd/idmap_adex/provider_unified.c @@ -368,7 +368,7 @@ static NTSTATUS check_result_unique_scoped(ADS_STRUCT **ads_list, LDAPMessage *e = ads_first_entry(ads_list[i], msg_list[i]); while (e) { - entry_dn = ads_get_dn(ads_list[i], NULL, e); + entry_dn = ads_get_dn(ads_list[i], talloc_tos(), e); BAIL_ON_PTR_ERROR(entry_dn, nt_status); if (check_forest_scope(entry_dn)) { -- cgit