summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/usermgmt
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2012-12-21 19:26:17 +0000
committerdteske <dteske@FreeBSD.org>2012-12-21 19:26:17 +0000
commit10fd5103d05e0e84415fd9b26eebe9c98c8880fc (patch)
treed18d863cf5690553d6d8e68efe62f69a60817d61 /usr.sbin/bsdconfig/usermgmt
parent1906ac57cd7e750371015d64e4b50a2807c3ec75 (diff)
downloadFreeBSD-src-10fd5103d05e0e84415fd9b26eebe9c98c8880fc.zip
FreeBSD-src-10fd5103d05e0e84415fd9b26eebe9c98c8880fc.tar.gz
Improve the debugging abilities and clean up debug messages. In most cases,
all one has to do is set the environment variable DEBUGGING to get the debug messages to appear on the console.
Diffstat (limited to 'usr.sbin/bsdconfig/usermgmt')
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupedit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupinput12
-rw-r--r--usr.sbin/bsdconfig/usermgmt/share/group_input.subr12
-rw-r--r--usr.sbin/bsdconfig/usermgmt/share/user_input.subr69
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useredit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userinput12
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/usermgmt2
9 files changed, 60 insertions, 55 deletions
diff --git a/usr.sbin/bsdconfig/usermgmt/groupdel b/usr.sbin/bsdconfig/usermgmt/groupdel
index 5a2f110..952058e 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupdel
+++ b/usr.sbin/bsdconfig/usermgmt/groupdel
@@ -71,7 +71,7 @@ while :; do
f_dialog_menu_group_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
[ $retval -eq 0 ] || f_die
diff --git a/usr.sbin/bsdconfig/usermgmt/groupedit b/usr.sbin/bsdconfig/usermgmt/groupedit
index bb314cf..f132baf 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupedit
+++ b/usr.sbin/bsdconfig/usermgmt/groupedit
@@ -71,7 +71,7 @@ while :; do
f_dialog_menu_group_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%s mtag=[%s]" $retval "$mtag"
[ $retval -eq 0 ] || f_die
diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput
index dc55852..91f0619 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupinput
+++ b/usr.sbin/bsdconfig/usermgmt/groupinput
@@ -77,7 +77,7 @@ save_changes()
elif [ "$group_password" ]; then
cmd="echo \"\$group_password\" | $cmd -h 0"
fi
- f_dprintf "cmd=$cmd"
+ f_dprintf "cmd=%s" "$cmd"
err=$( eval $cmd 2>&1 )
retval=$?
if [ $retval -ne $SUCCESS ]; then
@@ -96,7 +96,7 @@ save_changes()
elif [ "$group_password" ]; then
cmd="echo \"\$group_password\" | $cmd -h 0"
fi
- f_dprintf "cmd=$cmd"
+ f_dprintf "cmd=%s" "$cmd"
err=$( eval $cmd 2>&1 )
retval=$?
if [ $retval -ne $SUCCESS ]; then
@@ -136,14 +136,14 @@ dialog_title_update()
while [ $# -gt 0 ]; do
key="${1%%=*}"
value="${1#*=}"
- f_dprintf "key=[$key] value=[$value]"
+ f_dprintf "key=[%s] value=[%s]" "$key" "$value"
case "$key" in
mode) mode="$value";;
group) group="$value";;
esac
shift
done
-f_dprintf "mode=[$mode] group=[$group]"
+f_dprintf "mode=[%s] group=[%s]" "$mode" "$group"
#
# Initialize
@@ -242,7 +242,7 @@ while :; do
retval=$?
setvar DIALOG_MENU_$$ "$dialog_menu"
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
# Exit if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || f_die
@@ -261,7 +261,7 @@ while :; do
f_dialog_menu_group_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
# Loop if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || continue
diff --git a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
index b722ce2..746d8a0 100644
--- a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
+++ b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
@@ -154,7 +154,7 @@ f_dialog_input_group_name()
done
save_flag=1
- f_dprintf "group_name: [$cur_group_name]->[$group_name]"
+ f_dprintf "group_name: [%s]->[%s]" "$cur_group_name" "$group_name"
return $SUCCESS
}
@@ -247,7 +247,8 @@ f_dialog_input_group_password()
done
save_flag=1
- f_dprintf "group_password: [$cur_group_password]->[$group_password]"
+ f_dprintf "group_password: [%s]->[%s]" \
+ "$cur_group_password" "$group_password"
return $SUCCESS
}
@@ -270,7 +271,7 @@ f_dialog_input_group_gid()
group_gid="$_input"
save_flag=1
- f_dprintf "group_gid: [$cur_group_gid]->[$group_gid]"
+ f_dprintf "group_gid: [%s]->[%s]" "$cur_group_gid" "$group_gid"
return $SUCCESS
}
@@ -319,7 +320,7 @@ f_dialog_input_group_members()
retval=$?
setvar DIALOG_MENU_$$ "$dialog_menu"
menu_choice=$( f_dialog_menutag )
- f_dprintf "retval=$retval menu_choice=[$menu_choice]"
+ f_dprintf "retval=%u menu_choice=[%s]" $retval "$menu_choice"
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
@@ -385,7 +386,8 @@ f_dialog_input_group_members()
group_members="$_input"
save_flag=1
- f_dprintf "group_members: [$cur_group_members]->[$group_members]"
+ f_dprintf "group_members: [%s]->[%s]" \
+ "$cur_group_members" "$group_members"
return $SUCCESS
}
diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
index ba665c1..0cf8999 100644
--- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
+++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
@@ -198,8 +198,8 @@ f_dialog_input_member_groups()
done
save_flag=1
- local debug="pw_member_groups:"
- f_dprintf "$debug [$cur_pw_member_groups]->[$pw_member_groups]"
+ f_dprintf "pw_member_groups: [%s]->[%s]" \
+ "$cur_pw_member_groups" "$pw_member_groups"
return $SUCCESS
}
@@ -259,7 +259,7 @@ f_dialog_input_name()
done
save_flag=1
- f_dprintf "pw_name: [$cur_pw_name]->[$pw_name]"
+ f_dprintf "pw_name: [%s]->[%s]" "$cur_pw_name" "$pw_name"
return $SUCCESS
}
@@ -352,7 +352,7 @@ f_dialog_input_password()
done
save_flag=1
- f_dprintf "pw_password: [$cur_pw_password]->[$pw_password]"
+ f_dprintf "pw_password: [%s]->[%s]" "$cur_pw_password" "$pw_password"
return $SUCCESS
}
@@ -376,7 +376,7 @@ f_dialog_input_gecos()
pw_gecos="$_input"
save_flag=1
- f_dprintf "pw_gecos: [$cur_pw_gecos]->[$pw_gecos]"
+ f_dprintf "pw_gecos: [%s]->[%s]" "$cur_pw_gecos" "$pw_gecos"
return $SUCCESS
}
@@ -399,7 +399,7 @@ f_dialog_input_uid()
pw_uid="$_input"
save_flag=1
- f_dprintf "pw_uid: [$cur_pw_uid]->[$pw_uid]"
+ f_dprintf "pw_uid: [%s]->[%s]" "$cur_pw_uid" "$pw_uid"
return $SUCCESS
}
@@ -422,7 +422,7 @@ f_dialog_input_gid()
pw_gid="$_input"
save_flag=1
- f_dprintf "pw_gid: [$cur_pw_gid]->[$pw_gid]"
+ f_dprintf "pw_gid: [%s]->[%s]" "$cur_pw_gid" "$pw_gid"
return $SUCCESS
}
@@ -445,7 +445,7 @@ f_dialog_input_class()
pw_class="$_input"
save_flag=1
- f_dprintf "pw_class: [$cur_pw_class]->[$pw_class]"
+ f_dprintf "pw_class: [%s]->[%s]" "$cur_pw_class" "$pw_class"
return $SUCCESS
}
@@ -496,7 +496,7 @@ f_dialog_input_change()
retval=$?
setvar DIALOG_MENU_$$ "$dialog_menu"
date_type=$( f_dialog_menutag )
- f_dprintf "retval=$retval date_type=[$date_type]"
+ f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
@@ -532,7 +532,7 @@ f_dialog_input_change()
retval=$?
setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox"
ret_date=$( f_dialog_inputstr )
- f_dprintf "retval=$retval ret_date=[$ret_date]"
+ f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date"
# Return to menu if either ESC or Cancel/No
[ $retval -eq $SUCCESS ] || continue
@@ -559,7 +559,7 @@ f_dialog_input_change()
retval=$?
setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox"
ret_time=$( f_dialog_inputstr )
- f_dprintf "retval=$retval ret_time=[$ret_time]"
+ f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time"
# Return to menu if either ESC or Cancel/No
[ $retval -eq $SUCCESS ] || continue
@@ -568,7 +568,7 @@ f_dialog_input_change()
-j -f "%d/%m/%Y %T" \
-- "$ret_date $ret_time" \
+%s 2> /dev/null )
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
3) # Enter number of days into the future
@@ -592,13 +592,13 @@ f_dialog_input_change()
continue
fi
- f_dprintf "ret_days=[$ret_days]"
+ f_dprintf "ret_days=[%s]" "$ret_days"
case "$ret_days" in
[-+]*) _input=$( date -v${ret_days}d +%s );;
0) _input=$( date +%s );;
*) _input=$( date -v+${ret_days}d +%s );;
esac
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
4) # Enter value manually
@@ -619,7 +619,7 @@ f_dialog_input_change()
continue
fi
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
esac
@@ -629,8 +629,8 @@ f_dialog_input_change()
pw_password_expire="$_input"
save_flag=1
- local debug=pw_password_expire
- f_dprintf "$debug: [$cur_pw_password_expire]->[$pw_password_expire]"
+ f_dprintf "pw_password_expire: [%s]->[%s]" \
+ "$cur_pw_password_expire" "$pw_password_expire"
return $SUCCESS
}
@@ -681,7 +681,7 @@ f_dialog_input_expire()
retval=$?
setvar DIALOG_MENU_$$ "$dialog_menu"
date_type=$( f_dialog_menutag )
- f_dprintf "retval=$retval date_type=[$date_type]"
+ f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
@@ -717,7 +717,7 @@ f_dialog_input_expire()
retval=$?
setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox"
ret_date=$( f_dialog_inputstr )
- f_dprintf "retval=$retval ret_date=[$ret_date]"
+ f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date"
# Return to menu if either ESC or Cancel/No
[ $retval -eq $SUCCESS ] || continue
@@ -743,7 +743,7 @@ f_dialog_input_expire()
retval=$?
setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox"
ret_time=$( f_dialog_inputstr )
- f_dprintf "retval=$retval ret_time=[$ret_time]"
+ f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time"
# Return to menu if either ESC or Cancel/No
[ $retval -eq $SUCCESS ] || continue
@@ -752,7 +752,7 @@ f_dialog_input_expire()
-j -f "%d/%m/%Y %T" \
-- "$ret_date $ret_time" \
+%s 2> /dev/null )
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
3) # Enter number of days into the future
@@ -776,13 +776,13 @@ f_dialog_input_expire()
continue
fi
- f_dprintf "ret_days=[$ret_days]"
+ f_dprintf "ret_days=[%s]" "$ret_days"
case "$ret_days" in
[-+]*) _input=$( date -v${ret_days}d +%s );;
0) _input=$( date +%s );;
*) _input=$( date -v+${ret_days}d +%s );;
esac
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
4) # Enter value manually
@@ -803,7 +803,7 @@ f_dialog_input_expire()
continue
fi
- f_dprintf "_input=[$_input]"
+ f_dprintf "_input=[%s]" "$_input"
break ;;
esac
@@ -813,8 +813,8 @@ f_dialog_input_expire()
pw_account_expire="$_input"
save_flag=1
- local debug=pw_account_expire
- f_dprintf "$debug: [$cur_pw_account_expire]->[$pw_account_expire]"
+ f_dprintf "pw_account_expire: [%s]->[%s]" \
+ "$cur_pw_account_expire" "$pw_account_expire"
return $SUCCESS
}
@@ -837,7 +837,7 @@ f_dialog_input_home_dir()
pw_home_dir="$_input"
save_flag=1
- f_dprintf "pw_home_dir: [$cur_pw_home_dir]->[$pw_home_dir]"
+ f_dprintf "pw_home_dir: [%s]->[%s]" "$cur_pw_home_dir" "$pw_home_dir"
return $SUCCESS
}
@@ -863,7 +863,8 @@ f_dialog_input_home_create()
fi
save_flag=1
- f_dprintf "pw_home_create: [$cur_pw_home_create]->[$pw_home_create]"
+ f_dprintf "pw_home_create: [%s]->[%s]" \
+ "$cur_pw_home_create" "$pw_home_create"
[ $retval -ne 255 ] # return failure if user pressed ESC
}
@@ -905,7 +906,8 @@ f_dialog_input_group_delete()
fi
save_flag=1
- f_dprintf "pw_group_delete: [$cur_pw_group_delete]->[$pw_group_delete]"
+ f_dprintf "pw_group_delete: [%s]->[%s]" \
+ "$cur_pw_group_delete" "$pw_group_delete"
[ $retval -ne 255 ] # return failure if user pressed ESC
}
@@ -931,7 +933,8 @@ f_dialog_input_home_delete()
fi
save_flag=1
- f_dprintf "pw_home_delete: [$cur_pw_home_delete]->[$pw_home_delete]"
+ f_dprintf "pw_home_delete: [%s]->[%s]" \
+ "$cur_pw_home_delete" "$pw_home_delete"
[ $retval -ne 255 ] # return failure if user pressed ESC
}
@@ -958,8 +961,8 @@ f_dialog_input_dotfiles_create()
fi
save_flag=1
- local debug="pw_dotfiles_create:"
- f_dprintf "$debug: [$cur_pw_dotfiles_create]->[$pw_dotfiles_create]"
+ f_dprintf "pw_dotfiles_create: [%s]->[%s]" \
+ "$cur_pw_dotfiles_create" "$pw_dotfiles_create"
[ $retval -ne 255 ] # return failure if user pressed ESC
}
@@ -1017,7 +1020,7 @@ f_dialog_input_shell()
pw_shell="$_input"
save_flag=1
- f_dprintf "pw_shell: [$cur_pw_shell]->[$pw_shell]"
+ f_dprintf "pw_shell: [%s]->[%s]" "$cur_pw_shell" "$pw_shell"
return $SUCCESS
}
diff --git a/usr.sbin/bsdconfig/usermgmt/userdel b/usr.sbin/bsdconfig/usermgmt/userdel
index e1a26dd..b09815d 100755
--- a/usr.sbin/bsdconfig/usermgmt/userdel
+++ b/usr.sbin/bsdconfig/usermgmt/userdel
@@ -71,7 +71,7 @@ while :; do
f_dialog_menu_user_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
[ $retval -eq 0 ] || f_die
diff --git a/usr.sbin/bsdconfig/usermgmt/useredit b/usr.sbin/bsdconfig/usermgmt/useredit
index 40a93a8..238d0d5 100755
--- a/usr.sbin/bsdconfig/usermgmt/useredit
+++ b/usr.sbin/bsdconfig/usermgmt/useredit
@@ -71,7 +71,7 @@ while :; do
f_dialog_menu_user_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
[ $retval -eq 0 ] || f_die
diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput
index 0bf8d89..596496f 100755
--- a/usr.sbin/bsdconfig/usermgmt/userinput
+++ b/usr.sbin/bsdconfig/usermgmt/userinput
@@ -114,7 +114,7 @@ save_changes()
elif [ "$pw_password" ]; then
cmd="echo \"\$pw_password\" | $cmd -h 0"
fi
- f_dprintf "cmd=$cmd"
+ f_dprintf "cmd=%s" "$cmd"
err=$( eval $cmd 2>&1 )
retval=$?
if [ $retval -ne $SUCCESS ]; then
@@ -160,7 +160,7 @@ save_changes()
elif [ "$pw_password" ]; then
cmd="echo \"\$pw_password\" | $cmd -h 0"
fi
- f_dprintf "cmd=$cmd"
+ f_dprintf "cmd=%s" "$cmd"
err=$( eval $cmd 2>&1 )
retval=$?
if [ $retval -ne $SUCCESS ]; then
@@ -217,14 +217,14 @@ dialog_title_update()
while [ $# -gt 0 ]; do
key="${1%%=*}"
value="${1#*=}"
- f_dprintf "key=[$key] value=[$value]"
+ f_dprintf "key=[%s] value=[%s]" "$key" "$value"
case "$key" in
mode) mode="$value";;
user) user="$value";;
esac
shift
done
-f_dprintf "mode=[$mode] user=[$user]"
+f_dprintf "mode=[%s] user=[%s]" "$mode" "$user"
#
# Initialize
@@ -406,7 +406,7 @@ while :; do
retval=$?
setvar DIALOG_MENU_$$ "$dialog_menu"
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
# Exit if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || f_die
@@ -425,7 +425,7 @@ while :; do
f_dialog_menu_user_list
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
# Loop if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || continue
diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt
index f3357d4..d679628 100755
--- a/usr.sbin/bsdconfig/usermgmt/usermgmt
+++ b/usr.sbin/bsdconfig/usermgmt/usermgmt
@@ -126,7 +126,7 @@ while :; do
dialog_menu_main
retval=$?
mtag=$( f_dialog_menutag )
- f_dprintf "retval=$retval mtag=[$mtag]"
+ f_dprintf "retval=%u mtag=[%s]" $retval "$mtag"
if [ $retval -eq 2 ]; then
# The Help button was pressed
OpenPOWER on IntegriCloud