dgaudet 97/07/20 20:37:54
Modified: src CHANGES Configure PORTING conf.h dummy.c
http_main.c
src/modules/proxy proxy_ftp.c
Log:
Linux porting tweaks for glibc based systems. Linux tweaks to find db
libraries. Added NET_SIZE_T for handling size_t * args to some functions.
Revision Changes Path
1.357 +8 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.356
retrieving revision 1.357
diff -C3 -r1.356 -r1.357
*** CHANGES 1997/07/20 23:45:45 1.356
--- CHANGES 1997/07/21 03:37:47 1.357
***************
*** 1,5 ****
--- 1,13 ----
Changes with Apache 1.3
+ *) PORT: Some architectures use size_t for various lengths in network
+ functions such as accept(), and getsockname(). The definition
+ NET_SIZE_T is used to control this. [Dean Gaudet]
+
+ *) PORT: Linux: Attempt to detect glibc based systems and include crypt.h
+ and -lcrypt. Test for various db libraries (dbm, ndbm, db) when
+ mod_auth_dbm or mod_auth_db are included. [Dean Gaudet]
+
*) PORT: QNX doesn't have initgroups() which support/suexec.c uses.
[Igor N Kovalenko <[EMAIL PROTECTED]>]
1.114 +24 -12 apache/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apache/src/Configure,v
retrieving revision 1.113
retrieving revision 1.114
diff -C3 -r1.113 -r1.114
*** Configure 1997/07/19 09:34:32 1.113
--- Configure 1997/07/21 03:37:48 1.114
***************
*** 279,300 ****
CFLAGS="$CFLAGS -DIRIX"
fi
;;
- alpha-*-linux2)
- DEF_WANTHSREGEX=yes
- OS='Linux'
- CFLAGS="$CFLAGS -DLINUX=2"
- LIBS="$LIBS -lcrypt"
- ;;
- sparc-*-linux2)
- DEF_WANTHSREGEX=yes
- OS='Linux'
- CFLAGS="$CFLAGS -DLINUX=2"
- LIBS="$LIBS -lm"
- ;;
*-linux2)
DEF_WANTHSREGEX=yes
OS='Linux'
CFLAGS="$CFLAGS -DLINUX=2"
;;
*-linux1)
DEF_WANTHSREGEX=yes
--- 279,289 ----
CFLAGS="$CFLAGS -DIRIX"
fi
;;
*-linux2)
DEF_WANTHSREGEX=yes
OS='Linux'
CFLAGS="$CFLAGS -DLINUX=2"
+ LIBS="$LIBS -lm"
;;
*-linux1)
DEF_WANTHSREGEX=yes
***************
*** 684,697 ****
--- 673,709 ----
# before we actually write LIBS to Makefile.config.
# Punt for now...
+ case "$PLAT" in
+ *-linux*)
+ # newer systems using glibc 2.x need -lcrypt
+ if ./helpers/TestLib crypt; then
+ LIBS="$LIBS -lcrypt"
+ fi
+ # many systems have -ldb installed
+ DB_LIB=""
+ if ./helpers/TestLib db; then
+ DB_LIB="-ldb"
+ fi;
+ # many systems don't have -ldbm
+ DBM_LIB=""
+ if ./helpers/TestLib dbm; then
+ DBM_LIB="-ldbm"
+ elif ./helpers/TestLib ndbm; then
+ DBM_LIB="-lndbm"
+ fi
+ ;;
+ esac
+
#
# Are they using dbm/db auth? If so, add DBM/DB library.
#
if grep mod_auth_dbm Makefile > /dev/null; then
LIBS="$LIBS $DBM_LIB"
+ echo " + using $DBM_LIB for mod_auth_dbm"
fi
if grep mod_auth_db Makefile > /dev/null; then
LIBS="$LIBS $DB_LIB"
+ echo " + using $DB_LIB for mod_auth_db"
fi
####################################################################
1.8 +5 -0 apache/src/PORTING
Index: PORTING
===================================================================
RCS file: /export/home/cvs/apache/src/PORTING,v
retrieving revision 1.7
retrieving revision 1.8
diff -C3 -r1.7 -r1.8
*** PORTING 1997/07/07 14:34:24 1.7
--- PORTING 1997/07/21 03:37:48 1.8
***************
*** 245,250 ****
--- 245,255 ----
Amount to move sbrk() breakpoint, if required, before attaching
shared-memory segment.
+ NET_SIZE_T:
+ Some functions such as accept(), getsockname(), getpeername() take
+ an int *len on some architectures and a size_t *len on others.
+ If left undefined apache will default it to int.
+
-----------
Conclusion:
-----------
1.116 +14 -0 apache/src/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.115
retrieving revision 1.116
diff -C3 -r1.115 -r1.116
*** conf.h 1997/07/16 00:41:20 1.115
--- conf.h 1997/07/21 03:37:48 1.116
***************
*** 259,264 ****
--- 259,270 ----
#elif defined(LINUX)
#if LINUX > 1
+ #include <features.h>
+ #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
+ /* it's a glibc host */
+ #include <crypt.h>
+ #define NET_SIZE_T size_t
+ #endif
#define HAVE_SHMGET
#define HAVE_SYS_RESOURCE_H
typedef int rlim_t;
***************
*** 362,367 ****
--- 368,374 ----
#define HAVE_SYS_RESOURCE_H
#include <sys/time.h>
#define _POSIX_SOURCE
+ #define NET_SIZE_T size_t
#elif defined(DGUX)
#define NO_KILLPG
***************
*** 814,819 ****
--- 821,833 ----
#define XtOffsetOf(s_type,field) offsetof(s_type,field)
#else
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
+ #endif
+
+ /* some architectures require size_t * pointers where others require int *
+ * pointers in functions such as accept(), getsockname(), getpeername()
+ */
+ #ifndef NET_SIZE_T
+ #define NET_SIZE_T int
#endif
#ifdef SUNOS_LIB_PROTOTYPES
1.2 +1 -1 apache/src/dummy.c
Index: dummy.c
===================================================================
RCS file: /export/home/cvs/apache/src/dummy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C3 -r1.1 -r1.2
*** dummy.c 1997/07/13 19:01:09 1.1
--- dummy.c 1997/07/21 03:37:49 1.2
***************
*** 1,3 ****
! void dummy()
{
}
--- 1,3 ----
! void main()
{
}
1.183 +6 -9 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -C3 -r1.182 -r1.183
*** http_main.c 1997/07/20 04:05:56 1.182
--- http_main.c 1997/07/21 03:37:49 1.183
***************
*** 2084,2094 ****
void child_main(int child_num_arg)
{
! #if defined(UW)
! size_t clen;
! #else
! int clen;
! #endif
struct sockaddr sa_server;
struct sockaddr sa_client;
listen_rec *lr;
--- 2084,2090 ----
void child_main(int child_num_arg)
{
! NET_SIZE_T clen;
struct sockaddr sa_server;
struct sockaddr sa_client;
listen_rec *lr;
***************
*** 2744,2749 ****
--- 2740,2746 ----
request_rec *r;
struct sockaddr sa_server, sa_client;
BUFF *cio;
+ NET_SIZE_T l;
open_logs(server_conf, pconf);
set_group_privs();
***************
*** 2767,2782 ****
}
#endif
! c = sizeof(sa_client);
! if ((getpeername(fileno(stdin), &sa_client, &c)) < 0)
{
/* get peername will fail if the input isn't a socket */
perror("getpeername");
memset(&sa_client, '\0', sizeof(sa_client));
}
! c = sizeof(sa_server);
! if(getsockname(fileno(stdin), &sa_server, &c) < 0) {
perror("getsockname");
fprintf(stderr, "Error getting local address\n");
exit(1);
--- 2764,2779 ----
}
#endif
! l = sizeof(sa_client);
! if ((getpeername(fileno(stdin), &sa_client, &l)) < 0)
{
/* get peername will fail if the input isn't a socket */
perror("getpeername");
memset(&sa_client, '\0', sizeof(sa_client));
}
! l = sizeof(sa_server);
! if(getsockname(fileno(stdin), &sa_server, &l) < 0) {
perror("getsockname");
fprintf(stderr, "Error getting local address\n");
exit(1);
1.26 +10 -9 apache/src/modules/proxy/proxy_ftp.c
Index: proxy_ftp.c
===================================================================
RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_ftp.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C3 -r1.25 -r1.26
*** proxy_ftp.c 1997/07/19 20:16:21 1.25
--- proxy_ftp.c 1997/07/21 03:37:53 1.26
***************
*** 402,409 ****
BUFF *f, *cache;
BUFF *data = NULL;
pool *pool=r->pool;
! const int one=1;
const long int zero=0L;
void *sconf = r->server->module_config;
proxy_server_conf *conf =
--- 402,410 ----
BUFF *f, *cache;
BUFF *data = NULL;
pool *pool=r->pool;
! int one=1;
const long int zero=0L;
+ NET_SIZE_T clen;
void *sconf = r->server->module_config;
proxy_server_conf *conf =
***************
*** 498,505 ****
}
note_cleanups_for_socket(pool, sock);
! if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one,
! sizeof(int)) == -1)
{
proxy_log_uerror("setsockopt", NULL,
"proxy: error setting reuseaddr option", r->server);
--- 499,506 ----
}
note_cleanups_for_socket(pool, sock);
! if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one,
! sizeof(one)) == -1)
{
proxy_log_uerror("setsockopt", NULL,
"proxy: error setting reuseaddr option", r->server);
***************
*** 742,749 ****
if (!pasvmode) /* set up data connection */
{
! len = sizeof(struct sockaddr_in);
! if (getsockname(sock, (struct sockaddr *)&server, &len) < 0)
{
proxy_log_uerror("getsockname", NULL,
"proxy: error getting socket address", r->server);
--- 743,750 ----
if (!pasvmode) /* set up data connection */
{
! clen = sizeof(struct sockaddr_in);
! if (getsockname(sock, (struct sockaddr *)&server, &clen) < 0)
{
proxy_log_uerror("getsockname", NULL,
"proxy: error getting socket address", r->server);
***************
*** 763,770 ****
}
note_cleanups_for_fd(pool, dsock);
! if (setsockopt(dsock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one,
! sizeof(int)) == -1)
{
proxy_log_uerror("setsockopt", NULL,
"proxy: error setting reuseaddr option", r->server);
--- 764,771 ----
}
note_cleanups_for_fd(pool, dsock);
! if (setsockopt(dsock, SOL_SOCKET, SO_REUSEADDR, (void *)&one,
! sizeof(one)) == -1)
{
proxy_log_uerror("setsockopt", NULL,
"proxy: error setting reuseaddr option", r->server);
***************
*** 932,939 ****
if (!pasvmode) /* wait for connection */
{
hard_timeout ("proxy ftp data connect", r);
! len = sizeof(struct sockaddr_in);
! do csd = accept(dsock, (struct sockaddr *)&server, &len);
while (csd == -1 && errno == EINTR);
if (csd == -1)
{
--- 933,940 ----
if (!pasvmode) /* wait for connection */
{
hard_timeout ("proxy ftp data connect", r);
! clen = sizeof(struct sockaddr_in);
! do csd = accept(dsock, (struct sockaddr *)&server, &clen);
while (csd == -1 && errno == EINTR);
if (csd == -1)
{