summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-26 15:33:16 +0100
committerGünther Deschner <gd@samba.org>2009-02-26 22:02:19 +0100
commita263d8f430383cc94f14cf331db5e21671196032 (patch)
tree8b6d772bc3ad9e60d69aeb5c60c54997b9984746 /source3
parentf343ed7319272fc8105ae3edf8039742fc4fe6d9 (diff)
downloadsamba-a263d8f430383cc94f14cf331db5e21671196032.tar.gz
samba-a263d8f430383cc94f14cf331db5e21671196032.tar.bz2
samba-a263d8f430383cc94f14cf331db5e21671196032.zip
s3-rpcclient: use is_valid_policy_hnd before closing handles.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_spoolss.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 79cde704d2..72cc40b748 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -2428,7 +2428,6 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
{
WERROR result;
uint32 level = 1, num_jobs, i;
- bool got_hnd = False;
const char *printername;
POLICY_HND hnd;
JOB_INFO_CTR ctr;
@@ -2452,8 +2451,6 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
if (!W_ERROR_IS_OK(result))
goto done;
- got_hnd = True;
-
/* Enumerate ports */
result = rpccli_spoolss_enumjobs(cli, mem_ctx, &hnd, level, 0, 1000,
@@ -2477,7 +2474,7 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
}
done:
- if (got_hnd)
+ if (is_valid_policy_hnd(&hnd))
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
return result;
@@ -2492,7 +2489,6 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
{
WERROR result;
uint32 i=0, val_needed, data_needed;
- bool got_hnd = False;
const char *printername;
POLICY_HND hnd;
@@ -2512,8 +2508,6 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
if (!W_ERROR_IS_OK(result))
goto done;
- got_hnd = True;
-
/* Enumerate data */
result = rpccli_spoolss_enumprinterdata(cli, mem_ctx, &hnd, i, 0, 0,
@@ -2531,7 +2525,7 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
result = W_ERROR(ERRsuccess);
done:
- if (got_hnd)
+ if (is_valid_policy_hnd(&hnd))
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
return result;
@@ -2546,7 +2540,6 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
{
WERROR result;
uint32 i;
- bool got_hnd = False;
const char *printername;
const char *keyname = NULL;
POLICY_HND hnd;
@@ -2570,8 +2563,6 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
if (!W_ERROR_IS_OK(result))
goto done;
- got_hnd = True;
-
/* Enumerate subkeys */
if ( !(ctr = TALLOC_ZERO_P( mem_ctx, REGVAL_CTR )) )
@@ -2589,7 +2580,7 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
TALLOC_FREE( ctr );
done:
- if (got_hnd)
+ if (is_valid_policy_hnd(&hnd))
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
return result;
@@ -2603,7 +2594,6 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
const char **argv)
{
WERROR result;
- bool got_hnd = False;
const char *printername;
const char *keyname = NULL;
POLICY_HND hnd;
@@ -2630,8 +2620,6 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
if (!W_ERROR_IS_OK(result))
goto done;
- got_hnd = True;
-
/* Enumerate subkeys */
result = rpccli_spoolss_enumprinterkey(cli, mem_ctx, &hnd, keyname, &keylist, NULL);
@@ -2655,7 +2643,7 @@ done:
SAFE_FREE(keylist);
- if (got_hnd)
+ if (is_valid_policy_hnd(&hnd))
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
return result;
@@ -2671,7 +2659,6 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
const char *printername;
const char *clientname;
POLICY_HND hnd;
- bool got_hnd = False;
WERROR result;
NTSTATUS status;
struct spoolss_NotifyOption option;
@@ -2695,8 +2682,6 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
goto done;
}
- got_hnd = True;
-
/* Create spool options */
option.version = 2;
@@ -2748,7 +2733,7 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
}
done:
- if (got_hnd)
+ if (is_valid_policy_hnd(&hnd))
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
return result;