svn commit: samba r17369 - in branches/SOC/mkhl: ldb-map/common
ldb-map/include ldb-map/ldb_ildap ldb-map/ldb_tdb
samdb-map/ldb_modules
mkhl at samba.org
mkhl at samba.org
Tue Aug 1 22:59:37 GMT 2006
Author: mkhl
Date: 2006-08-01 22:59:36 +0000 (Tue, 01 Aug 2006)
New Revision: 17369
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17369
Log:
Merge from mainline, r17368.
Removed:
branches/SOC/mkhl/samdb-map/ldb_modules/password_sync.c
Modified:
branches/SOC/mkhl/ldb-map/common/ldb_match.c
branches/SOC/mkhl/ldb-map/include/ldb.h
branches/SOC/mkhl/ldb-map/include/ldb_private.h
branches/SOC/mkhl/ldb-map/ldb_ildap/ldb_ildap.c
branches/SOC/mkhl/ldb-map/ldb_tdb/ldb_tdb.c
Changeset:
Modified: branches/SOC/mkhl/ldb-map/common/ldb_match.c
===================================================================
--- branches/SOC/mkhl/ldb-map/common/ldb_match.c 2006-08-01 22:46:49 UTC (rev 17368)
+++ branches/SOC/mkhl/ldb-map/common/ldb_match.c 2006-08-01 22:59:36 UTC (rev 17369)
@@ -81,9 +81,9 @@
match if node is present
*/
static int ldb_match_present(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
- enum ldb_scope scope)
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
+ enum ldb_scope scope)
{
if (ldb_attr_dn(tree->u.present.attr) == 0) {
return 1;
@@ -97,8 +97,8 @@
}
static int ldb_match_comparison(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
enum ldb_scope scope,
enum ldb_parse_op comp_op)
{
@@ -138,8 +138,8 @@
match a simple leaf node
*/
static int ldb_match_equality(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
unsigned int i;
@@ -183,7 +183,7 @@
}
static int ldb_wildcard_compare(struct ldb_context *ldb,
- struct ldb_parse_tree *tree,
+ const struct ldb_parse_tree *tree,
const struct ldb_val value)
{
const struct ldb_attrib_handler *h;
@@ -254,8 +254,8 @@
match a simple leaf node
*/
static int ldb_match_substring(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
unsigned int i;
@@ -279,7 +279,7 @@
/*
bitwise-and comparator
*/
-static int ldb_comparator_and(struct ldb_val *v1, struct ldb_val *v2)
+static int ldb_comparator_and(const struct ldb_val *v1, const struct ldb_val *v2)
{
uint64_t i1, i2;
i1 = strtoull((char *)v1->data, NULL, 0);
@@ -290,7 +290,7 @@
/*
bitwise-or comparator
*/
-static int ldb_comparator_or(struct ldb_val *v1, struct ldb_val *v2)
+static int ldb_comparator_or(const struct ldb_val *v1, const struct ldb_val *v2)
{
uint64_t i1, i2;
i1 = strtoull((char *)v1->data, NULL, 0);
@@ -303,19 +303,19 @@
extended match, handles things like bitops
*/
static int ldb_match_extended(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
int i;
const struct {
const char *oid;
- int (*comparator)(struct ldb_val *, struct ldb_val *);
+ int (*comparator)(const struct ldb_val *, const struct ldb_val *);
} rules[] = {
{ LDB_OID_COMPARATOR_AND, ldb_comparator_and},
{ LDB_OID_COMPARATOR_OR, ldb_comparator_or}
};
- int (*comp)(struct ldb_val *, struct ldb_val *) = NULL;
+ int (*comp)(const struct ldb_val *, const struct ldb_val *) = NULL;
struct ldb_message_element *el;
if (tree->u.extended.dnAttributes) {
@@ -366,8 +366,8 @@
this is a recursive function, and does short-circuit evaluation
*/
static int ldb_match_message(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
unsigned int i;
@@ -418,8 +418,8 @@
}
int ldb_match_msg(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
const struct ldb_dn *base,
enum ldb_scope scope)
{
Modified: branches/SOC/mkhl/ldb-map/include/ldb.h
===================================================================
--- branches/SOC/mkhl/ldb-map/include/ldb.h 2006-08-01 22:46:49 UTC (rev 17368)
+++ branches/SOC/mkhl/ldb-map/include/ldb.h 2006-08-01 22:59:36 UTC (rev 17369)
@@ -502,6 +502,22 @@
*/
#define LDB_EXTENDED_START_TLS_OID "1.3.6.1.4.1.1466.20037"
+/**
+ OID for LDAP Extended Operation START_TLS.
+
+ This Extended operation is used to start a new TLS
+ channel on top of a clear text channel.
+*/
+#define LDB_EXTENDED_DYNAMIC_OID "1.3.6.1.4.1.1466.101.119.1"
+
+/**
+ OID for LDAP Extended Operation START_TLS.
+
+ This Extended operation is used to start a new TLS
+ channel on top of a clear text channel.
+*/
+#define LDB_EXTENDED_FAST_BIND_OID "1.2.840.113556.1.4.1781"
+
struct ldb_paged_control {
int size;
int cookie_len;
Modified: branches/SOC/mkhl/ldb-map/include/ldb_private.h
===================================================================
--- branches/SOC/mkhl/ldb-map/include/ldb_private.h 2006-08-01 22:46:49 UTC (rev 17368)
+++ branches/SOC/mkhl/ldb-map/include/ldb_private.h 2006-08-01 22:59:36 UTC (rev 17369)
@@ -171,8 +171,8 @@
int ldb_sqlite3_init(void);
int ldb_match_msg(struct ldb_context *ldb,
- struct ldb_message *msg,
- struct ldb_parse_tree *tree,
+ const struct ldb_message *msg,
+ const struct ldb_parse_tree *tree,
const struct ldb_dn *base,
enum ldb_scope scope);
Modified: branches/SOC/mkhl/ldb-map/ldb_ildap/ldb_ildap.c
===================================================================
--- branches/SOC/mkhl/ldb-map/ldb_ildap/ldb_ildap.c 2006-08-01 22:46:49 UTC (rev 17368)
+++ branches/SOC/mkhl/ldb-map/ldb_ildap/ldb_ildap.c 2006-08-01 22:59:36 UTC (rev 17369)
@@ -323,21 +323,18 @@
}
}
-static int ildb_request_send(struct ldb_module *module, struct ldap_message *msg,
- void *context,
- int (*callback)(struct ldb_context *, void *, struct ldb_reply *),
- int timeout,
- struct ldb_handle **handle)
+static struct ldb_handle *init_ildb_handle(struct ldb_module *module,
+ void *context,
+ int (*callback)(struct ldb_context *, void *, struct ldb_reply *))
{
struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private);
struct ildb_context *ildb_ac;
struct ldb_handle *h;
- struct ldap_request *req;
h = talloc_zero(ildb->ldap, struct ldb_handle);
if (h == NULL) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory"));
- return LDB_ERR_OPERATIONS_ERROR;
+ return NULL;
}
h->module = module;
@@ -346,7 +343,7 @@
if (ildb_ac == NULL) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory"));
talloc_free(h);
- return LDB_ERR_OPERATIONS_ERROR;
+ return NULL;
}
h->private_data = (void *)ildb_ac;
@@ -354,6 +351,30 @@
h->state = LDB_ASYNC_INIT;
h->status = LDB_SUCCESS;
+ ildb_ac->module = module;
+ ildb_ac->context = context;
+ ildb_ac->callback = callback;
+
+ return h;
+}
+
+static int ildb_request_send(struct ldb_module *module, struct ldap_message *msg,
+ void *context,
+ int (*callback)(struct ldb_context *, void *, struct ldb_reply *),
+ int timeout,
+ struct ldb_handle **handle)
+{
+ struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private);
+ struct ldb_handle *h = init_ildb_handle(module, context, callback);
+ struct ildb_context *ildb_ac;
+ struct ldap_request *req;
+
+ if (!h) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ildb_ac = talloc_get_type(h->private_data, struct ildb_context);
+
req = ldap_request_send(ildb->ldap, msg);
if (req == NULL) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "async send request failed"));
@@ -366,13 +387,6 @@
}
ildb_ac->req = talloc_steal(ildb_ac, req);
- ildb_ac->module = module;
- ildb_ac->context = context;
- ildb_ac->callback = callback;
-
- req->async.fn = ildb_callback;
- req->async.private_data = (void *)h;
-
talloc_free(req->time_event);
req->time_event = NULL;
if (timeout) {
@@ -381,10 +395,32 @@
ildb_request_timeout, h);
}
+ req->async.fn = ildb_callback;
+ req->async.private_data = (void *)h;
+
*handle = h;
-
return LDB_SUCCESS;
+}
+static int ildb_request_noop(struct ldb_module *module, struct ldb_request *req)
+{
+ struct ldb_handle *h = init_ildb_handle(module, req->context, req->callback);
+ struct ildb_context *ildb_ac;
+ int ret = LDB_SUCCESS;
+
+ if (!h) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ildb_ac = talloc_get_type(h->private_data, struct ildb_context);
+
+ req->handle = h;
+
+ if (ildb_ac->callback) {
+ ret = ildb_ac->callback(module->ldb, ildb_ac->context, NULL);
+ }
+ req->handle->state = LDB_ASYNC_DONE;
+ return ret;
}
/*
@@ -466,7 +502,7 @@
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.add.message->dn)) {
- return LDB_SUCCESS;
+ return ildb_request_noop(module, req);
}
msg = new_ldap_message(ildb->ldap);
@@ -516,7 +552,7 @@
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.mod.message->dn)) {
- return LDB_SUCCESS;
+ return ildb_request_noop(module, req);
}
msg = new_ldap_message(ildb->ldap);
@@ -564,7 +600,7 @@
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.del.dn)) {
- return LDB_SUCCESS;
+ return ildb_request_noop(module, req);
}
msg = new_ldap_message(ildb->ldap);
@@ -595,7 +631,7 @@
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.rename.olddn) || ldb_dn_is_special(req->op.rename.newdn)) {
- return LDB_SUCCESS;
+ return ildb_request_noop(module, req);
}
msg = new_ldap_message(ildb->ldap);
Modified: branches/SOC/mkhl/ldb-map/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SOC/mkhl/ldb-map/ldb_tdb/ldb_tdb.c 2006-08-01 22:46:49 UTC (rev 17368)
+++ branches/SOC/mkhl/ldb-map/ldb_tdb/ldb_tdb.c 2006-08-01 22:59:36 UTC (rev 17369)
@@ -270,35 +270,27 @@
}
ret = ltdb_store(module, msg, TDB_INSERT);
- if (ret != LDB_SUCCESS) {
- switch (ret) {
- case LDB_ERR_ENTRY_ALREADY_EXISTS:
- {
- TALLOC_CTX *mem_ctx = talloc_new(module);
- char *errstring, *dn;
- if (!mem_ctx) {
- break;
- }
- dn = ldb_dn_linearize(mem_ctx, msg->dn);
- if (!dn) {
- break;
- }
- errstring = talloc_asprintf(mem_ctx, "Entry %s already exists",
- dn);
- ldb_set_errstring(module->ldb, errstring);
- talloc_free(mem_ctx);
- break;
+
+ if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
+ char *dn;
+
+ dn = ldb_dn_linearize(module, msg->dn);
+ if (!dn) {
+ return ret;
}
- }
+ ldb_set_errstring(module->ldb, talloc_asprintf(module, "Entry %s already exists", dn));
+ talloc_free(dn);
return ret;
}
-
- ret = ltdb_modified(module, msg->dn);
- if (ret != LDB_SUCCESS) {
- return LDB_ERR_OPERATIONS_ERROR;
+
+ if (ret == LDB_SUCCESS) {
+ ret = ltdb_modified(module, msg->dn);
+ if (ret != LDB_SUCCESS) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
- return LDB_SUCCESS;
+ return ret;
}
/*
Deleted: branches/SOC/mkhl/samdb-map/ldb_modules/password_sync.c
===================================================================
More information about the samba-cvs
mailing list