|
Lines 43-50
Link Here
|
| 43 |
#include <string.h> |
43 |
#include <string.h> |
| 44 |
#include <time.h> |
44 |
#include <time.h> |
| 45 |
#include <sys/time.h> |
45 |
#include <sys/time.h> |
|
|
46 |
#include <sys/statvfs.h> |
| 46 |
|
47 |
|
| 47 |
#include <univention/debug.h> |
48 |
#include <univention/debug.h> |
|
|
49 |
#include <univention/config.h> |
| 48 |
#include <univention/ldap.h> |
50 |
#include <univention/ldap.h> |
| 49 |
#ifdef WITH_KRB5 |
51 |
#ifdef WITH_KRB5 |
| 50 |
#include <univention/krb5.h> |
52 |
#include <univention/krb5.h> |
|
Lines 84-89
static int connect_to_ldap(univention_ldap_parameters_t *lp,
Link Here
|
| 84 |
return LDAP_SUCCESS; |
86 |
return LDAP_SUCCESS; |
| 85 |
} |
87 |
} |
| 86 |
|
88 |
|
|
|
89 |
static void check_free_space() |
| 90 |
{ |
| 91 |
static int min_mib = -2; |
| 92 |
const char *dirnames[] = { |
| 93 |
cache_dir, |
| 94 |
ldap_dir, |
| 95 |
NULL |
| 96 |
}, **dirname; |
| 97 |
|
| 98 |
if (min_mib == -2) |
| 99 |
min_mib = univention_config_get_int("listener/freespace"); |
| 100 |
|
| 101 |
if (min_mib <= 0) |
| 102 |
return; |
| 103 |
|
| 104 |
for (dirname=dirnames; *dirname; dirname++) { |
| 105 |
struct statvfs buf; |
| 106 |
int free_mib; |
| 107 |
|
| 108 |
if (statvfs(*dirname, &buf)) |
| 109 |
continue; |
| 110 |
|
| 111 |
free_mib = ((long)buf.f_bavail * (long)buf.f_frsize) >> 20; |
| 112 |
if (free_mib >= min_mib) |
| 113 |
continue; |
| 114 |
|
| 115 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "File system '%s' full: %d < %d", *dirname, free_mib, min_mib); |
| 116 |
abort(); |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 87 |
/* listen for ldap updates */ |
120 |
/* listen for ldap updates */ |
| 88 |
int notifier_listen(univention_ldap_parameters_t *lp, |
121 |
int notifier_listen(univention_ldap_parameters_t *lp, |
| 89 |
univention_krb5_parameters_t *kp, |
122 |
univention_krb5_parameters_t *kp, |
|
Lines 101-106
int notifier_listen(univention_ldap_parameters_t *lp,
Link Here
|
| 101 |
int msgid; |
134 |
int msgid; |
| 102 |
time_t timeout = DELAY_LDAP_CLOSE; |
135 |
time_t timeout = DELAY_LDAP_CLOSE; |
| 103 |
|
136 |
|
|
|
137 |
check_free_space(); |
| 138 |
|
| 104 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Last Notifier ID: %lu", id); |
139 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Last Notifier ID: %lu", id); |
| 105 |
if ((msgid = notifier_get_dn(NULL, id + 1)) < 1) |
140 |
if ((msgid = notifier_get_dn(NULL, id + 1)) < 1) |
| 106 |
break; |
141 |
break; |