projects
/
invirt/packages/invirt-remote.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Actually suppress the error, without suppressing code errors.
[invirt/packages/invirt-remote.git]
/
files
/
usr
/
sbin
/
remctl-update.sh
diff --git
a/files/usr/sbin/remctl-update.sh
b/files/usr/sbin/remctl-update.sh
index
79c860a
..
f0254b9
100755
(executable)
--- a/
files/usr/sbin/remctl-update.sh
+++ b/
files/usr/sbin/remctl-update.sh
@@
-46,6
+46,15
@@
update_moiragroup()
rm -f "$MOIRATMP"
}
rm -f "$MOIRATMP"
}
+check_machine_name()
+{
+ machinename="$1"
+ if ! perl -0e 'exit($ARGV[0] !~ /^[A-Za-z0-9][A-Za-z0-9._-]*$/)' -- "$machinename"; then
+ echo "Bad machine name"
+ exit 1
+ fi
+}
+
case "$1" in
moiragroup)
update_moiragroup "$2"
case "$1" in
moiragroup)
update_moiragroup "$2"
@@
-76,20
+85,23
@@
case "$1" in
;;
unregister)
machine="$2"
;;
unregister)
machine="$2"
+ check_machine_name "$machine"
rm -f "$ACLDIR"/"$machine"
rm -f "$MACHINEDIR"/"$machine"
"$0" web
;;
rm -f "$ACLDIR"/"$machine"
rm -f "$MACHINEDIR"/"$machine"
"$0" web
;;
+ moveregister)
+ oldmachine="$2"
+ newmachine="$3"
+ check_machine_name "$oldmachine"
+ check_machine_name "$newmachine"
+ mv "$ACLDIR"/"$oldmachine" "$ACLDIR"/"$newmachine"
+ rm -f "$MACHINEDIR"/"$oldmachine"
+ "$0" web
+ ;;
register)
machine="$2"
register)
machine="$2"
- if [ "$machine" == "Domain-0" ]; then
- echo "No, you can't control Domain 0"
- exit 1
- fi
- if [ -e /etc/xen/"$machine" ]; then
- echo "Machine already exists outside database"
- exit 1
- fi
+ check_machine_name "$machine"
if [ -e "$ACLDIR"/"$machine" ]; then
echo "Machine already registered"
exit 1
if [ -e "$ACLDIR"/"$machine" ]; then
echo "Machine already registered"
exit 1