Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UserMaint V1.0 PART 1/2

0 views
Skip to first unread message

Charles Eads

unread,
Mar 10, 1993, 1:13:43 PM3/10/93
to
UserMaint - A utility for user account maintenance.
(Version 1.0, Mar 8, 1993)

Charles A. Eads
(ea...@cory.berkeley.edu)
Computer Science Division-EECS, University of California at Berkeley

This archive contains UserMaint, a user account maintenance package
written in Tcl/Tk which provides a generic and highly modifiable
graphical interface between the system administrator and the
/etc/passwd and /etc/group files.

* UserMaint has also been uploaded to harbor.ecn.purdue.edu and sould
be available there as UserMaint_V1.0.tar.Z in the near future.

#!/bin/sh
#
# UserMaint V1.0 by Charles A. Eads
#
# Copyright (c) 1993 The Regents of the University of California.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written agreement is
# hereby granted, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# usermaint/README
# usermaint/man/man8/UserMaint.8
# usermaint/usermaint
# usermaint/lib/add.tcl
# usermaint/lib/apply.tcl
# usermaint/lib/control.tcl
# usermaint/lib/edit.tcl
# usermaint/lib/group-manip.tcl
# usermaint/lib/menu
# usermaint/lib/passwd-manip.tcl
# usermaint/lib/space
# usermaint/lib/title.tcl
# This archive created: Tue Mar 9 08:54:36 1993
export PATH; PATH=/bin:$PATH

echo shar: creating subdirectories
if test ! -d usermaint; then mkdir usermaint; fi
if test ! -d usermaint/man; then mkdir usermaint/man; fi
if test ! -d usermaint/man/man8; then mkdir usermaint/man/man8; fi
if test ! -d usermaint/lib; then mkdir usermaint/lib; fi
cd usermaint
echo shar: extracting "'README'" '(3281 characters)'
if test -f 'README'
then
echo shar: over-writing existing file "'README'"
fi
sed 's/^X//' << \SHAR_EOF > 'README'
X UserMaint - A utility for user account maintenance.
X (Version 1.0, Mar 8, 1993)
X
X Charles A. Eads
X (ea...@cory.berkeley.edu)
X Computer Science Division-EECS, University of California at Berkeley
X
XThis directory contains UserMaint, a user account maintenance package
Xwritten in Tcl/Tk which provides a generic and highly modifiable
Xgraphical interface between the system administrator and the
X/etc/passwd and /etc/group files.
X
XINSTALLATION:
X
XAfter unarchiving UserMaint, you must edit the usermaint-config file
Xand set the environment variable 'USERMAINT' to the directory where
Xthe usermaint program files are stored. (You may also run usermaint
Xin an _unconfigured_ manner by simply logging in as root, changing to
Xthe directory that contains the usermaint script and executing the
Xprogram.) The usermaint-config file is a tcl file that is 'sourced'
Xby the usermaint.tcl program that provides the UserMaint system with
Xnecessary parameters. This config file is self explanatory, but
Xshould be read and modified as required.
X
XREQUIREMENTS:
X
XUserMaint was developed using Tcl Version 6.7/Tk Version 3.2 and
Xrequires perl for the purpose of generating random numbers and
Xencrypting passwords.
X
XOPERATION:
X
X ADD
X The 'ADD' button or menu option brings up a window that allows
X for the creation of new accounts. Upon creation these entries
X get placed at the bottom of the user list in the password file,
X unless a password entry was selected from the list of users that
X comes up when the usermaint program is first run in which case the
X entry is placed after the selected entry.
X
X EDIT
X The 'EDIT' button or menu option or double clicking on an account
X entry beings up a window that allows for editing account
X information.
X
X DELETE
X The 'DELETE' button or menu option deletes the password entries
X selected from the list of users.
X
X UP
X The 'UP' button or menu option moves the set of password entries
X that are selected up one line.
X
X DOWN
X The 'DOWN' button or menu option moves the set of password entries
X that are selected down one line.
X
X SORT
X The 'SORT' button or menu option sorts the set of selected
X password entries.
X
X APPLY CHANGES
X The 'APPLY CHANGES' button or menu option currently saves and
X distributes the '/etc/passwd' and '/etc/group' to the locations
X specified in the usermaint-config file, asks if you would like to
X delete the directories of deleted users, asks if you would like to
X create directories for new user, and asks if you would like to
X initialize these directories from a skeleton directory upon their
X creation. See the section entitled HOOKS.
X
X CANCEL
X The 'CANCEL button or menu option cancels all editing that has
X taken place and exits the application.
X
XCUSTOMIZATION:
X
XThe 'usermaint-hooks' file allows the system administrator to
Xcustomize what the Usermaint system does after the 'APPLY CHANGES'
Xoption has been selected, and allows for the addition of other UID
Xlookup methods. The current usermaint-hooks allow for the deletion
Xand creation of user directories as described in the APPLY CHANGES
Xsection, and the verification and selection of unique UID's. For how
Xto create new hooks, see the 'usermaint-hooks' file.
SHAR_EOF
if test 3281 -ne "`wc -c 'README'`"
then
echo shar: error transmitting "'README'" '(should have been 3281 characters)'
fi
chmod +x 'README'
echo shar: extracting "'UserMaint.8'" '(6660 characters)'
cd man/man8
if test -f 'UserMaint.8'
then
echo shar: over-writing existing file "'UserMaint.8'"
fi
sed 's/^X//' << \SHAR_EOF > 'UserMaint.8'
X'\"
X' $Header: UserMaint.3,v 1.0 1993/02/28 18:00:00 eads Exp $ SPRITE (Berkeley)
X.\" The definitions below are for supplemental macros used in Sprite
X.\" manual entries.
X.\"
X.\" .HS name section [date [version]]
X.\" Replacement for .TH in other man pages. See below for valid
X.\" section names.
X.\"
X.\" .AP type name in/out [indent]
X.\" Start paragraph describing an argument to a library procedure.
X.\" type is type of argument (int, etc.), in/out is either "in", "out",
X.\" or "in/out" to describe whether procedure reads or modifies arg,
X.\" and indent is equivalent to second arg of .IP (shouldn't ever be
X.\" needed; use .AS below instead)
X.\"
X.\" .AS [type [name]]
X.\" Give maximum sizes of arguments for setting tab stops. Type and
X.\" name are examples of largest possible arguments that will be passed
X.\" to .AP later. If args are omitted, default tab stops are used.
X.\"
X.\" .BS
X.\" Start box enclosure. From here until next .BE, everything will be
X.\" enclosed in one large box.
X.\"
X.\" .BE
X.\" End of box enclosure.
X.\"
X.\" .VS
X.\" Begin vertical sidebar, for use in marking newly-changed parts
X.\" of man pages.
X.\"
X.\" .VE
X.\" End of vertical sidebar.
X.\"
X.\" .DS
X.\" Begin an indented unfilled display.
X.\"
X.\" .DE
X.\" End of indented unfilled display.
X.\"
X' # Heading for Sprite man pages
X.de HS
X.if '\\$2'cmds' .TH \\$1 8 \\$3 \\$4
X.if '\\$2'lib' .TH \\$1 8 \\$3 \\$4
X.if '\\$2'tcl' .TH \\$1 8 \\$3 \\$4
X.if '\\$2'tk' .TH \\$1 8 \\$3 \\$4
X.if t .wh -1.3i ^B
X.nr ^l \\n(.l
X.ad b
X..
X' # Start an argument description
X.de AP
X.ie !"\\$4"" .TP \\$4
X.el \{\
X. ie !"\\$2"" .TP \\n()Cu
X. el .TP 15
X.\}
X.ie !"\\$3"" \{\
X.ta \\n()Au \\n()Bu
X\&\\$1 \\fI\\$2\\fP (\\$3)
X.\".b
X.\}
X.el \{\
X.br
X.ie !"\\$2"" \{\
X\&\\$1 \\fI\\$2\\fP
X.\}
X.el \{\
X\&\\fI\\$1\\fP
X.\}
X.\}
X..
X' # define tabbing values for .AP
X.de AS
X.nr )A 10n
X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
X.nr )B \\n()Au+15n
X.\"
X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
X.nr )C \\n()Bu+\\w'(in/out)'u+2n
X..
X' # BS - start boxed text
X' # ^y = starting y location
X' # ^b = 1
X.de BS
X.br
X.mk ^y
X.nr ^b 1u
X.if n .nf
X.if n .ti 0
X.if n \l'\\n(.lu\(ul'
X.if n .fi
X..
X' # BE - end boxed text (draw box now)
X.de BE
X.nf
X.ti 0
X.mk ^t
X.ie n \l'\\n(^lu\(ul'
X.el \{\
X.\" Draw four-sided box normally, but don't draw top of
X.\" box if the box started on an earlier page.
X.ie !\\n(^b-1 \{\
X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
X.\}
X.el \}\
X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
X.\}
X.\}
X.fi
X.br
X.nr ^b 0
X..
X' # VS - start vertical sidebar
X' # ^Y = starting y location
X' # ^v = 1 (for troff; for nroff this doesn't matter)
X.de VS
X.mk ^Y
X.ie n 'mc \s12\(br\s0
X.el .nr ^v 1u
X..
X' # VE - end of vertical sidebar
X.de VE
X.ie n 'mc
X.el \{\
X.ev 2
X.nf
X.ti 0
X.mk ^t
X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
X.sp -1
X.fi
X.ev
X.\}
X.nr ^v 0
X..
X' # Special macro to handle page bottom: finish off current
X' # box/sidebar if in box/sidebar mode, then invoked standard
X' # page bottom macro.
X.de ^B
X.ev 2
X'ti 0
X'nf
X.mk ^t
X.if \\n(^b \{\
X.\" Draw three-sided box if this is the box's first page,
X.\" draw two sides but no top otherwise.
X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
X.\}
X.if \\n(^v \{\
X.nr ^x \\n(^tu+1v-\\n(^Yu
X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
X.\}
X.bp
X'fi
X.ev
X.if \\n(^b \{\
X.mk ^y
X.nr ^b 2
X.\}
X.if \\n(^v \{\
X.mk ^Y
X.\}
X..
X' # DS - begin display
X.de DS
X.RS
X.nf
X.sp
X..
X' # DE - end display
X.de DE
X.fi
X.RE
X.sp .5
X..
X.HS UserMaint tk
X.BS
X.SH NAME
XUserMaint V1.0 \- A utility for user account maintenance.
X.SH SYNOPSIS
Xusermaint
X.SH DESCRIPTION
X.PP
X
XUserMaint is a user account maintenance package written in Tcl/Tk. It
Xprovides a generic and highly modifiable graphical interface between
Xthe System Administrator and the /etc/passwd and /etc/group files.
X.SH INSTALLATION
XUpon installation of UserMaint, you must edit the usermaint-config
Xfile and set the environment variable 'USERMAINT' to the directory
Xwhere the usermaint program files are stored. The usermaint-config
Xfile is a tcl file that is 'sourced' by the usermaint.tcl program that
Xprovides the UserMaint system with necessary parameters. This config
Xfile is self explanatory, but should be read and modified as required.
X.SH REQUIREMENTS
XUserMaint was developed using Tcl Version 6.7/Tk Version 3.2 and
Xrequires perl for the purpose of generating random numbers and
Xencrypting passwords.
X.SH OPERATION
X.SH
X.SH " ADD"
XThe 'ADD' button or menu option brings up a window that allows for the
Xcreation of new accounts. Upon creation these entries get placed at
Xthe bottom of the user list in the password file, unless a password
Xentry was selected from the list of users that comes up when the
Xusermaint program is first run in which case the entry is placed after
Xthe selected entry.
X.SH " EDIT"
XThe 'EDIT' button or menu option or double clicking on an account
Xentry beings up a window that allows for editing account information.
X.SH " DELETE"
XThe 'DELETE' button or menu option deletes the password entries
Xselected from the list of users.
X.SH " UP"
XThe 'UP' button or menu option moves the set of password entries that
Xare selected up one line.
X.SH " DOWN"
XThe 'DOWN' button or menu option moves the set of password entries
Xthat are selected down one line.
X.SH " SORT"
XThe 'SORT' button or menu option sorts the set of selected password
Xentries.
X.SH " APPLY CHANGES"
XThe 'APPLY CHANGES' button or menu option currently saves and
Xdistributes the '/etc/passwd' and '/etc/group' to the locations
Xspecified in the usermaint-config file, asks if you would like to
Xdelete the directories of deleted users, asks if you would like to
Xcreate directories for new user, and asks if you would like to
Xinitialize these directories from a skeleton directory upon their
Xcreation. See the section entitled HOOKS.
X.SH " CANCEL"
XThe 'CANCEL button or menu option cancels all editing that has taken
Xplace and exits the application.
X.SH CUSTOMIZATION - HOOKS
XThe 'usermaint-hooks' file allows the system administrator to
Xcustomize what the Usermaint system does after the 'APPLY CHANGES'
Xoption has been selected, and allows for the addition of other UID
Xlookup methods. The current usermaint-hooks allow for the deletion
Xand creation of user directories as described in the APPLY CHANGES
Xsection, and the verification and selection of unique UID's. For how
Xto create new hooks, see the 'usermaint-hooks' file.
X.SH AUTHOR
XCharles A. Eads (ea...@cory.berkeley.edu)
SHAR_EOF
if test 6660 -ne "`wc -c 'UserMaint.8'`"
then
echo shar: error transmitting "'UserMaint.8'" '(should have been 6660 characters)'
fi
echo shar: extracting "'usermaint'" '(1187 characters)'
cd ../..
if test -f 'usermaint'
then
echo shar: over-writing existing file "'usermaint'"
fi
sed 's/^X//' << \SHAR_EOF > 'usermaint'
X#!/bin/sh -f
X#
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xtrap "" 0 1 2 3 5 6
XUSERMAINT=${USERMAINT:=`pwd`}
Xcd $USERMAINT/lib
Xusermaint.tcl
SHAR_EOF
if test 1187 -ne "`wc -c 'usermaint'`"
then
echo shar: error transmitting "'usermaint'" '(should have been 1187 characters)'
fi
chmod +x 'usermaint'
echo shar: extracting "'add.tcl'" '(2886 characters)'
cd lib
if test -f 'add.tcl'
then
echo shar: over-writing existing file "'add.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'add.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc add_control_create {w win} \
X{
X global BACKGROUND_COLOR_ADD_EDIT
X frame $w.control -border 5 -background $BACKGROUND_COLOR_ADD_EDIT
X button $w.control.add -text "Add User" -command "add_add $w {$win}"
X button $w.control.cancel -width 8 -text "Cancel" -command "add_finish $w {$win}"
X pack append $w.control $w.control.add {left} $w.control.cancel {right}
X}
X
Xproc add_create {w} \
X{
X set index [lindex [$w.userlist.list curselection] 0]
X upvar #0 window_number wnumber
X if {$index != {}} \
X {
X userlist_tag $w $index .add-$wnumber
X }
X toplevel .add-$wnumber
X useredit_create .add-$wnumber $w
X add_control_create .add-$wnumber $w
X pack append .add-$wnumber .add-$wnumber.useredit {top fill} .add-$wnumber.control {bottom expand fill}
X
X useredit_init .add-$wnumber {} {} {} {} {} {} {}
X
X wm title .add-$wnumber "ADD USER"
X
X incr wnumber
X}
X
Xproc add_add {w win} \
X{
X upvar #0 tmp_passwd_text([expr "{$win} == {} ? {.} : {$win}"]) tmp_passwd_text
X upvar #0 tmp_gid($w) tmp_gid
X global group_text
X
X set user_entry [useredit_get_user_entry $w]
X if {$user_entry == -1} return
X
X set add_index end
X set i [userlist_tag_find $win $w]
X if { $i != -1 } \
X {
X set add_index [expr "$i + 1"]
X userlist_tag_remove $win $i [userlist_get_user_entry $win $i] $w
X }
X useredit_apply $w $win
X if {$add_index == {end}} {set add_index [$win.userlist.list size]}
X $win.userlist.list insert $add_index $user_entry
X userlist_tag $win $add_index .added
X set passwd_entry [useredit_get_passwd_entry $w]
X set tmp_passwd_text [linsert $tmp_passwd_text $add_index [file_to_list $passwd_entry]]
X
X follow $win.userlist.list $add_index 30
X
X destroy $w
X}
X
Xproc add_finish {w win} \
X{
X set i [userlist_tag_find $win $w]
X if { $i != -1 } \
X {
X userlist_tag_remove $win $i [userlist_get_user_entry $win $i] $w
X }
X destroy $w
X}
SHAR_EOF
if test 2886 -ne "`wc -c 'add.tcl'`"
then
echo shar: error transmitting "'add.tcl'" '(should have been 2886 characters)'
fi
echo shar: extracting "'apply.tcl'" '(3892 characters)'
if test -f 'apply.tcl'
then
echo shar: over-writing existing file "'apply.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'apply.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc apply_init {w} \
X{
X global TMP_DIRECTORY
X
X set children [winfo children [expr "{$w} == {} ? {.} : {$w}"]]
X if {[lsearch $children ".edit-*"] > -1} \
X {
X if {[query "There are currently users being edited. Do you wish to continue with apply?"] == 0} return
X } else \
X {
X if {[lsearch $children ".add-*"] > -1} \
X {
X if {[query "There are currently users being added. Do you wish to continue with apply?"] == 0} return
X }
X }
X
X set children [winfo children [expr "{$w} == {} ? {.} : {$w}"]]
X foreach child $children \
X {
X if {[string match ".edit-*" $child] == 1} {destroy $child}
X if {[string match ".add-*" $child] == 1} {destroy $child}
X if {[string match ".query-*" $child] == 1} {destroy $child}
X }
X
X wm withdraw [expr "{$w} == {} ? {.} : {$w}"]
X
X upvar #0 active_delete 0
X set index [userlist_tag_find $w .delete-current]
X if {$index > -1} \
X {
X userlist_tag_remove $w $index [userlist_get_user_entry $w $index] .delete-current
X userlist_tag $w $index .delete
X }
X
X if {[userlist_tag_find $w .delete] > -1} \
X {
X if {[query "There are users taged for deletion. Continue with delete?"] == 1} \
X {
X useredit_delete_handler $w
X }
X }
X
X create_message "Distributing passwd and group files."
X
X set tmp_passwd_file_name "$TMP_DIRECTORY/tmp_passwd"
X set tmp_group_file_name "$TMP_DIRECTORY/tmp_group"
X
X if {[file exists $tmp_passwd_file_name] == 1} {exec rm -f $tmp_passwd_file_name}
X if {[file exists $tmp_group_file_name] == 1} {exec rm -f $tmp_group_file_name}
X
X upvar #0 tmp_passwd_text([expr "{$w} == {} ? {.} : {$w}"]) tmp_passwd_text
X passwd_write_to_file $tmp_passwd_text $tmp_passwd_file_name
X
X global group_text
X group_write_to_file $group_text $tmp_group_file_name
X
X global DISTRIBUTE_DESTINATIONS_PASSWD
X foreach dest $DISTRIBUTE_DESTINATIONS_PASSWD \
X {
X catch {exec rcp $tmp_passwd_file_name $dest}
X }
X
X global DISTRIBUTE_DESTINATIONS_GROUP
X foreach dest $DISTRIBUTE_DESTINATIONS_GROUP \
X {
X catch {exec rcp $tmp_group_file_name $dest}
X }
X
X set userlist_added {}
X set userlist_edited {}
X
X while (1) \
X {
X set index [userlist_tag_find $w .added]
X if {$index == -1} \
X {
X set index [userlist_tag_find $w .edited]
X if {$index == -1} \
X {
X break
X } else \
X {
X set passwd_entry [lindex $tmp_passwd_text $index]
X lappend userlist_edited $passwd_entry
X }
X } else \
X {
X set passwd_entry [lindex $tmp_passwd_text $index]
X lappend userlist_added $passwd_entry
X }
X userlist_tag_remove $w $index [userlist_get_user_entry $w $index] .edited
X userlist_tag_remove $w $index [userlist_get_user_entry $w $index] .added
X }
X
X destroy_message
X
X global HOOK_LIST
X
X upvar #0 userlist_deleted deleted_users
X foreach hook $HOOK_LIST \
X {
X catch {$hook $userlist_added $userlist_edited $deleted_users}
X }
X
X passwd_global_unlock
X passwd_unlock
X destroy .
X}
SHAR_EOF
if test 3892 -ne "`wc -c 'apply.tcl'`"
then
echo shar: error transmitting "'apply.tcl'" '(should have been 3892 characters)'
fi
echo shar: extracting "'control.tcl'" '(5858 characters)'
if test -f 'control.tcl'
then
echo shar: over-writing existing file "'control.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'control.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc control_menu_create {w} \
X{
X global BACKGROUND_COLOR_MAIN
X frame $w.menu
X
X menubutton $w.menu.project -text "Project" -menu $w.menu.project.m
X menu $w.menu.project.m
X $w.menu.project.m add command -label "Apply Changes" -command "apply_init {$w}"
X $w.menu.project.m add command -label "Cancel" -command "control_cancel"
X
X menubutton $w.menu.edit -text "Edit" -menu $w.menu.edit.m
X menu $w.menu.edit.m
X $w.menu.edit.m add command -label "Up" -command "userlist_up {$w}"
X $w.menu.edit.m add command -label "Down" -command "userlist_down {$w}"
X $w.menu.edit.m add command -label "Move" -command "userlist_move {$w}"
X $w.menu.edit.m add command -label "Sort" -command "userlist_sort {$w}"
X
X menubutton $w.menu.usermaint -text "User Maint" -menu $w.menu.usermaint.m
X menu $w.menu.usermaint.m
X $w.menu.usermaint.m add command -label "Add" -command "add_create {$w}"
X $w.menu.usermaint.m add command -label "Edit" -command "edit_init {$w}"
X $w.menu.usermaint.m add command -label "Delete" -command "userlist_delete {$w}"
X
X# menubutton $w.menu.config -text "Config" -menu $w.menu.config.m
X# menu $w.menu.config.m
X# $w.menu.config.m add command -label "Speed Bar"
X# $w.menu.config.m add separator
X# $w.menu.config.m add command -label "Delete Item"
X# $w.menu.config.m add command -label "Add Item"
X
X label $w.menu.tail -relief flat
X
X
X menubutton $w.menu.help -text "Help" -menu $w.menu.help.m
X menu $w.menu.help.m
X $w.menu.help.m add command -label "UserMaint V1.0"
X $w.menu.help.m add command -label "Info" -command "control_display_info"
X
X pack append $w.menu \
X $w.menu.project {left} \
X $w.menu.edit {left} \
X $w.menu.usermaint {left} \
X $w.menu.tail {left expand fillx} \
X $w.menu.help {left}
X# $w.menu.config {left} \
X}
X
Xproc control_panel_create {w} \
X{
X global BACKGROUND_COLOR_MAIN
X frame $w.buttons -borderwidth 5 -background $BACKGROUND_COLOR_MAIN
X
X frame $w.buttons.left -relief raised
X button $w.buttons.left.add -text "Add" -command "add_create {$w}"
X button $w.buttons.left.edit -text "Edit" -command "edit_init {$w}"
X button $w.buttons.left.delete -text "Delete" -command "userlist_delete {$w}"
X button $w.buttons.left.apply -text "Apply Changes" -command "apply_init {$w}"
X pack append $w.buttons.left \
X $w.buttons.left.apply {bottom fillx} \
X $w.buttons.left.add {left expand fillx} \
X $w.buttons.left.edit {left expand fillx} \
X $w.buttons.left.delete {left expand fillx}
X
X frame $w.buttons.right -relief raised
X button $w.buttons.right.up -text "Up" -command "userlist_up {$w}"
X button $w.buttons.right.down -text "Down" -command "userlist_down {$w}"
X button $w.buttons.right.move -text "Move" -command "userlist_move {$w}"
X button $w.buttons.right.sort -text "Sort" -command "userlist_sort {$w}"
X button $w.buttons.right.cancel -text "Cancel" -command "control_cancel"
X pack append $w.buttons.right \
X $w.buttons.right.cancel {bottom fillx} \
X $w.buttons.right.up {left expand fillx} \
X $w.buttons.right.down {left expand fillx} \
X $w.buttons.right.move {left expand fillx} \
X $w.buttons.right.sort {left expand fillx}
X
X pack append $w.buttons \
X $w.buttons.left {left expand fill} \
X $w.buttons.right {right expand fill}
X}
X
Xcontrol_menu_create {}
X#control_speedbar_create {}
Xuserlist_create {}
Xif {$CONTROL_PANEL == {T}} \
X{
X control_panel_create {}
X pack append . .menu {top expand fillx} .userlist {top expand fillx} .buttons {bottom expand fillx}
X} else \
X{
X pack append . .menu {top expand fillx} .userlist {top expand fillx}
X}
X
Xuserlist_update {} $passwd_text $group_text
X
Xbind .userlist.list <Double-Button-1> {edit_init {}}
X
Xproc control_cancel {} \
X{
X passwd_global_unlock
X passwd_unlock
X exit
X}
X
Xproc control_display_info {} \
X{
X global BACKGROUND_COLOR_MAIN
X catch \
X{
X toplevel .info -class Dialog -border 0
X wm title .info "UserMaint V1.0 by Charles A. Eads"
X frame .info.info -borderwidth 5 -background $BACKGROUND_COLOR_MAIN
X message .info.info.msg -font *times-bold-*-*-*-*-140-*-*-*-*-*-* -relief raised -aspect 250 \
X-text "\
X UserMaint V 1.0 by Charles A. Eads
X
XCopyright (c) 1993 The Regents of the University of California.
X All rights reserved.
X
XUserMaint is a user account maintenace package written in TCL/TK. \
XIt provides a generic and highly modifiable graphical interface between the \
XSystem Administrator and the /etc/passwd and /etc/group files. Refer to the \
Xmanual page for further details."
X frame .info.control -borderwidth 5 -background $BACKGROUND_COLOR_MAIN
X button .info.control.ok -text "OK" -command {destroy .info}
X pack append .info.info .info.info.msg {top}
X pack append .info.control .info.control.ok {top expand fillx}
X pack append .info .info.info {top expand fillx} .info.control {bottom expand fillx}
X}
X}
SHAR_EOF
if test 5858 -ne "`wc -c 'control.tcl'`"
then
echo shar: error transmitting "'control.tcl'" '(should have been 5858 characters)'
fi
echo shar: extracting "'edit.tcl'" '(3315 characters)'
if test -f 'edit.tcl'
then
echo shar: over-writing existing file "'edit.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'edit.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc edit_init {w} \
X{
X set index [$w.userlist.list curselection]
X if {$index == {}} return
X
X foreach i $index \
X {
X edit_create $w $i
X }
X}
X
Xproc edit_control_create {w win} \
X{
X global BACKGROUND_COLOR_ADD_EDIT
X frame $w.control -border 5 -background $BACKGROUND_COLOR_ADD_EDIT
X button $w.control.apply_changes -text "Apply Changes" -command "edit_apply_changes $w {$win}"
X button $w.control.cancel -width 13 -text "Cancel" -command "edit_finish $w {$win}"
X pack append $w.control \
X $w.control.apply_changes {left} \
X $w.control.cancel {right}
X}
X
Xproc edit_create {w index} \
X{
X upvar #0 window_number wnumber
X upvar #0 tmp_passwd_text([expr "{$w} == {} ? {.} : {$w}"]) tmp_passwd_text
X global group_text
X
X userlist_tag $w $index .edit-$wnumber
X
X toplevel .edit-$wnumber
X useredit_create .edit-$wnumber $w
X edit_control_create .edit-$wnumber $w
X
X pack append .edit-$wnumber .edit-$wnumber.useredit {top expand fill} .edit-$wnumber.control {bottom expand fill}
X
X set passwd_entry [file_to_normal [lindex $tmp_passwd_text $index]]
X useredit_init .edit-$wnumber \
X [passwd_get_username $passwd_entry] \
X [passwd_get_password $passwd_entry] \
X [passwd_get_uid $passwd_entry] \
X [passwd_get_gid $passwd_entry] \
X [passwd_get_gcos_field $passwd_entry] \
X [passwd_get_home_dir $passwd_entry] \
X [passwd_get_login_shell $passwd_entry]
X
X wm title .edit-$wnumber "EDIT: [passwd_get_realname $passwd_entry] ([passwd_get_username $passwd_entry])"
X
X incr wnumber
X}
X
Xproc edit_apply_changes {w win} \
X{
X upvar #0 tmp_passwd_text([expr "{$win} == {} ? {.} : {$win}"]) tmp_passwd_text
X upvar #0 tmp_gid($w) tmp_gid
X global group_text
X
X set i [userlist_tag_find $win $w]
X if { $i != -1 } \
X {
X set user_entry [useredit_get_user_entry $w]
X if {$user_entry == -1} return
X useredit_apply $w $win
X userlist_tag_remove $win $i $user_entry $w
X userlist_tag $win $i .edited
X set passwd_entry [useredit_get_passwd_entry $w]
X set tmp_passwd_text [lreplace $tmp_passwd_text $i $i [file_to_list $passwd_entry]]
X }
X destroy $w
X
X follow $win.userlist.list $i 30
X}
X
Xproc edit_finish {w win} \
X{
X set i [userlist_tag_find $win $w]
X if { $i != -1 } \
X {
X userlist_tag_remove $win $i [userlist_get_user_entry $win $i] $w
X }
X destroy $w
X}
SHAR_EOF
if test 3315 -ne "`wc -c 'edit.tcl'`"
then
echo shar: error transmitting "'edit.tcl'" '(should have been 3315 characters)'
fi
echo shar: extracting "'group-manip.tcl'" '(4124 characters)'
if test -f 'group-manip.tcl'
then
echo shar: over-writing existing file "'group-manip.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'group-manip.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc group_init {group_file_name} \
X{
X set group_file [open $group_file_name r]
X set group_text [file_to_list [read $group_file nonewline]]
X close $group_file
X return $group_text
X}
X
Xproc group_write_to_file {group_text group_file_name} \
X{
X set group_file [open $group_file_name w]
X foreach group_entry $group_text \
X {
X puts $group_file [file_to_normal $group_entry]
X }
X close $group_file
X}
X
Xproc group_translate { group_text group_gid } \
X{
X set index [lsearch $group_text *:*:$group_gid:*]
X if $index!=-1 {return [group_get_groupname [lindex $group_text $index]]}
X return {}
X}
X
Xproc group_get_groupname {group_entry} \
X{
X return [file_get_element $group_entry 0]
X}
X
Xproc group_get_password {group_entry} \
X{
X return [file_get_element $group_entry 1]
X}
X
Xproc group_get_gid {group_entry} \
X{
X return [file_get_element $group_entry 2]
X}
X
Xproc group_get_groupname_gid_translate {group_text group_gid} \
X{
X return "[group_translate $group_text $group_gid]($group_gid)"
X}
X
Xproc group_get_groupname_gid {group_entry} \
X{
X return "[group_get_groupname $group_entry]([group_get_gid $group_entry])"
X}
X
Xproc group_get_gid_from_groupname_gid {groupname_gid} \
X{
X set groupname_gid [split $groupname_gid "()"]
X return [lindex $groupname_gid [expr "[llength $groupname_gid] - 2"]]
X}
X
Xproc group_get_gid_list {group_text username} \
X{
X set gid_list {}
X foreach group_entry $group_text \
X {
X if [group_contains_user $group_entry $username] \
X {
X lappend gid_list [group_get_gid $group_entry]
X }
X }
X return $gid_list
X}
X
Xproc group_contains_user {group_entry username} \
X{
X if [lsearch [group_get_user_list $group_entry] $username]!=-1 {return 1}
X return 0
X}
X
Xproc group_get_user_list {group_entry} \
X{
X return [split [file_get_element $group_entry 3] ,]
X}
X
Xproc group_get_not_user_list {group_entry} \
X{
X return "[group_get_groupname $group_entry]:[group_get_password $group_entry]:[group_get_gid $group_entry]:"
X}
X
Xproc group_add_user {group_text username gid_list} \
X{
X set new_group_text {}
X foreach group_entry $group_text \
X {
X set group_entry [file_to_normal $group_entry]
X if { [lsearch $gid_list [group_get_gid $group_entry]] > -1 } \
X {
X set userlist [lunion [group_get_user_list $group_entry] $username]
X set userlist [lremove_spaces $userlist]
X regsub -all { } $userlist {,} userlist
X set group_entry "[group_get_not_user_list $group_entry]$userlist"
X }
X lappend new_group_text [file_to_list $group_entry]
X }
X return $new_group_text
X}
X
Xproc group_remove_user {group_text username} \
X{
X set new_group_text {}
X foreach group_entry $group_text \
X {
X set group_entry [file_to_normal $group_entry]
X set userlist [group_get_user_list $group_entry]
X set userindex [lsearch $userlist $username]
X if {$userindex > -1} \
X {
X set userlist [lreplace $userlist $userindex $userindex]
X set userlist [lremove_spaces $userlist]
X regsub -all { } $userlist {,} userlist
X set group_entry "[group_get_not_user_list $group_entry]$userlist"
X }
X lappend new_group_text [file_to_list $group_entry]
X }
X return $new_group_text
X}
SHAR_EOF
if test 4124 -ne "`wc -c 'group-manip.tcl'`"
then
echo shar: error transmitting "'group-manip.tcl'" '(should have been 4124 characters)'
fi
echo shar: extracting "'menu'" '(186 characters)'
if test -f 'menu'
then
echo shar: over-writing existing file "'menu'"
fi
sed 's/^X//' << \SHAR_EOF > 'menu'
X#define menu_width 9
X#define menu_height 9
Xstatic char menu_bits[] = {
X 0xff, 0x01, 0xff, 0x01, 0xd6, 0x00, 0xae, 0x00, 0x5c, 0x00, 0x6c, 0x00,
X 0x38, 0x00, 0x38, 0x00, 0x10, 0x00};
SHAR_EOF
if test 186 -ne "`wc -c 'menu'`"
then
echo shar: error transmitting "'menu'" '(should have been 186 characters)'
fi
echo shar: extracting "'passwd-manip.tcl'" '(5118 characters)'
if test -f 'passwd-manip.tcl'
then
echo shar: over-writing existing file "'passwd-manip.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'passwd-manip.tcl'
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xproc passwd_lock {} \
X{
X global PASSWD_LOCK_DIR
X return [catch {exec mkdir $PASSWD_LOCK_DIR}]
X}
X
Xproc passwd_global_lock {} \
X{
X global GLOBAL_PASSWD_LOCK_DIR
X if {$GLOBAL_PASSWD_LOCK_DIR == {}} {return 0}
X return [catch {exec mkdir $GLOBAL_PASSWD_LOCK_DIR}]
X}
X
Xproc passwd_unlock {} \
X{
X global PASSWD_LOCK_DIR
X catch {exec rmdir $PASSWD_LOCK_DIR}
X}
X
Xproc passwd_global_unlock {} \
X{
X global GLOBAL_PASSWD_LOCK_DIR
X catch {exec rmdir $GLOBAL_PASSWD_LOCK_DIR}
X}
X
Xproc passwd_init { passwd_file_name } \
X{
X set passwd_file [open $passwd_file_name r]
X set passwd_text [file_to_list [read $passwd_file nonewline]]
X close $passwd_file
X return $passwd_text
X}
X
Xproc passwd_write_to_file {passwd_text passwd_file_name} \
X{
X set passwd_file [open $passwd_file_name w]
X foreach passwd_entry $passwd_text \
X {
X puts $passwd_file [file_to_normal $passwd_entry]
X }
X close $passwd_file
X}
X
Xproc passwd_get_username {passwd_entry} \
X{
X return [file_get_element $passwd_entry 0]
X}
X
Xproc passwd_get_password {passwd_entry} \
X{
X return [file_get_element $passwd_entry 1]
X}
X
Xproc passwd_get_uid {passwd_entry} \
X{
X return [file_get_element $passwd_entry 2]
X}
X
Xproc passwd_get_gid {passwd_entry} \
X{
X return [file_get_element $passwd_entry 3]
X}
X
Xproc passwd_get_gcos_field {passwd_entry} \
X{
X return [file_get_element $passwd_entry 4]
X}
X
Xproc passwd_get_gcos_field_element {gcos_field element} \
X{
X set gcos_field [file_to_list $gcos_field]
X set gcos_field [lindex [split $gcos_field {,}] $element]
X return [file_to_normal $gcos_field]
X}
X
Xproc passwd_get_gcos_field1_passwd {passwd_entry} \
X{
X set gcos_field [passwd_get_gcos_field $passwd_entry]
X return [passwd_get_gcos_field_element $gcos_field 0]
X}
Xproc passwd_get_gcos_field1_gcos {gcos_field} \
X{
X return [passwd_get_gcos_field_element $gcos_field 0]
X}
X
Xproc passwd_get_gcos_field2_passwd {passwd_entry} \
X{
X set gcos_field [passwd_get_gcos_field $passwd_entry]
X return [passwd_get_gcos_field_element $gcos_field 1]
X}
Xproc passwd_get_gcos_field2_gcos {gcos_field} \
X{
X return [passwd_get_gcos_field_element $gcos_field 1]
X}
X
Xproc passwd_get_gcos_field3_passwd {passwd_entry} \
X{
X set gcos_field [passwd_get_gcos_field $passwd_entry]
X return [passwd_get_gcos_field_element $gcos_field 2]
X}
Xproc passwd_get_gcos_field3_gcos {gcos_field} \
X{
X return [passwd_get_gcos_field_element $gcos_field 2]
X}
X
Xproc passwd_get_gcos_field4_passwd {passwd_entry} \
X{
X set gcos_field [passwd_get_gcos_field $passwd_entry]
X return [passwd_get_gcos_field_element $gcos_field 3]
X}
Xproc passwd_get_gcos_field4_gcos {gcos_field} \
X{
X return [passwd_get_gcos_field_element $gcos_field 3]
X}
X
Xproc passwd_compress_gcos_field {gcos_field username} \
X{
X regsub -all [capitalize $username] $gcos_field {&} gcos_field
X return $gcos_field
X}
X
Xproc passwd_decompress_gcos_field {gcos_field username} \
X{
X regsub -all {&} $gcos_field [capitalize $username] gcos_field
X return $gcos_field
X}
X
Xproc passwd_get_realname {passwd_entry} \
X{
X set entry [passwd_get_gcos_field $passwd_entry]
X return [passwd_get_realname_gcos $entry [passwd_get_username $passwd_entry]]
X}
X
Xproc passwd_get_realname_gcos {entry username} \
X{
X set entry [file_to_list $entry]
X set entry [lindex [split $entry {,}] 0]
X set entry [file_to_normal $entry]
X return [passwd_decompress_gcos_field $entry $username]
X}
X
Xproc passwd_get_home_dir {passwd_entry} \
X{
X return [file_get_element $passwd_entry 5]
X}
X
Xproc passwd_get_login_shell {passwd_entry} \
X{
X return [file_get_element $passwd_entry 6]
X}
X
Xproc passwd_construct {username password uid gid gcos_field \
X home_dir login_shell} \
X{
X return $username:$password:$uid:$gid:$gcos_field:$home_dir:$login_shell
X}
X
Xproc passwd_crypt_internal {passwd salt} \
X{
X return [exec perl -e "print crypt(\"$passwd\",\"$salt\"),\"\\n\";"]
X}
X
Xproc passwd_crypt {passwd} \
X{
X set valid_chars "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
X set salt [string index $valid_chars [rand 64]][string index $valid_chars [rand 64]]
X set passwd [passwd_crypt_internal $passwd $salt]
X return $passwd
X}
SHAR_EOF
if test 5118 -ne "`wc -c 'passwd-manip.tcl'`"
then
echo shar: error transmitting "'passwd-manip.tcl'" '(should have been 5118 characters)'
fi
echo shar: extracting "'space'" '(189 characters)'
if test -f 'space'
then
echo shar: over-writing existing file "'space'"
fi
sed 's/^X//' << \SHAR_EOF > 'space'
X#define space_width 9
X#define space_height 9
Xstatic char space_bits[] = {
X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
if test 189 -ne "`wc -c 'space'`"
then
echo shar: error transmitting "'space'" '(should have been 189 characters)'
fi
echo shar: extracting "'title.tcl'" '(1707 characters)'
if test -f 'title.tcl'
then
echo shar: over-writing existing file "'title.tcl'"
fi
sed 's/^X//' << \SHAR_EOF > 'title.tcl'
X#!/usr/cluster/bin/wish -f
X#
X# UserMaint V1.0 by Charles A. Eads
X#
X# Copyright (c) 1993 The Regents of the University of California.
X# All rights reserved.
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose, without fee, and without written agreement is
X# hereby granted, provided that the above copyright notice and the following
X# two paragraphs appear in all copies of this software.
X#
X# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
X# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
X# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
X# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X#
X# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
X# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
X# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
X# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
X# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
X
Xsource usermaint-config
Xwm withdraw .
Xtoplevel .w -class Dialog -border 0
Xwm title .w "UserMaint V1.0 by Charles A. Eads"
Xwm transient .w .
Xwm geometry .w +400+10
Xframe .w.f1 -border 5 -background $BACKGROUND_COLOR_MAIN
Xlabel .w.f1.l -relief raised -text "UserMaint V1.0 by Charles A. Eads" -font -*-times-bold-*-*-*-*-240-*-*-*-*-*-*
Xpack append .w.f1 .w.f1.l {top expand fillx}
Xpack append .w .w.f1 {top expand fillx}
Xbind .w <Any-Button-1> "catch {destroy .}"
Xbind .w.f1 <Any-Button-1> "catch {destroy .}"
Xbind .w.f1.l <Any-Button-1> "catch {destroy .}"
Xafter 7500 "catch {destroy .}"
SHAR_EOF
if test 1707 -ne "`wc -c 'title.tcl'`"
then
echo shar: error transmitting "'title.tcl'" '(should have been 1707 characters)'
fi
chmod +x 'title.tcl'
# End of shell archive
cd ../..
exit 0

De Clarke

unread,
Mar 16, 1993, 10:56:04 PM3/16/93
to
210) helios.UCSC.EDU.de: wish
Error: Can't access Tcl default file,
Located in one of the following ways:
Environment variable: `TCLDEFAULT' or,
File `/usr/local/tcl/lib/tcldefault6.7c'.

The envar is not set, but the file exists! Look:

211) helios.UCSC.EDU.de: ls -l /usr/local/tcl/lib
total 955
drwxr-xr-x 2 wizard 512 Mar 16 19:36 ./
drwxrwxrwx 7 wizard 512 Mar 16 19:37 ../
-rw-r--r-- 1 wizard 368922 Mar 16 19:35 libtcl.a
-rw-r--r-- 1 wizard 577936 Mar 16 19:36 libtk.a
-rwxr-xr-x 1 wizard 109 Mar 16 19:35 tcldefault6.7c*

OK, so let's set the envar to that exact same filename:

212) helios.UCSC.EDU.de: setenv TCLDEFAULT /usr/local/tcl/lib/tcldefault6.7c

And now wish is happy.

This happened to me once before. Please someone remind me of the
cure? Why does wish know exactly what file to look at, yet pretend
that it is not there?
..............................................................................
: De Clarke, Computing Resources Mgr. UCO/Lick Observatory, UCSC :
: d...@helios.ucsc.edu | Due to budgetary shortfalls, the light at the end of :
: d...@portal.bitnet | the tunnel has been turned off. --Anon :

0 new messages