[PATCH] omniorb: use password userdata hook for the password
Teemu Torma <[email protected]> Fri, 26 Oct 2007 00:19:20 +0200
| Newsgroups | gmane.comp.corba.omniorb.devel |
|---|---|
| Message-ID | <[email protected]> |
--Boundary-00=_pZRIHh3xPOvBTGo
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
The following patch is just for "niceness" to use the password userdata
to give the password to the callback instead of a static variable. I
am sure the code works perfectly as it is right now.
Teemu
--Boundary-00=_pZRIHh3xPOvBTGo
Content-Type: text/x-diff; charset="us-ascii";
name="omniorb-ssl-password.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="omniorb-ssl-password.patch"
diff --git a/src/lib/omniORB/orbcore/ssl/sslContext.cc b/src/lib/omniORB/orbcore/ssl/sslContext.cc
--- a/src/lib/omniORB/orbcore/ssl/sslContext.cc
+++ b/src/lib/omniORB/orbcore/ssl/sslContext.cc
@@ -240,13 +240,13 @@ sslContext::set_cipher() {
}
/////////////////////////////////////////////////////////////////////////
-static const char* ssl_password = 0;
+extern "C"
+int sslContext_password_cb (char *buf,int num,int,void *arg) {
+ const char **password = static_cast<const char **> (arg);
-extern "C"
-int sslContext_password_cb (char *buf,int num,int,void *) {
- int size = strlen(ssl_password);
+ int size = strlen(*password);
if (num < size+1) return 0;
- strcpy(buf,ssl_password);
+ strcpy(buf,*password);
return size;
}
@@ -262,8 +262,10 @@ sslContext::set_privatekey() {
return;
}
- ssl_password = pd_password;
+ void *password_arg = static_cast<void *> (&pd_password);
SSL_CTX_set_default_passwd_cb(pd_ctx,sslContext_password_cb);
+ SSL_CTX_set_default_passwd_cb_userdata(pd_ctx,password_arg);
+
if(!(SSL_CTX_use_PrivateKey_file(pd_ctx,pd_keyfile,SSL_FILETYPE_PEM))) {
report_error();
OMNIORB_THROW(INITIALIZE,INITIALIZE_TransportError,CORBA::COMPLETED_NO);
--Boundary-00=_pZRIHh3xPOvBTGo
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
omniORB-dev mailing list
[email protected]
http://www.omniorb-support.com/mailman/listinfo/omniorb-dev
--Boundary-00=_pZRIHh3xPOvBTGo--