*/
int ssl_hook_UserCheck(request_rec *r)
{
- SSLConnRec *sslconn = myConnConfig(r->connection);
- SSLSrvConfigRec *sc = mySrvConfig(r->server);
+ SSLConnRec *sslconn;
SSLDirConfigRec *dc = myDirConfig(r);
const char *user, *auth_line, *username, *password;
/*
* We decline operation in various situations...
+ * - TLS not enabled
+ * - client did not present a certificate
* - SSLOptions +FakeBasicAuth not configured
* - r->user already authenticated
- * - ssl not enabled
- * - client did not present a certificate
*/
- if (!((sc->enabled == SSL_ENABLED_TRUE || sc->enabled == SSL_ENABLED_OPTIONAL)
- && sslconn && sslconn->ssl && sslconn->client_cert) ||
- !(dc->nOptions & SSL_OPT_FAKEBASICAUTH) || r->user)
- {
+ if (!modssl_request_is_tls(r, &sslconn)
+ || !sslconn->client_cert
+ || !(dc->nOptions & SSL_OPT_FAKEBASICAUTH)
+ || r->user) {
return DECLINED;
}
const char *servername;
#endif
STACK_OF(X509) *peer_certs;
+ SSLConnRec *sslconn;
SSL *ssl;
int i;
- if (!modssl_request_is_tls(r, &ssl)) {
+ if (!modssl_request_is_tls(r, &sslconn)) {
return DECLINED;
}
+ ssl = sslconn->ssl;
/*
* Annotate the SSI/CGI environment with standard SSL information
* memory. */
DH *modssl_get_dh_params(unsigned keylen);
-/* Returns non-zero if the request is using SSL/TLS. If ssl is
- * non-NULL and the request is using SSL/TLS, sets *ssl to the
- * corresponding SSL structure for the connectbion. */
-int modssl_request_is_tls(const request_rec *r, SSL **ssl);
+/* Returns non-zero if the request was made over SSL/TLS. If sslconn
+ * is non-NULL and the request is using SSL/TLS, sets *sslconn to the
+ * corresponding SSLConnRec structure for the connection. */
+int modssl_request_is_tls(const request_rec *r, SSLConnRec **sslconn);
#if HAVE_VALGRIND
extern int ssl_running_on_valgrind;
return FALSE;
}
-int modssl_request_is_tls(const request_rec *r, SSL **ssl)
+int modssl_request_is_tls(const request_rec *r, SSLConnRec **scout)
{
SSLConnRec *sslconn = myConnConfig(r->connection);
SSLSrvConfigRec *sc = mySrvConfig(r->server);
if (sc->enabled == SSL_ENABLED_FALSE || !sslconn || !sslconn->ssl)
return 0;
- if (ssl) *ssl = sslconn->ssl;
+ if (scout) *scout = sslconn;
return 1;
}