diff options
author | dteske <dteske@FreeBSD.org> | 2013-06-18 21:44:35 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2013-06-18 21:44:35 +0000 |
commit | e1afea6c7ee734fbdedaca02749e0fb178200c36 (patch) | |
tree | dba39d4168e5d82fbe343b9942b78de087aab01c /usr.sbin/bsdconfig/usermgmt | |
parent | e126a17bd263caf562796096aba9da73f641d793 (diff) | |
download | FreeBSD-src-e1afea6c7ee734fbdedaca02749e0fb178200c36.zip FreeBSD-src-e1afea6c7ee734fbdedaca02749e0fb178200c36.tar.gz |
Perform some code consolidation and add some additional error
checking/reporting. (similar to SVN revisions 251919 and 251928)
Diffstat (limited to 'usr.sbin/bsdconfig/usermgmt')
-rw-r--r-- | usr.sbin/bsdconfig/usermgmt/include/messages.subr | 1 | ||||
-rwxr-xr-x | usr.sbin/bsdconfig/usermgmt/usermgmt | 44 |
2 files changed, 17 insertions, 28 deletions
diff --git a/usr.sbin/bsdconfig/usermgmt/include/messages.subr b/usr.sbin/bsdconfig/usermgmt/include/messages.subr index aa98407..71cc51d 100644 --- a/usr.sbin/bsdconfig/usermgmt/include/messages.subr +++ b/usr.sbin/bsdconfig/usermgmt/include/messages.subr @@ -105,6 +105,7 @@ msg_separated_by_commas="Separated by commas" msg_select_group_members_from_list="Select Group Members from a list" msg_select_login_shell="Select Login Shell" msg_shell="Shell" +msg_unknown_user_management_menu_selection="Unknown user management menu selection" msg_use_default_values_for_all_account_details="Use default values for all account details?" msg_user="User" msg_user_id="UID" diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt index 96f7e6f..b7d36b9 100755 --- a/usr.sbin/bsdconfig/usermgmt/usermgmt +++ b/usr.sbin/bsdconfig/usermgmt/usermgmt @@ -144,38 +144,26 @@ while :; do f_die fi + command= case "$mtag" in - X) # Exit - exit 0 - ;; - - 1) # Add User - $BSDCFG_LIBE/$APP_DIR/useradd ${USE_XDIALOG:+-X} - ;; - - 2) # Edit/View User - $BSDCFG_LIBE/$APP_DIR/useredit ${USE_XDIALOG:+-X} - ;; - - 3) # Delete User - $BSDCFG_LIBE/$APP_DIR/userdel ${USE_XDIALOG:+-X} - ;; - - 4) # Add Group - $BSDCFG_LIBE/$APP_DIR/groupadd ${USE_XDIALOG:+-X} - ;; - - 5) # Edit/View Group - $BSDCFG_LIBE/$APP_DIR/groupedit ${USE_XDIALOG:+-X} - ;; - - 6) # Delete Group - $BSDCFG_LIBE/$APP_DIR/groupdel ${USE_XDIALOG:+-X} - ;; - + X) break ;; + 1) command=useradd ;; # Add User + 2) command=useredit ;; # Edit/View User + 3) command=userdel ;; # Delete User + 4) command=groupadd ;; # Add Group + 5) command=groupedit ;; # Edit/View Group + 6) command=groupdel ;; # Delete Group esac + + if [ "$command" ]; then + $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} + else + f_die 1 "$msg_unknown_user_management_menu_selection" + fi done +exit $SUCCESS + ################################################################################ # END ################################################################################ |