summaryrefslogtreecommitdiff
path: root/source4/nbt_server/wins
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-29 01:30:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:41 -0500
commit3a4d7eb2c08a06fac89c34d132f1c32751ce7ad5 (patch)
tree7d34281bba70aaa79d7527b823f00f625836dc3a /source4/nbt_server/wins
parent0bd3636a1249dd55f7595c06892e2db65af18bfc (diff)
downloadsamba-3a4d7eb2c08a06fac89c34d132f1c32751ce7ad5.tar.gz
samba-3a4d7eb2c08a06fac89c34d132f1c32751ce7ad5.tar.bz2
samba-3a4d7eb2c08a06fac89c34d132f1c32751ce7ad5.zip
r15927: Optimize ldb module traverse while keeping the API intact.
I was sick of jumping inot each module for each request, even the ones not handle by that module. (This used to be commit 7d65105e885a28584e8555453b90232c43a92bf7)
Diffstat (limited to 'source4/nbt_server/wins')
-rw-r--r--source4/nbt_server/wins/wins_ldb.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/source4/nbt_server/wins/wins_ldb.c b/source4/nbt_server/wins/wins_ldb.c
index 6fcf675702..5c45a64413 100644
--- a/source4/nbt_server/wins/wins_ldb.c
+++ b/source4/nbt_server/wins/wins_ldb.c
@@ -37,13 +37,28 @@
#include "system/network.h"
#include "netif/netif.h"
-/* add_record: do things with the sambaPassword attribute */
-static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req, const struct ldb_message *msg)
+static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req)
{
struct winsdb_handle *h = talloc_get_type(ldb_get_opaque(module->ldb, "winsdb_handle"),
struct winsdb_handle);
+ const struct ldb_message *msg;
char *error = NULL;
+ switch (req->operation) {
+ case LDB_REQ_ADD:
+ case LDB_ASYNC_ADD:
+ msg = req->op.add.message;
+ break;
+
+ case LDB_REQ_MODIFY:
+ case LDB_ASYNC_MODIFY:
+ msg = req->op.mod.message;
+ break;
+
+ default:
+ return ldb_next_request(module, req);
+ }
+
/* do not manipulate our control entries */
if (ldb_dn_is_special(msg->dn)) {
return ldb_next_request(module, req);
@@ -73,26 +88,13 @@ static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req, c
static int wins_ldb_request(struct ldb_module *module, struct ldb_request *req)
{
- const struct ldb_message *msg;
-
switch (req->operation) {
case LDB_REQ_ADD:
- case LDB_ASYNC_ADD:
-
- msg = req->op.add.message;
- break;
-
case LDB_REQ_MODIFY:
- case LDB_ASYNC_MODIFY:
-
- msg = req->op.mod.message;
- break;
-
+ return wins_ldb_verify(module, req);
default:
return ldb_next_request(module, req);
}
-
- return wins_ldb_verify(module, req, msg);
}
@@ -127,6 +129,8 @@ failed:
static const struct ldb_module_ops wins_ldb_ops = {
.name = "wins_ldb",
+ .add = wins_ldb_verify,
+ .modify = wins_ldb_verify,
.request = wins_ldb_request,
.init_context = wins_ldb_init
};