forked from Uninett/mod_auth_mellon
-
Notifications
You must be signed in to change notification settings - Fork 49
/
auth_mellon_compat.h
57 lines (45 loc) · 1.52 KB
/
auth_mellon_compat.h
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
#ifndef AUTH_MELLON_COMPAT_H
#define AUTH_MELLON_COMPAT_H
#include <glib.h>
#include "ap_config.h"
#include "ap_release.h"
#ifdef AP_NEED_SET_MUTEX_PERMS
#include "unixd.h"
#endif
/* Old glib compatibility */
#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)
static void g_hash_table_get_keys_helper(gpointer key, gpointer value,
gpointer user_data)
{
GList **out = user_data;
*out = g_list_prepend(*out, key);
}
static GList *g_hash_table_get_keys(GHashTable *ht)
{
GList *ret = NULL;
g_hash_table_foreach(ht, g_hash_table_get_keys_helper, &ret);
return g_list_reverse(ret);
}
#endif
/* "remote_ip" in struct conn_rec changed name to "client_ip" in Apache 2.4.
* This function retrieves the corrent member depending on the Apache version.
*/
static inline const char *am_compat_request_ip(request_rec *r) {
#if (AP_SERVER_MAJORVERSION_NUMBER == 2) && (AP_SERVER_MINORVERSION_NUMBER < 4)
return r->connection->remote_ip;
#else
return r->useragent_ip;
#endif
}
/* unixd_set_global_mutex_perms changed name to ap_unixd_set_global_mutex_perms
* in Apache 2.4. This function provides a wrapper with the new name for old
* versions.
*/
#ifdef AP_NEED_SET_MUTEX_PERMS
#if (AP_SERVER_MAJORVERSION_NUMBER == 2) && (AP_SERVER_MINORVERSION_NUMBER < 4)
static inline apr_status_t ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) {
return unixd_set_global_mutex_perms(gmutex);
}
#endif
#endif /* AP_NEED_SET_MUTEX_PERMS */
#endif /* AUTH_MELLON_COMPAT_H */