summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-19 15:56:05 +0100
committerGünther Deschner <gd@samba.org>2009-02-19 19:19:59 +0100
commit0038acb20d1c5ed8eea632adf631ed84f960165f (patch)
tree62f5335bdb7a10984892a8c2d15d4e1397290e5b
parentbcb5331fa7e8711e22c9543c59efa442143a6cc6 (diff)
downloadsamba-0038acb20d1c5ed8eea632adf631ed84f960165f.tar.gz
samba-0038acb20d1c5ed8eea632adf631ed84f960165f.tar.bz2
samba-0038acb20d1c5ed8eea632adf631ed84f960165f.zip
s3-spoolss: _spoolss_OpenPrinterEx needs to wipe out policy handle upon failure.
Guenther
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 8420c3765c..7f4ff97ba8 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1529,6 +1529,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
DEBUGADD(3,("checking name: %s\n",name));
if (!open_printer_hnd(p, handle, name, 0)) {
+ ZERO_STRUCTP(r->out.handle);
return WERR_INVALID_PARAM;
}
@@ -1537,6 +1538,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
DEBUG(0,("_spoolss_OpenPrinterEx: logic error. Can't find printer "
"handle we created for printer %s\n", name ));
close_printer_handle(p,handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_INVALID_PARAM;
}
@@ -1587,6 +1589,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
~(SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE)) {
DEBUG(3, ("access DENIED for non-printserver bits\n"));
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
@@ -1598,6 +1601,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
if (!lp_ms_add_printer_wizard()) {
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
@@ -1613,6 +1617,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
p->server_info->ptok,
lp_printer_admin(snum))) {
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
@@ -1635,6 +1640,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
if (!get_printer_snum(p, handle, &snum, NULL)) {
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_BADFID;
}
@@ -1660,6 +1666,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
if ( !check_access(get_client_fd(), lp_hostsallow(snum), lp_hostsdeny(snum)) ) {
DEBUG(3, ("access DENIED (hosts allow/deny) for printer open\n"));
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
@@ -1669,12 +1676,14 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
r->in.access_mask)) {
DEBUG(3, ("access DENIED for printer open\n"));
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
if ((r->in.access_mask & SPECIFIC_RIGHTS_MASK)& ~(PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE)) {
DEBUG(3, ("access DENIED for printer open - unknown bits\n"));
close_printer_handle(p, handle);
+ ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
}
@@ -1690,6 +1699,7 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
default:
/* sanity check to prevent programmer error */
+ ZERO_STRUCTP(r->out.handle);
return WERR_BADFID;
}