Re: built-in apache server with mod_rpaf compile error

[email protected] (Jérémie Courrèges-Angl as)
Newsgroups gmane.os.openbsd.www
Message-ID <[email protected]>
Hi. Please ask misc@ for support, next time.

suisou <[email protected]> writes:

>  OpenBSD 5.1-stable (GENERIC.MP) #0: Sat May 26 19:25:48 CST 2012
> amd64 wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
> tar zxvf mod_rpaf-0.6.tar.gz
> cd mod_rpaf-0.6
> # /usr/sbin/apxs -i -c -n mod_rpaf.so mod_rpaf.c
> cc -O2 -pipe -DINET6 -Dss_family=__ss_family -Dss_len=__ss_len
> -DHAVE_SOCKADDR_LEN -DMOD_SSL=208116 -DEAPI -DUSE_SETUSERCONTEXT -fPIC
> -DSHARED_MODULE -I/usr/lib/apache/include  -c mod_rpaf.c
> mod_rpaf.c: In function 'rpaf_cleanup':
> mod_rpaf.c:151: error: 'struct sockaddr_storage' has no member named
> 'sin_addr'
> mod_rpaf.c: In function 'change_remote_ip':
> mod_rpaf.c:186: error: 'struct sockaddr_storage' has no member named
> 'sin_addr'
> apxs:Break: Command failed with rc=1
> # httpd -v
> Server version: Apache/1.3.29 (Unix)
> each version  mod_rpaf   has the same  error how to repire it ?
>

Casting to struct sockaddr_in solves the compilation error, but I'm not
sure that's a safe option.

-- 
JC)rC)mie CourrC(ges-Anglas
GPG fingerprint: 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494

diff -pruN mod_rpaf-0.6.old/mod_rpaf.c mod_rpaf-0.6/mod_rpaf.c
--- mod_rpaf-0.6.old/mod_rpaf.c	Tue Jan  1 04:03:15 2008
+++ mod_rpaf-0.6/mod_rpaf.c	Wed May 30 10:19:57 2012
@@ -148,7 +148,7 @@ static int is_in_array(const char *remote_ip, array_he
 static void rpaf_cleanup(void *data) {
     rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data;
     rcr->r->connection->remote_ip   = ap_pstrdup(rcr->r->connection->pool, rcr->old_ip);
-    rcr->r->connection->remote_addr.sin_addr.s_addr = inet_addr(rcr->r->connection->remote_ip);
+    ((struct sockaddr_in *) &rcr->r->connection->remote_addr)->sin_addr.s_addr = inet_addr(rcr->r->connection->remote_ip);
 }
 
 static int change_remote_ip(request_rec *r) {
@@ -183,7 +183,7 @@ static int change_remote_ip(request_rec *r) {
             rcr->r = r;
             ap_register_cleanup(r->pool, (void *)rcr, rpaf_cleanup, ap_null_cleanup);
             r->connection->remote_ip = ap_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
-            r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
+            ((struct sockaddr_in *) &r->connection->remote_addr)->sin_addr.s_addr = inet_addr(r->connection->remote_ip);
             if (cfg->sethostname) {
                 const char *hostvalue;
                 if (hostvalue = ap_table_get(r->headers_in, "X-Forwarded-Host")) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.