[LEDE-DEV] [PATCH 2/3] base-files: allocate uid/gid starting from 65536
Yousong Zhou
yszhou4tech at gmail.com
Thu Jun 15 05:08:23 PDT 2017
On 15 June 2017 at 19:33, Karl Palsson <karlp at tweak.net.au> wrote:
>
> I'm not really sure I understand wanting to start so high. Are
> you afraid of someone installing 65400 packages and colliding
> with nobody? I know it's a machine that looks at the number, but
> can't they be humanly simple as well?
>
> Cheers,
> Karl P
>
the line should be drawn at 1000 by default according to source code
of package shadow, but we already have packages in openwrt/packages
feed taking id numbers higher than that (the highest at the moment is
65533 by portmap).
The intention is simply to make sure dynamic assignment will not take
up numbers in the range of those for static assignment.
yousong
>
> Yousong Zhou <yszhou4tech at gmail.com> wrote:
>> There already exist static assignment of uid/gid 65533 in
>> packages feed and we have nobody/nogroup taking 65534 as their
>> ids. Let's change the pid of dynamic assignment to start from
>> 65536 so that the two assignment scheme will not collide with
>> each other
>>
>> While at, fix the scan command checking existence of uid/gid
>>
>> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
>> ---
>> package/base-files/Makefile | 2 +-
>> package/base-files/files/lib/functions.sh | 8 ++++----
>> 2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/package/base-files/Makefile
>> b/package/base-files/Makefile index 54c157611f..2cea494c3f
>> 100644
>> --- a/package/base-files/Makefile
>> +++ b/package/base-files/Makefile
>> @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
>> include $(INCLUDE_DIR)/version.mk
>>
>> PKG_NAME:=base-files
>> -PKG_RELEASE:=174
>> +PKG_RELEASE:=175
>> PKG_FLAGS:=nonshared
>>
>> PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
>> diff --git a/package/base-files/files/lib/functions.sh
>> b/package/base-files/files/lib/functions.sh index
>> ae7f4dc9ee..dd69a4f1f3 100755
>> --- a/package/base-files/files/lib/functions.sh
>> +++ b/package/base-files/files/lib/functions.sh
>> @@ -306,8 +306,8 @@ group_add_next() {
>> gid=$(grep -s "^${1}:" ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
>> [ -n "$gid" ] && return $gid
>> gids=$(cat ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
>> - gid=100
>> - while [ -n "$(echo $gids | grep $gid)" ] ; do
>> + gid=65536
>> + while [ -n "$(echo "$gids" | grep "^$gid$")" ] ; do
>> gid=$((gid + 1))
>> done
>> group_add $1 $gid
>> @@ -334,8 +334,8 @@ user_add() {
>> local rc
>> [ -z "$uid" ] && {
>> uids=$(cat ${IPKG_INSTROOT}/etc/passwd | cut -d: -f3)
>> - uid=100
>> - while [ -n "$(echo $uids | grep $uid)" ] ; do
>> + uid=65536
>> + while [ -n "$(echo "$uids" | grep "^$uid$")" ] ; do
>> uid=$((uid + 1))
>> done
>> }
>> --
>> 2.12.2
>>
>>
>> _______________________________________________
>> Lede-dev mailing list
>> Lede-dev at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
More information about the Lede-dev
mailing list