[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-2090-g23b501e
Volker Lendecke
vlendec at samba.org
Sat Jun 6 11:10:52 GMT 2009
The branch, master has been updated
via 23b501e02a15fe94e807e279c224e5657ce47af2 (commit)
via 256b227b27b599fffe5746bae7132a27e2c59dd4 (commit)
via 1769c8d81b8b4ad7bae77fabce2bf2051a7d32c1 (commit)
via 7194937eea7f12a9408655654777fe19832e338a (commit)
from 0e261d0e9c89ff11dc37b2bfd70c74c3a06486bd (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 23b501e02a15fe94e807e279c224e5657ce47af2
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 6 11:25:02 2009 +0200
Add an early prototyp of pdb_ads.c.
The purpose of this module is to connect to a locally running samba4 ldap
server for an alternative "Franky" setup. Right now it contains a couple of
gross hacks: For example it just takes the s4-chosed RID directly as uid/gid...
Checking in tldap and pdb_ads now, I think 3777 insertions are enough for a
start...
commit 256b227b27b599fffe5746bae7132a27e2c59dd4
Author: Volker Lendecke <vl at samba.org>
Date: Fri May 29 10:48:54 2009 +0200
Allow access as SYSTEM on a privileged ldapi connection
This patch creates ldap_priv/ as a subdirectory under the private dir with the
appropriate permissions to only allow the same access as the privileged winbind
socket allows. Connecting to ldap_priv/ldapi gives SYSTEM access to the ldap
database.
commit 1769c8d81b8b4ad7bae77fabce2bf2051a7d32c1
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 6 12:32:46 2009 +0200
Add some samba-style tldap utility functions
commit 7194937eea7f12a9408655654777fe19832e338a
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 6 12:30:57 2009 +0200
Add the early start of an async ldap library
There's a lot of things this does not do yet: For example it does not parse the
reply blob in the sasl bind, it does not do anything with controls yet, a lot
of the ldap requests are not covered yet. But it provides a basis for me to
play with a pdb_ads passdb module.
-----------------------------------------------------------------------
Summary of changes:
source3/Makefile.in | 6 +
source3/configure.in | 3 +-
source3/include/includes.h | 2 +
source3/include/tldap.h | 237 +++++
source3/include/tldap_util.h | 53 ++
source3/lib/tldap.c | 1835 +++++++++++++++++++++++++++++++++++++
source3/lib/tldap_util.c | 351 +++++++
source3/passdb/pdb_ads.c | 1284 ++++++++++++++++++++++++++
source4/ldap_server/ldap_server.c | 96 ++-
9 files changed, 3853 insertions(+), 14 deletions(-)
create mode 100644 source3/include/tldap.h
create mode 100644 source3/include/tldap_util.h
create mode 100644 source3/lib/tldap.c
create mode 100644 source3/lib/tldap_util.c
create mode 100644 source3/passdb/pdb_ads.c
Changeset truncated at 500 lines:
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 7229cea..49c3e2a 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -477,6 +477,8 @@ CLDAP_OBJ = libads/cldap.o \
../lib/util/idtree.o \
$(LIBCLI_LDAP_MESSAGE_OBJ) $(LIBCLI_LDAP_NDR_OBJ) $(LIBTSOCKET_OBJ)
+TLDAP_OBJ = lib/tldap.o lib/tldap_util.o
+
LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
libsmb/clikrb5.o libsmb/clispnego.o ../lib/util/asn1.o \
libsmb/clirap.o libsmb/clierror.o libsmb/climessage.o \
@@ -2568,6 +2570,10 @@ bin/ldapsam. at SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_ldap.o passdb/pdb_nds.o
@echo "Building plugin $@"
@$(SHLD_MODULE) passdb/pdb_ldap.o passdb/pdb_nds.o $(LDAP_LIBS)
+bin/ads. at SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_ads.o
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) passdb/pdb_ads.o
+
bin/tdbsam. at SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_tdb.o
@echo "Building plugin $@"
@$(SHLD_MODULE) passdb/pdb_tdb.o
diff --git a/source3/configure.in b/source3/configure.in
index f980911..bbd40db 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -438,7 +438,7 @@ dnl These are preferably build shared, and static if dlopen() is not available
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer vfs_preopen"
if test "x$developer" = xyes; then
- default_static_modules="$default_static_modules rpc_rpcecho"
+ default_static_modules="$default_static_modules rpc_rpcecho pdb_ads"
default_shared_modules="$default_shared_modules charset_weird perfcount_test"
fi
@@ -6212,6 +6212,7 @@ fi
SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT", PDB,
[ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
+SMB_MODULE(pdb_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
diff --git a/source3/include/includes.h b/source3/include/includes.h
index e468bd5..3ce63bb 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -684,6 +684,8 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
#include "eventlog.h"
#include "../lib/util/smb_threads.h"
#include "../lib/util/smb_threads_internal.h"
+#include "tldap.h"
+#include "tldap_util.h"
#include "lib/smbconf/smbconf.h"
#include "lib/smbconf/smbconf_init.h"
diff --git a/source3/include/tldap.h b/source3/include/tldap.h
new file mode 100644
index 0000000..2cf2230
--- /dev/null
+++ b/source3/include/tldap.h
@@ -0,0 +1,237 @@
+/*
+ Unix SMB/CIFS implementation.
+ Infrastructure for async ldap client requests
+ Copyright (C) Volker Lendecke 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TLDAP_H__
+#define __TLDAP_H__
+
+#include <talloc.h>
+#include <tevent.h>
+
+struct tldap_context;
+struct tldap_message;
+
+struct tldap_control {
+ const char *oid;
+ struct berval value;
+ bool iscritical;
+};
+
+struct tldap_attribute {
+ char *name;
+ int num_values;
+ DATA_BLOB *values;
+};
+
+struct tldap_mod {
+ int mod_op;
+ char *attribute;
+ int num_values;
+ DATA_BLOB *values;
+};
+
+struct tldap_context *tldap_context_create(TALLOC_CTX *mem_ctx, int fd);
+
+struct tevent_req *tldap_sasl_bind_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ld,
+ const char *dn,
+ const char *mechanism,
+ DATA_BLOB *creds,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls);
+int tldap_sasl_bind_recv(struct tevent_req *req);
+int tldap_sasl_bind(struct tldap_context *ldap,
+ const char *dn,
+ const char *mechanism,
+ DATA_BLOB *creds,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls);
+
+struct tevent_req *tldap_simple_bind_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ldap,
+ const char *dn,
+ const char *passwd);
+int tldap_simple_bind_recv(struct tevent_req *req);
+int tldap_simple_bind(struct tldap_context *ldap, const char *dn,
+ const char *passwd);
+
+struct tevent_req *tldap_search_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ld,
+ const char *base, int scope,
+ const char *filter,
+ const char **attrs,
+ int num_attrs,
+ int attrsonly,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls,
+ int timelimit,
+ int sizelimit,
+ int deref);
+int tldap_search_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+ struct tldap_message **pmsg);
+int tldap_search(struct tldap_context *ld,
+ const char *base, int scope, const char *filter,
+ const char **attrs, int num_attrs, int attrsonly,
+ struct tldap_control **sctrls, struct tldap_control **cctrls,
+ int timelimit, int sizelimit, int deref,
+ TALLOC_CTX *mem_ctx, struct tldap_message ***pentries,
+ struct tldap_message ***refs);
+bool tldap_entry_dn(struct tldap_message *msg, char **dn);
+bool tldap_entry_attributes(struct tldap_message *msg, int *num_attributes,
+ struct tldap_attribute **attributes);
+
+struct tevent_req *tldap_add_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ld,
+ const char *dn,
+ int num_attributes,
+ struct tldap_mod *attributes,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls);
+int tldap_add_recv(struct tevent_req *req);
+int tldap_add(struct tldap_context *ld, const char *dn,
+ int num_attributes, struct tldap_mod *attributes,
+ struct tldap_control **sctrls, struct tldap_control **cctrls);
+
+struct tevent_req *tldap_modify_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ld,
+ const char *dn,
+ int num_mods, struct tldap_mod *mods,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls);
+int tldap_modify_recv(struct tevent_req *req);
+int tldap_modify(struct tldap_context *ld, const char *dn,
+ int num_mods, struct tldap_mod *mods,
+ struct tldap_control **sctrls, struct tldap_control **cctrls);
+
+
+struct tevent_req *tldap_delete_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tldap_context *ld,
+ const char *dn,
+ struct tldap_control **sctrls,
+ struct tldap_control **cctrls);
+int tldap_delete_recv(struct tevent_req *req);
+int tldap_delete(struct tldap_context *ld, const char *dn,
+ struct tldap_control **sctrls, struct tldap_control **cctrls);
+
+
+int tldap_msg_id(const struct tldap_message *msg);
+int tldap_msg_type(const struct tldap_message *msg);
+const char *tldap_req_matcheddn(struct tevent_req *req);
+const char *tldap_req_diagnosticmessage(struct tevent_req *req);
+const char *tldap_req_referral(struct tevent_req *req);
+const char *tldap_ctx_matcheddn(struct tldap_context *ctx);
+const char *tldap_ctx_diagnosticmessage(struct tldap_context *ctx);
+const char *tldap_ctx_referral(struct tldap_context *ctx);
+const char *tldap_err2string(int rc);
+
+#define TLDAP_REQ_BIND (0)
+#define TLDAP_RES_BIND (1)
+#define TLDAP_REQ_UNBIND (2)
+#define TLDAP_REQ_SEARCH (3)
+#define TLDAP_RES_SEARCH_ENTRY (4)
+#define TLDAP_RES_SEARCH_RESULT (5)
+#define TLDAP_REQ_MODIFY (6)
+#define TLDAP_RES_MODIFY (7)
+#define TLDAP_REQ_ADD (8)
+#define TLDAP_RES_ADD (9)
+#define TLDAP_REQ_DELETE (10)
+#define TLDAP_RES_DELETE (11)
+#define TLDAP_REQ_MODDN (12)
+#define TLDAP_RES_MODDN (13)
+#define TLDAP_REQ_COMPARE (14)
+#define TLDAP_RES_COMPARE (15)
+#define TLDAP_REQ_ABANDON (16)
+#define TLDAP_RES_SEARCH_REFERENCE (19)
+#define TLDAP_REQ_EXTENDED (23)
+#define TLDAP_RES_EXTENDED (24)
+#define TLDAP_RES_INTERMEDIATE (25)
+
+#define TLDAP_SUCCESS (0x00)
+#define TLDAP_OPERATIONS_ERROR (0x01)
+#define TLDAP_PROTOCOL_ERROR (0x02)
+#define TLDAP_TIMELIMIT_EXCEEDED (0x03)
+#define TLDAP_SIZELIMIT_EXCEEDED (0x04)
+#define TLDAP_COMPARE_FALSE (0x05)
+#define TLDAP_COMPARE_TRUE (0x06)
+#define TLDAP_STRONG_AUTH_NOT_SUPPORTED (0x07)
+#define TLDAP_STRONG_AUTH_REQUIRED (0x08)
+#define TLDAP_REFERRAL (0x0a)
+#define TLDAP_ADMINLIMIT_EXCEEDED (0x0b)
+#define TLDAP_UNAVAILABLE_CRITICAL_EXTENSION (0x0c)
+#define TLDAP_CONFIDENTIALITY_REQUIRED (0x0d)
+#define TLDAP_SASL_BIND_IN_PROGRESS (0x0e)
+#define TLDAP_NO_SUCH_ATTRIBUTE (0x10)
+#define TLDAP_UNDEFINED_TYPE (0x11)
+#define TLDAP_INAPPROPRIATE_MATCHING (0x12)
+#define TLDAP_CONSTRAINT_VIOLATION (0x13)
+#define TLDAP_TYPE_OR_VALUE_EXISTS (0x14)
+#define TLDAP_INVALID_SYNTAX (0x15)
+#define TLDAP_NO_SUCH_OBJECT (0x20)
+#define TLDAP_ALIAS_PROBLEM (0x21)
+#define TLDAP_INVALID_DN_SYNTAX (0x22)
+#define TLDAP_IS_LEAF (0x23)
+#define TLDAP_ALIAS_DEREF_PROBLEM (0x24)
+#define TLDAP_INAPPROPRIATE_AUTH (0x30)
+#define TLDAP_INVALID_CREDENTIALS (0x31)
+#define TLDAP_INSUFFICIENT_ACCESS (0x32)
+#define TLDAP_BUSY (0x33)
+#define TLDAP_UNAVAILABLE (0x34)
+#define TLDAP_UNWILLING_TO_PERFORM (0x35)
+#define TLDAP_LOOP_DETECT (0x36)
+#define TLDAP_NAMING_VIOLATION (0x40)
+#define TLDAP_OBJECT_CLASS_VIOLATION (0x41)
+#define TLDAP_NOT_ALLOWED_ON_NONLEAF (0x42)
+#define TLDAP_NOT_ALLOWED_ON_RDN (0x43)
+#define TLDAP_ALREADY_EXISTS (0x44)
+#define TLDAP_NO_OBJECT_CLASS_MODS (0x45)
+#define TLDAP_RESULTS_TOO_LARGE (0x46)
+#define TLDAP_AFFECTS_MULTIPLE_DSAS (0x47)
+#define TLDAP_OTHER (0x50)
+#define TLDAP_SERVER_DOWN (0x51)
+#define TLDAP_LOCAL_ERROR (0x52)
+#define TLDAP_ENCODING_ERROR (0x53)
+#define TLDAP_DECODING_ERROR (0x54)
+#define TLDAP_TIMEOUT (0x55)
+#define TLDAP_AUTH_UNKNOWN (0x56)
+#define TLDAP_FILTER_ERROR (0x57)
+#define TLDAP_USER_CANCELLED (0x58)
+#define TLDAP_PARAM_ERROR (0x59)
+#define TLDAP_NO_MEMORY (0x5a)
+#define TLDAP_CONNECT_ERROR (0x5b)
+#define TLDAP_NOT_SUPPORTED (0x5c)
+#define TLDAP_CONTROL_NOT_FOUND (0x5d)
+#define TLDAP_NO_RESULTS_RETURNED (0x5e)
+#define TLDAP_MORE_RESULTS_TO_RETURN (0x5f)
+#define TLDAP_CLIENT_LOOP (0x60)
+#define TLDAP_REFERRAL_LIMIT_EXCEEDED (0x61)
+
+#define TLDAP_MOD_ADD (0)
+#define TLDAP_MOD_DELETE (1)
+#define TLDAP_MOD_REPLACE (2)
+
+#define TLDAP_SCOPE_BASE (0)
+#define TLDAP_SCOPE_ONE (1)
+#define TLDAP_SCOPE_SUB (2)
+
+#endif
diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h
new file mode 100644
index 0000000..2d5cf57
--- /dev/null
+++ b/source3/include/tldap_util.h
@@ -0,0 +1,53 @@
+/*
+ Unix SMB/CIFS implementation.
+ Infrastructure for async ldap client requests
+ Copyright (C) Volker Lendecke 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TLDAP_UTIL_H__
+#define __TLDAP_UTIL_H__
+
+#include "includes.h"
+
+bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
+ int *num_values, DATA_BLOB **values);
+bool tldap_get_single_valueblob(struct tldap_message *msg,
+ const char *attribute, DATA_BLOB *blob);
+char *tldap_talloc_single_attribute(struct tldap_message *msg,
+ const char *attribute,
+ TALLOC_CTX *mem_ctx);
+bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute,
+ struct dom_sid *sid);
+bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+ int mod_op, const char *attrib,
+ int num_values, DATA_BLOB *values);
+bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
+ int *pnum_mods, struct tldap_mod **pmods,
+ const char *attrib, DATA_BLOB newval);
+bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
+ int *pnum_mods, struct tldap_mod **pmods,
+ const char *attrib, const char *fmt, ...);
+
+const char *tldap_errstr(TALLOC_CTX *mem_ctx, struct tldap_context *ld,
+ int rc);
+int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope,
+ const char *attrs[], int num_attrs, int attrsonly,
+ TALLOC_CTX *mem_ctx, struct tldap_message ***res,
+ const char *fmt, ...);
+bool tldap_pull_uint64(struct tldap_message *msg, const char *attr,
+ uint64_t *presult);
+
+#endif
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
new file mode 100644
index 0000000..2012441
--- /dev/null
+++ b/source3/lib/tldap.c
@@ -0,0 +1,1835 @@
+/*
+ Unix SMB/CIFS implementation.
+ Infrastructure for async ldap client requests
+ Copyright (C) Volker Lendecke 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+
+static bool tevent_req_is_ldap_error(struct tevent_req *req, int *perr)
+{
+ enum tevent_req_state state;
+ uint64_t err;
+
+ if (!tevent_req_is_error(req, &state, &err)) {
+ return false;
+ }
+ switch (state) {
+ case TEVENT_REQ_TIMED_OUT:
+ *perr = TLDAP_TIMEOUT;
+ break;
+ case TEVENT_REQ_NO_MEMORY:
+ *perr = TLDAP_NO_MEMORY;
+ break;
+ case TEVENT_REQ_USER_ERROR:
+ *perr = err;
+ break;
+ default:
+ *perr = TLDAP_OPERATIONS_ERROR;
+ break;
+ }
+ return true;
+}
+
+struct tldap_context {
+ int ld_version;
+ int ld_deref;
+ int ld_sizelimit;
+ int ld_timelimit;
+ int fd;
+ int msgid;
+ struct tevent_queue *outgoing;
+ struct tevent_req **pending;
+
+ /* For the sync wrappers we need something like get_last_error... */
+ int lderr;
+ char *res_matcheddn;
+ char *res_diagnosticmessage;
+ char *res_referral;
+};
+
+struct tldap_message {
+ struct asn1_data *data;
+ uint8_t *inbuf;
+ int type;
+ int id;
+
+ /* RESULT_ENTRY */
+ char *dn;
+ struct tldap_attribute *attribs;
+};
+
+static int tldap_next_msgid(struct tldap_context *ld)
+{
+ int result;
+
+ result = ld->msgid++;
+ if (ld->msgid == 2147483647) {
+ ld->msgid = 1;
+ }
+ return result;
+}
+
+struct tldap_context *tldap_context_create(TALLOC_CTX *mem_ctx, int fd)
+{
+ struct tldap_context *ctx;
+
+ ctx = talloc_zero(mem_ctx, struct tldap_context);
+ if (ctx == NULL) {
+ return NULL;
+ }
+ ctx->fd = fd;
+ ctx->msgid = 1;
+ ctx->ld_version = 3;
+ ctx->outgoing = tevent_queue_create(ctx, "tldap_outgoing");
+ if (ctx->outgoing == NULL) {
+ TALLOC_FREE(ctx);
+ return NULL;
+ }
+ return ctx;
+}
+
+struct read_ldap_state {
+ uint8_t *buf;
+ bool done;
+};
+
+static ssize_t read_ldap_more(uint8_t *buf, size_t buflen, void *private_data)
+{
+ struct read_ldap_state *state = talloc_get_type_abort(
+ private_data, struct read_ldap_state);
+ size_t len;
+ int i, lensize;
+
+ if (state->done) {
+ /* We've been here, we're done */
+ return 0;
+ }
+
+ /*
+ * From ldap.h: LDAP_TAG_MESSAGE is 0x30
+ */
+ if (buf[0] != 0x30) {
+ return -1;
+ }
+
+ len = buf[1];
+ if ((len & 0x80) == 0) {
+ state->done = true;
+ return len;
+ }
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list