]> code.ossystems Code Review - openembedded-core.git/commitdiff
image.bbclass: improve sed expressions for ssh_allow_empty_password()
authorJonathan Liu <net147@gmail.com>
Thu, 10 Apr 2014 08:24:19 +0000 (18:24 +1000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 10 Apr 2014 09:22:25 +0000 (10:22 +0100)
The sed expression was also replacing documentation text containing
PermitRootLogin in the line so "PermitRootLogin yes" was specified
twice.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/image.bbclass

index 32df01d2b38097dffbbf43d6498427f773617e3b..79de5a2cae51ec56045b586800d898495df0fdb0 100644 (file)
@@ -285,8 +285,8 @@ zap_empty_root_password () {
 # allow dropbear/openssh to accept root logins and logins from accounts with an empty password string
 ssh_allow_empty_password () {
        if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
-               sed -i 's#.*PermitRootLogin.*#PermitRootLogin yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
-               sed -i 's#.*PermitEmptyPasswords.*#PermitEmptyPasswords yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+               sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+               sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
        fi
 
        if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then