Skip Menu |

This queue is for tickets about the Unix-ConfigFile CPAN distribution.

Report information
The Basics
Id: 8880
Status: new
Priority: 0/
Queue: Unix-ConfigFile

People
Owner: Nobody in particular
Requestors: tonvoon [...] mac.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Bug with nisgroup entries in /etc/passwd
If /etc/passwd contains nis entries, usually of the format: +@netgroup:x::::: then a $pw->commit will try to rearrange the order of the passwd file based on uid. Since these entries do not have a uid, this will put the files back in a broken order (since nisentries are order specific). The attached patch will read in the entries and store in an array. When a commit is made, it will write it back out again in the same order. Thanks for a very reliable perl module.
*** PasswdFile.pm.original Tue Dec 14 16:58:14 2004 --- PasswdFile.pm Tue Dec 14 16:58:06 2004 *************** *** 25,30 **** --- 25,33 ---- # The key is the username and the array contents are the next six fields # found in the password file. + # Used to hold the nis entries, where the username field begins with a + + my @nisentries; + # Preloaded methods go here. # Read the file and build the data structures *************** *** 33,39 **** while (<$fh>) { chop; ! $this->user(split /:/); } return 1; } --- 36,46 ---- while (<$fh>) { chop; ! if (/^\+/) { ! push @nisentries, $_; ! } else { ! $this->user(split /:/); ! } } return 1; } *************** *** 119,124 **** --- 126,134 ---- next if ($user eq "root"); print $fh join(":", $user, $this->user($user)), "\n" or return 0; } + foreach $_ (@nisentries) { + print $fh $_, "\n" or return 0; + } return 1; }