108 lines
3.4 KiB
Plaintext
108 lines
3.4 KiB
Plaintext
--- includes/dhcpd.h
|
|
+++ includes/dhcpd.h 2007/01/24 13:50:54
|
|
@@ -462,6 +462,7 @@
|
|
# define SV_LDAP_METHOD 52
|
|
# define SV_LDAP_DEBUG_FILE 53
|
|
# define SV_LDAP_DHCP_SERVER_CN 54
|
|
+# define SV_LDAP_REFERRALS 55
|
|
#endif
|
|
|
|
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
|
|
--- server/ldap.c
|
|
+++ server/ldap.c 2007/01/24 14:25:16
|
|
@@ -55,6 +55,7 @@
|
|
*ldap_debug_file = NULL;
|
|
static int ldap_port = LDAP_PORT,
|
|
ldap_method = LDAP_METHOD_DYNAMIC,
|
|
+ ldap_referrals = -1,
|
|
ldap_debug_fd = -1;
|
|
static struct ldap_config_stack *ldap_stack = NULL;
|
|
|
|
@@ -532,6 +533,34 @@
|
|
return (ret);
|
|
}
|
|
|
|
+int
|
|
+ldap_rebind_cb (LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *parms)
|
|
+{
|
|
+ int ret;
|
|
+ LDAPURLDesc *ldapurl = NULL;
|
|
+ char *who = NULL, *pwd = NULL;
|
|
+
|
|
+ log_info("LDAP rebind to '%s'", url);
|
|
+ if ((ret = ldap_url_parse(url, &ldapurl)) != LDAP_SUCCESS)
|
|
+ {
|
|
+ log_error ("Error: Can not parse ldap rebind url '%s': %s",
|
|
+ url, ldap_err2string(ret));
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ if (ldap_username != NULL || *ldap_username != '\0')
|
|
+ {
|
|
+ who = ldap_username;
|
|
+ pwd = ldap_password;
|
|
+ }
|
|
+
|
|
+ if ((ret = ldap_simple_bind_s (ld, who, pwd)) != LDAP_SUCCESS)
|
|
+ {
|
|
+ log_error ("Error: Cannot login into ldap server %s:%d: %s",
|
|
+ ldapurl->lud_host, ldapurl->lud_port, ldap_err2string (ret));
|
|
+ }
|
|
+ return ret;
|
|
+}
|
|
|
|
static void
|
|
ldap_start (void)
|
|
@@ -560,6 +589,7 @@
|
|
ldap_method = _do_lookup_dhcp_enum_option (options, SV_LDAP_METHOD);
|
|
ldap_debug_file = _do_lookup_dhcp_string_option (options,
|
|
SV_LDAP_DEBUG_FILE);
|
|
+ ldap_referrals = _do_lookup_dhcp_enum_option (options, SV_LDAP_REFERRALS);
|
|
|
|
#if defined (LDAP_CASA_AUTH)
|
|
if (!load_uname_pwd_from_miCASA(&ldap_username,&ldap_password))
|
|
@@ -611,6 +641,23 @@
|
|
ldap_err2string (ret));
|
|
}
|
|
|
|
+ if (ldap_referrals != -1)
|
|
+ {
|
|
+ if ((ret = ldap_set_option (ld, LDAP_OPT_REFERRALS, ldap_referrals ?
|
|
+ LDAP_OPT_ON : LDAP_OPT_OFF)) != LDAP_OPT_SUCCESS)
|
|
+ {
|
|
+ log_error ("Cannot %s LDAP referrals option: %s",
|
|
+ (ldap_referrals ? "enable" : "disable"),
|
|
+ ldap_err2string (ret));
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if ((ret = ldap_set_rebind_proc(ld, ldap_rebind_cb, NULL)) != LDAP_SUCCESS)
|
|
+ {
|
|
+ log_error ("Warning: Cannot set ldap rebind procedure: %s",
|
|
+ ldap_err2string (ret));
|
|
+ }
|
|
+
|
|
#if defined (USE_SSL)
|
|
if ((ret = ldap_start_tls_s (ld, NULL, NULL)) != LDAP_SUCCESS)
|
|
log_error ("Warning: Cannot start TLS session to %s: %s",
|
|
--- server/stables.c
|
|
+++ server/stables.c 2007/01/24 13:52:54
|
|
@@ -492,6 +492,7 @@
|
|
{ "ldap-method", "Nldap-methods.", &server_universe, 52 },
|
|
{ "ldap-debug-file", "t", &server_universe, 53 },
|
|
{ "ldap-dhcp-server-cn", "t", &server_universe, 54 },
|
|
+ { "ldap-referrals", "f", &server_universe, 55 },
|
|
#else
|
|
{ "unknown-47", "X", &server_universe, 47 },
|
|
{ "unknown-48", "X", &server_universe, 48 },
|
|
@@ -501,8 +502,8 @@
|
|
{ "unknown-52", "X", &server_universe, 52 },
|
|
{ "unknown-53", "X", &server_universe, 53 },
|
|
{ "unknown-54", "X", &server_universe, 54 },
|
|
-#endif
|
|
{ "unknown-55", "X", &server_universe, 55 },
|
|
+#endif
|
|
{ "unknown-56", "X", &server_universe, 56 },
|
|
{ "unknown-57", "X", &server_universe, 57 },
|
|
{ "unknown-58", "X", &server_universe, 58 },
|