Has this been tested where root isn't the first entry in /etc/passwd?

Because there's no requirement for the entries to be sorted on uid...


On 2/7/11 5:01 PM, [email protected] wrote:
Author: acinonyx
Date: 2011-02-08 02:01:17 +0100 (Tue, 08 Feb 2011)
New Revision: 25417

Modified:
    trunk/package/busybox/files/telnet
Log:
[package] busybox: get root home dir from /etc/passwd in telnet init script 
(thanks tripolar)

Modified: trunk/package/busybox/files/telnet
===================================================================
--- trunk/package/busybox/files/telnet  2011-02-08 00:05:48 UTC (rev 25416)
+++ trunk/package/busybox/files/telnet  2011-02-08 01:01:17 UTC (rev 25417)
@@ -10,9 +10,16 @@
        test -n "${pwd#!}"
  }

+get_root_home() {
+       local homedir=$([ -f "$1" ]&&  cat "$1")
+       homedir="${homedir#*:*:0:0:*:}"
+
+       echo "${homedir%%:*}"
+}
+
  has_ssh_pubkey() {
        ( /etc/init.d/dropbear enabled 2>  /dev/null&&  grep -qs "^ssh-" 
/etc/dropbear/authorized_keys ) || \
-       ( /etc/init.d/sshd enabled 2>  /dev/null&&  grep -qs "^ssh-" 
/root/.ssh/authorized_keys )
+       ( /etc/init.d/sshd enabled 2>  /dev/null&&  grep -qs "^ssh-" 
"$(get_root_home /etc/passwd)"/.ssh/authorized_keys )
  }

  start() {

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to