Ignore:
Timestamp:
03/12/18 14:22:15 (7 years ago)
Author:
Edwin Eefting <edwin@datux.nl>
Branches:
master, perl-5.22
Children:
fdfd619
Parents:
1051986
Message:

flush nscd cache when modifying users

File:
1 edited

Legend:

Unmodified
Added
Removed
  • npl/fileserver/smb-ldap-tool/modified/smbldap_tools.pm

    r1051986 r3187b26  
    241241        undef $smbconf{$parameter_smb};
    242242  }
    243  
     243
    244244}
    245245
     
    287287                                                                         # debug => 0xffff,
    288288                                                                        );
    289                                                                        
     289
    290290        if ($ldap_master)
    291291        {
     
    542542                                                                                  ]
    543543                                                                );
    544        
     544
    545545        $add->code && warn "failed to add entry: ", $add->error ;
    546546        sleep($wait);
     
    564564        $name =~ s/.$//s;
    565565
    566         my ($lmpassword,$ntpassword) = ntlmgen $name;   
     566        my ($lmpassword,$ntpassword) = ntlmgen $name;
    567567        my $modify = $ldap->modify ( "uid=$user,$config{computersdn}",
    568568                                                                                changes => [
     
    581581                                                                                                   ]
    582582                                                                          );
    583        
     583
    584584        $modify->code && die "failed to add entry: ", $modify->error ;
    585585
     
    594594        if (!defined(get_group_dn($group))) {
    595595          print "$0: group \"$group\" doesn't exist\n";
    596           exit (6); 
     596          exit (6);
    597597        }
    598598        if (!defined($dn_line)) {
     
    666666  }
    667667
    668  
     668
    669669sub add_grouplist_user
    670670{
     
    683683        my $dn_line;
    684684        my $dn = get_dn_from_line($dn_line);
    685        
     685
    686686        if (!defined($dn_line = get_user_dn($user))) {
    687687          print "$0: user $user doesn't exist\n";
     
    725725  {
    726726        my ($gname, $gid, $force) = @_;
    727         my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
    728         if ($nscd_status == 0) {
    729           system "/etc/init.d/nscd stop > /dev/null 2>&1";
    730         }
     727        # my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
     728        # if ($nscd_status == 0) {
     729        #   system "/etc/init.d/nscd stop > /dev/null 2>&1";
     730        # }
    731731        if (!defined($gid)) {
    732732          #while (defined(getgrgid($config{GID_START}))) {
     
    742742          }
    743743        }
    744         if ($nscd_status == 0) {
    745           system "/etc/init.d/nscd start > /dev/null 2>&1";
    746         }
     744        # if ($nscd_status == 0) {
     745          # system "/etc/init.d/nscd start > /dev/null 2>&1";
     746          system "nscd -i passwd; nscd -i group";
     747        # }
    747748        my $modify = $ldap->add ( "cn=$gname,$config{groupsdn}",
    748749                                                                         attrs => [
     
    752753                                                                                          ]
    753754                                                                   );
    754        
     755
    755756        $modify->code && die "failed to add entry: ", $modify->error ;
    756757        return $gid;
     
    10781079        }
    10791080        my $entry = $next_uid_mesg->entry(0);
    1080            
     1081
    10811082        $nextuid = $entry->get_value($attribute);
    10821083        my $modify=$ldap->modify( "$config{sambaUnixIdPooldn}",
     
    11031104
    11041105sub utf8Encode {
    1105   my $arg = shift; 
     1106  my $arg = shift;
    11061107
    11071108  return to_utf8(
     
    11181119                                   -charset => 'ISO-8859-1',
    11191120                                  );
    1120 }   
     1121}
    11211122
    112211231;
    1123 
Note: See TracChangeset for help on using the changeset viewer.