summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_backend.c9
-rw-r--r--source4/ldap_server/ldap_server.c2
-rw-r--r--source4/ldap_server/ldap_server.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 0dafd0f312..fcd282da9e 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -24,7 +24,7 @@
#include "libcli/ldap/ldap.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
-#include "dsdb/samdb/samdb.h"
+#include "lib/db_wrap.h"
#define VALID_DN_SYNTAX(dn,i) do {\
if (!(dn)) {\
@@ -49,12 +49,17 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin
*/
NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
{
- conn->ldb = samdb_connect(conn, conn->session_info);
+ conn->ldb = ldb_wrap_connect(conn, lp_sam_url(), conn->session_info,
+ NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL);
if (conn->ldb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
ldb_set_opaque(conn->ldb, "server_credentials", conn->server_credentials);
+ if (conn->global_catalog) {
+ ldb_set_opaque(conn->ldb, "global_catalog", (void *)(-1));
+ }
+
return NT_STATUS_OK;
}
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 6f57073f18..07b1bc6a27 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -433,6 +433,8 @@ static void ldapsrv_accept(struct stream_connection *c)
ldapsrv_terminate_connection(conn, "ldapsrv_accept: tls_init_server() failed");
return;
}
+ } else if (port == 3268) /* Global catalog */ {
+ conn->global_catalog = True;
}
conn->packet = packet_init(conn);
if (conn->packet == NULL) {
diff --git a/source4/ldap_server/ldap_server.h b/source4/ldap_server/ldap_server.h
index 033f8ef67c..0b0b78ea7f 100644
--- a/source4/ldap_server/ldap_server.h
+++ b/source4/ldap_server/ldap_server.h
@@ -32,6 +32,8 @@ struct ldapsrv_connection {
/* are we using gensec wrapping? */
BOOL enable_wrap;
+ BOOL global_catalog;
+
struct packet_context *packet;
struct {