]>
Commit | Line | Data |
---|---|---|
a226ebb8 | 1 | diff -urN samba-2.0.7/packaging/RedHat/smbadduser samba-2.0.7.new/packaging/RedHat/smbadduser |
2 | --- samba-2.0.7/packaging/RedHat/smbadduser Fri Aug 21 16:20:38 1998 | |
3 | +++ samba-2.0.7.new/packaging/RedHat/smbadduser Tue Aug 8 10:23:42 2000 | |
4 | @@ -2,11 +2,17 @@ | |
5 | # | |
6 | # smbadduser - Written by Mike Zakharoff | |
7 | # | |
8 | +# * Sun Aug 6 2000 Philipp Knirsch <pknirsch@redhat.com> | |
9 | +# - Bugfix to change file location from /etc to /etc/samba and to use | |
10 | +# smbpasswd -a to add the user entry to the smbpasswd file in case it didn't | |
11 | +# exist before. | |
12 | +# | |
13 | + | |
14 | unalias * | |
15 | set path = ($path) | |
16 | ||
17 | -set smbpasswd = /etc/smbpasswd | |
18 | -set user_map = /etc/smbusers | |
19 | +set smbpasswd = /etc/samba/smbpasswd | |
20 | +set user_map = /etc/samba/smbusers | |
21 | # | |
22 | # Set to site specific passwd command | |
23 | # | |
24 | @@ -46,19 +52,23 @@ | |
25 | echo "ERROR: $unix Not in passwd database SKIPPING..." | |
26 | continue | |
27 | endif | |
28 | - set tmp = `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix` | |
29 | - if ($#tmp != 0) then | |
30 | - echo "ERROR: $unix is already in $smbpasswd SKIPPING..." | |
31 | - continue | |
32 | - endif | |
33 | ||
34 | - echo "Adding: $unix to $smbpasswd" | |
35 | - eval $passwd | \ | |
36 | - awk -F: '$1==USR { \ | |
37 | - printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n", $1, $3, $5, $6, $7) }' USR=$unix >> $smbpasswd | |
38 | + # Fix 8/7/2000 Phil Knirsch: Removed the smbpasswd stuff here and fixed | |
39 | + # the way the usermap gets updated as that one was really wrong: If a | |
40 | + # user was added twice the usermap would contain 2 entries! We now | |
41 | + # first select the existing entry, remove it from the usermap and add | |
42 | + # a new one with the new ntid. If something goes wrong the new entry | |
43 | + # will as before simply be added to the file (for manual fixing later). | |
44 | + set usr = `eval cat $user_map | awk -F= '{if(match($1, USR" *") != 0) print $2}' USR=$unix` | |
45 | + | |
46 | if ($unix != $ntid) then | |
47 | - echo "Adding: {$unix = $ntid} to $user_map" | |
48 | - echo "$unix = $ntid" >> $user_map | |
49 | + echo "Adding: {$unix = $usr $ntid} to $user_map" | |
50 | + cat $user_map | sed /"$unix.*"/d > $user_map.new | |
51 | + if (-e $user_map.new) then | |
52 | + cp $user_map.new $user_map | |
53 | + endif | |
54 | + rm $user_map.new | |
55 | + echo "$unix = $usr $ntid" >> $user_map | |
56 | endif | |
57 | set new = ($new $unix) | |
58 | end | |
59 | @@ -69,5 +79,9 @@ | |
60 | foreach one ($new) | |
61 | echo $line | |
62 | echo "ENTER password for $one" | |
63 | - smbpasswd $one | |
64 | + | |
65 | + # Fix Phil Knirsch 8/6/2000: Use the -a option to create the user | |
66 | + # entry in case it didn't exist before. This way we get rid of the | |
67 | + # file format dependent awk replacement in the previous version. | |
68 | + smbpasswd -a $one | |
69 | end |