#include "auth/auth.h"
#include "param/param.h"
#include "../lib/tsocket/tsocket.h"
+#include "libds/common/roles.h"
-NTSTATUS server_service_cldapd_init(void);
+NTSTATUS server_service_cldapd_init(TALLOC_CTX *);
/*
handle incoming cldap requests
struct cldapd_server);
struct ldap_SearchRequest *search;
+ if (in->ldap_msg->type == LDAP_TAG_AbandonRequest) {
+ DEBUG(10,("Got (and ignoring) CLDAP AbandonRequest from %s.",
+ tsocket_address_string(in->src, in)));
+ talloc_free(in);
+ return;
+ }
+
if (in->ldap_msg->type != LDAP_TAG_SearchRequest) {
DEBUG(0,("Invalid CLDAP request type %d from %s\n",
in->ldap_msg->type,
return;
}
- if (search->num_attributes == 1 &&
- strcasecmp(search->attributes[0], "netlogon") == 0) {
- cldapd_netlogon_request(cldap,
- cldapd,
- in,
- in->ldap_msg->messageid,
- search->tree,
- in->src);
- talloc_free(in);
- return;
- }
-
cldapd_rootdse_request(cldap, cldapd, in,
in->ldap_msg->messageid,
search, in->src);
lpcfg_cldap_port(lp_ctx),
&socket_address);
if (ret != 0) {
- status = map_nt_error_from_unix(errno);
+ status = map_nt_error_from_unix_common(errno);
DEBUG(0,("invalid address %s:%d - %s:%s\n",
address, lpcfg_cldap_port(lp_ctx),
gai_strerror(ret), nt_errstr(status)));
/* listen for unicasts on the CLDAP port (389) */
status = cldap_socket_init(cldapd,
- cldapd->task->event_ctx,
socket_address,
NULL,
&cldapsock);
}
talloc_free(socket_address);
- cldap_set_incoming_handler(cldapsock, cldapd_request_handler, cldapd);
+ cldap_set_incoming_handler(cldapsock, cldapd->task->event_ctx,
+ cldapd_request_handler, cldapd);
return NT_STATUS_OK;
}
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
NTSTATUS status;
- num_interfaces = iface_count(ifaces);
+ num_interfaces = iface_list_count(ifaces);
/* if we are allowing incoming packets from any address, then
we need to bind to the wildcard address */
if (!lpcfg_bind_interfaces_only(lp_ctx)) {
- status = cldapd_add_socket(cldapd, lp_ctx, "0.0.0.0");
- NT_STATUS_NOT_OK_RETURN(status);
+ int num_binds = 0;
+ char **wcard = iface_list_wildcard(cldapd);
+ NT_STATUS_HAVE_NO_MEMORY(wcard);
+ for (i=0; wcard[i]; i++) {
+ status = cldapd_add_socket(cldapd, lp_ctx, wcard[i]);
+ if (NT_STATUS_IS_OK(status)) {
+ num_binds++;
+ }
+ }
+ talloc_free(wcard);
+ if (num_binds == 0) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
}
/* now we have to also listen on the specific interfaces,
so that replies always come from the right IP */
for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+ const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
NTSTATUS status;
struct interface *ifaces;
- load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+ load_interface_list(task, task->lp_ctx, &ifaces);
- if (iface_count(ifaces) == 0) {
+ if (iface_list_count(ifaces) == 0) {
task_server_terminate(task, "cldapd: no network interfaces configured", false);
return;
}
task_server_terminate(task, "cldap_server: no CLDAP server required in member server configuration",
false);
return;
- case ROLE_DOMAIN_CONTROLLER:
+ case ROLE_ACTIVE_DIRECTORY_DC:
/* Yes, we want an CLDAP server */
break;
}
/*
register ourselves as a available server
*/
-NTSTATUS server_service_cldapd_init(void)
+NTSTATUS server_service_cldapd_init(TALLOC_CTX *ctx)
{
return register_server_service("cldap", cldapd_task_init);
}