← Back to team overview

touch-packages team mailing list archive

[Bug 1355111] Re: newgrp fails with "crypt: Invalid argument"

 

I had a look in src/newgrp.c
I wonder why the variable grp is overwritten several times, before check_perms is called.
In my understanding, this means the last found group entry wins.

If I have following group entries in my environment:
#From /etc/passwd
comgrp:x:27:user1
#From NIS/LDAP or something similar
comgrp:x:27:user2
#From /etc/gshadow
comgrp:*::user3

user1 and user2 aren't able to change primary group to comgrp because check_perms only sees user3 in that group.
I had expected that all three users are able to change to the comgrp.
What is the correct behaviour? And why?

[src/newgrp.c]
617         grp = getgrnam (group); /* local, no need for xgetgrnam */
[...]
628         grp = find_matching_group (name, grp->gr_gid);
[...]
637                 grp = xgetgrnam (group);
[...]
644                 grp->gr_mem = sgrp->sg_mem;
[...]
651         check_perms (grp, pwd, group);

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to shadow in Ubuntu.
https://bugs.launchpad.net/bugs/1355111

Title:
  newgrp fails with "crypt: Invalid argument"

Status in “shadow” package in Ubuntu:
  New

Bug description:
  entry from /etc/passwd:
  user:x:1000:1000:User,,,:/home/user:/bin/bash

  entry from /etc/group:
  dummy:x:200:user

  entry from /etc/gshadow:
  dummy:*::

  logged on as user the command
  "newgrp dummy" asks for a password and fails with "crypt: Invalid argument"

  after removing the line for dummy from gshadow newgrp works

  
  A similar bug was reported on the redhat tracker: https://bugzilla.redhat.com/show_bug.cgi?id=988184

  
  cat /etc/lsb-release 
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=14.04
  DISTRIB_CODENAME=trusty
  DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1355111/+subscriptions