SSLIOP_CredentialsAcquirer.cpp File Reference

#include "orbsvcs/SSLIOP/SSLIOP_CredentialsAcquirer.h"
#include "orbsvcs/SSLIOP/SSLIOP_OwnCredentials.h"
#include "tao/debug.h"
#include "tao/ORB_Constants.h"
#include "ace/SSL/SSL_Context.h"
#include "ace/OS_NS_stdio.h"
#include <openssl/x509.h>
#include <openssl/pem.h>

Include dependency graph for SSLIOP_CredentialsAcquirer.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define TAO_SSLIOP_PASSWORD_CALLBACK_NAME   TAO_SSLIOP_password_callback

Functions

int TAO_SSLIOP_PASSWORD_CALLBACK_NAME (char *buf, int size, int, void *userdata)


Define Documentation

#define TAO_SSLIOP_PASSWORD_CALLBACK_NAME   TAO_SSLIOP_password_callback
 

Definition at line 27 of file SSLIOP_CredentialsAcquirer.cpp.

Referenced by TAO::SSLIOP::CredentialsAcquirer::make_EVP_PKEY(), and TAO::SSLIOP::CredentialsAcquirer::make_X509().


Function Documentation

int TAO_SSLIOP_PASSWORD_CALLBACK_NAME char *  buf,
int  size,
int  ,
void *  userdata
 

Definition at line 33 of file SSLIOP_CredentialsAcquirer.cpp.

References ACE_OS::memcpy(), ACE_OS::memset(), and ACE_OS::strlen().

00037 {
00038   // @@ I'm probably over complicating this implementation, but that's
00039   //    what you get when you try to be overly efficient.  :-)
00040   //        -Ossama
00041 
00042   const char * password = static_cast<char *> (userdata);
00043 
00044   int pwlen = -1;
00045 
00046   if (password != 0)
00047     {
00048       pwlen = ACE_OS::strlen (password);
00049 
00050       int copy_len = pwlen + 1;  // Include the NULL terminator
00051 
00052       // Clear the portion of the buffer that exceeds the space that
00053       // will be occupied by the password.
00054       if (copy_len < size)
00055         ACE_OS::memset (buf + copy_len, 0, size - copy_len);
00056 
00057       // Make sure we don't overflow the OpenSSL supplied buffer.
00058       // Truncate the password if necessary.
00059       copy_len = (copy_len > size) ? size : copy_len;
00060 
00061       ACE_OS::memcpy (buf, password, copy_len);
00062 
00063       // NULL terminate the truncated password.
00064       if (copy_len > size)
00065         {
00066           pwlen = size - 1;
00067           buf[pwlen] = '\0';
00068         }
00069     }
00070 
00071   return pwlen;
00072 }


Generated on Thu Nov 9 13:54:41 2006 for TAO_SSLIOP by doxygen 1.3.6