Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Problem with Function Pointers in my Module in Apache 1.3...

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  IE automatic logon does not work after XP SP2  
Author Message
prashant_shett

External


Since: Jan 10, 2005
Posts: 1



(Msg. 1) Posted: Mon Jan 10, 2005 9:23 am
Post subject: Problem with Function Pointers in my Module in Apache 1.3.33 on AIX
Archived from groups: comp>unix>aix, others (more info?)

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.

 >> Stay informed about: Problem with Function Pointers in my Module in Apache 1.3... 
Back to top
Login to vote
noway6

External


Since: Jan 14, 2005
Posts: 1



(Msg. 2) Posted: Fri Jan 14, 2005 12:35 pm
Post subject: Re: Problem with Function Pointers in my Module in Apache 1.3.33 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Prashant Shetty wrote:
 > 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");
 > ------------------------------------------------------
 >
<...snip...>
 >
 > 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.

Not good enough. -u only prevents garbage collection. The real
question is, is the symbol _exported_? dump -Tv <file> | grep peer
will tell you this. nm and dump -tv are useless when what you need to
examine is the API of the module. You'll need to add an export list
(-bE:<explist>) to your build command.

Otherwise, your dlopen/dlsym usage appears correct.

--
Gary R. Hook
________________________________________________________________________
    Vocatus atque non vocatus deus aderit<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Problem with Function Pointers in my Module in Apache 1.3... 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
undefined function() + can't load module question yet agai.. - First I am a newbie to php, apache and mysql - I'm not new to programming etc. I seriously want to learn this. I'm specifically chosing this environment in order to have the option to move to linux later on. I am learning (teaching my self) to run a..

Some pointers please dyndns.org and apache - I registered a domain name with DYNDNS.org and this domain name is pointing at my ip address. I have installed Apache on Mandrake 9.2 and everything appears to be working this side. I have followed the instruction from the dyndns support pages for apach...

Newbie problem (PHP module with Apache on XP Pro) - Hi folks I wonder if anyone can help me out. I'm a total newbie to Apache. I want to learn about online databases so I've started with a book. I installed MySQL and that works ok. Installed Apache 2.0.43 and got it running. Starting Netscape or IE and ...

Apache Oracle load module problem - Hi I have finally successfully installed the DBD and DBI modules. They work fine from a script started from the command line but as soon as I try to use them in an apache CGI call it gives the following error: ..

Problem changing PHP from CGI to module in Apache 2 on Man.. - Hey folks :) Trying to install PostNuke on my Apache server, which isn't going too well, since it won't install on servers running PHP as CGI. I actually thought I was running PHP as a module, but installing PN proved otherwise ;) Anyways, I..
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]