httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashant Shetty <prashant_she...@hotpop.com>
Subject Problem with Function Pointers in my Module in Apache 1.3.33 on AIX
Date Tue, 11 Jan 2005 08:31:38 GMT
*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.



Mime
View raw message