1 diff -urN samba-2.2.0.org/source/smbadduser samba-2.2.0/source/smbadduser
2 --- samba-2.2.0.org/source/smbadduser Wed Apr 18 01:27:35 2001
3 +++ samba-2.2.0/source/smbadduser Wed Apr 18 01:33:08 2001
5 # smbadduser - Written by Mike Zakharoff
8 -set path = ($path /usr/local/samba/bin)
9 +set path = ($path /usr/bin)
11 -set smbpasswd = /usr/local/samba/private/smbpasswd
12 -set user_map = /usr/local/samba/lib/users.map
13 +set smbpasswd = /etc/samba/smbpasswd
14 +set user_map = /etc/samba/users.map
16 # Set to site specific passwd command
19 echo "ERROR: $unix Not in passwd database SKIPPING..."
22 - set tmp = `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix`
23 - if ($#tmp != 0) then
24 - echo "ERROR: $unix is already in $smbpasswd SKIPPING..."
28 - echo "Adding: $unix to $smbpasswd"
30 - awk -F: '$1==USR { \
31 - printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n", $1, $3, $5, $6, $7) }' USR=$unix >> $smbpasswd
32 + # Fix 8/7/2000 Phil Knirsch: Removed the smbpasswd stuff here and fixed
33 + # the way the usermap gets updated as that one was really wrong: If a
34 + # user was added twice the usermap would contain 2 entries! We now
35 + # first select the existing entry, remove it from the usermap and add
36 + # a new one with the new ntid. If something goes wrong the new entry
37 + # will as before simply be added to the file (for manual fixing later).
38 + set usr = `eval cat $user_map | awk -F= '{if(match($1, USR" *") != 0) print $2}' USR=$unix`
40 if ($unix != $ntid) then
41 - echo "Adding: {$unix = $ntid} to $user_map"
42 - echo "$unix = $ntid" >> $user_map
43 + echo "Adding: {$unix = $usr $ntid} to $user_map"
44 + cat $user_map | sed /"$unix.*"/d > $user_map.new
45 + if (-e $user_map.new) then
46 + cp $user_map.new $user_map
49 + echo "$unix = $usr $ntid" >> $user_map
51 set new = ($new $unix)
56 echo "ENTER password for $one"
59 + # Fix Phil Knirsch 8/6/2000: Use the -a option to create the user
60 + # entry in case it didn't exist before. This way we get rid of the
61 + # file format dependent awk replacement in the previous version.