Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 26691 invoked from network); 10 Jan 2005 17:00:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Jan 2005 17:00:27 -0000 Received: (qmail 99782 invoked by uid 500); 10 Jan 2005 17:00:17 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 99771 invoked by uid 500); 10 Jan 2005 17:00:16 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 99758 invoked by uid 99); 10 Jan 2005 17:00:16 -0000 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,FORGED_RCVD_HELO,HTML_20_30,HTML_MESSAGE,HTML_TITLE_EMPTY X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtp.persistent.co.in (HELO smtp.pspl.co.in) (202.54.11.65) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 10 Jan 2005 09:00:15 -0800 Received: from [192.168.10.62] (fremont.intranet.pspl.co.in [192.168.10.62]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id j0AH4GRV006949; Mon, 10 Jan 2005 22:34:17 +0530 Message-ID: <41E2B4F8.4020208@hotpop.com> Date: Mon, 10 Jan 2005 22:31:44 +0530 From: Prashant Shetty Reply-To: prashant_shetty@hotpop.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: users@httpd.apache.org Content-Type: multipart/alternative; boundary="------------080307030205020307000303" X-Virus-Checked: Checked Subject: [users@httpd] Problem with Function Pointers in my Module in Apache 1.3.33 on AIX X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --------------080307030205020307000303 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit *The Problem* : I am using a function pointer in my WebServer module to call OpenSSL function - SSL_get_peer_certificate() from the main Apache process. The function definition is taken from the OpenSSL Library : /libssl.a/ . On execution, I get the following error in my Apache Error Log file : /Error: Look up of symbol - SSL_get_peer_certificate failed - Function not implemented (SSL_get_peer_certificate)./ *Modules used to build Apache WebServer* : mod_ssl version : *2.8.22-1.3.33* OpenSSL version : *0.9.7d* ( openssl-0.9.7e is giving problem while building on AIX ) Apache version : *1.3.33* AIX version : *4.3* and *5.2* gcc version : *2.95.3* *Code* : ---------------------------------------------------------------------------- void * libssl = NULL; typedef X509* (*funcptr)(SSL*); funcptr fptr = NULL; // Get the handle to main Apache process libssl = dlopen (NULL, RTLD_NOW | RTLD_GLOBAL | RTLD_MEMBER ); fptr = (funcptr) dlsym(libssl, "SSL_get_peer_certificate"); ---------------------------------------------------------------------------- *Details :* Initially, the problem I faced was that the function symbol /SSL_get_peer_certificate/, was getting garbage collected ( During linking and binding on AIX, any unused or unreferenced symbols are deleted ). This was the output of /nm/ command on /httpd/ executable : .SSL_get_peer_certificate T 269039260 .. ie .. the function definition was visible only in the Text Section. Hence, while building Apache, I specifically exported the function symbol using -u flag with /ld/. The /make /command is : make MFLAGS="EXTRA_LDFLAGS='-uSSL_get_peer_certificate'" The output of /nm/ command on /httpd/ executable now is : .SSL_get_peer_certificate T 269039260 SSL_get_peer_certificate D 536993772 SSL_get_peer_certificate d 536993772 12 Now, the function is visible in the Data Section both at global and local level. But I am still not able to access the function using the pointer. Same is the case with accessing the functions in my own module, using a pointer. *Further Observations :* - If we do a /dlsym /to get the handle of a function defined *inside Apache Code*, there is no such problem. - There is no problem using function pointers in the rest of our application. Has anybody else faced a similar problem? Any pointers or related links would be of great help. Thanks in Advance, Prashant. --------------080307030205020307000303 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit The Problem :
I am using a function pointer in my WebServer module to call  OpenSSL function - SSL_get_peer_certificate() from the main Apache process. The function definition is taken from the OpenSSL Library : libssl.a . On execution, I get the following error in my Apache Error Log file :
Error: Look up of symbol - SSL_get_peer_certificate failed - Function not implemented (SSL_get_peer_certificate).

Modules used to build Apache WebServer :
mod_ssl version : 2.8.22-1.3.33
OpenSSL version : 0.9.7d  ( openssl-0.9.7e  is giving problem while building on AIX )
Apache version : 1.3.33
AIX version :  4.3 and 5.2
gcc version : 2.95.3

Code :
----------------------------------------------------------------------------
void * libssl = NULL;
typedef X509* (*funcptr)(SSL*);
funcptr fptr = NULL;

// Get the handle to main Apache process
libssl = dlopen (NULL, RTLD_NOW | RTLD_GLOBAL | RTLD_MEMBER ); 
fptr = (funcptr) dlsym(libssl, "SSL_get_peer_certificate");
----------------------------------------------------------------------------

Details :
Initially, the problem I faced was that the function symbol SSL_get_peer_certificate, was getting garbage collected  ( During linking and binding on AIX, any unused or unreferenced symbols are deleted ). This was the output of nm command on httpd executable :
.SSL_get_peer_certificate T   269039260
.. ie .. the function definition was visible only in the Text Section.

Hence, while building Apache, I specifically exported the function symbol using -u flag with ld. The make command is :
make MFLAGS="EXTRA_LDFLAGS='-uSSL_get_peer_certificate'"

The output of nm command on httpd executable now is :
.SSL_get_peer_certificate T   269039260
SSL_get_peer_certificate D   536993772
SSL_get_peer_certificate d   536993772      12
Now, the function is visible in the Data Section both at global and local level.

But I am still not able to access the function using the pointer. Same is the case with accessing the functions in my own module, using a pointer.

Further Observations :
- If we do a dlsym to get the handle of a function defined inside Apache Code, there is no such problem.
- There is no problem using function pointers in the rest of our application.

Has anybody else faced a similar problem? Any pointers or related links would be of great help.

Thanks in Advance,
Prashant.

--------------080307030205020307000303--