ssl_engine_vars.c revision 40ec097fc670e8068b2342d2cd00247fb1ae2645
/* _ _
** _ __ ___ ___ __| | ___ ___| | mod_ssl
** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL
** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org
** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org
** |_____|
** Variable Lookup Facility
*/
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*/
/* ``Those of you who think they
know everything are very annoying
to those of us who do.''
-- Unknown */
#include "mod_ssl.h"
/* _________________________________________________________________
**
** Variable Lookup
** _________________________________________________________________
*/
void ssl_var_register(void)
{
return;
}
{
char *result;
/*
* When no pool is given try to find one
*/
if (p == NULL) {
if (r != NULL)
p = r->pool;
else if (c != NULL)
p = c->pool;
else
}
/*
* Request dependent stuff
*/
if (r != NULL) {
/* all other headers from which we are still not know about */
result = r->the_request;
result = (char *)ap_http_method(r);
result = (char *)ap_get_remote_logname(r);
result = (char *)ap_document_root(r);
result = (char *)ap_get_server_name(r);
}
/*
* Connection stuff
*/
sslconn = myConnConfig(c);
result = r->ap_auth_type;
result = "on";
else
result = "off";
}
}
/*
* Totally independent stuff
*/
result = (char *)ap_get_server_version();
}
}
}
}
}
}
}
}
result = apr_psprintf(p,
}
/* all other env-variables from the parent Apache process */
}
}
result = "";
return result;
}
{
return hdr;
}
{
char *result;
}
}
char buf[SSL_SESSION_ID_STRING_LEN];
}
}
}
result = ssl_var_lookup_ssl_cert_verify(p, c);
}
}
}
}
return result;
}
{
char *result;
int nid;
char *cp;
}
}
}
}
}
}
}
}
result = apr_pstrdup(p,
}
result = apr_pstrdup(p,
}
}
return result;
}
static const struct {
char *name;
int nid;
} ssl_var_lookup_ssl_cert_dn_rec[] = {
{ "C", NID_countryName },
{ "L", NID_localityName },
{ "O", NID_organizationName },
{ "OU", NID_organizationalUnitName },
{ "CN", NID_commonName },
{ "T", NID_title },
{ "I", NID_initials },
{ "G", NID_givenName },
{ "S", NID_surname },
{ "D", NID_description },
/* This has been removed in OpenSSL 0.9.8-dev. */
#ifdef NID_uniqueIdentifier
{ "UID", NID_uniqueIdentifier },
#endif
{ "Email", NID_pkcs9_emailAddress },
{ NULL, 0 }
};
{
char *result;
int i, j, n;
unsigned char *data_ptr;
int data_len;
j++) {
X509_NAME_get_entries(xsname), j);
if (n == ssl_var_lookup_ssl_cert_dn_rec[i].nid) {
#ifdef CHARSET_EBCDIC
#endif /* CHARSET_EBCDIC */
break;
}
}
break;
}
}
return result;
}
{
char *result;
int n;
return NULL;
n = BIO_pending(bio);
return result;
}
{
char *result;
int n;
return NULL;
n = BIO_pending(bio);
return result;
}
{
char *result;
int n;
if (n < sk_X509_num(sk)) {
}
}
return result;
}
{
char *result;
int n;
return NULL;
n = BIO_pending(bio);
return result;
}
{
char *result;
long vrc;
const char *verr;
const char *vinfo;
/* no client verification done at all */
result = "NONE";
/* client verification done successful */
result = "SUCCESS";
/* client verification done in generous way */
result = "GENEROUS";
else
/* client verification failed */
if (xs)
return result;
}
{
char *result;
int usekeysize, algkeysize;
}
}
}
return result;
}
{
*usekeysize = 0;
*algkeysize = 0;
return;
}
{
char *result;
#if defined(SSL_PRODUCT_NAME) && defined(SSL_PRODUCT_VERSION)
#else
#endif
}
}
*cp = '/';
}
}
return result;
}
/* _________________________________________________________________
**
** SSL Extension to mod_log_config
** _________________________________________________________________
*/
#include "../../modules/loggers/mod_log_config.h"
static const char *ssl_var_log_handler_c(request_rec *r, char *a);
static const char *ssl_var_log_handler_x(request_rec *r, char *a);
/*
* register us for the mod_log_config function registering phase
* to establish %{...}c and to be able to expand %{...}x variables.
*/
void ssl_var_log_config_register(apr_pool_t *p)
{
if (log_pfn_register) {
}
return;
}
/*
* implement the %{..}c log function
* (we are the only function)
*/
static const char *ssl_var_log_handler_c(request_rec *r, char *a)
{
char *result;
return NULL;
if (strEQ(a, "version"))
else if (strEQ(a, "cipher"))
else if (strEQ(a, "errcode"))
result = "-";
else if (strEQ(a, "errstr"))
return result;
}
/*
* extend the implementation of the %{..}x log function
* (there can be more functions)
*/
static const char *ssl_var_log_handler_x(request_rec *r, char *a)
{
char *result;
return result;
}