summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_cm.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-04-04 02:39:57 +0000
committerJeremy Allison <jra@samba.org>2002-04-04 02:39:57 +0000
commitadc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7 (patch)
tree51c483b35db87dcf641e31a8c7a61f5a1a0da587 /source3/nsswitch/winbindd_cm.c
parent04014751ddc9219f112afc7dc761a80ffddd78c4 (diff)
downloadsamba-adc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7.tar.gz
samba-adc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7.tar.bz2
samba-adc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7.zip
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)
Diffstat (limited to 'source3/nsswitch/winbindd_cm.c')
-rw-r--r--source3/nsswitch/winbindd_cm.c13
1 files changed, 13 insertions, 0 deletions
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);