PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » File_Passwd » Bug #2696

Losted informations in the /etc/shadow file

Details

Submitted2004-11-04 22:12 UTC
Fromvinnie dot gp at gmail dot com
StatusNo Feedback
PackageFile_Passwd
PHP Version4.3.9
OSGnu/Linux 2.6.7-1-386
Roadmaps(Not assigned)

Comments

[2004-11-04 22:12 UTC] vinnie dot gp at gmail dot com

Description:
------------
Pear 1.3.2
PHP 4.3.9-1
Package File_Passwd (version 1.1.0 or

When a try to use the code below it generates a shadow file with all the previous informations except the passwords. They all get lost in the new file. Just the new user password shows up.

Reproduce code:
---------------
$passwd = &new File_Passwd_Unix('passwd');
$shadow = &new File_Passwd_Unix('shadow');
$shadow_map = array('pass','lastm','minage','maxage','expire_warn','expire_disable','disabled_since','reserved');
$shadow->setMap($shadow_map);
$passwd->load();
$shadow->load();
// properties for /etc/passwd
$p = array('uid' => 501,'gid' => 500,
'shell' => '/bin/bash','home' => '/home/mike');
// default properties for /etc/shadow
$s = array(
'lastm' => round(time()/(60*60*24*365)),'minage' => 0,
'maxage' => 99999,'expire_warn' => 7 );
if ($passwd->userExists('john')) {
$passwd->modUser('john', $p);
$shadow->changePasswd('john', 'secret');
} else {
$passwd->addUser('john', 'secret', $p);
$shadow->addUser('john', 'secret', $s);
}
$passwd->save();
$shadow->save();

Expected result:
----------------
I expected a new brand shadow file with all the previous passwords and informations, like this:

messagebus:!:12709:0:99999:7:::
gdm:!:12709:0:99999:7:::
sshd:!:12709:0:99999:7:::
tiago:$1$SBxKlvHN$gR42G7ZLNuTm8yH6XUCHc.:12716:0:99999:7:::
krishna:$1$D5O9o/uh$Lp7tEJzaqWVHKxtIT8W/h/:12717:0:99999:7:::
yupanqui:$1$q4bzbfV2$/ZXeBmiXs40po0NWKfikD.:12716:0:99999:7:::
vinicius:$1$vhu7WVvX$wjHrQIV4At1eDEUycHaaR1:12720:0:99999:7:::
postgres:!:12716:0:99999:7:::

Actual result:
--------------
The result is like this (shadow file):

messagebus:12709:0:99999:7:::
gdm:12709:0:99999:7:::
sshd:12709:0:99999:7:::
tiago:12716:0:99999:7:::
krishna:12717:0:99999:7:::
yupanqui:12716:0:99999:7:::
vinicius:12720:0:99999:7:::
postgres:12716:0:99999:7:::