[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Wed Feb 17 18:20:28 MST 2010
The branch, master has been updated
via 43e3d8f... s3-spoolss: fix return code of spoolss_DeletePrinter.
via 8ce66fb... s3-spoolss: in spoolss_EnumPrinters r->in.server is a *unique* pointer!
via 2d2db2a... s3-spoolss: more AddPrinter{Ex} checks.
via 5cff7e1... s3-spoolss: add some printer info validation for AddPrinter calls.
from 9ff2c1e... testprogs: print SDDL string of printer security descriptors
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 43e3d8f51da4bbdb3108af45e2fddab7e2e91f04
Author: Günther Deschner <gd at samba.org>
Date: Thu Feb 18 02:14:26 2010 +0100
s3-spoolss: fix return code of spoolss_DeletePrinter.
When the printer has been removed by the "deleteprinter command", we need to
check if it is still there and then fail, not fail if we successfully removed
it (found by RPC-SPOOLSS-PRINTER).
Guenther
commit 8ce66fba03f782c0b9948a9835bb488cfa74acf9
Author: Günther Deschner <gd at samba.org>
Date: Thu Feb 18 02:03:53 2010 +0100
s3-spoolss: in spoolss_EnumPrinters r->in.server is a *unique* pointer!
Guenther
commit 2d2db2a8226f6a3a8e114abc9a37aea66dba912e
Author: Günther Deschner <gd at samba.org>
Date: Thu Feb 18 01:58:56 2010 +0100
s3-spoolss: more AddPrinter{Ex} checks.
Windows will allow to add a non-shared printer that is returned by EnumPrinters.
Samba has no notion of non-shared local printers yet, so just make sure to
behave like we do elsewhere: a printer autoloaded by samba or added to samba is
shared.
Guenther
commit 5cff7e1692e4caa308271581f3df3f72c4f31261
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 14 14:34:30 2009 +0200
s3-spoolss: add some printer info validation for AddPrinter calls.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source3/rpc_server/srv_spoolss_nt.c | 50 ++++++++++++++++++++++++++++++++---
1 files changed, 46 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 34daf40..445a654 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -315,7 +315,7 @@ static WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const c
reload_services(false);
unbecome_root();
- if ( lp_servicenumber( sharename ) < 0 )
+ if ( lp_servicenumber( sharename ) > 0 )
return WERR_ACCESS_DENIED;
return WERR_OK;
@@ -4281,7 +4281,7 @@ static WERROR enumprinters_level5(TALLOC_CTX *mem_ctx,
WERROR _spoolss_EnumPrinters(pipes_struct *p,
struct spoolss_EnumPrinters *r)
{
- const char *name;
+ const char *name = NULL;
WERROR result;
/* that's an [in out] buffer */
@@ -4309,8 +4309,10 @@ WERROR _spoolss_EnumPrinters(pipes_struct *p,
* Level 5: same as Level 2
*/
- name = talloc_strdup_upper(p->mem_ctx, r->in.server);
- W_ERROR_HAVE_NO_MEMORY(name);
+ if (name) {
+ name = talloc_strdup_upper(p->mem_ctx, r->in.server);
+ W_ERROR_HAVE_NO_MEMORY(name);
+ }
switch (r->in.level) {
case 0:
@@ -7136,6 +7138,15 @@ static WERROR spoolss_addprinterex_level_2(pipes_struct *p,
return WERR_NOMEM;
}
+ /* samba does not have a concept of local, non-shared printers yet, so
+ * make sure we always setup sharename - gd */
+ if ((printer->info_2->sharename[0] == '\0') && (printer->info_2->printername != '\0')) {
+ DEBUG(5, ("spoolss_addprinterex_level_2: "
+ "no sharename has been set, setting printername %s as sharename\n",
+ printer->info_2->printername));
+ fstrcpy(printer->info_2->sharename, printer->info_2->printername);
+ }
+
/* check to see if the printer already exists */
if ((snum = print_queue_snum(printer->info_2->sharename)) != -1) {
@@ -7145,6 +7156,37 @@ static WERROR spoolss_addprinterex_level_2(pipes_struct *p,
return WERR_PRINTER_ALREADY_EXISTS;
}
+ if (!lp_force_printername(GLOBAL_SECTION_SNUM)) {
+ if ((snum = print_queue_snum(printer->info_2->printername)) != -1) {
+ DEBUG(5, ("spoolss_addprinterex_level_2: Attempted to add a printer named [%s] when one already existed!\n",
+ printer->info_2->printername));
+ free_a_printer(&printer, 2);
+ return WERR_PRINTER_ALREADY_EXISTS;
+ }
+ }
+
+ /* validate printer info struct */
+ if (!info_ctr->info.info2->printername ||
+ strlen(info_ctr->info.info2->printername) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_INVALID_PRINTER_NAME;
+ }
+ if (!info_ctr->info.info2->portname ||
+ strlen(info_ctr->info.info2->portname) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PORT;
+ }
+ if (!info_ctr->info.info2->drivername ||
+ strlen(info_ctr->info.info2->drivername) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PRINTER_DRIVER;
+ }
+ if (!info_ctr->info.info2->printprocessor ||
+ strlen(info_ctr->info.info2->printprocessor) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PRINTPROCESSOR;
+ }
+
/* FIXME!!! smbd should check to see if the driver is installed before
trying to add a printer like this --jerry */
--
Samba Shared Repository
More information about the samba-cvs
mailing list