diff options
Diffstat (limited to 'source4/ldap_server/ldap_server.c')
-rw-r--r-- | source4/ldap_server/ldap_server.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 0de76052d1..a74d002e9b 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -40,6 +40,7 @@ #include "system/network.h" #include "lib/socket/netif.h" #include "dsdb/samdb/samdb.h" +#include "param/param.h" /* close the socket and shutdown a server_context */ @@ -368,7 +369,7 @@ static void ldapsrv_accept(struct stream_connection *c) conn->sockets.tls = tls_socket; } else if (port == 3268) /* Global catalog */ { - conn->global_catalog = True; + conn->global_catalog = true; } conn->packet = packet_init(conn); if (conn->packet == NULL) { @@ -395,7 +396,7 @@ static void ldapsrv_accept(struct stream_connection *c) return; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(status)) { stream_terminate_connection(c, talloc_asprintf(conn, "Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status))); @@ -512,6 +513,18 @@ static void ldapsrv_task_init(struct task_server *task) NTSTATUS status; const struct model_ops *model_ops; + switch (lp_server_role(global_loadparm)) { + case ROLE_STANDALONE: + task_server_terminate(task, "ldap_server: no LDAP server required in standalone configuration"); + return; + case ROLE_DOMAIN_MEMBER: + task_server_terminate(task, "ldap_server: no LDAP server required in member server configuration"); + return; + case ROLE_DOMAIN_CONTROLLER: + /* Yes, we want an LDAP server */ + break; + } + task_server_set_title(task, "task[ldapsrv]"); /* run the ldap server as a single process */ @@ -524,7 +537,7 @@ static void ldapsrv_task_init(struct task_server *task) ldap_service->tls_params = tls_initialise(ldap_service); if (ldap_service->tls_params == NULL) goto failed; - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; @@ -538,7 +551,8 @@ static void ldapsrv_task_init(struct task_server *task) if (!NT_STATUS_IS_OK(status)) goto failed; } } else { - status = add_socket(task->event_ctx, model_ops, lp_socket_address(), ldap_service); + status = add_socket(task->event_ctx, model_ops, + lp_socket_address(global_loadparm), ldap_service); if (!NT_STATUS_IS_OK(status)) goto failed; } |