Changeset 11457 for trunk

Show
Ignore:
Timestamp:
09/29/08 18:01:14 (3 months ago)
Author:
juruen@…
Message:

+ Bugfix. Check and correct if there is a user or group with a wrong SID.
It's possible to run into that scenarion depending when the user/group is
created

Location:
trunk/client/samba
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/client/samba/ChangeLog

    r11443 r11457  
     10.12.4 
     2        + Bugfix. Check and correct if there is a user or group with a wrong SID. 
     3        It's possible to run into that scenarion depending when the user/group is 
     4        created 
    150.12.3 
    26        + Add configuration variable to enable/disable quota support 
  • trunk/client/samba/configure.ac

    r11444 r11457  
    1 AC_INIT([EBox-samba], [0.12.3]) 
     1AC_INIT([EBox-samba], [0.12.4]) 
    22 
    33AC_CONFIG_AUX_DIR([config]) 
  • trunk/client/samba/src/EBox/Samba.pm

    r11443 r11457  
    364364    $smbimpl->setSambaDomainName($self->workgroup) ; 
    365365    $smbimpl->updateNetbiosName($self->netbios); 
     366    $smbimpl->updateSIDEntries(); 
    366367 
    367368    my @array = (); 
  • trunk/client/samba/src/EBox/SambaLdapUser.pm

    r10429 r11457  
    952952                        base => "dc=ebox",  
    953953                        filter => "(objectclass=sambaDomain)",  
     954                         
    954955                        scope => "sub" 
    955956                    );  
     
    11611162} 
    11621163 
     1164# Method: updateSIDEntries 
     1165#        
     1166#               Check and correct if there's any user or group with a wrong SID. Note 
     1167#               that depending on when the user/group is created the SID might change. 
     1168#               This method should be run in regenConfig 
     1169# 
     1170#        
     1171sub updateSIDEntries 
     1172{ 
     1173        my ($self) = @_; 
     1174 
     1175        my $users = EBox::Global->modInstance('users'); 
     1176        my $ldap = $self->{'ldap'}; 
     1177        my $userDN = $users->usersDn(); 
     1178        my $sid = uc(getSID()); 
     1179        $sid = uc($sid); 
     1180 
     1181        my %attrs = ( 
     1182                        base   => $userDN, 
     1183                        filter => "(&(objectclass=sambaSamAccount)(!(sambaSID=$sid*)))", 
     1184                        attrs  => ['sambaSID', 'sambaPrimaryGroupSID', 'dn'], 
     1185                        scope  => 'sub' 
     1186                        ); 
     1187 
     1188        my $result = $ldap->search(\%attrs); 
     1189 
     1190        for my $entry ($result->entries()) { 
     1191                my $oldSID = $entry->get_value('sambaSID'); 
     1192                my $oldGroupSID = $entry->get_value('sambaPrimaryGroupSID'); 
     1193                my ($lastNumbers) = $oldSID =~ /.*-(\d+)$/; 
     1194                my $newSID = "$sid-$lastNumbers"; 
     1195                my ($lastNumbersGroup) = $oldGroupSID =~ /.*-(\d+)$/; 
     1196                my $newGroupSID = "$sid-$lastNumbersGroup"; 
     1197                $ldap->modifyAttribute($entry->dn(), 'sambaSID', $newSID); 
     1198                $ldap->modifyAttribute($entry->dn(),  
     1199                                'sambaPrimaryGroupSID',  
     1200                                $newGroupSID); 
     1201        } 
     1202 
     1203        my $groupDN = $users->groupsDn(); 
     1204        %attrs = ( 
     1205                        base   => $groupDN, 
     1206                        filter => "(&(objectclass=sambaGroupMapping)(!(sambaSID=$sid*)))", 
     1207                        attrs  => ['sambaSID'], 
     1208                        scope  => 'sub' 
     1209                        ); 
     1210 
     1211        $result = $ldap->search(\%attrs); 
     1212 
     1213        for my $entry ($result->entries()) { 
     1214                my $oldSID = $entry->get_value('sambaSID'); 
     1215                my ($lastNumbers) = $oldSID =~ /.*-(\d+)$/; 
     1216                my $newSID = "$sid-$lastNumbers"; 
     1217                $ldap->modifyAttribute($entry->dn(), 'sambaSID', $newSID); 
     1218        } 
     1219} 
     1220 
     1221 
    11631222sub _isSambaObject($$$) { 
    11641223        my $self = shift;