[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Apr 7 15:53:26 MDT 2010


The branch, master has been updated
       via  0ec6f29... s4-smbtorture: minor typo in SetJob test in RPC-SPOOLSS.
       via  d9138f4... s3-spoolss: Fix an issue in _spoolss_DeleteForm.
       via  65c5b78... s3-spoolss: Fix some issues in _spoolss_AddForm.
       via  34ada1d... s3-spoolss: Fix potential memleak in _spoolss_AddForm and _spoolss_SetForm.
      from  7f3116a... build: allow the waf build to work with python 3.0 and 3.1

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0ec6f297eebe1062f48b9e03b7a0def8a1b5ee21
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 7 23:40:17 2010 +0200

    s4-smbtorture: minor typo in SetJob test in RPC-SPOOLSS.
    
    Guenther

commit d9138f4ccf7b5a491a922254fe3ff67c7d612703
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 7 23:36:48 2010 +0200

    s3-spoolss: Fix an issue in _spoolss_DeleteForm.
    
    Found by torture test.
    
    Guenther

commit 65c5b786ca4dcb3fda47eea24848232548caf443
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 7 23:36:15 2010 +0200

    s3-spoolss: Fix some issues in _spoolss_AddForm.
    
    Found by torture test.
    
    Guenther

commit 34ada1d540b0eedbe1dd573a47146f0309ed4875
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 7 23:34:36 2010 +0200

    s3-spoolss: Fix potential memleak in _spoolss_AddForm and _spoolss_SetForm.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source3/printing/nt_printing.c      |    2 +-
 source3/rpc_server/srv_spoolss_nt.c |   26 +++++++++++++++++++++++---
 source4/torture/rpc/spoolss.c       |    2 +-
 3 files changed, 25 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 5096ca0..3791c0d 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -918,7 +918,7 @@ bool delete_a_form(nt_forms_struct **list, const char *del_name, int *count, WER
 
 	if (n == *count) {
 		DEBUG(10,("delete_a_form, [%s] not found\n", del_name));
-		*ret = WERR_INVALID_PARAM;
+		*ret = WERR_INVALID_FORM_NAME;
 		return False;
 	}
 
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index bb14c59..236f15a 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7883,6 +7883,7 @@ WERROR _spoolss_AddForm(pipes_struct *p,
 	int count=0;
 	nt_forms_struct *list=NULL;
 	Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle);
+	int i;
 
 	DEBUG(5,("_spoolss_AddForm\n"));
 
@@ -7893,7 +7894,7 @@ WERROR _spoolss_AddForm(pipes_struct *p,
 	}
 
 
-	/* forms can be added on printer of on the print server handle */
+	/* forms can be added on printer or on the print server handle */
 
 	if ( Printer->printer_type == SPLHND_PRINTER )
 	{
@@ -7915,7 +7916,18 @@ WERROR _spoolss_AddForm(pipes_struct *p,
 					  p->server_info->ptok,
 					  lp_printer_admin(snum))) {
 		DEBUG(2,("_spoolss_Addform: denied by insufficient permissions.\n"));
-		return WERR_ACCESS_DENIED;
+		status = WERR_ACCESS_DENIED;
+		goto done;
+	}
+
+	switch (form->flags) {
+	case SPOOLSS_FORM_USER:
+	case SPOOLSS_FORM_BUILTIN:
+	case SPOOLSS_FORM_PRINTER:
+		break;
+	default:
+		status = WERR_INVALID_PARAM;
+		goto done;
 	}
 
 	/* can't add if builtin */
@@ -7927,6 +7939,13 @@ WERROR _spoolss_AddForm(pipes_struct *p,
 
 	count = get_ntforms(&list);
 
+	for (i=0; i < count; i++) {
+		if (strequal(form->form_name, list[i].name)) {
+			status = WERR_FILE_EXISTS;
+			goto done;
+		}
+	}
+
 	if(!add_a_form(&list, form, &count)) {
 		status =  WERR_NOMEM;
 		goto done;
@@ -8079,7 +8098,8 @@ WERROR _spoolss_SetForm(pipes_struct *p,
 					  p->server_info->ptok,
 					  lp_printer_admin(snum))) {
 		DEBUG(2,("_spoolss_Setform: denied by insufficient permissions.\n"));
-		return WERR_ACCESS_DENIED;
+		status = WERR_ACCESS_DENIED;
+		goto done;
 	}
 
 	/* can't set if builtin */
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index b86a9ce..d46780b 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2842,7 +2842,7 @@ static bool test_SetJob(struct torture_context *tctx,
 
 	switch (command) {
 	case SPOOLSS_JOB_CONTROL_PAUSE:
-		torture_comment(tctx, "Testing SetJob(%d) SPOOLSS_JOB_CONTROL_PAUSE\n", job_id);
+		torture_comment(tctx, "Testing SetJob(%d), SPOOLSS_JOB_CONTROL_PAUSE\n", job_id);
 		break;
 	case SPOOLSS_JOB_CONTROL_RESUME:
 		torture_comment(tctx, "Testing SetJob(%d), SPOOLSS_JOB_CONTROL_RESUME\n", job_id);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list