[PATCH 3/3] spoolss: fix handling of bad EnumJobs levels

David Disseldorp ddiss at samba.org
Mon Oct 27 13:13:59 MDT 2014


Currently Samba is inconsistent when returning WERR_UNKNOWN_LEVEL
errors for spoolss EnumJobs requests - if no print jobs are present,
then WERR_OK will be returned, regardless of whether the EnumJobs level
is supported or not.
This change fixes this behaviour, by catching invalid or unsupported
levels prior to the no-jobs response fast-path.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10898

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source3/rpc_server/spoolss/srv_spoolss_nt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index b8a6d77..552d4cb 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -7338,6 +7338,11 @@ WERROR _spoolss_EnumJobs(struct pipes_struct *p,
 		return WERR_INVALID_PARAM;
 	}
 
+	if ((r->in.level != 1) && (r->in.level != 2) && (r->in.level != 3)) {
+		DEBUG(4, ("EnumJobs level %d not supported\n", r->in.level));
+		return WERR_UNKNOWN_LEVEL;
+	}
+
 	DEBUG(4,("_spoolss_EnumJobs\n"));
 
 	*r->out.needed = 0;
@@ -7383,7 +7388,7 @@ WERROR _spoolss_EnumJobs(struct pipes_struct *p,
 					 pinfo2, r->out.info, r->out.count);
 		break;
 	default:
-		result = WERR_UNKNOWN_LEVEL;
+		SMB_ASSERT(false);	/* level checked on entry */
 		break;
 	}
 
-- 
1.8.4.5



More information about the samba-technical mailing list