diff options
author | John Terpstra <jht@samba.org> | 1998-08-21 14:20:38 +0000 |
---|---|---|
committer | John Terpstra <jht@samba.org> | 1998-08-21 14:20:38 +0000 |
commit | c8f34dac393efcf4823736c9f804ac1412556cb9 (patch) | |
tree | 55e1cefcd8b760f104c76b32945e86172f124d59 /packaging/RedHat/smbadduser | |
parent | 038e3433d39337f736b7b69ac1e6212e9f8e5406 (diff) | |
download | samba-c8f34dac393efcf4823736c9f804ac1412556cb9.tar.gz samba-c8f34dac393efcf4823736c9f804ac1412556cb9.tar.xz samba-c8f34dac393efcf4823736c9f804ac1412556cb9.zip |
Adding first cut of the new Red Hat Linux packaging tools.
Note: It is intended to extend this so that the release
process produces all the packaging scripts, templates, etc.
that may be needed.
(This used to be commit 6e196841c618044d33da45d3de5371004a58e4c6)
Diffstat (limited to 'packaging/RedHat/smbadduser')
-rwxr-xr-x | packaging/RedHat/smbadduser | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/packaging/RedHat/smbadduser b/packaging/RedHat/smbadduser new file mode 100755 index 00000000000..2f38bf28f1a --- /dev/null +++ b/packaging/RedHat/smbadduser @@ -0,0 +1,73 @@ +#!/bin/csh +# +# smbadduser - Written by Mike Zakharoff +# +unalias * +set path = ($path) + +set smbpasswd = /etc/smbpasswd +set user_map = /etc/smbusers +# +# Set to site specific passwd command +# +set passwd = "cat /etc/passwd" +#set passwd = "niscat passwd.org_dir" +#set passwd = "ypcat passwd" + +set line = "----------------------------------------------------------" +if ($#argv == 0) then + echo $line + echo "Written: Mike Zakharoff email: michael.j.zakharoff@boeing.com" + echo "" + echo " 1) Updates $smbpasswd" + echo " 2) Updates $user_map" + echo " 3) Executes smbpasswd for each new user" + echo "" + echo "smbadduser unixid:ntid unixid:ntid ..." + echo "" + echo "Example: smbadduser zak:zakharoffm johns:smithj" + echo $line + exit 1 +endif + +touch $smbpasswd $user_map +set new = () +foreach one ($argv) + echo $one | grep ':' >& /dev/null + if ($status != 0) then + echo "ERROR: Must use unixid:ntid like -> zak:zakharoffm" + continue + endif + set unix = `echo $one | awk -F: '{print $1}'` + set ntid = `echo $one | awk -F: '{print $2}'` + + set usr = `eval $passwd | awk -F: '$1==USR {print $1}' USR=$unix` + if ($#usr != 1) then + echo "ERROR: $unix Not in passwd database SKIPPING..." + continue + endif + set tmp = `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix` + if ($#tmp != 0) then + echo "ERROR: $unix is already in $smbpasswd SKIPPING..." + continue + endif + + echo "Adding: $unix to $smbpasswd" + eval $passwd | \ + awk -F: '$1==USR { \ + printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n", $1, $3, $5, $6, $7) }' USR=$unix >> $smbpasswd + if ($unix != $ntid) then + echo "Adding: {$unix = $ntid} to $user_map" + echo "$unix = $ntid" >> $user_map + endif + set new = ($new $unix) +end + +# +# Enter password for new users +# +foreach one ($new) + echo $line + echo "ENTER password for $one" + smbpasswd $one +end |