Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-updates-src > by-pkgid > 8fda3ecf7b23856f7036f304b55572dc > files > 18

glibc-2.4-7mdv2007.0.src.rpm

--- glibc-2.3.4/nscd/connections.c.nscd-HUP	2004-10-29 11:52:24.000000000 +0200
+++ glibc-2.3.4/nscd/connections.c	2004-12-28 14:40:36.580532757 +0100
@@ -1530,7 +1530,6 @@ start_threads (void)
   main_loop_poll ();
 }
 
-
 /* Look up the uid, gid, and supplementary groups to run nscd as. When
    this function is called, we are not listening on the nscd socket yet so
    we can just use the ordinary lookup functions without causing a lockup  */
@@ -1599,3 +1598,18 @@ finish_drop_privileges (void)
       exit (1);
     }
 }
+
+/* Handle the HUP signal which will force a dump of the cache */
+void
+sighup_handler (int signum)
+{
+    /* Prune the password database */
+    prune_cache (&dbs[pwddb], LONG_MAX);
+    
+    /* Prune the group database */
+    prune_cache (&dbs[grpdb], LONG_MAX);
+
+    /* Prune the host database */
+    prune_cache (&dbs[hstdb], LONG_MAX);
+}
+
--- glibc-2.3.4/nscd/nscd.c.nscd-HUP	2004-10-07 13:34:04.000000000 +0200
+++ glibc-2.3.4/nscd/nscd.c	2004-12-28 14:41:47.464016388 +0100
@@ -125,6 +125,9 @@ static struct argp argp =
 /* True if only statistics are requested.  */
 static bool get_stats;
 
+/* The SIGHUP handler is extern to this file */
+extern void sighup_handler(int signum);
+
 int
 main (int argc, char **argv)
 {
@@ -266,6 +269,7 @@ main (int argc, char **argv)
   signal (SIGINT, termination_handler);
   signal (SIGQUIT, termination_handler);
   signal (SIGTERM, termination_handler);
+  signal (SIGHUP, sighup_handler);
   signal (SIGPIPE, SIG_IGN);
 
   /* Cleanup files created by a previous 'bind'.  */