Bug#291777: marked as done (gnome-cups-manager: users in lpadmin group cannot add/remove printers)

Debian Bug Tracking System owner@bugs.debian.org
Mon, 13 Jun 2005 09:03:12 -0700


Your message dated Mon, 13 Jun 2005 11:47:04 -0400
with message-id <E1Dhr9U-0004kR-00@newraff.debian.org>
and subject line Bug#291777: fixed in gnome-cups-manager 0.30-2
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 23 Jan 2005 03:18:59 +0000
>From cameron@patrick.wattle.id.au Sat Jan 22 19:18:59 2005
Return-path: <cameron@patrick.wattle.id.au>
Received: from dsl-202-72-174-244.wa.westnet.com.au (euclid.patrick.wattle.id.au) [202.72.174.244] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CsYHC-0003ip-00; Sat, 22 Jan 2005 19:18:58 -0800
Received: from kant.home (kant.vpn.patrick.wattle.id.au [IPv6:2002:ca48:aef4:4::1])
	by euclid.patrick.wattle.id.au (Postfix) with ESMTP id 9D8A953E99;
	Sun, 23 Jan 2005 11:18:51 +0800 (WST)
Received: by kant.home (Postfix, from userid 1000)
	id 46F71414A3; Sun, 23 Jan 2005 11:18:51 +0800 (WST)
Content-Type: multipart/mixed; boundary="===============1264144532=="
MIME-Version: 1.0
From: Cameron Patrick <cameron@patrick.wattle.id.au>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gnome-cups-manager: users in lpadmin group cannot add/remove printers
X-Mailer: reportbug 3.2
Date: Sun, 23 Jan 2005 11:18:50 +0800
X-Debbugs-Cc: devel@lists.computerangels.org.au
Message-Id: <20050123031851.46F71414A3@kant.home>
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-11.0 required=4.0 tests=BAYES_00,HAS_PACKAGE,
	REMOVE_IN_QUOTES,X_DEBBUGS_CC autolearn=ham 
	version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

This is a multi-part MIME message sent by reportbug.

--===============1264144532==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: gnome-cups-manager
Version: 0.25-2
Severity: normal
Tags: patch

Users who are members of the lpadmin group can (at least on Debian
systems) modify the CUPS configuration without requiring a root
password.  However gnome-cups-manager still prompts for the root
password to add printers and the "remove" option is greyed out.  The
attached patch fixes this behaviour.

Cheers,

Cameron.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-ck4-cjp-kant
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)

Versions of packages gnome-cups-manager depends on:
ii  libart-2.0-2          2.3.16-6           Library of functions for 2D graphi
ii  libatk1.0-0           1.8.0-3            The ATK accessibility toolkit
ii  libbonobo2-0          2.8.0-3            Bonobo CORBA interfaces library
ii  libbonoboui2-0        2.8.0-2            The Bonobo UI library
ii  libc6                 2.3.2.ds1-18       GNU C Library: Shared libraries an
ii  libcupsys2-gnutls10   1.1.20final+rc1-10 Common UNIX Printing System(tm) - 
ii  libgconf2-4           2.8.1-4            GNOME configuration database syste
ii  libglade2-0           1:2.4.0-1          Library to load .glade files at ru
ii  libglib2.0-0          2.4.7-1            The GLib library of C routines
ii  libgnome-keyring0     0.4.0-2            GNOME keyring services library
ii  libgnome2-0           2.8.0-5            The GNOME 2 library - runtime file
ii  libgnomecanvas2-0     2.8.0-1            A powerful object-oriented display
ii  libgnomecups1.0-1     0.1.13-1           GNOME library for CUPS interaction
ii  libgnomecupsui1.0-1   0.25-2             UI extensions to libgnomecups
ii  libgnomeui-0          2.8.0-3            The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0        2.8.3-8            The GNOME virtual file-system libr
ii  libgtk2.0-0           2.4.13-1           The GTK+ graphical user interface 
ii  libice6               4.3.0.dfsg.1-8     Inter-Client Exchange library
ii  liborbit2             1:2.10.2-1.1       libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0         1.6.0-3            Layout and rendering of internatio
ii  libpopt0              1.7-5              lib for parsing cmdline parameters
ii  libsm6                4.3.0.dfsg.1-8     X Window System Session Management
ii  libx11-6              4.3.0.dfsg.1-8     X Window System protocol client li
ii  libxml2               2.6.11-5           GNOME XML library
ii  xlibs                 4.3.0.dfsg.1-8     X Window System client libraries m
ii  zlib1g                1:1.2.2-3          compression library - runtime

-- no debconf information

--===============1264144532==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="can-admin.patch"

--- gnome-cups-manager-0.25/libgnomecups/gnome-cups-permission.c.orig	2005-01-22 17:01:16.000000000 +0800
+++ gnome-cups-manager-0.25/libgnomecups/gnome-cups-permission.c	2005-01-22 16:59:39.000000000 +0800
@@ -27,6 +27,7 @@
 #include <glib/gi18n.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <grp.h>
 #include <string.h>
 
 static char *gnome_cups_app_path = NULL;
@@ -34,7 +35,50 @@
 gboolean
 gnome_cups_can_admin ()
 {
-	return (geteuid () == 0);
+	struct group *groupbuf = NULL, *lpadmin_group = NULL;
+	gid_t lpadmin_gid;
+	char *buf = NULL;
+	int bufsize;
+	gboolean can_admin = 0;
+	gid_t *gid_list;
+	int ngids, ngids_used;
+	int i;
+
+	/* root can do anything */
+	if (geteuid () == 0)
+		return 1;
+
+	/* check for lpadmin group access */
+	groupbuf = (struct group *)g_malloc(sizeof(struct group));
+	bufsize = sysconf(_SC_GETGR_R_SIZE_MAX) + 1;
+	buf = (char *)g_malloc(bufsize * sizeof(char));
+	if (getgrnam_r("lpadmin", groupbuf, buf, bufsize, &lpadmin_group) != 0)
+		goto finish;
+	lpadmin_gid = lpadmin_group->gr_gid;
+	
+	/* see what groups we're members of */
+	if (getgid() == lpadmin_gid || getegid() == lpadmin_gid) {
+		can_admin = 1;
+		goto finish;
+	}
+
+	ngids = sysconf(_SC_NGROUPS_MAX) + 1;
+	gid_list = g_malloc(ngids * sizeof(gid_t));
+	ngids_used = getgroups(ngids, gid_list);
+	if (ngids_used < 0) goto finish;
+	
+	for (i=0; i<ngids_used; i++) {
+		if (gid_list[i] == lpadmin_gid) {
+			can_admin = 1;
+			goto finish;
+		}
+	}
+
+finish:
+	if (buf) g_free(buf);
+	if (groupbuf) g_free(groupbuf);
+	if (gid_list) g_free(gid_list);
+	return can_admin;
 }
 
 void

--===============1264144532==--

---------------------------------------
Received: (at 291777-close) by bugs.debian.org; 13 Jun 2005 15:51:41 +0000
>From katie@ftp-master.debian.org Mon Jun 13 08:51:41 2005
Return-path: <katie@ftp-master.debian.org>
Received: from newraff.debian.org [208.185.25.31] (mail)
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1DhrDx-0006YS-00; Mon, 13 Jun 2005 08:51:41 -0700
Received: from katie by newraff.debian.org with local (Exim 3.35 1 (Debian))
	id 1Dhr9U-0004kR-00; Mon, 13 Jun 2005 11:47:04 -0400
From: Jordi Mallach <jordi@debian.org>
To: 291777-close@bugs.debian.org
X-Katie: $Revision: 1.56 $
Subject: Bug#291777: fixed in gnome-cups-manager 0.30-2
Message-Id: <E1Dhr9U-0004kR-00@newraff.debian.org>
Sender: Archive Administrator <katie@ftp-master.debian.org>
Date: Mon, 13 Jun 2005 11:47:04 -0400
Delivered-To: 291777-close@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-5.2 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	REMOVE_REMOVAL_NEAR autolearn=no 
	version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Source: gnome-cups-manager
Source-Version: 0.30-2

We believe that the bug you reported is fixed in the latest version of
gnome-cups-manager, which is due to be installed in the Debian FTP archive:

gnome-cups-manager_0.30-2.diff.gz
  to pool/main/g/gnome-cups-manager/gnome-cups-manager_0.30-2.diff.gz
gnome-cups-manager_0.30-2.dsc
  to pool/main/g/gnome-cups-manager/gnome-cups-manager_0.30-2.dsc
gnome-cups-manager_0.30-2_i386.deb
  to pool/main/g/gnome-cups-manager/gnome-cups-manager_0.30-2_i386.deb
libgnomecupsui1.0-1_0.30-2_i386.deb
  to pool/main/g/gnome-cups-manager/libgnomecupsui1.0-1_0.30-2_i386.deb
libgnomecupsui1.0-dev_0.30-2_i386.deb
  to pool/main/g/gnome-cups-manager/libgnomecupsui1.0-dev_0.30-2_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 291777@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jordi Mallach <jordi@debian.org> (supplier of updated gnome-cups-manager package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 13 Jun 2005 16:55:45 +0200
Source: gnome-cups-manager
Binary: libgnomecupsui1.0-dev gnome-cups-manager libgnomecupsui1.0-1
Architecture: source i386
Version: 0.30-2
Distribution: unstable
Urgency: low
Maintainer: Ross Burton <ross@debian.org>
Changed-By: Jordi Mallach <jordi@debian.org>
Description: 
 gnome-cups-manager - CUPS printer admin tool for GNOME
 libgnomecupsui1.0-1 - UI extensions to libgnomecups
 libgnomecupsui1.0-dev - UI extensions to libgnomecups (headers)
Closes: 291777 295310 313223
Changes: 
 gnome-cups-manager (0.30-2) unstable; urgency=low
 .
   * Upload to unstable.
     - 0.30 appears to have an up-to-date Russian translation
       (closes: #313223).
 .
 gnome-cups-manager (0.30-1) experimental; urgency=low
 .
   * Acknowledge NMU, thanks Frank (Closes: #295310)
   * New upstream release
     - remove build.patch
     - remove glade-hide-passwords.patch, fixed upstream
     - bump libgnomecups build-dep to 0.2.0
   * Merge patches from Ubuntu:
     - check-lpadmin-member.diff: members of lpadmin can edit printers
       too (closes: #291777)
     - options.patch: use --properties instead of -p when calling
       gnome-cups-manager
     - properties_on_add.patch: Don't open up a printer properties on a fresh
       add of a printer.  CUPS isn't synced yet, so it causes problems.
     - printer_properties_name_entry.patch: Doesn't allow changing of printer
       names, but the GUI pretends to.
   * Add build-dep on libsmbclient for Samba printer browsing
   * Add debian/watch
Files: 
 126bf8e9a3027cf2f103587c814cc309 1718 gnome optional gnome-cups-manager_0.30-2.dsc
 11cc55f2625a493edc5208247613244c 7343 gnome optional gnome-cups-manager_0.30-2.diff.gz
 acc2582b41cee2845d9c7809944decbe 224358 gnome optional gnome-cups-manager_0.30-2_i386.deb
 947c89e628c2f3dbfc7ae43b9938d24a 95686 libs optional libgnomecupsui1.0-1_0.30-2_i386.deb
 53a60f9921da2ced8e9b69f1a5165345 136008 libdevel optional libgnomecupsui1.0-dev_0.30-2_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCrabfJYSUupF6Il4RAoozAKDvjC+DL+nu2z8C2l+E+Uj8LAXdOwCdE/qe
LzEWUg/Dog4aRDWS7n7DwW8=
=ezR3
-----END PGP SIGNATURE-----