[Koha-cvs] CVS: koha/acqui.simple processz3950queue,1.3.2.3,1.3.2.4

Steve Tonnesen tonnesen at users.sourceforge.net
Sun Jun 30 22:53:45 CEST 2002


Update of /cvsroot/koha/koha/acqui.simple
In directory usw-pr-cvs1:/tmp/cvs-serv24306

Modified Files:
      Tag: rel-1-2
	processz3950queue 
Log Message:
Modified processz3950queue to create a pid file in /var/run (if it exists) and
then drop root privileges to the apache user before doing anything else.  Still
needs a good init script to start/stop/restart.


Index: processz3950queue
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/processz3950queue,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -C2 -r1.3.2.3 -r1.3.2.4
*** processz3950queue	28 Jun 2002 17:45:39 -0000	1.3.2.3
--- processz3950queue	30 Jun 2002 20:53:41 -0000	1.3.2.4
***************
*** 7,10 ****
--- 7,30 ----
  use C4::Output;
  use Net::Z3950;
+ 
+ 
+ if ($< == 0) {
+     # Running as root, switch privs 
+     if (-d "/var/run") {
+ 	open PID, ">/var/run/processz3950queue.pid";
+ 	print PID $$."\n";
+ 	close PID;
+     }
+     # Get real apacheuser from koha.conf or reparsing httpd.conf
+     my $apacheuser='www-data';  
+     my $uid=0;
+     unless ($uid = (getpwnam($apacheuser))[2]) { 
+ 	die "Attempt to run daemon as non-existent or superuser\n";
+     }
+     $>=$uid;
+     $<=$uid;
+ }
+     
+ 
  my $dbh=C4Connect;
  
***************
*** 21,24 ****
--- 41,45 ----
  print PID $$."\n";
  close PID;
+ 
  my $reapcounter=0;
  my $forkcounter=0;





More information about the Koha-cvs mailing list