Skip to content

Commit 66857a8

Browse files
committed
Implement checking for TLS connections
Obey the GSSSSLOnly setting.
1 parent 7454bf6 commit 66857a8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/mod_auth_gssapi.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
module AP_MODULE_DECLARE_DATA auth_gssapi_module;
3939

40+
APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *));
41+
4042
struct mag_config {
4143
bool ssl_only;
4244
bool map_to_local;
@@ -103,6 +105,17 @@ static int mag_pre_connection(conn_rec *c, void *csd)
103105
return OK;
104106
}
105107

108+
static APR_OPTIONAL_FN_TYPE(ssl_is_https) *mag_is_https = NULL;
109+
110+
static bool mag_conn_is_https(conn_rec *c)
111+
{
112+
if (mag_is_https) {
113+
if (mag_is_https(c)) return true;
114+
}
115+
116+
return false;
117+
}
118+
106119
static int mag_auth(request_rec *req)
107120
{
108121
const char *type;
@@ -134,8 +147,11 @@ static int mag_auth(request_rec *req)
134147
cfg = ap_get_module_config(req->per_dir_config, &auth_gssapi_module);
135148

136149
if (cfg->ssl_only) {
137-
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, req,
138-
"FIXME: check for ssl!");
150+
if (!mag_conn_is_https(req->connection)) {
151+
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, req,
152+
"Not a TLS connection, refusing to authenticate!");
153+
goto done;
154+
}
139155
}
140156

141157
if (cfg->gss_conn_ctx) {

0 commit comments

Comments
 (0)