netroot handlers: Add argument checking

This is probably not necessary, but paranoia dictates that the actual
netroot handlers should check if all three required arguments (netif,
root, NEWROOT) are there and useable.
master
Philippe Seewer 2009-06-16 10:52:21 +02:00
parent 9cdfd735a8
commit 268de90f82
3 changed files with 28 additions and 0 deletions

View File

@ -17,6 +17,16 @@ for conf in conf/conf.d/*; do
[ -f ${conf} ] && . ${conf} [ -f ${conf} ] && . ${conf}
done done


# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
# used here. But let's be consistent
[ -z "$3" ] && exit 1

# root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> # root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
netif="$1" netif="$1"
root="$2" root="$2"

View File

@ -12,6 +12,15 @@ if getarg rdnetdebug; then
set -x set -x
fi fi


# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3?
[ -z "$3" ] && exit 1

# root is in the form root=nbd:server:port:fstype:fsopts:nbdopts # root is in the form root=nbd:server:port:fstype:fsopts:nbdopts
netif="$1" netif="$1"
root="$2" root="$2"

View File

@ -12,6 +12,15 @@ getarg rdnetdebug && {
set -x set -x
} }


# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3?
[ -z "$3" ] && exit 1

# root is in the form root=nfs[4]:server:path:[options] # root is in the form root=nfs[4]:server:path:[options]
netif="$1" netif="$1"
root="$2" root="$2"