mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
2a8730b21c
* file.c (move_dir_dir): Give an error when an attempt is made to move an empty directory into itself. 1999-06-14 Wayne Roberts <wroberts1@cx983858-b.orng1.occa.home.com> * vfs/smbfs.c: New file. Implements the Samba-based file system. * vfs/vfs.h: Declare vfs_smbfs_ops, vfs_file_is_smb. * vfs/vfs.c (vfs_file_is_smb): implemented. (vfs_init) register smbfs. * vfs/samba: Incorporate SAMBA source code required for smbfs 1999-05-27 Miguel de Icaza <miguel@nuclecu.unam.mx> * Make.common.in (confdir): Define confdir as sysconfdir. This should fix the problem we had with FSSTND distributions.
74 lines
1.9 KiB
Tcsh
74 lines
1.9 KiB
Tcsh
#!/bin/csh
|
|
#
|
|
# smbadduser - Written by Mike Zakharoff
|
|
#
|
|
unalias *
|
|
set path = ($path /usr/local/samba/bin)
|
|
|
|
set smbpasswd = /usr/local/samba/private/smbpasswd
|
|
set user_map = /usr/local/samba/lib/users.map
|
|
#
|
|
# 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
|