[Ovirt-devel] [PATCH node] Refactor o-c-password to use passwd/saslpasswd2 natively instead of manual prompts
Perry Myers
pmyers at redhat.com
Mon Jan 19 08:25:23 UTC 2009
This has the advantage of allowing the admin to see any warnings about password
lengths or complexity.
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
scripts/ovirt-config-password | 38 ++++++++------------------------------
1 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password
index 89b91da..5070b49 100755
--- a/scripts/ovirt-config-password
+++ b/scripts/ovirt-config-password
@@ -8,42 +8,20 @@
trap '__st=$?; stop_log; exit $__st' 0
trap 'exit $?' 1 2 13 15
-function sasl_password {
- user=$1
- passwd=$2
-
- printf "\nadding user $user to the sasl list for libvirt\n"
-
- start_log
- printf '%s\n' "$passwd" | saslpasswd2 -a libvirt -p "$user"
- stop_log
-}
-
# Usage: set_sasl_password USER
# Prompt(twice) for a password for the specified USER.
# If they match, set that user's system password,
# and add USER to the SASL list for libvirt.
function set_sasl_password {
user=$1
- while : ; do
- printf "\nPlease enter the password for $user (hit return to skip) "
- read -es
- test -z "$REPLY" && return 1
- local passwd=$REPLY
- printf "\nPlease enter again to confirm "
- read -es
- local confirm=$REPLY
- if test "$passwd" = "$confirm"; then
- if [ "$user" = "root" ]; then
- start_log
- printf '%s\n' "$passwd" | passwd --stdin "$user"
- stop_log
- fi
- sasl_password "$user" "$passwd"
- return 0
- fi
- printf "Paswords did not match. Please try again\n"
- done
+ if [ "$user" = "root" ]; then
+ printf "\nSystem Administrator ($user):\n"
+ passwd "$user"
+ fi
+
+ printf "\nNode SASL User ($user):\n"
+ saslpasswd2 -a libvirt "$user"
+ return 0
}
# Prompts the user for a single username, password combo
--
1.6.0.6
More information about the ovirt-devel
mailing list