From owner-freebsd-bugs Mon Mar 5 8:40:11 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6E8D837B719 for ; Mon, 5 Mar 2001 08:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f25Ge1q33510; Mon, 5 Mar 2001 08:40:01 -0800 (PST) (envelope-from gnats) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by hub.freebsd.org (Postfix) with ESMTP id D240C37B718 for ; 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 ; 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 ; 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 To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/25544: [PATCH] lprm - fails for remote printers Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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