diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-07-12 04:59:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:04 -0500 |
commit | 32ab51876728577375b954a04103f71ddd4d93dc (patch) | |
tree | 99ece19cb36fc02d90ec07f2498e9b1a34c5c237 /source4/ldap_server | |
parent | b1a92083d8bbfcf917d2a567833bf6925067718e (diff) | |
download | samba-32ab51876728577375b954a04103f71ddd4d93dc.tar.gz samba-32ab51876728577375b954a04103f71ddd4d93dc.tar.bz2 samba-32ab51876728577375b954a04103f71ddd4d93dc.zip |
r16972: Replace the sequence_number function pointer in ldb with the ldb flags.
The function pointer was meant to be unused, this patch fixes
partition.c to use ldb_sequence_number(). (No backend provided the
pointer any more).
Set the flags onto the ldb structure, so that all backends opened by
the partitions module inherit the flags.
Set the read-ony flag when accessed as the global catalog
Modify the LDAP server to track that this query is for the global
catalog (by incoming port), and set a opqaue pointer.
Next step is to read that opaque pointer in the partitions module.
Andrew Bartlett
(This used to be commit a1161cb30e4ffa09657a89e03ca85dd6efd4feba)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 9 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.c | 2 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.h | 2 |
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 { |