From andre.albsmeier@mchp.siemens.de  Mon Mar  5 08:35:52 2001
Return-Path: <andre.albsmeier@mchp.siemens.de>
Received: from david.siemens.de (david.siemens.de [192.35.17.14])
	by hub.freebsd.org (Postfix) with ESMTP id D240C37B718
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  5 Mar 2001 08:35:50 -0800 (PST)
	(envelope-from andre.albsmeier@mchp.siemens.de)
Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14])
	by david.siemens.de (8.11.0/8.11.0) with ESMTP id f25GZmt12249
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 5 Mar 2001 17:35:49 +0100 (MET)
Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7])
	by mail3.siemens.de (8.11.1/8.11.1) with ESMTP id f25GZmr31942812
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 5 Mar 2001 17:35:48 +0100 (MET)
Received: (from localhost)
	by curry.mchp.siemens.de (8.11.2/8.11.2) id f25GZmS85478
	for FreeBSD-gnats-submit@freebsd.org; Mon, 5 Mar 2001 17:35:48 +0100 (CET)
Message-Id: <200103051635.f25GZm864417@curry.mchp.siemens.de>
Date: Mon, 5 Mar 2001 17:35:48 +0100 (CET)
From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] lprm - fails for remote printers
X-Send-Pr-Version: 3.2

>Number:         25544
>Category:       bin
>Synopsis:       [MFC] lprm - fails for remote printers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gad
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 05 08:40:01 PST 2001
>Closed-Date:    Tue Mar 13 12:43:10 PST 2001
>Last-Modified:  Tue Mar 13 12:44:41 PST 2001
>Originator:     Andre Albsmeier
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:

FreeBSD 4.2-STABLE using remote printers

>Description:

When using "lprm -" to remove all jobs in a remote print queue, rmjob()
is called from lprm. To indicate that all jobs should be deleted, the
global variable users is set to -1. rmjob() then constructs an iovec 
struct array to talk to the remote lpd. Here iov[3].iov_base is set to
the string "-all". The size of this array is calculated from the variable
users (among others). This is done wrongly which turns out that the
"-all" never makes it to the destination lpd and it complains.

>How-To-Repeat:

Issue a "lprm -" command for a remote printer.

>Fix:

Don't let a negative value users incorrectly shrink the number
of iov's. Since users won't be uses anymore we can safely set it
to 0.

--- usr.sbin/lpr/common_source/rmjob.c.ORI	Mon Mar  5 17:20:54 2001
+++ usr.sbin/lpr/common_source/rmjob.c	Mon Mar  5 17:21:58 2001
@@ -338,6 +338,8 @@
 	 * us to process requests of indeterminate length without
 	 * applying an arbitrary limit.  Arbitrary Limits Are Bad (tm).
 	 */
+	if(users < 0)
+		users = 0;
 	niov = 4 + 2 * users + requests + 1;
 	iov = malloc(niov * sizeof *iov);
 	if (iov == 0)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gad 
Responsible-Changed-By: gad 
Responsible-Changed-When: Sun Mar 11 16:02:13 PST 2001 
Responsible-Changed-Why:  
I'll commit a fix for this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25544 
State-Changed-From-To: open->suspended 
State-Changed-By: gad 
State-Changed-When: Mon Mar 12 19:43:18 PST 2001 
State-Changed-Why:  
I wrote an update to lpr/common_source/rmjob.c which fixes this 
problem, and committed it to -current.  So, the solution to this 
PR is awaiting MFC. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25544 
State-Changed-From-To: suspended->closed 
State-Changed-By: gad 
State-Changed-When: Tue Mar 13 12:43:10 PST 2001 
State-Changed-Why:  
The fix for this 'lprm -' problem has been MFC-ed (in time for 4.3-release) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25544 
>Unformatted:
