Commit 2b48c7ac authored by Leigh Stoller's avatar Leigh Stoller

Change os_usermod to update the user password string. We were not

actually doing that on local nodes before. I guess I'm very ssh
centric (I never type passwords) but that appears not to be the case
for most people!
parent 93684dd1
......@@ -185,9 +185,9 @@ sub os_userdel($)
#
# Modify user group membership.
#
sub os_usermod($$$$)
sub os_usermod($$$$$)
{
my($login, $gid, $glist, $root) = @_;
my($login, $gid, $glist, $pswd, $root) = @_;
if ($root) {
$glist = join(',', split(/,/, $glist), "wheel");
......@@ -196,6 +196,10 @@ sub os_usermod($$$$)
$glist = "-G $glist";
}
if (system("$CHPASS $pswd $login") != 0) {
warn "*** WARNING: $CHPASS $login error.\n";
return -1;
}
return system("$USERMOD $login -g $gid $glist");
}
......
......@@ -177,9 +177,9 @@ sub os_userdel($)
#
# Modify user group membership.
#
sub os_usermod($$$$)
sub os_usermod($$$$$)
{
my($login, $gid, $glist, $root) = @_;
my($login, $gid, $glist, $pswd, $root) = @_;
if ($root) {
$glist = join(',', split(/,/, $glist), "root");
......@@ -188,7 +188,7 @@ sub os_usermod($$$$)
$glist = "-G $glist";
}
return system("$USERMOD -g $gid $glist $login");
return system("$USERMOD -g $gid $glist -p $pswd $login");
}
#
......
......@@ -84,17 +84,19 @@ sub os_userdel($)
#
# Modify user group membership.
#
sub os_usermod($$$$)
sub os_usermod($$$$$)
{
my($login, $gid, $glist, $root) = @_;
my($login, $gid, $glist, $pswd, $root) = @_;
# if ($root) {
# $glist = join(',', split(/,/, $glist), "wheel");
# }
if ($glist ne "") {
$glist = "-G $glist";
}
if (system("$CHPASS $pswd $login") != 0) {
warn "*** WARNING: $CHPASS $login error.\n";
return -1;
}
return system("$USERMOD $login -g $gid $glist");
}
......@@ -117,9 +119,6 @@ sub os_useradd($$$$$$$$)
{
my($login, $uid, $gid, $pswd, $glist, $homedir, $gcos, $root) = @_;
# if ($root) {
# $glist = join(',', split(/,/, $glist), "wheel");
# }
if ($glist ne "") {
$glist = "-G $glist";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment