summaryrefslogtreecommitdiffstats
path: root/src/mod_auth_gssapi.h
blob: 2e05bb0438119bf32a4a6c2d9d8922db0363beba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Copyright (C) 2014 mod_auth_gssapi authors - See COPYING for (C) terms */

#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_ext.h>
#include <gssapi/gssapi_krb5.h>
#include <gssapi/gssapi_ntlmssp.h>

#define APR_WANT_STRFUNC
#include "apr_want.h"
#include <apr_strings.h>
#include <apr_base64.h>

#include <httpd.h>
#include <http_core.h>
#include <http_connection.h>
#include <http_log.h>
#include <http_request.h>
#include <mod_session.h>
#include <mod_ssl.h>

/* apache's httpd.h drags in empty PACKAGE_* variables.
 * undefine them to avoid annoying compile warnings as they
 * are re-defined in config.h */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"

#include "crypto.h"
#include "sessions.h"

#define MIN_SESS_EXP_TIME 300 /* 5 minutes validity minimum */

#ifdef HAVE_GSS_ACQUIRE_CRED_FROM
#  ifdef HAVE_GSS_STORE_CRED_INTO
#define HAVE_CRED_STORE 1
#  endif
#endif

struct mag_config {
    apr_pool_t *pool;
    bool ssl_only;
    bool map_to_local;
    bool gss_conn_ctx;
    bool send_persist;
    bool use_sessions;
#ifdef HAVE_CRED_STORE
    bool use_s4u2proxy;
    char *deleg_ccache_dir;
    gss_key_value_set_desc *cred_store;
#endif
    struct seal_key *mag_skey;

    bool use_basic_auth;
    gss_OID_set_desc *allowed_mechs;
    gss_OID_set_desc *basic_mechs;
};

struct mag_conn {
    apr_pool_t *pool;
    gss_ctx_id_t ctx;
    bool established;
    const char *user_name;
    const char *gss_name;
    time_t expiration;
    int auth_type;
    bool delegated;
    struct databuf basic_hash;
};

#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))

struct mag_conn *mag_new_conn_ctx(apr_pool_t *pool);