Skip site navigation (1)Skip section navigation (2)
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:   bin/25544: [PATCH] lprm - fails for remote printers
Message-ID:  <200103051635.f25GZm864417@curry.mchp.siemens.de>

next in thread | raw e-mail | index | archive | help

>Number:         25544
>Category:       bin
>Synopsis:       [PATCH] lprm - fails for remote printers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 05 08:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103051635.f25GZm864417>