summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Winkler <tewinkler86@gmail.com>2023-11-10 22:48:59 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2024-05-10 22:39:57 +0200
commit140b48a9e93909873bee777ca5bdf49fe4f01271 (patch)
treefac96df6ed46a3bbb435bce8a2e7dfd12943d338
parent72cdba7b1a5a573d6b34c8fe462788ee9c951f99 (diff)
downloadopenwrt-140b48a9e93909873bee777ca5bdf49fe4f01271.tar.gz
openwrt-140b48a9e93909873bee777ca5bdf49fe4f01271.tar.bz2
openwrt-140b48a9e93909873bee777ca5bdf49fe4f01271.zip
base-files: fix uid/gid auto-enumeration to avoid 16-bit limit
uid/gid range should be limited to 16bit unsigned integer range to avoid "wraparound" issues with permissions where jffs2 is employed for storage and chown 65536 (first auto-created user) becomes equivalent to chown 0 Fixes: #13927 Signed-off-by: Thomas Winkler <tewinkler86@gmail.com>
-rw-r--r--package/base-files/files/lib/functions.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 7b3203f55a..82ee58f642 100644
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -408,7 +408,7 @@ group_add_next() {
return
fi
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
- gid=65536
+ gid=32768
while echo "$gids" | grep -q "^$gid$"; do
gid=$((gid + 1))
done
@@ -439,7 +439,7 @@ user_add() {
local rc
[ -z "$uid" ] && {
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
- uid=65536
+ uid=32768
while echo "$uids" | grep -q "^$uid$"; do
uid=$((uid + 1))
done