You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Jim Jagielski <ji...@hyperreal.com> on 1997/02/05 00:54:30 UTC
cvs commit: apache/support htdigest.c htpasswd.c logresolve.c
jim 97/02/04 15:54:29
Modified: src Configure conf.h http_main.c mod_usertrack.c
util.c
support htdigest.c htpasswd.c logresolve.c
Log:
apache
Revision Changes Path
1.75 +6 -0 apache/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apache/src/Configure,v
retrieving revision 1.74
retrieving revision 1.75
diff -C3 -r1.74 -r1.75
*** Configure 1997/01/25 22:38:22 1.74
--- Configure 1997/02/04 23:54:22 1.75
***************
*** 165,170 ****
--- 165,176 ----
fi
case "$PLAT" in
+ *MPE/iX*)
+ OS='MPE/iX'
+ CFLAGS="$CFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE"
+ LIBS="$LIBS -lsocket"
+ LFLAGS="$LFLAGS -Xlinker \"-WL,cap=ia,ba,ph,pm;nmstack=1024000\""
+ ;;
*-apple-aux3*)
OS='A/UX 3.1.x'
CFLAGS="$CFLAGS -DAUX -D_POSIX_SOURCE"
1.76 +21 -2 apache/src/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -C3 -r1.75 -r1.76
*** conf.h 1997/02/01 01:58:01 1.75
--- conf.h 1997/02/04 23:54:22 1.76
***************
*** 55,66 ****
* See README for a listing of what they mean
*/
! #ifndef QNX
#include <sys/param.h>
#endif
/* Define one of these according to your system. */
! #if defined(SUNOS4)
#define HAVE_GMTOFF
#define HAVE_SYS_RESOURCE_H
#undef NO_KILLPG
--- 55,81 ----
* See README for a listing of what they mean
*/
! #if !defined(QNX) && !defined(MPE)
#include <sys/param.h>
#endif
/* Define one of these according to your system. */
! #if defined(MPE)
! #include <setjmp.h>
! #include <sys/times.h>
! #define JMP_BUF sigjmp_buf
! #define NO_SETSID
! #define NO_KILLPG
! #define NEED_INITGROUPS
! #define NEED_STRCASECMP
! #define NEED_STRDUP
! #define NEED_STRNCASECMP
! #define getwd(d) getcwd(d,MAX_STRING_LEN)
! extern void GETPRIVMODE();
! extern void GETUSERMODE();
! extern char *inet_ntoa();
!
! #elif defined(SUNOS4)
#define HAVE_GMTOFF
#define HAVE_SYS_RESOURCE_H
#undef NO_KILLPG
***************
*** 513,519 ****
--- 528,536 ----
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+ #ifndef MPE
#include <sys/file.h>
+ #endif
#include <sys/socket.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
***************
*** 522,528 ****
--- 539,547 ----
#include <netinet/in.h>
#include <netdb.h>
#include <sys/ioctl.h>
+ #ifndef MPE
#include <arpa/inet.h> /* for inet_ntoa */
+ #endif
#include <time.h> /* for ctime */
#include <signal.h>
#include <errno.h>
1.116 +57 -3 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -C3 -r1.115 -r1.116
*** http_main.c 1997/01/30 02:42:58 1.115
--- http_main.c 1997/02/04 23:54:23 1.116
***************
*** 1136,1141 ****
--- 1136,1144 ----
int x;
chdir("/");
+ #ifndef MPE
+ /* Don't detach for MPE because child processes can't survive the death of
+ the parent. */
if((x = fork()) > 0)
exit(0);
else if(x == -1) {
***************
*** 1143,1148 ****
--- 1146,1152 ----
perror("fork");
exit(1);
}
+ #endif
#ifndef NO_SETSID
if((pgrp=setsid()) == -1) {
fprintf(stderr,"httpd: setsid failed\n");
***************
*** 1157,1165 ****
exit(1);
}
#else
! #ifdef __EMX__
! /* OS/2 doesn't support process group IDs */
! pgrp=getpid();
#else
if((pgrp=setpgrp(getpid(),0)) == -1) {
fprintf(stderr,"httpd: setpgrp failed\n");
--- 1161,1169 ----
exit(1);
}
#else
! #if defined(__EMX__) || defined(MPE)
! /* OS/2 and MPE don't support process group IDs */
! pgrp=-getpid();
#else
if((pgrp=setpgrp(getpid(),0)) == -1) {
fprintf(stderr,"httpd: setpgrp failed\n");
***************
*** 1504,1512 ****
--- 1508,1519 ----
* In spite of these problems, failure here is not a shooting offense.
*/
const int just_say_no = 1;
+ #ifndef MPE
+ /* MPE does not support TCP_NODELAY */
if (0 != setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
sizeof(just_say_no)))
fprintf(stderr, "httpd: could not set socket option TCP_NODELAY\n");
+ #endif
}
/*****************************************************************
***************
*** 1537,1547 ****
--- 1544,1566 ----
reopen_scoreboard (pconf);
(void)update_child_status (child_num, SERVER_READY, (request_rec*)NULL);
+ #ifdef MPE
+ /* Only try to switch if we're running as MANAGER.SYS */
+ if (geteuid() == 1 && user_id > 1) {
+ GETPRIVMODE();
+ if (setuid(user_id) == -1) {
+ GETUSERMODE();
+ #else
/* Only try to switch if we're running as root */
if(!geteuid() && setuid(user_id) == -1) {
+ #endif
log_unixerr("setuid", NULL, "unable to change uid", server_conf);
exit (1);
}
+ #ifdef MPE
+ GETUSERMODE();
+ }
+ #endif
#ifdef NEXT
setjmp(jmpbuffer);
***************
*** 1758,1763 ****
--- 1777,1784 ----
note_cleanups_for_fd (pconf, s); /* arrange to close on exec or restart */
+ #ifndef MPE
+ /* MPE does not support SO_REUSEADDR and SO_KEEPALIVE */
if((setsockopt(s, SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)))
== -1) {
perror("setsockopt(SO_REUSEADDR)");
***************
*** 1770,1775 ****
--- 1791,1797 ----
fprintf(stderr,"httpd: could not set socket option SO_KEEPALIVE\n");
exit(1);
}
+ #endif
sock_disable_nagle(s);
***************
*** 1820,1827 ****
--- 1842,1856 ----
}
}
+ #ifdef MPE
+ /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */
+ if (ntohs(server->sin_port) < 1024) GETPRIVMODE();
+ #endif
if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1)
{
+ #ifdef MPE
+ if (ntohs(server->sin_port) < 1024) GETUSERMODE();
+ #endif
perror("bind");
if (server->sin_addr.s_addr != htonl(INADDR_ANY))
fprintf(stderr,"httpd: could not bind to address %s port %d\n",
***************
*** 1831,1836 ****
--- 1860,1868 ----
ntohs(server->sin_port));
exit(1);
}
+ #ifdef MPE
+ if (ntohs(server->sin_port) < 1024) GETUSERMODE();
+ #endif
listen(s, 512);
return s;
}
***************
*** 2118,2128 ****
--- 2150,2172 ----
set_group_privs();
default_server_hostnames (server_conf);
+ #ifdef MPE
+ /* Only try to switch if we're running as MANAGER.SYS */
+ if (geteuid() == 1 && user_id > 1) {
+ GETPRIVMODE();
+ if (setuid(user_id) == -1) {
+ GETUSERMODE();
+ #else
/* Only try to switch if we're running as root */
if(!geteuid() && setuid(user_id) == -1) {
+ #endif
log_unixerr("setuid", NULL, "unable to change uid", server_conf);
exit (1);
}
+ #ifdef MPE
+ GETUSERMODE();
+ }
+ #endif
c = sizeof(sa_client);
if ((getpeername(fileno(stdin), &sa_client, &c)) < 0)
***************
*** 2140,2146 ****
--- 2184,2200 ----
}
server_conf->port =ntohs(((struct sockaddr_in *)&sa_server)->sin_port);
cio = bcreate(ptrans, B_RDWR);
+ #ifdef MPE
+ /* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas
+ HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1).
+ Go figure. SR 5003355016 has been submitted to request that the existing
+ functionality be documented, and then to enhance the functionality to be
+ like HPUX. */
+
+ cio->fd = fileno(stdin);
+ #else
cio->fd = fileno(stdout);
+ #endif
cio->fd_in = fileno(stdin);
conn = new_connection (ptrans, server_conf, cio,
(struct sockaddr_in *)&sa_client,
1.9 +18 -2 apache/src/mod_usertrack.c
Index: mod_usertrack.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_usertrack.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C3 -r1.8 -r1.9
*** mod_usertrack.c 1997/01/20 04:28:16 1.8
--- mod_usertrack.c 1997/02/04 23:54:24 1.9
***************
*** 120,126 ****
--- 120,132 ----
{
cookie_log_state *cls = get_module_config (r->server->module_config,
&usertrack_module);
+ #ifdef MPE
+ clock_t mpe_times;
+ struct tms mpe_tms;
+ #else
struct timeval tv;
+ struct timezone tz = { 0 , 0 };
+ #endif
/* 1024 == hardcoded constants */
char *new_cookie = palloc( r->pool, 1024);
char *cookiebuf = palloc( r->pool, 1024);
***************
*** 128,141 ****
const char *rname = pstrdup(r->pool,
get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME));
-
- struct timezone tz = { 0 , 0 };
if ((dot = strchr(rname,'.'))) *dot='\0'; /* First bit of hostname */
gettimeofday(&tv, &tz);
ap_snprintf(cookiebuf, 1024, "%s%d%ld%d", rname, (int)getpid(),
(long)tv.tv_sec, (int)tv.tv_usec/1000);
if (cls->expires) {
static const char *const days[7]=
--- 134,157 ----
const char *rname = pstrdup(r->pool,
get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME));
if ((dot = strchr(rname,'.'))) *dot='\0'; /* First bit of hostname */
+
+ #ifdef MPE
+ /* MPE lacks gettimeofday(), so we must use time() to obtain the epoch
+ seconds, and then times() to obtain CPU clock ticks (milliseconds).
+ Combine this together to obtain a hopefully unique cookie ID. */
+
+ mpe_times=times(&mpe_tms);
+
+ ap_snprintf(cookiebuf, 1024, "%s%d%ld%ld", rname, (int)getpid(),
+ (long)time(NULL), (long)mpe_tms.tms_utime);
+ #else
gettimeofday(&tv, &tz);
ap_snprintf(cookiebuf, 1024, "%s%d%ld%d", rname, (int)getpid(),
(long)tv.tv_sec, (int)tv.tv_usec/1000);
+ #endif
if (cls->expires) {
static const char *const days[7]=
1.42 +2 -3 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C3 -r1.41 -r1.42
*** util.c 1997/01/20 09:36:26 1.41
--- util.c 1997/02/04 23:54:24 1.42
***************
*** 1015,1023 ****
#ifdef NEED_INITGROUPS
int initgroups(const char *name, gid_t basegid)
{
! #ifdef QNX
! /* QNX does not appear to support supplementary groups.
! Ben <be...@algroup.co.uk> */
return 0;
#else /* ndef QNX */
gid_t groups[NGROUPS_MAX];
--- 1015,1022 ----
#ifdef NEED_INITGROUPS
int initgroups(const char *name, gid_t basegid)
{
! #if defined(QNX) || defined(MPE)
! /* QNX and MPE do not appear to support supplementary groups. */
return 0;
#else /* ndef QNX */
gid_t groups[NGROUPS_MAX];
1.7 +4 -0 apache/support/htdigest.c
Index: htdigest.c
===================================================================
RCS file: /export/home/cvs/apache/support/htdigest.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C3 -r1.6 -r1.7
*** htdigest.c 1996/11/03 21:10:13 1.6
--- htdigest.c 1997/02/04 23:54:27 1.7
***************
*** 7,13 ****
--- 7,17 ----
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
+ #ifdef MPE
+ #include <signal.h>
+ #else
#include <sys/signal.h>
+ #endif
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
1.6 +23 -0 apache/support/htpasswd.c
Index: htpasswd.c
===================================================================
RCS file: /export/home/cvs/apache/support/htpasswd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C3 -r1.5 -r1.6
*** htpasswd.c 1996/11/03 21:09:07 1.5
--- htpasswd.c 1997/02/04 23:54:27 1.6
***************
*** 7,13 ****
--- 7,17 ----
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
+ #ifdef MPE
+ #include <signal.h>
+ #else
#include <sys/signal.h>
+ #endif
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
***************
*** 75,80 ****
--- 79,103 ----
v >>= 6;
}
}
+
+ #ifdef MPE
+ /* MPE lacks getpass() and a way to suppress stdin echo. So for now, just
+ issue the prompt and read the results with echo. (Ugh). */
+
+ char *getpass(const char *prompt) {
+
+ static char password[81];
+
+ fputs(prompt,stderr);
+ gets((char *)&password);
+
+ if (strlen((char *)&password) > 8) {
+ password[8]='\0';
+ }
+
+ return (char *)&password;
+ }
+ #endif
void add_password(char *user, FILE *f) {
char *pw, *cpw, salt[3];
1.7 +15 -0 apache/support/logresolve.c
Index: logresolve.c
===================================================================
RCS file: /export/home/cvs/apache/support/logresolve.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C3 -r1.6 -r1.7
*** logresolve.c 1996/11/03 21:02:32 1.6
--- logresolve.c 1997/02/04 23:54:28 1.7
***************
*** 51,57 ****
--- 51,59 ----
#include <sys/socket.h>
#include <netinet/in.h>
+ #ifndef MPE
#include <arpa/inet.h>
+ #endif
static void cgethost(struct in_addr ipnum, char *string, int check);
static int getline(char *s, int n);
***************
*** 68,73 ****
--- 70,88 ----
/* number of buckets in cache hash table */
#define BUCKETS 256
+
+ #ifdef MPE
+ char *strdup (const char *str)
+ {
+ char *dup;
+
+ if(!(dup = (char *)malloc (strlen (str) + 1)))
+ return NULL;
+ dup = strcpy (dup, str);
+
+ return dup;
+ }
+ #endif
/*
* struct nsrec - record of nameservice for cache linked list