cvs commit: apache-1.3/src/os/win32 registry.c registry.h service.c service.h

1999-04-08 Thread stoddard
stoddard99/04/08 14:04:55

  Modified:src  CHANGES
   src/main http_main.c
   src/os/win32 registry.c registry.h service.c service.h
  Log:
  Update CHANGES and get rid of the ^Z.
  
  Revision  ChangesPath
  1.1301+31 -0 apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1300
  retrieving revision 1.1301
  diff -u -r1.1300 -r1.1301
  --- CHANGES   1999/04/08 20:56:34 1.1300
  +++ CHANGES   1999/04/08 21:04:41 1.1301
  @@ -1,4 +1,34 @@
   Changes with Apache 1.3.7
  +  *) Win32: Win32 multiple services patch. Added capability to install and
  + run multiple copies of apache as individual services.
  +
  + Example 1:
  + apache -n apache1 -i -f c:/httpd.conf
  +Installs apache as service 'apache1' and associates c:/httpd.conf
  +with that service.
  + net start apache1
  +Starts apache1 service.
  + net stop apache1
  +Stops apache1 service
  +
  + Example 2:
  + apache -n apache2 -i
  +Installs apache as service 'apache2'. httpd.conf is located under
  +the default server root (/apache/conf/httpd.conf).
  + net start apache2
  +Starts apache2 service.
  +
  + Example 3:
  + apache -n apache3 -i -d c:/program files/apache
  +Install apache as service 'apache3' and sets server root to
  +c:/program files/apache.
  +
  + Example 4:
  + apache -n apache2 -k restart
  +Restart apache2 service 
  +
  + [Keith Wannamaker, Ken Parzygnat, Bill Stoddard]
  +
 *) Correct the signed/unsigned character handling for the MD5 routines;
mismatches were causing compilation problems with gcc -pedantic and
in the TPF cross-compilation.  [Ken Coar]
  @@ -6341,3 +6371,4 @@
 *) Based on NCSA httpd 1.3 by Rob McCool and patches by CERT,
Roy Fielding, Robert Thau, Nicolas Pioch, David Robinson,
Brian Behlendorf, Rob Hartill, and Cliff Skolnick
  +
  
  
  
  1.429 +1 -1  apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.428
  retrieving revision 1.429
  diff -u -r1.428 -r1.429
  --- http_main.c   1999/04/08 20:26:24 1.428
  +++ http_main.c   1999/04/08 21:04:43 1.429
  @@ -6297,4 +6297,4 @@
   
   #endif /* ndef SHARED_CORE_BOOTSTRAP */
   
  -
  \ No newline at end of file
  +
  
  
  
  1.20  +0 -1  apache-1.3/src/os/win32/registry.c
  
  Index: registry.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/registry.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- registry.c1999/04/08 20:26:26 1.19
  +++ registry.c1999/04/08 21:04:46 1.20
  @@ -469,4 +469,3 @@
   return rv < 0 ? -1 : 0;
   }
   
  -
  \ No newline at end of file
  
  
  
  1.3   +0 -1  apache-1.3/src/os/win32/registry.h
  
  Index: registry.h
  ===
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/registry.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- registry.h1999/04/08 20:26:26 1.2
  +++ registry.h1999/04/08 21:04:46 1.3
  @@ -6,4 +6,3 @@
   extern int ap_registry_set_server_root(char *dir);
   extern int ap_registry_get_service_conf(pool *p, char *dir, int size, char 
*service_name);
   extern int ap_registry_set_service_conf(char *dir, char *service_name);
  -
  \ No newline at end of file
  
  
  
  1.13  +1 -1  apache-1.3/src/os/win32/service.c
  
  Index: service.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/service.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- service.c 1999/04/08 20:26:26 1.12
  +++ service.c 1999/04/08 21:04:47 1.13
  @@ -428,4 +428,4 @@
   }
  
   #endif /* WIN32 */
  -
  \ No newline at end of file
  +
  
  
  
  1.4   +0 -1  apache-1.3/src/os/win32/service.h
  
  Index: service.h
  ===
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/service.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- service.h 1999/04/08 20:26:27 1.3
  +++ service.h 1999/04/08 21:04:48 1.4
  @@ -15,4 +15,3 @@
   #endif /* WIN32 */
   
   #endif /* SERVICE_H */
  -
  \ No newline at end of file
  
  
  


cvs commit: apache-1.3/src/os/win32 registry.c registry.h service.c service.h

1999-04-08 Thread stoddard
stoddard99/04/08 13:26:28

  Modified:src/main http_main.c
   src/os/win32 registry.c registry.h service.c service.h
  Log:
  Win32 multiple services patch. Documentation to follow.
  Submitted by: Keith Wannamaker
  Reviewed by: Bill Stoddard, Ken Parzygnat
  
  Revision  ChangesPath
  1.428 +216 -66   apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.427
  retrieving revision 1.428
  diff -u -r1.427 -r1.428
  --- http_main.c   1999/03/17 23:05:43 1.427
  +++ http_main.c   1999/04/08 20:26:24 1.428
  @@ -180,6 +180,10 @@
   #ifdef WIN32
   #include "../os/win32/service.h"
   #include "../os/win32/registry.h"
  +#define DEFAULTSERVICENAME "Apache"
  +#define PATHSEPARATOR '\\'
  +#else
  +#define PATHSEPARATOR '/'
   #endif
   
   
  @@ -984,6 +988,9 @@
   #endif
   fprintf(stderr, "   %s [-C \"directive\"] [-c \"directive\"]\n", 
pad);
   fprintf(stderr, "   %s [-v] [-V] [-h] [-l] [-L] [-S] [-t]\n", pad);
  +#ifdef WIN32
  +fprintf(stderr, "   %s [-n service] [-k signal] [-i] [-u]\n", pad);
  +#endif
   fprintf(stderr, "Options:\n");
   #ifdef SHARED_CORE
   fprintf(stderr, "  -R directory : specify an alternate location for 
shared object files\n");
  @@ -1001,8 +1008,12 @@
   fprintf(stderr, "  -S   : show parsed settings (currently 
only vhost settings)\n");
   fprintf(stderr, "  -t   : run syntax test for configuration 
files only\n");
   #ifdef WIN32
  +fprintf(stderr, "  -n name  : set service name and use its 
ServerConfigFile\n");
   fprintf(stderr, "  -k shutdown  : tell running Apache to 
shutdown\n");
   fprintf(stderr, "  -k restart   : tell running Apache to do a 
graceful restart\n");
  +fprintf(stderr, "  -k start : tell Apache to start\n");
  +fprintf(stderr, "  -i   : install an Apache service\n");
  +fprintf(stderr, "  -u   : uninstall an Apache service\n");
   #endif
   exit(1);
   }
  @@ -3465,7 +3476,7 @@
* some of it is #ifdef'd but was duplicated before anyhow.  This stuff
* is still a mess.
*/
  -static void common_init(void)
  +void common_init(void)
   {
   INIT_SIGLIST()
   #ifdef AUX3
  @@ -4485,7 +4496,7 @@
   
   common_init();
   
  -if ((s = strrchr(argv[0], '/')) != NULL) {
  +if ((s = strrchr(argv[0], PATHSEPARATOR)) != NULL) {
ap_server_argv0 = ++s;
   }
   else {
  @@ -5434,7 +5445,13 @@
   {
   char buf[40], mod[200];
   int i, rv;
  -char **pass_argv = (char **) alloca(sizeof(char *) * (argc + 3));
  +
  +#ifdef WIN32
  +#define NUMCHILDARGS  4
  +#else
  +#define NUMCHILDARGS  2
  +#endif
  +char **pass_argv = (char **) alloca(sizeof(char *) * (argc + 
NUMCHILDARGS + 1));
   
   /* We need an event to tell the child process to kill itself when
* the parent is doing a shutdown/restart. This will be named
  @@ -5456,10 +5473,14 @@
   pass_argv[0] = argv[0];
   pass_argv[1] = "-Z";
   pass_argv[2] = buf;
  +#ifdef WIN32
  +pass_argv[3] = "-f";
  +pass_argv[4] = ap_server_confname;
  +#endif
   for (i = 1; i < argc; i++) {
  - pass_argv[i + 2] = argv[i];
  +pass_argv[i + NUMCHILDARGS] = argv[i];
   }
  -pass_argv[argc + 2] = NULL;
  +pass_argv[argc + NUMCHILDARGS] = NULL;
   
   rv = GetModuleFileName(NULL, mod, sizeof(mod));
   if (rv == sizeof(mod)) {
  @@ -5533,8 +5554,47 @@
   return 0;
   }
   
  +/* To share the semaphores with other processes, we need a NULL ACL
  + * Code from MS KB Q106387
  + */
  +
  +static PSECURITY_ATTRIBUTES GetNullACL()
  +{
  +PSECURITY_DESCRIPTOR pSD;
  +PSECURITY_ATTRIBUTES sa;
  +
  +sa  = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof 
(SECURITY_ATTRIBUTES));
  +pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, 
SECURITY_DESCRIPTOR_MIN_LENGTH);
  +if (pSD == NULL || sa == NULL)
  +return NULL;
  +if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) {
  +LocalFree( pSD );
  +LocalFree( sa );
  +return NULL;
  +}
  +if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)) {
  +LocalFree( pSD );
  +LocalFree( sa );
  +return NULL;
  +}
  +sa->nLength = sizeof(sa);
  +sa->lpSecurityDescriptor = pSD;
  +sa->bInheritHandle = TRUE;
  +return sa;
  +}
  +
  +
  +static void CleanNullACL( void *sa ) {
  +if( sa ) {
  +LocalFree( ((PSECURITY_ATTRIBUTES)sa)->lpSecurityDescriptor);
  +LocalFree( sa );
  +}
  +}
  +
   int master_main(int argc, char **argv)
   {
  +/* returns NULL if invalid (Win95?) */
  +PSECURITY_ATTRIBUTES sa = GetNullACL();
   int nchild = ap_daemons_to_start;
   event **ev;