1 |
diff -up e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps.fix_modify e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps |
2 |
--- e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps.fix_modify 2008-10-07 11:37:34.000000000 -0600 |
3 |
+++ e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps 2010-10-27 15:24:17.000000000 -0600 |
4 |
@@ -37,7 +37,7 @@ my %ridmap = ( |
5 |
'Domain Users' => '513', |
6 |
'Domain Guests' => '514'); |
7 |
|
8 |
-my %mapping_done = (); |
9 |
+my %sidmap = (); |
10 |
foreach (`/usr/bin/net groupmap list`) |
11 |
{ |
12 |
chomp; |
13 |
@@ -58,12 +58,14 @@ foreach (`/usr/bin/net groupmap list`) |
14 |
elsif ($sid =~ /^$local_sid-/) |
15 |
{ |
16 |
my $ug = $mappings{$nt}; |
17 |
- system('/usr/bin/net',$debug, |
18 |
- 'groupmap','modify', |
19 |
- "sid=$sid", |
20 |
- "unixgroup=$ug", |
21 |
- 'type=d') unless ($group eq $ug); |
22 |
- $mapping_done{$nt} = 1; |
23 |
+ if ($group eq $ug) |
24 |
+ { |
25 |
+ $sidmap{$nt} = 'done'; |
26 |
+ } |
27 |
+ else |
28 |
+ { |
29 |
+ system('/usr/bin/net','groupmap','delete',"sid=$sid"); |
30 |
+ } |
31 |
} |
32 |
else |
33 |
{ |
34 |
@@ -81,11 +83,12 @@ foreach (`/usr/bin/net groupmap list`) |
35 |
|
36 |
foreach (keys %mappings) |
37 |
{ |
38 |
- next if $mapping_done{$_}; |
39 |
+ next if $sidmap{$_} && $sidmap{$_} eq 'done'; |
40 |
system('/usr/bin/net',$debug, |
41 |
'groupmap','add', |
42 |
"ntgroup=$_", |
43 |
"unixgroup=" . $mappings{$_}, |
44 |
$ridmap{$_} ? "rid=$ridmap{$_}" : (), |
45 |
+ $sidmap{$_} && ! $ridmap{$_} ? "sid=$sidmap{$_}" : (), |
46 |
'type=d'); |
47 |
} |