On Tue, Apr 21, 2009 at 09:03:22PM +0200, David Manso wrote:
> CHAP parameters aren't treated correctly when booting from iscsi and
> stored in /etc/iscsi/iscsi.initramfs.
> iscsistart options for this parameters aren't added.
> Patch attached.

> --- usr/share/initramfs-tools/scripts/local-top/iscsi.orig    2009-01-08 
> 19:06:00.000000000 +0100
> +++ usr/share/initramfs-tools/scripts/local-top/iscsi 2009-04-21 
> 20:31:56.000000000 +0200
> @@ -42,6 +42,22 @@
>               ISCSI_TARGET_GROUP=1
>       fi
>  
> +     if [ ! -z $ISCSI_USERNAME ]; then
> +             ISCSI_USERNAME="-u $ISCSI_USERNAME"
> +     fi
> +
> +     if [ ! -z $ISCSI_PASSWORD ]; then
> +             ISCSI_PASSWORD="-w $ISCSI_PASSWORD"
> +     fi
> +
> +     if [ ! -z $ISCSI_IN_USERNAME ]; then
> +             ISCSI_IN_USERNAME="-U $ISCSI_IN_USERNAME"
> +     fi
> +
> +     if [ ! -z $ISCSI_IN_PASSWORD ]; then
> +             ISCSI_IN_PASSWORD="-W $ISCSI_IN_PASSWORD"
> +     fi
> +
>       iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME    \
>                  -g $ISCSI_TARGET_GROUP -a $ISCSI_TARGET_IP   \
>                  -p $ISCSI_TARGET_PORT $ISCSI_USERNAME        \

Agreed, although some better quoting wouldn't hurt since usernames and
passwords seem more likely to possibly contain spaces than the other
options here. How about this instead:

=== modified file 'debian/extra/initramfs.local-top'
--- debian/extra/initramfs.local-top    2009-12-10 18:19:20 +0000
+++ debian/extra/initramfs.local-top    2009-12-14 12:03:46 +0000
@@ -64,8 +64,11 @@ do_iscsi_login ()
 
        iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME    \
                   -g $ISCSI_TARGET_GROUP -a $ISCSI_TARGET_IP   \
-                  -p $ISCSI_TARGET_PORT $ISCSI_USERNAME        \
-                  $ISCSI_PASSWORD $ISCSI_IN_USERNAME $ISCSI_IN_PASSWORD
+                  -p $ISCSI_TARGET_PORT                        \
+                  ${ISCSI_USERNAME:+-u "$ISCSI_USERNAME"}      \
+                  ${ISCSI_PASSWORD:+-w "$ISCSI_PASSWORD"}      \
+                  ${ISCSI_IN_USERNAME:+-U "$ISCSI_IN_USERNAME"}\
+                  ${ISCSI_IN_PASSWORD:+-W "$ISCSI_IN_PASSWORD"}
 }
 
 parse_iscsi_ops ()
@@ -90,16 +93,16 @@ parse_iscsi_ops ()
                        ISCSI_TARGET_GROUP="${x#iscsi_target_group=}"
                        ;;
                iscsi_username=*)
-                       ISCSI_USERNAME="-u ${x#iscsi_username=}"
+                       ISCSI_USERNAME="${x#iscsi_username=}"
                        ;;
                iscsi_password=*)
-                       ISCSI_PASSWORD="-w ${x#iscsi_password=}"
+                       ISCSI_PASSWORD="${x#iscsi_password=}"
                        ;;
                iscsi_in_username=*)
-                       ISCSI_IN_USERNAME="-U ${x#iscsi_in_username=}"
+                       ISCSI_IN_USERNAME="${x#iscsi_in_username=}"
                        ;;
                iscsi_in_password=*)
-                       ISCSI_IN_PASSWORD="-W ${x#iscsi_in_password=}"
+                       ISCSI_IN_PASSWORD="${x#iscsi_in_password=}"
                        ;;
                esac
        done

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to