diff -C3 -r ../apache_1.1.1/src/Configuration ./src/Configuration *** ../apache_1.1.1/src/Configuration Tue Jul 9 15:02:01 1996 --- ./src/Configuration Mon Jul 15 10:46:02 1996 *************** *** 17,26 **** # First, ordinary compile-time configuration. # What to call the compiler: For normal machines with ANSI compilers ! # CC= cc # For Suns or other non-ANSI platforms. Please make sure your gcc is # 2.0 or later, as 1.40 seems to create bad code for the Sun 4. ! CC= gcc # CFLAGS, compile flags. --- 17,26 ---- # First, ordinary compile-time configuration. # What to call the compiler: For normal machines with ANSI compilers ! CC= cc # For Suns or other non-ANSI platforms. Please make sure your gcc is # 2.0 or later, as 1.40 seems to create bad code for the Sun 4. ! #CC= gcc # CFLAGS, compile flags. *************** *** 65,71 **** # defaults in. Note that this config file does not include DBM auth by # default --- configure it in below if you need it]. ! CFLAGS= -O2 # Place here any flags you may need upon linking, such as a flag to # prevent dynamic linking (if desired) --- 65,71 ---- # defaults in. Note that this config file does not include DBM auth by # default --- configure it in below if you need it]. ! CFLAGS= -O2 -g # Place here any flags you may need upon linking, such as a flag to # prevent dynamic linking (if desired) *************** *** 75,80 **** --- 75,91 ---- # -lndbm is commonly required for DBM auth, if that is configured in. EXTRA_LIBS= + # Define the target + TARGET=httpd + + # Enable SSL. NB: There is one line at the end of this file, too... + SSL_BASE=../../../work/scuzzy-ssleay6 + SSL_INCLUDE= -I$(SSL_BASE)/include + SSL_CFLAGS= -DAPACHE_SSL $(SSL_INCLUDE) + SSL_LIB_DIR= $(SSL_BASE) + SSL_LIBS= -L$(SSL_LIB_DIR) -lssl -lcrypto + TARGET=httpsd + # AUX_CFLAGS are system-specific control flags. # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE # SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN. *************** *** 115,123 **** # For SCO OpenServer Release 5 # -K noinline is needed to work around an optimiser bug which appears in # http_bprintf.c ! #AUX_CFLAGS= -DSCO5 ! #AUX_LIBS=-lsocket -lmalloc -lprot ! #BROKEN_BPRINTF_FLAGS=-K noinline # For SVR4 # Some SVR4 implementations will require SO_LINGER option to be set in order # to guarantee buffer flushes. Dell, Esix, and UnixWare are a few of these. --- 126,134 ---- # For SCO OpenServer Release 5 # -K noinline is needed to work around an optimiser bug which appears in # http_bprintf.c ! AUX_CFLAGS= -DSCO5 ! AUX_LIBS=-lsocket -lmalloc -lprot ! BROKEN_BPRINTF_FLAGS=-K noinline # For SVR4 # Some SVR4 implementations will require SO_LINGER option to be set in order # to guarantee buffer flushes. Dell, Esix, and UnixWare are a few of these. *************** *** 209,215 **** ## mod_log_common --- a server with both will work, but you'll get ## very confused trying to figure out what's going on... ! # Module config_log_module mod_log_config.o ## cern_meta mimicks the behavior of the CERN web server with regards to ## metainformation files. --- 220,226 ---- ## mod_log_common --- a server with both will work, but you'll get ## very confused trying to figure out what's going on... ! Module config_log_module mod_log_config.o ## cern_meta mimicks the behavior of the CERN web server with regards to ## metainformation files. *************** *** 270,272 **** --- 281,287 ---- ## be yet, so use at your own risk. # Module proxy_module mod_proxy.o + + # Damn damn damn. Apache inverts the module list. SSL must go first to fake + # basic authorization. So, uncomment this line to add SSL. + Module ssl_module apache_ssl.o diff -C3 -r ../apache_1.1.1/src/Configuration.tmpl ./src/Configuration.tmpl *** ../apache_1.1.1/src/Configuration.tmpl Sat Jun 29 19:59:25 1996 --- ./src/Configuration.tmpl Sat Jul 13 13:44:02 1996 *************** *** 75,80 **** --- 75,88 ---- # -lndbm is commonly required for DBM auth, if that is configured in. EXTRA_LIBS= + # + # SSL Related stuff + # + SSL_INCLUDE= -I../../../work/scuzzy-ssleay/include + SSL_CFLAGS= -DAPACHE_SSL $(SSL_INCLUDE) + SSL_LIB_DIR= ../../../work/scuzzy-ssleay + SSL_LIBS= -L$(SSL_LIB_DIR) -lssl -lcrypto + # AUX_CFLAGS are system-specific control flags. # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE # SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN. *************** *** 257,264 **** # Module digest_module mod_digest.o ## Outright experiments --- mod_dld defines commands which ! ## allows other modules to be loaded in at runtime, and mod_cookies ## uses Netscape cookies to automatically construct and log accurate ## click-trails from Netscape cookies, for Netscape-using clients who ## aren't coming in via proxy. --- 265,275 ---- # Module digest_module mod_digest.o + # Damn damn damn. Apache inverts the module list. SSL must go first to fake + # basic authorization. So, uncomment this line to add SSL. + Module ssl_module apache_ssl.o ## Outright experiments --- mod_dld defines commands which ! # End ## uses Netscape cookies to automatically construct and log accurate ## click-trails from Netscape cookies, for Netscape-using clients who ## aren't coming in via proxy. diff -C3 -r ../apache_1.1.1/src/Makefile.tmpl ./src/Makefile.tmpl *** ../apache_1.1.1/src/Makefile.tmpl Fri Jun 14 16:24:26 1996 --- ./src/Makefile.tmpl Sat Jul 13 15:35:29 1996 *************** *** 8,16 **** md5c.o util_md5.o explain.o http_bprintf.o $(MODULES) .c.o: ! $(CC) -c $(CFLAGS) $(AUX_CFLAGS) $< ! all: Configuration httpd Configuration: Configuration.tmpl @echo "Configuration older than Configuration.tmpl, or doesn't exist." --- 8,16 ---- md5c.o util_md5.o explain.o http_bprintf.o $(MODULES) .c.o: ! $(CC) -c $(CFLAGS) $(AUX_CFLAGS) $(SSL_CFLAGS) $< ! all: Configuration $(TARGET) Configuration: Configuration.tmpl @echo "Configuration older than Configuration.tmpl, or doesn't exist." *************** *** 22,29 **** httpd: $(OBJS) $(CC) $(LFLAGS) $(AUX_LFLAGS) -o httpd $(OBJS) $(EXTRA_LIBS) $(AUX_LIBS) clean: ! rm -f httpd $(OBJS) *pure* dist.tar: # Assure a semi-sensible configuration going out... --- 22,40 ---- httpd: $(OBJS) $(CC) $(LFLAGS) $(AUX_LFLAGS) -o httpd $(OBJS) $(EXTRA_LIBS) $(AUX_LIBS) + httpsd: $(OBJS) + $(CC) $(LFLAGS) -o httpsd $(OBJS) $(EXTRA_LIBS) $(SSL_LIBS) $(AUX_LIBS) + + certificate: + $(SSL_LIB_DIR)/apps/ssleay req \ + -config $(SSL_LIB_DIR)/apps/ssleay.conf \ + -new -x509 -nodes -out ../SSLconf/conf/httpsd.pem \ + -keyout ../SSLconf/conf/httpsd.pem; \ + ln -sf ../SSLconf/conf/httpsd.pem ../SSLconf/conf/`$(SSL_LIB_DIR)/apps/ssleay \ + x509 -noout -hash < ../SSLconf/conf/httpsd.pem`.0 + clean: ! rm -f httpd httpsd $(OBJS) *pure* dist.tar: # Assure a semi-sensible configuration going out... diff -C3 -r ../apache_1.1.1/src/buff.c ./src/buff.c *** ../apache_1.1.1/src/buff.c Wed May 8 15:28:19 1996 --- ./src/buff.c Sat Jul 13 15:29:50 1996 *************** *** 125,130 **** --- 125,135 ---- fb->fd = -1; fb->fd_in = -1; + #ifdef APACHE_SSL + fb->ssl = NULL; + fb->szClientX509 = NULL; + #endif + return fb; } *************** *** 148,154 **** { fb->bytes_sent = *(const long int *)optval - (long int)fb->outcnt;; return 0; ! } else { errno = EINVAL; return -1; --- 153,159 ---- { fb->bytes_sent = *(const long int *)optval - (long int)fb->outcnt;; return 0; ! } else { errno = EINVAL; return -1; *************** *** 187,194 **** if (!(fb->flags & B_RD)) { /* Unbuffered reading */ ! do i = read(fb->fd_in, buf, nbyte); ! while (i == -1 && errno == EINTR); if (i == -1 && errno != EAGAIN) doerror(fb, B_RD); return i; } --- 192,206 ---- if (!(fb->flags & B_RD)) { /* Unbuffered reading */ ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? read(fb->fd_in, buf, nbyte) ! : SSL_read(fb->ssl, buf, nbyte); ! #else ! i = read(fb->fd_in, buf, nbyte); ! #endif ! } while (i == -1 && errno == EINTR); if (i == -1 && errno != EAGAIN) doerror(fb, B_RD); return i; } *************** *** 216,223 **** if (nbyte >= fb->bufsiz) { /* read directly into buffer */ ! do i = read(fb->fd_in, buf, nbyte); ! while (i == -1 && errno == EINTR); if (i == -1) { if (nrd == 0) --- 228,242 ---- if (nbyte >= fb->bufsiz) { /* read directly into buffer */ ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? read(fb->fd_in, buf, nbyte) ! : SSL_read(fb->ssl, buf, nbyte); ! #else ! i = read(fb->fd_in, buf, nbyte); ! #endif ! } while (i == -1 && errno == EINTR); if (i == -1) { if (nrd == 0) *************** *** 231,238 **** { /* read into hold buffer, then memcpy */ fb->inptr = fb->inbase; ! do i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! while (i == -1 && errno == EINTR); if (i == -1) { if (nrd == 0) --- 250,264 ---- { /* read into hold buffer, then memcpy */ fb->inptr = fb->inbase; ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? read(fb->fd_in, fb->inptr, fb->bufsiz) ! : SSL_read(fb->ssl, fb->inptr, fb->bufsiz); ! #else ! i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! #endif ! } while (i == -1 && errno == EINTR); if (i == -1) { if (nrd == 0) *************** *** 293,300 **** fb->inptr = fb->inbase; fb->incnt = 0; if (fb->flags & B_EOF) break; ! do i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! while (i == -1 && errno == EINTR); if (i == -1) { buff[ct] = '\0'; --- 319,333 ---- fb->inptr = fb->inbase; fb->incnt = 0; if (fb->flags & B_EOF) break; ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? read(fb->fd_in, fb->inptr, fb->bufsiz) ! : SSL_read(fb->ssl, fb->inptr, fb->bufsiz); ! #else ! i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! #endif ! } while (i == -1 && errno == EINTR); if (i == -1) { buff[ct] = '\0'; *************** *** 372,379 **** fb->inptr = fb->inbase; fb->incnt = 0; if (fb->flags & B_EOF) return 0; ! do i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! while (i == -1 && errno == EINTR); if (i == 0) fb->flags |= B_EOF; if (i == -1 && errno != EAGAIN) doerror(fb, B_RD); if (i == 0 || i == -1) return i; --- 405,419 ---- fb->inptr = fb->inbase; fb->incnt = 0; if (fb->flags & B_EOF) return 0; ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? read(fb->fd_in, fb->inptr, fb->bufsiz) ! : SSL_read(fb->ssl, fb->inptr, fb->bufsiz); ! #else ! i = read(fb->fd_in, fb->inptr, fb->bufsiz); ! #endif ! } while (i == -1 && errno == EINTR); if (i == 0) fb->flags |= B_EOF; if (i == -1 && errno != EAGAIN) doerror(fb, B_RD); if (i == 0 || i == -1) return i; *************** *** 424,431 **** if (!(fb->flags & B_WR)) { /* unbuffered write */ ! do i = write(fb->fd, buf, nbyte); ! while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { --- 464,478 ---- if (!(fb->flags & B_WR)) { /* unbuffered write */ ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? write(fb->fd_in, buf, nbyte) ! : SSL_write(fb->ssl, buf, nbyte); ! #else ! i = write(fb->fd, buf, nbyte); ! #endif ! } while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { *************** *** 457,464 **** } /* the buffer must be full */ ! do i = write(fb->fd, fb->outbase, fb->bufsiz); ! while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { --- 504,518 ---- } /* the buffer must be full */ ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? write(fb->fd_in, fb->outbase, fb->bufsiz) ! : SSL_write(fb->ssl, fb->outbase, fb->bufsiz); ! #else ! i = write(fb->fd, fb->outbase, fb->bufsiz); ! #endif ! } while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { *************** *** 493,500 **** */ while (nbyte > fb->bufsiz) { ! do i = write(fb->fd, buf, nbyte); ! while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { --- 547,561 ---- */ while (nbyte > fb->bufsiz) { ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? write(fb->fd_in, buf, nbyte) ! : SSL_write(fb->ssl, buf, nbyte); ! #else ! i = write(fb->fd, buf, nbyte); ! #endif ! } while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { *************** *** 539,546 **** { /* the buffer must be full */ j = fb->outcnt; ! do i = write(fb->fd, fb->outbase, fb->outcnt); ! while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { --- 600,614 ---- { /* the buffer must be full */ j = fb->outcnt; ! do { ! #ifdef APACHE_SSL ! i = (fb->ssl == NULL) ! ? write(fb->fd_in, fb->outbase, fb->outcnt) ! : SSL_write(fb->ssl, fb->outbase, fb->outcnt); ! #else ! i = write(fb->fd, fb->outbase, fb->outcnt); ! #endif ! } while (i == -1 && errno == EINTR); if (i > 0) fb->bytes_sent += i; if (i == 0) { *************** *** 593,598 **** --- 661,673 ---- fb->fd = -1; fb->fd_in = -1; + #ifdef APACHE_SSL + if (fb->ssl != NULL) { + SSL_free(fb->ssl); + fb->ssl = NULL; + } + #endif + if (rc1 != 0) return rc1; else if (rc2 != 0) return rc2; else return rc3; *************** *** 646,648 **** --- 721,728 ---- fb->error = error; fb->error_data = data; } + + /* + * This is nasty wrt to modularity, but I have put the + * bsslset() function into apache_ssl.c + */ diff -C3 -r ../apache_1.1.1/src/buff.h ./src/buff.h *** ../apache_1.1.1/src/buff.h Mon May 27 21:08:27 1996 --- ./src/buff.h Sat Jul 13 14:07:11 1996 *************** *** 52,57 **** --- 52,62 ---- #include + #ifdef APACHE_SSL + #include "stdio.h" + #include "ssl.h" + #endif + /* Reading is buffered */ #define B_RD (1) /* Writing is buffered */ *************** *** 66,72 **** /* A write error has occurred */ #define B_WRERR (32) #define B_ERROR (48) - typedef struct buff_struct BUFF; struct buff_struct --- 71,76 ---- *************** *** 88,93 **** --- 92,104 ---- /* could also put pointers to the basic I/O routines here */ int fd; /* the file descriptor */ int fd_in; /* input file descriptor, if different */ + + #ifdef APACHE_SSL + /* Add some context for SSL */ + SSL *ssl; + char *szClientX509; + int nVerifyError; + #endif }; /* Options to bset/getopt */ diff -C3 -r ../apache_1.1.1/src/http_config.c ./src/http_config.c *** ../apache_1.1.1/src/http_config.c Sat Jun 29 19:52:11 1996 --- ./src/http_config.c Tue Jul 16 11:34:06 1996 *************** *** 736,742 **** --- 736,746 ---- { server_rec *s = (server_rec *)pcalloc (p, sizeof (server_rec)); + #ifdef APACHE_SSL + s->port=0; + #else s->port = DEFAULT_PORT; + #endif s->server_admin = DEFAULT_ADMIN; s->server_hostname = NULL; s->error_fname = DEFAULT_ERRORLOG; *************** *** 772,777 **** --- 776,783 ---- process_resource_config (s, s->access_confname, p, ptemp); fixup_virtual_hosts (p, s); + + default_server_hostnames(s); for (m = top_module; m; m = m->next) if (m->init) diff -C3 -r ../apache_1.1.1/src/http_main.c ./src/http_main.c *** ../apache_1.1.1/src/http_main.c Mon Jul 8 19:00:35 1996 --- ./src/http_main.c Sat Jul 13 19:27:24 1996 *************** *** 1242,1247 **** --- 1242,1256 ---- (struct sockaddr_in *)&sa_server, child_num); + #ifdef APACHE_SSL + /* + * This returns false if the connection cannot be setup, + * so maybe we should do something with this here... + * however it also blocks the BUFF connections + * so the next bit should fall out anyway! + */ + ApacheSSLSetupConnection(current_conn); + #endif r = read_request (current_conn); (void)update_child_status (child_num, SERVER_BUSY_WRITE, r); if (r) process_request (r); /* else premature EOF --- ignore */ *************** *** 1362,1367 **** --- 1371,1377 ---- void standalone_main(int argc, char **argv) { struct sockaddr_in sa_server; + static BOOL bFirst=TRUE; standalone = 1; sd = listenmaxfd = -1; *************** *** 1392,1407 **** } restart_time = time(NULL); ! clear_pool (pconf); ! ptrans = make_sub_pool (pconf); ! ! server_conf = read_config(pconf, ptrans, server_confname); open_logs(server_conf, pconf); set_group_privs(); accept_mutex_init(pconf); reinit_scoreboard(pconf); ! default_server_hostnames (server_conf); if (listeners == NULL) { --- 1402,1422 ---- } restart_time = time(NULL); ! if(!bFirst) ! { ! clear_pool (pconf); ! ptrans = make_sub_pool (pconf); ! server_conf = read_config(pconf, ptrans, server_confname); ! } ! else ! bFirst=FALSE; ! open_logs(server_conf, pconf); set_group_privs(); accept_mutex_init(pconf); reinit_scoreboard(pconf); ! /* default_server_hostnames (server_conf);*/ if (listeners == NULL) { *************** *** 1525,1531 **** server_conf = read_config (pconf, ptrans, server_confname); if(standalone) { ! clear_pool (pconf); /* standalone_main rereads... */ standalone_main(argc, argv); } else { --- 1540,1546 ---- server_conf = read_config (pconf, ptrans, server_confname); if(standalone) { ! /* clear_pool (pconf); /* standalone_main rereads... */ standalone_main(argc, argv); } else { diff -C3 -r ../apache_1.1.1/src/http_protocol.c ./src/http_protocol.c *** ../apache_1.1.1/src/http_protocol.c Sun Jun 23 18:05:16 1996 --- ./src/http_protocol.c Tue Jul 16 18:08:03 1996 *************** *** 280,288 **** int i, port; /* This routine parses full URLs, if they match the server */ if (strncmp(uri, "http://", 7)) return uri; name = pstrdup(r->pool, uri + 7); ! /* Find the hostname, assuming a valid request */ i = ind(name, '/'); name[i] = '\0'; --- 280,294 ---- int i, port; /* This routine parses full URLs, if they match the server */ + #ifdef APACHE_SSL + if((r->connection->client->ssl && strncmp(uri,"https://",8)) + || (!r->connection->client->ssl && strncmp(uri,"http://",7))) + return uri; + name = pstrdup(r->pool, uri + (r->connection->client->ssl ? 8 : 7)); + #else if (strncmp(uri, "http://", 7)) return uri; name = pstrdup(r->pool, uri + 7); ! #endif /* Find the hostname, assuming a valid request */ i = ind(name, '/'); name[i] = '\0'; *************** *** 290,296 **** /* Find the port */ host = getword(r->pool, &name, ':'); if (*name) port = atoi(name); ! else port = 80; /* Make sure ports patch */ if (port != r->server->port) return uri; --- 296,309 ---- /* Find the port */ host = getword(r->pool, &name, ':'); if (*name) port = atoi(name); ! #ifdef APACHE_SSL ! else if(r->connection->client->ssl) ! port=HTTPS_PORT; ! else ! port=HTTP_PORT; ! #else ! else port = DEFAULT_PORT; ! #endif /* Make sure ports patch */ if (port != r->server->port) return uri; *************** *** 373,382 **** void check_hostalias (request_rec *r) { char *host = getword(r->pool, &r->hostname, ':'); /* Get rid of port */ ! int port = (*r->hostname) ? atoi(r->hostname) : 0; server_rec *s; ! if (port && (port != r->server->port)) return; if ((host[strlen(host)-1]) == '.') { --- 386,395 ---- void check_hostalias (request_rec *r) { char *host = getword(r->pool, &r->hostname, ':'); /* Get rid of port */ ! int port = (*r->hostname) ? atoi(r->hostname) : default_port(r); server_rec *s; ! if (port != r->server->port) return; if ((host[strlen(host)-1]) == '.') { *************** *** 388,395 **** for (s = r->server->next; s; s = s->next) { char *names = s->names; ! if ((!strcasecmp(host, s->server_hostname)) && ! (!port || (port == s->port))) { r->server = r->connection->server = s; if (r->hostlen && !strncmp(r->uri, "http://", 7)) { r->uri += r->hostlen; --- 401,407 ---- for (s = r->server->next; s; s = s->next) { char *names = s->names; ! if (!strcasecmp(host, s->server_hostname) && port == s->port) { r->server = r->connection->server = s; if (r->hostlen && !strncmp(r->uri, "http://", 7)) { r->uri += r->hostlen; diff -C3 -r ../apache_1.1.1/src/httpd.h ./src/httpd.h *** ../apache_1.1.1/src/httpd.h Mon Jul 8 19:01:19 1996 --- ./src/httpd.h Tue Jul 16 18:06:23 1996 *************** *** 62,67 **** --- 62,68 ---- #include "alloc.h" #include "buff.h" + /* ----------------------------- config dir ------------------------------ */ /* Define this to be the default server home dir. Anything later in this *************** *** 97,105 **** */ ! /* -------------- Port number for server running standalone --------------- */ ! ! #define DEFAULT_PORT 80 /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */ --- 98,114 ---- */ ! /* -------------- Port number and protocol for server running standalone -- */ ! #ifdef APACHE_SSL ! #define HTTP_PORT 80 ! #define HTTPS_PORT 443 ! #define default_port(r) ((r)->connection->client->ssl ? HTTPS_PORT : HTTP_PORT) ! #define is_default_port(port,r) ((port) == default_port(r)) ! #define http_method(r) ((r)->connection->client->ssl ? "https" : "http") ! #else ! #define is_default_port(port,r) ((port) == 80) ! #define http_method(r) "http" ! #endif /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */ *************** *** 238,244 **** --- 247,257 ---- * Example: "Apache/1.1b3 MrWidget/0.1-alpha" */ + #ifdef APACHE_SSL + #define SERVER_VERSION "Apache/1.1.1 Ben-SSL/1.3" /* SEE COMMENTS ABOVE */ + #else #define SERVER_VERSION "Apache/1.1.1" /* SEE COMMENTS ABOVE */ + #endif #define SERVER_PROTOCOL "HTTP/1.0" #define SERVER_SUPPORT "http://www.apache.org/" *************** *** 528,534 **** char *os_escape_path(pool *p,const char *path,int partial); char *escape_uri (pool *p, char *s); extern char *escape_html(pool *p, const char *s); ! char *construct_url (pool *p, char *path, server_rec *s); char *escape_shell_cmd (pool *p, char *s); int count_dirs(char *path); --- 541,547 ---- char *os_escape_path(pool *p,const char *path,int partial); char *escape_uri (pool *p, char *s); extern char *escape_html(pool *p, const char *s); ! char *construct_url (pool *p, char *path, request_rec *r); char *escape_shell_cmd (pool *p, char *s); int count_dirs(char *path); *************** *** 558,560 **** --- 571,581 ---- unsigned long get_virthost_addr (char *hostname, short int *port); extern time_t restart_time; + + typedef unsigned int BOOL; + #define TRUE 1 + #define FALSE 0 + + #ifdef APACHE_SSL + int ApacheSSLSetupConnection(conn_rec * conn); + #endif diff -C3 -r ../apache_1.1.1/src/md5.h ./src/md5.h *** ../apache_1.1.1/src/md5.h Thu Feb 22 11:46:52 1996 --- ./src/md5.h Sat Jul 13 15:28:20 1996 *************** *** 91,99 **** UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ ! } MD5_CTX; ! extern void MD5Init(MD5_CTX *context); ! extern void MD5Update(MD5_CTX *context, const unsigned char *input, unsigned int inputLen); ! extern void MD5Final(unsigned char digest[16], MD5_CTX *context); --- 91,99 ---- UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ ! } APACHE_MD5_CTX; ! extern void MD5Init(APACHE_MD5_CTX *context); ! extern void MD5Update(APACHE_MD5_CTX *context, const unsigned char *input, unsigned int inputLen); ! extern void MD5Final(unsigned char digest[16], APACHE_MD5_CTX *context); diff -C3 -r ../apache_1.1.1/src/md5c.c ./src/md5c.c *** ../apache_1.1.1/src/md5c.c Thu Feb 22 11:46:52 1996 --- ./src/md5c.c Sat Jul 13 15:30:29 1996 *************** *** 158,164 **** /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void ! MD5Init(MD5_CTX *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ --- 158,164 ---- /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void ! MD5Init(APACHE_MD5_CTX *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ *************** *** 173,179 **** context. */ void ! MD5Update(MD5_CTX *context, const unsigned char *input, unsigned int inputLen) { unsigned int i, index, partLen; --- 173,179 ---- context. */ void ! MD5Update(APACHE_MD5_CTX *context, const unsigned char *input, unsigned int inputLen) { unsigned int i, index, partLen; *************** *** 209,215 **** the message digest and zeroizing the context. */ void ! MD5Final(unsigned char digest[16], MD5_CTX *context) { unsigned char bits[8]; unsigned int index, padLen; --- 209,215 ---- the message digest and zeroizing the context. */ void ! MD5Final(unsigned char digest[16], APACHE_MD5_CTX *context) { unsigned char bits[8]; unsigned int index, padLen; diff -C3 -r ../apache_1.1.1/src/mod_dir.c ./src/mod_dir.c *** ../apache_1.1.1/src/mod_dir.c Fri Jun 21 20:12:07 1996 --- ./src/mod_dir.c Tue Jul 16 12:46:37 1996 *************** *** 779,785 **** "/", NULL); table_set (r->headers_out, "Location", ! construct_url(r->pool, ifile, r->server)); return REDIRECT; } --- 779,785 ---- "/", NULL); table_set (r->headers_out, "Location", ! construct_url(r->pool, ifile, r)); return REDIRECT; } diff -C3 -r ../apache_1.1.1/src/mod_imap.c ./src/mod_imap.c *** ../apache_1.1.1/src/mod_imap.c Fri Jun 7 17:39:25 1996 --- ./src/mod_imap.c Tue Jul 16 17:22:11 1996 *************** *** 366,376 **** char my_base[SMALLBUF] = {'\0'}; if ( ! strcasecmp(value, "map" ) || ! strcasecmp(value, "menu") ) { ! if (r->server->port == 80 ) { ! sprintf(url, "http://%s%s", r->server->server_hostname, r->uri); } else { ! sprintf(url, "http://%s:%d%s", r->server->server_hostname, r->server->port, r->uri); } return; --- 366,376 ---- char my_base[SMALLBUF] = {'\0'}; if ( ! strcasecmp(value, "map" ) || ! strcasecmp(value, "menu") ) { ! if (is_default_port(r->server->port,r)) { ! sprintf(url, "%s://%s%s", http_method(r),r->server->server_hostname, r->uri); } else { ! sprintf(url,"%s://%s:%d%s",http_method(r), r->server->server_hostname, r->server->port, r->uri); } return; *************** *** 405,415 **** strcpy(url, value); /* no base: use what is given */ } else { ! if (r->server->port == 80 ) { ! sprintf(url, "http://%s/", r->server->server_hostname); } ! if (r->server->port != 80 ) { ! sprintf(url, "http://%s:%d/", r->server->server_hostname, r->server->port); } /* no base, no value: pick a simple default */ } --- 405,415 ---- strcpy(url, value); /* no base: use what is given */ } else { ! if (is_default_port(r->server->port,r)) { ! sprintf(url, "%s://%s/",http_method(r), r->server->server_hostname); } ! else { ! sprintf(url, "%s://%s:%d/",http_method(r), r->server->server_hostname, r->server->port); } /* no base, no value: pick a simple default */ } diff -C3 -r ../apache_1.1.1/src/mod_log_config.c ./src/mod_log_config.c *** ../apache_1.1.1/src/mod_log_config.c Thu Jun 27 01:23:26 1996 --- ./src/mod_log_config.c Mon Jul 15 10:45:01 1996 *************** *** 70,75 **** --- 70,82 ---- * %...{Foobar}i: The contents of Foobar: header line(s) in the request * sent to the client. * %...{Foobar}o: The contents of Foobar: header line(s) in the reply. + * Additional SSL directives: + * + * %...{cipher}c: cipher used (SSL_get_cipher) + * %...{clientcert}c: client certificate information + * %...{errcode}c: X509 verify error code + * %...{errstr}c: X509 verify error string + * * * The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can * indicate conditions for inclusion of the item (which will cause it *************** *** 223,228 **** --- 230,263 ---- return pstrdup (r->pool, tstr); } + char *log_ssl_info(request_rec *r, char *a) + { + char str[MAX_STRING_LEN]; + + if(!strcmp(a, "cipher")) + return SSL_get_cipher(r->connection->client->ssl); + + if(!strcmp(a, "clientcert")) + return r->connection->client->szClientX509; + + if(!strcmp(a, "errcode")) + if(r->connection->client->nVerifyError) + { + sprintf(str, "%d", r->connection->client->nVerifyError); + return pstrdup(r->pool,str); + } + else + return NULL; + + if(!strcmp(a, "errstr")) + if(r->connection->client->nVerifyError) + return X509_cert_verify_error_string(r->connection->client->nVerifyError); + else + return NULL; + + return NULL; + } + /***************************************************************** * * Parsing the log format string *************** *** 243,248 **** --- 278,284 ---- { 'i', log_header_in, 0 }, { 'o', log_header_out, 0 }, { 'e', log_env_var, 0 }, + { 'c', log_ssl_info, 0 }, { '\0' } }; diff -C3 -r ../apache_1.1.1/src/util.c ./src/util.c *** ../apache_1.1.1/src/util.c Wed Jun 26 10:46:37 1996 --- ./src/util.c Tue Jul 16 17:23:50 1996 *************** *** 617,632 **** else return OK; } ! char *construct_url(pool *p, char *uri, server_rec *s) { char portnum[10]; /* Long enough. Really! */ ! ! if (s->port == 80) { ! return pstrcat (p, "http://", s->server_hostname, uri, NULL); ! } else { sprintf (portnum, "%d", s->port); ! return pstrcat (p, "http://", s->server_hostname, ":", portnum, uri, ! NULL); ! } } #define c2x(what,where) sprintf(where,"%%%02x",what) --- 617,634 ---- else return OK; } ! char *construct_url(pool *p, char *uri, request_rec *r) { char portnum[10]; /* Long enough. Really! */ ! server_rec *s=r->server; ! ! if(is_default_port(s->port,r)) ! return pstrcat(p,http_method(r),"://",s->server_hostname,uri,NULL); ! else ! { sprintf (portnum, "%d", s->port); ! return pstrcat (p,http_method(r), ! "://", s->server_hostname, ":", portnum, uri, NULL); ! } } #define c2x(what,where) sprintf(where,"%%%02x",what) diff -C3 -r ../apache_1.1.1/src/util_md5.c ./src/util_md5.c *** ../apache_1.1.1/src/util_md5.c Tue Mar 26 19:05:24 1996 --- ./src/util_md5.c Sat Jul 13 15:30:57 1996 *************** *** 85,91 **** char *md5 (pool *p, unsigned char *string) { ! MD5_CTX my_md5; unsigned char hash[16]; char *r, result[33]; int i; --- 85,91 ---- char *md5 (pool *p, unsigned char *string) { ! APACHE_MD5_CTX my_md5; unsigned char hash[16]; char *r, result[33]; int i; *************** *** 150,156 **** static char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; ! char *md5contextTo64(pool *a, MD5_CTX *context) { unsigned char digest[18]; char *encodedDigest; --- 150,156 ---- static char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; ! char *md5contextTo64(pool *a, APACHE_MD5_CTX *context) { unsigned char digest[18]; char *encodedDigest; *************** *** 177,183 **** char *md5digest(pool *p, FILE *infile) { ! MD5_CTX context; unsigned char buf[1000]; long length = 0; int nbytes; --- 177,183 ---- char *md5digest(pool *p, FILE *infile) { ! APACHE_MD5_CTX context; unsigned char buf[1000]; long length = 0; int nbytes; diff -C3 -r ../apache_1.1.1/src/util_md5.h ./src/util_md5.h *** ../apache_1.1.1/src/util_md5.h Thu Mar 21 03:50:16 1996 --- ./src/util_md5.h Sat Jul 13 15:29:02 1996 *************** *** 54,59 **** #include "md5.h" char *md5(pool *a, unsigned char *string); ! char *md5contextTo64(pool *p, MD5_CTX *context); char *md5digest(pool *p, FILE *infile); --- 54,59 ---- #include "md5.h" char *md5(pool *a, unsigned char *string); ! char *md5contextTo64(pool *p, APACHE_MD5_CTX *context); char *md5digest(pool *p, FILE *infile);