Re: [OpenWrt-Devel] add entry in /etc/shadow when user_add is used v2
v2 a : was missing On Montag, 14. November 2011 22:33:21 Peter Wagner wrote: Hi, by now when user_add is used no line is shadow is created for that user. This patch adds this to /lib/functions.sh. /Peter diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index f6ec3d7..6dd70ee 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -428,10 +428,12 @@ user_add() { local shell=${6:-/bin/false} local rc [ -f ${IPKG_INSTROOT}/etc/passwd ] || return 1 - [ -n $IPKG_INSTROOT ] || lock /var/lock/passwd - echo ${name}:x:${uid}:${gid}:${desc}:${home}:${shell} ${IPKG_INSTROOT}/etc/passwd + [ -n $IPKG_INSTROOT ] || ( lock /var/lock/passwd lock /var/lock/shadow ) + echo ${name}:*:9797:0: ${IPKG_INSTROOT}/etc/shadow rc=$? - [ -n $IPKG_INSTROOT ] || lock -u /var/lock/passwd + echo ${name}:x:${uid}:${gid}:${desc}:${home}:${shell} ${IPKG_INSTROOT}/etc/passwd + rc=$(($rc + $?)) + [ -n $IPKG_INSTROOT ] || ( lock -u /var/lock/passwd lock -u /var/lock/shadow ) return $rc } ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] add entry in /etc/shadow when user_add is used v2
Hi Peter, A single lock for both /etc/passwd and /etc/shadow should be enough, it was just there to prevent multiple initscripts from messing with /etc/passwd at boot. -- -{Nico} ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] add entry in /etc/shadow when user_add is used v2
Hi Nico, new version that only locks passwd. /Peter On Dienstag, 15. November 2011 00:02:06 Nico wrote: Hi Peter, A single lock for both /etc/passwd and /etc/shadow should be enough, it was just there to prevent multiple initscripts from messing with /etc/passwd at boot. -- -{Nico} ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index f6ec3d7..5230ea8 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -429,8 +429,10 @@ user_add() { local rc [ -f ${IPKG_INSTROOT}/etc/passwd ] || return 1 [ -n $IPKG_INSTROOT ] || lock /var/lock/passwd - echo ${name}:x:${uid}:${gid}:${desc}:${home}:${shell} ${IPKG_INSTROOT}/etc/passwd + echo ${name}:*:9797:0: ${IPKG_INSTROOT}/etc/shadow rc=$? + echo ${name}:x:${uid}:${gid}:${desc}:${home}:${shell} ${IPKG_INSTROOT}/etc/passwd + rc=$(($rc + $?)) [ -n $IPKG_INSTROOT ] || lock -u /var/lock/passwd return $rc } ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel