From adc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 4 Apr 2002 02:39:57 +0000 Subject: Fixed the handle leak in the connection management code (this code is crap and should be rewritten, just not now... :-). Jeremy. (This used to be commit 5de792e7e9c2ad1422ac146caba632baa3f4e5c5) --- source3/nsswitch/winbindd_cm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/nsswitch/winbindd_cm.c') diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index f4abf86c47..ce484795f8 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -459,6 +459,13 @@ CLI_POLICY_HND *cm_get_lsa_handle(char *domain) if (!NT_STATUS_IS_OK(result = get_connection_from_cache(domain, PIPE_LSARPC, &conn))) { return NULL; } + + /* This *shitty* code needs scrapping ! JRA */ + if (policy_handle_is_valid(&conn->pol)) { + hnd.pol = conn->pol; + hnd.cli = conn->cli; + return &hnd; + } result = cli_lsa_open_policy(conn->cli, conn->cli->mem_ctx, False, des_access, &conn->pol); @@ -503,6 +510,12 @@ CLI_POLICY_HND *cm_get_sam_handle(char *domain) return NULL; } + /* This *shitty* code needs scrapping ! JRA */ + if (policy_handle_is_valid(&conn->pol)) { + hnd.pol = conn->pol; + hnd.cli = conn->cli; + return &hnd; + } result = cli_samr_connect(conn->cli, conn->cli->mem_ctx, des_access, &conn->pol); -- cgit