Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Handle missing auth file.



details:   https://anonhg.NetBSD.org/src/rev/8ef5330088e0
branches:  trunk
changeset: 373567:8ef5330088e0
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Feb 18 07:51:52 2023 +0000

description:
Handle missing auth file.
Skip empty lines.

diffstat:

 etc/rc.d/iscsid_volumes |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (52 lines):

diff -r 55ea90ea62e2 -r 8ef5330088e0 etc/rc.d/iscsid_volumes
--- a/etc/rc.d/iscsid_volumes   Sat Feb 18 05:25:59 2023 +0000
+++ b/etc/rc.d/iscsid_volumes   Sat Feb 18 07:51:52 2023 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: iscsid_volumes,v 1.2 2023/02/06 11:53:03 martin Exp $
+# $NetBSD: iscsid_volumes,v 1.3 2023/02/18 07:51:52 mlelstv Exp $
 #
 
 # PROVIDE: iscsid_volumes
@@ -20,7 +20,7 @@
 
        while read host target digest auth user alias; do
                case $host in
-               \#*) ;;
+               \#*|"") ;;
                *)
                        topts=''
                        case $digest in
@@ -33,13 +33,15 @@
                        pass="-"
                        mpass="-"
 
-                       while read entry dummy; do
-                               case $entry in
-                               \#*) ;;
-                               "$user":*) pass=${entry#*:} ;;
-                               "$target":*) mpass=${entry#*:} ;;
-                               esac
-                       done < /etc/iscsi/auths
+                       if [ -f /etc/iscsi/auths ]; then
+                               while read entry dummy; do
+                                       case $entry in
+                                       \#*|"") ;;
+                                       "$user":*) pass=${entry#*:} ;;
+                                       "$target":*) mpass=${entry#*:} ;;
+                                       esac
+                               done < /etc/iscsi/auths
+                       fi
 
                        case $host in
                        *:*)
@@ -82,7 +84,7 @@
 
        while read host target digest auth user alias; do
                case $host in
-               \#*) ;;
+               \#*|"") ;;
                *)
                        echo "Remove target ${alias:-$target}"
 



Home | Main Index | Thread Index | Old Index