summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-06-28 16:09:34 +0200
committerKarolin Seeger <kseeger@samba.org>2008-06-29 16:35:48 +0200
commit30fb2377da1848959afc1cac0f9098a4d06d9959 (patch)
treeac8598101734ee046c50f0492179729eabf8383f
parentdf391d46f55a4c2b55a4ac6e5d0284ef29ca6134 (diff)
downloadsamba-30fb2377da1848959afc1cac0f9098a4d06d9959.tar.gz
Fix a file descriptor leak in add_port_hook
This was probably cut&paste from add_printer_hook which further down has the unconditional close(fd). In add_port_hook() we're not interested in the output of 'addport command', so don't create the out fd. (cherry picked from commit 0c5ca2127ac6e3c71e369242376d27429c3aee5e)
-rw-r--r--source/rpc_server/srv_spoolss_nt.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index f3129ac3536..5fff9008758 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/rpc_server/srv_spoolss_nt.c
@@ -6155,7 +6155,6 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
char *cmd = lp_addport_cmd();
char *command = NULL;
int ret;
- int fd;
SE_PRIV se_printop = SE_PRINT_OPERATOR;
bool is_print_op = False;
@@ -6179,7 +6178,7 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
if ( is_print_op )
become_root();
- ret = smbrun(command, &fd);
+ ret = smbrun(command, NULL);
if ( is_print_op )
unbecome_root();
@@ -6191,8 +6190,6 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
TALLOC_FREE(command);
if ( ret != 0 ) {
- if (fd != -1)
- close(fd);
return WERR_ACCESS_DENIED;
}