#47473 setup-ds.pl doesn't lookup the "root" group correctly
Closed: wontfix None Opened 10 years ago by mreynolds.

Silent install will fail, if you set the "SuiteSpotUserID" to root, but do not set "SuiteSpotGroup".

Error: could not determine the current group ID: at /usr/lib64/dirsrv/perl/DSUtil.pm line 186
DSUtil::getGroup('root') called at /usr/lib64/dirsrv/perl/DSCreate.pm line 822
DSCreate::setDefaults('Inf=HASH(0x21bff90)') called at /usr/lib64/dirsrv/perl/DSCreate.pm line 1175
DSCreate::createDSInstance('Inf=HASH(0x21bff90)') called at /usr/sbin/setup-ds.pl line 83


I think the real problem is this:
{{{
(getpwnam($user))[3] || confess "Error: could not determine the current group ID: $!";
}}}

If getpwnam fails, it will return an empty array.

{{{
my @userinfo = getpwnam($user);
if (!@userinfo} {
confess "Error: could not find userid $user: $!";
}
}}}

If getpwnam succeeds, can't you just assume that $userinfo[3] is ok to use? That is, either it is a valid group or it isn't, no matter what the user id is, 0 or otherwise. So this test is all that's needed after getpwnam succeeds:
{{{
return (getgrgid($gid))[0] || confess "Error: could not determine the current group name from gid $gid: $!";
}}}
getgrgid($gid) can fail to return a group name in either one of two ways:
1) $gid is not a valid group - getgrgid will return an empty array
2) $gid is somehow a valid group with an empty name - not sure if this is even possible - if so, it will return an array which has element [0] == ""

Replying to [comment:3 rmeggins]:

I think the real problem is this:
{{{
(getpwnam($user))[3] || confess "Error: could not determine the current group ID: $!";
}}}

If getpwnam fails, it will return an empty array.

{{{
my @userinfo = getpwnam($user);
if (!@userinfo} {
confess "Error: could not find userid $user: $!";
}
}}}

If getpwnam succeeds, can't you just assume that $userinfo[3] is ok to use? That is, either it is a valid group or it isn't, no matter what the user id is, 0 or otherwise. So this test is all that's needed after getpwnam succeeds:
{{{
return (getgrgid($gid))[0] || confess "Error: could not determine the current group name from gid $gid: $!";
}}}
getgrgid($gid) can fail to return a group name in either one of two ways:
1) $gid is not a valid group - getgrgid will return an empty array
2) $gid is somehow a valid group with an empty name - not sure if this is even possible - if so, it will return an array which has element [0] == ""

New patch attached.

git merge tetIssues
Updating 03814dd..8aa9e8c
Fast-forward
ldap/admin/src/scripts/DSUtil.pm.in | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

git push origin master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 932 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
03814dd..8aa9e8c master -> master

commit 8aa9e8c
Author: Mark Reynolds mreynolds@redhat.com
Date: Tue Aug 13 16:39:57 2013 -0400

1.3.1

b7f006a..a7bdcc5 389-ds-base-1.3.1 -> 389-ds-base-1.3.1

Metadata Update from @rmeggins:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.3.1.7

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/810

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

3 years ago

Login to comment on this ticket.

Metadata