SOURCES: smbldap-tools-nscd.patch (NEW) - call nscd invalidate rat...

glen glen at pld-linux.org
Thu Aug 3 18:59:05 CEST 2006


Author: glen                         Date: Thu Aug  3 16:59:05 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- call nscd invalidate rather stopping/restarting whole service

---- Files affected:
SOURCES:
   smbldap-tools-nscd.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/smbldap-tools-nscd.patch
diff -u /dev/null SOURCES/smbldap-tools-nscd.patch:1.1
--- /dev/null	Thu Aug  3 18:59:05 2006
+++ SOURCES/smbldap-tools-nscd.patch	Thu Aug  3 18:59:00 2006
@@ -0,0 +1,171 @@
+--- smbldap-tools-0.9.2/smbldap-usermod~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap-usermod	2006-08-03 19:52:16.913071888 +0300
+@@ -34,7 +34,6 @@
+ 
+ use Getopt::Std;
+ my %Options;
+-my $nscd_status;
+ 
+ my $ok = getopts('A:B:C:D:E:F:H:IJM:N:S:PT:ame:f:u:g:G:d:l:r:s:c:ok:?h', \%Options);
+ if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) || ($Options{'h'}) ) {
+@@ -134,24 +133,12 @@
+ my $_userRid;
+ if (defined($tmp = $Options{'u'})) {
+   if (defined($Options{'o'})) {
+-    $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-	
+-    if ($nscd_status == 0) {
+-      system "/etc/init.d/nscd stop > /dev/null 2>&1";
+-    }
++    system "/usr/sbin/nscd -i passwd" if -x "/usr/sbin/nscd";
+ 
+     if (getpwuid($tmp)) {
+-      if ($nscd_status == 0) {
+-	system "/etc/init.d/nscd start > /dev/null 2>&1";
+-      }
+-
+       print "$0: uid number $tmp exists\n";
+       exit (6);
+     }
+-    if ($nscd_status == 0) {
+-      system "/etc/init.d/nscd start > /dev/null 2>&1";
+-    }
+-
+   }
+   push(@mods, 'uidNumber', $tmp);
+   $_userUidNumber = $tmp;
+@@ -529,11 +516,7 @@
+   $ldap_master->unbind;
+ }
+ 
+-$nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd restart > /dev/null 2>&1";
+-}
++system "/usr/sbin/nscd -i passwd" if -x "/usr/sbin/nscd";
+ 
+ if (defined($Options{'P'})) {
+   exec "$RealBin/smbldap-passwd $user"
+--- smbldap-tools-0.9.2/smbldap_tools.pm~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap_tools.pm	2006-08-03 19:53:47.965109611 +0300
+@@ -693,10 +693,7 @@
+ sub group_add
+   {
+ 	my ($gname, $gid, $force) = @_;
+-	my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-	if ($nscd_status == 0) {
+-	  system "/etc/init.d/nscd stop > /dev/null 2>&1";
+-	}
++	system "/usr/sbin/nscd -i group" if -x "/usr/sbin/nscd";
+ 	if (!defined($gid)) {
+ 	  #while (defined(getgrgid($config{GID_START}))) {
+ 	  #	$config{GID_START}++;
+@@ -710,9 +707,6 @@
+ 		}
+ 	  }
+ 	}
+-	if ($nscd_status == 0) {
+-	  system "/etc/init.d/nscd start > /dev/null 2>&1";
+-	}
+ 	my $modify = $ldap->add ( "cn=$gname,$config{groupsdn}",
+ 									 attrs => [
+ 											   objectClass => [ 'top', 'posixGroup' ],
+--- smbldap-tools-0.9.2/smbldap-useradd~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap-useradd	2006-08-03 19:56:17.748461827 +0300
+@@ -75,16 +75,6 @@
+ 
+ my $ldap_master=connect_ldap_master();
+ 
+-
+-# cause problems when dealing with getpwuid because of the
+-# negative ttl and ldap modification
+-my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd stop > /dev/null 2>&1";
+-}
+-
+-
+ # Read only first @ARGV
+ my $userName = $ARGV[0];
+ 
+@@ -103,6 +93,8 @@
+   exit (1);
+ }
+ 
++system "/usr/sbin/nscd -i passwd" if -x "/usr/sbin/nscd";
++
+ # user must not exist in LDAP (should it be nss-wide ?)
+ my ($rc, $dn) = get_user_dn2($userName);
+ if ($rc and defined($dn)) {
+@@ -152,10 +144,6 @@
+   die "Uid already exists.\n";
+ }
+ 
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd start > /dev/null 2>&1";
+-}
+-
+ my $createGroup = 0;
+ my $userGidNumber = $Options{'g'};
+ # gid not specified ? 
+--- smbldap-tools-0.9.2/smbldap-userdel~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap-userdel	2006-08-03 19:56:57.219345223 +0300
+@@ -95,12 +95,7 @@
+   system('rm', @rmargs, $homedir);
+ }
+ 
+-my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd restart > /dev/null 2>&1";
+-}
+-
++system "/usr/sbin/nscd -i passwd" if -x "/usr/sbin/nscd";
+ $ldap_master->unbind;		# take down session
+ 
+ exit (0);
+--- smbldap-tools-0.9.2/smbldap-groupmod~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap-groupmod	2006-08-03 19:57:32.490134624 +0300
+@@ -65,11 +65,7 @@
+ 
+ my $newname = $Options{'n'};
+ 
+-my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd restart > /dev/null 2>&1";
+-}
++system "/usr/sbin/nscd -i group" if -x "/usr/sbin/nscd";
+ 
+ my $gid = getgrnam($groupName);
+ unless (defined ($gid)) {
+@@ -222,12 +218,6 @@
+   $modify->code && warn "failed to delete entry: ", $modify->error ;
+ }
+ 
+-$nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd restart > /dev/null 2>&1";
+-}
+-
+ # take down session
+ $ldap_master->unbind;
+ 
+--- smbldap-tools-0.9.2/smbldap-groupdel~	2006-01-03 12:57:41.000000000 +0200
++++ smbldap-tools-0.9.2/smbldap-groupdel	2006-08-03 19:57:59.760744975 +0300
+@@ -56,11 +56,7 @@
+ 
+ group_del($dn);
+ 
+-my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
+-
+-if ($nscd_status == 0) {
+-  system "/etc/init.d/nscd restart > /dev/null 2>&1";
+-}
++system "/usr/sbin/nscd -i group" if -x "/usr/sbin/nscd";
+ 
+ #if (defined($dn_line = get_group_dn($_groupName))) {
+ #    print "$0: failed to delete group\n";
================================================================


More information about the pld-cvs-commit mailing list