hi, I'm using OpenSSL 0.9.8q in FreeBSD-8.2. I have 3 virtual hosts on my system and want to implement SNI to serve for all 3 of them in one server. I have 3 separate certificates one for each, and in my ssl-server code I have to somehow findout what is the domain-name of client's request, and use the appropriate certificate file based on that. for this I wrote a function named "get_ssl_servername_cb" and passed it as callback function to "SSL_CTX_set_tlsext_servername_callback". this way, in callback function I can get the the domain-name of the client's request.
but my problem is, this callback function is being executed after execution of "SSL_accept" function, but I have to choose and use the appropriate certificate before using "SSL_new" command, which is way before execution of SSL_accept. so my question is, how can I use "SSL_CTX_set_tlsext_servername_callback" function for SNI? any help would be much appropriated. thank you.