Skip to content

Commit

Permalink
mkuid: fall back to default values if no UID_MIN / GID_MIN found
Browse files Browse the repository at this point in the history
Closes #1897
  • Loading branch information
reinerh committed Apr 19, 2018
1 parent e2514aa commit b6156fd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mkuid.sh
Expand Up @@ -6,15 +6,15 @@ echo "#define FIREJAIL_UIDS_H" >> uids.h

if [ -r /etc/login.defs ]
then
echo "// using values extracted from /etc/login.defs" >> uids.h
UID_MIN=`awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs`
GID_MIN=`awk '/^\s*GID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs`
echo "#define UID_MIN $UID_MIN" >> uids.h
echo "#define GID_MIN $GID_MIN" >> uids.h
else
echo "// using default values" >> uids.h
echo "#define UID_MIN 1000" >> uids.h
echo "#define GID_MIN 1000" >> uids.h
fi

# use default values if not found
[ -z "$UID_MIN" ] && UID_MIN="1000"
[ -z "$GID_MIN" ] && GID_MIN="1000"

echo "#define UID_MIN $UID_MIN" >> uids.h
echo "#define GID_MIN $GID_MIN" >> uids.h

echo "#endif" >> uids.h

0 comments on commit b6156fd

Please sign in to comment.