Your message dated Tue, 21 Mar 2006 14:02:36 -0800
with message-id <[EMAIL PROTECTED]>
and subject line Bug#355070: fixed in shadow 1:4.0.15-1
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)

--- Begin Message ---
Package: shadow
Severity: normal
Tags: patch

hello,

please include chgpasswd into the shadow package. chpasswd is already
present to change user passwords in batch mode, but an equivalent for
group passwords is missing.

wesley terpstra created a chgpasswd from the chpasswd sources. it is
attached. please include it.

...
 jonas

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-7-amd64-resivo
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
/*
 * Copyright 1990 - 1994, Julianne Frances Haugh
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of Julianne F. Haugh nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <config.h>

#ident "$Id$"

#include <fcntl.h>
#include <getopt.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef USE_PAM
#include "pam_defs.h"
#endif				/* USE_PAM */
#include "defines.h"
#include "nscd.h"
#include "prototypes.h"
#include "groupio.h"
#include "sgroupio.h"
/*
 * Global variables
 */
static char *Prog;
static int eflg = 0;
static int md5flg = 0;

static int is_shadow_pwd;

/* local function prototypes */
static void usage (void);

/*
 * usage - display usage message and exit
 */
static void usage (void)
{
	fprintf (stderr, _("Usage: chgpasswd [options]\n"
			   "\n"
			   "Options:\n"
			   "  -e, --encrypted	supplied passwords are encrypted\n"
			   "  -h, --help		display this help message and exit\n"
			   "  -m, --md5		use MD5 encryption instead DES when the supplied\n"
			   "			passwords are not encrypted\n"));
	exit (1);
}

int main (int argc, char **argv)
{
	char buf[BUFSIZ];
	char *name;
	char *newpwd;
	char *cp;

	const struct sgrp *sg;
	struct sgrp newsg;

	const struct group *gr;
	struct group newgr;
	int errors = 0;
	int line = 0;
	long now = time ((long *) 0) / (24L * 3600L);
	int ok;

#ifdef USE_PAM
	pam_handle_t *pamh = NULL;
	struct passwd *pampw;
	int retval;
#endif

	Prog = Basename (argv[0]);

	setlocale (LC_ALL, "");
	bindtextdomain (PACKAGE, LOCALEDIR);
	textdomain (PACKAGE);

	{
		int option_index = 0;
		int c;
		static struct option long_options[] = {
			{"encrypted", no_argument, NULL, 'e'},
			{"help", no_argument, NULL, 'h'},
			{"md5", no_argument, NULL, 'm'},
			{NULL, 0, NULL, '\0'}
		};

		while ((c =
			getopt_long (argc, argv, "ehm", long_options,
				     &option_index)) != -1) {
			switch (c) {
			case 'e':
				eflg = 1;
				break;
			case 'h':
				usage ();
				break;
			case 'm':
				md5flg = 1;
				break;
			case 0:
				/* long option */
				break;
			default:
				usage ();
				break;
			}
		}
	}

#ifdef USE_PAM
	retval = PAM_SUCCESS;

	pampw = getpwuid (getuid ());
	if (pampw == NULL) {
		retval = PAM_USER_UNKNOWN;
	}

	if (retval == PAM_SUCCESS) {
		retval = pam_start ("chpasswd", pampw->pw_name, &conv, &pamh);
	}

	if (retval == PAM_SUCCESS) {
		retval = pam_authenticate (pamh, 0);
		if (retval != PAM_SUCCESS) {
			pam_end (pamh, retval);
		}
	}

	if (retval == PAM_SUCCESS) {
		retval = pam_acct_mgmt (pamh, 0);
		if (retval != PAM_SUCCESS) {
			pam_end (pamh, retval);
		}
	}

	if (retval != PAM_SUCCESS) {
		fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
		exit (1);
	}
#endif				/* USE_PAM */

	/*
	 * Lock the group file and open it for reading. This will bring
	 * all of the entries into memory where they may be updated.
	 */
	if (!gr_lock ()) {
		fprintf (stderr, _("%s: can't lock group file\n"), Prog);
		exit (1);
	}
	if (!gr_open (O_RDWR)) {
		fprintf (stderr, _("%s: can't open group file\n"), Prog);
		gr_unlock ();
		exit (1);
	}

	is_shadow_pwd = sgr_file_present ();
	if (is_shadow_pwd) {
		if (!sgr_lock ()) {
			fprintf (stderr, _("%s: can't lock gshadow file\n"),
				 Prog);
			gr_unlock ();
			exit (1);
		}
		if (!sgr_open (O_RDWR)) {
			fprintf (stderr, _("%s: can't open shadow file\n"),
				 Prog);
			gr_unlock ();
			sgr_unlock ();
			exit (1);
		}
	}

	/*
	 * Read each line, separating the group name from the password. The
	 * password entry for each group will be looked up in the appropriate
	 * file (gshadow or group) and the password changed.
	 */
	while (fgets (buf, sizeof buf, stdin) != (char *) 0) {
		line++;
		if ((cp = strrchr (buf, '\n'))) {
			*cp = '\0';
		} else {
			fprintf (stderr, _("%s: line %d: line too long\n"),
				 Prog, line);
			errors++;
			continue;
		}

		/*
		 * The groupname is the first field. It is separated from the
		 * password with a ":" character which is replaced with a
		 * NUL to give the new password. The new password will then
		 * be encrypted in the normal fashion with a new salt
		 * generated, unless the '-e' is given, in which case it is
		 * assumed to already be encrypted.
		 */

		name = buf;
		if ((cp = strchr (name, ':'))) {
			*cp++ = '\0';
		} else {
			fprintf (stderr,
				 _("%s: line %d: missing new password\n"),
				 Prog, line);
			errors++;
			continue;
		}
		newpwd = cp;
		if (!eflg) {
			if (md5flg) {
				char salt[12] = "$1$";

				strcat (salt, crypt_make_salt ());
				cp = pw_encrypt (newpwd, salt);
			} else
				cp = pw_encrypt (newpwd, crypt_make_salt ());
		}

		/*
		 * Get the password file entry for this user. The user must
		 * already exist.
		 */
		gr = gr_locate (name);
		if (!gr) {
			fprintf (stderr,
				 _("%s: line %d: unknown group %s\n"), Prog,
				 line, name);
			errors++;
			continue;
		}
		if (is_shadow_pwd)
			sg = sgr_locate (name);
		else
			sg = NULL;

		/*
		 * The freshly encrypted new password is merged into the
		 * user's password file entry and the last password change
		 * date is set to the current date.
		 */
		if (sg) {
			newsg = *sg;
			newsg.sg_passwd = cp;
		} else {
			newgr = *gr;
			newgr.gr_passwd = cp;
		}

		/* 
		 * The updated password file entry is then put back and will
		 * be written to the password file later, after all the
		 * other entries have been updated as well.
		 */
		if (sg)
			ok = sgr_update (&newsg);
		else
			ok = gr_update (&newgr);

		if (!ok) {
			fprintf (stderr,
				 _
				 ("%s: line %d: cannot update password entry\n"),
				 Prog, line);
			errors++;
			continue;
		}
	}

	/*
	 * Any detected errors will cause the entire set of changes to be
	 * aborted. Unlocking the password file will cause all of the
	 * changes to be ignored. Otherwise the file is closed, causing the
	 * changes to be written out all at once, and then unlocked
	 * afterwards.
	 */
	if (errors) {
		fprintf (stderr,
			 _("%s: error detected, changes ignored\n"), Prog);
		if (is_shadow_pwd)
			sgr_unlock ();
		gr_unlock ();
		exit (1);
	}
	if (is_shadow_pwd) {
		if (!sgr_close ()) {
			fprintf (stderr,
				 _("%s: error updating shadow file\n"), Prog);
			gr_unlock ();
			exit (1);
		}
		sgr_unlock ();
	}
	if (!gr_close ()) {
		fprintf (stderr, _("%s: error updating password file\n"), Prog);
		exit (1);
	}

	nscd_flush_cache ("group");

	gr_unlock ();

#ifdef USE_PAM
	if (retval == PAM_SUCCESS)
		pam_end (pamh, PAM_SUCCESS);
#endif				/* USE_PAM */

	return (0);
}

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Source: shadow
Source-Version: 1:4.0.15-1

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

login_4.0.15-1_i386.deb
  to pool/main/s/shadow/login_4.0.15-1_i386.deb
passwd_4.0.15-1_i386.deb
  to pool/main/s/shadow/passwd_4.0.15-1_i386.deb
shadow_4.0.15-1.diff.gz
  to pool/main/s/shadow/shadow_4.0.15-1.diff.gz
shadow_4.0.15-1.dsc
  to pool/main/s/shadow/shadow_4.0.15-1.dsc
shadow_4.0.15.orig.tar.gz
  to pool/main/s/shadow/shadow_4.0.15.orig.tar.gz



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 [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Christian Perrier <[EMAIL PROTECTED]> (supplier of updated shadow 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 [EMAIL PROTECTED])


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

Format: 1.7
Date: Tue, 21 Mar 2006 12:37:01 +0100
Source: shadow
Binary: login passwd
Architecture: source i386
Version: 1:4.0.15-1
Distribution: unstable
Urgency: low
Maintainer: Shadow package maintainers <[EMAIL PROTECTED]>
Changed-By: Christian Perrier <[EMAIL PROTECTED]>
Description: 
 login      - system login tools
 passwd     - change and administer password and group data
Closes: 333706 345514 346017 346376 346449 347198 347755 347943 348339 348713 
349193 349496 349560 349898 352028 352276 352310 352345 352444 352712 353898 
355010 355070 355587 356610
Changes: 
 shadow (1:4.0.15-1) unstable; urgency=low
 .
   * The "Livarot" release
   * Ack the previous changes uploaded to experimental except for #276419
   * New upstream release
     - chpasswd.8: Rewrite the CAVEATS section. Closes: #355010
     - Updated translation for:
       * Indonesian Closes: #345514, #347198
       * Swedish Closes: #346017, #346449, #352276
       * Slovak Closes: #346376, #349898, #352028
       * Romanian Closes: #347755, #352712
       * Galician Closes: #347943, #352444, #355587
       * Italian Closes: #348339, #352345
       * Greek Closes: #348713
       * Russian Closes: #349193
       * Basque Closes: #349496
       * Catalan Closes: #353898
       * Vietnamese Closes: #352310
       * Italian Closes: #356610
     - lastlog: Warn if non-option argument are provided. Closes: #349560
     - chgpasswd: new utility. Closes: #355070
   * Debian packaging fixes:
     - Only replace manpages-ko << 20050219-2. Thanks to the Debian QA Group.
     - Only replace manpages-fi << 0.2-4. Thanks to the Debian QA Group.
     - Only replace manpages-de << 0.4-10. Thanks to Daniel Kobras
     - Only replace manpages-es-extra << 0.8a-15. Thanks to Javier
       Fernandez-Sanguino Peña.
   * Upstream bugs or fixes not already fixed in upstream releases or CVS:
     - 467_useradd_-r_LSB: add a "-r" option for adding system users
       for LSB compatibility. Closes: #333706
       This patch, announced in 4.0.14-7 was indeed not applied.
   * Debconf translation updates:
     - Punjabi translation renamed to pa.po after debian-i18n decision
Files: 
 6979f3d50c8b08f2f158a55dca0cf6ba 964 admin required shadow_4.0.15-1.dsc
 c924ab6f76f9307a90da3619877aef56 1917025 admin required 
shadow_4.0.15.orig.tar.gz
 60094ea56ef04ed7bec914afe439f03d 163173 admin required shadow_4.0.15-1.diff.gz
 5edc0164d0ebc3316ac066bafe1faf8b 739408 admin required passwd_4.0.15-1_i386.deb
 85de4c3c81f225aed66763aff934f05f 710454 admin required login_4.0.15-1_i386.deb

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

iD8DBQFEIFQw1OXtrMAUPS0RAt3pAJ4oR+PAPZbJc61jyI+FqQz7Y0eLNwCfaunj
3Mx/F9694P5z2Nvkm2dWX9s=
=VFuC
-----END PGP SIGNATURE-----


--- End Message ---

Reply via email to