summaryrefslogtreecommitdiffstats
path: root/libaccount
diff options
context:
space:
mode:
authorDavid Brown2007-09-14 14:33:24 +0000
committerDavid Brown2007-09-14 14:33:24 +0000
commitdc203e275b5996da392c89bf86a3866a518082ba (patch)
tree83aa755f88833754b1529567606fe065602fc7f0 /libaccount
parent10452e955564f8b6c81ccae9520b1130e21f2ce6 (diff)
selinux/pam don't seem to like useradd/groupadd commands being run with LD_PRELOAD on so back it up and execute the command
Diffstat (limited to 'libaccount')
-rwxr-xr-xlibaccount16
1 files changed, 16 insertions, 0 deletions
diff --git a/libaccount b/libaccount
index 1c3261b29a..2c2464f62e 100755
--- a/libaccount
+++ b/libaccount
@@ -73,10 +73,18 @@ function create_account() {
debug "libgrimoire" "create_account() - $1, UID=$ACCOUNT_UID, GID=$PRIMARY_GID:$PRIMARY_GNAME, HOME=$HOME_DIR, SHELL=$USER_SHELL, SECONDARY_GIDS=$4"
+ # selinux/pam doesn't like it when LD_PRELOAD is set during group/user
+ # manipulations. These files aren't tracked anyway so this won't matter.
+
+ LD_PRELOAD_BAK="$LD_PRELOAD"
+ unset LD_PRELOAD
groupadd -g $PRIMARY_GID -f $PRIMARY_GNAME
# check for adding user problems and try to notify user.
useradd -u $ACCOUNT_UID -g $PRIMARY_GNAME $SECONDARY_GIDS -d "$HOME_DIR" -s "$USER_SHELL" $1
+ LD_PRELOAD="$LD_PRELOAD_BAK"
+ unset LD_PRELOAD_BAK
+
local USERADD_RETURN=$?
debug "libgrimoire.create_account()" "useradd return code was: $USERADD_RETURN"
@@ -117,7 +125,15 @@ function create_group() {
debug "libgrimoire" "create_group() - $1, GID=$GROUP_UID "
+ # selinux/pam doesn't like it when you are doing user/group manipulations
+ # with LD_PRELOAD set. the files changed aren't tracked anyway so this
+ # shouldn't matter
+
+ LD_PRELOAD_BAK="$LD_PRELOAD"
+ unset LD_PRELOAD
groupadd -g $GROUP_GID $1 > /dev/null 2>&1
+ LD_PRELOAD="$LD_PRELOAD_BAK"
+ unset LD_PRELOAD_BAK
local GROUPADD_RETURN=$?
debug "libgrimoire.create_group()" "groupadd return code was: $GROUPADD_RETURN"