summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-01-17 18:56:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:14 -0500
commit828ee2bc6fa4f757c63a31054a0046fe09f8c26e (patch)
treee1bed0944621ccb0f955b6b60981cbb5c04df949 /source4/lib/ldb
parent8139c1e6f2cf154dad0c0c3fbf8c4fac960bdfe0 (diff)
downloadsamba-828ee2bc6fa4f757c63a31054a0046fe09f8c26e.tar.gz
samba-828ee2bc6fa4f757c63a31054a0046fe09f8c26e.tar.bz2
samba-828ee2bc6fa4f757c63a31054a0046fe09f8c26e.zip
r12984: add parse code and ldbsearch cmdline code for
NOTIFICATION LDAP Controls http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ldap/ldap/ldap_server_notification_oid.asp this doesn't work yet, but it shows that we need to extend ldb to correctly handle async requests... metze (This used to be commit 1fe67189490c9faf499b68a28071a6294a53db0e)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/include/ldb.h7
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c19
2 files changed, 26 insertions, 0 deletions
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 09f4723f7b..770d23c638 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -375,6 +375,13 @@ typedef int (*ldb_qsort_cmp_fn_t) (const void *, const void *, const void *);
#define LDB_CONTROL_PAGED_RESULTS_OID "1.2.840.113556.1.4.319"
/**
+ OID for notification
+
+ \sa <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ldap/ldap/ldap_server_notification_oid.asp">Microsoft documentation of this OID</a>
+*/
+#define LDB_CONTROL_NOTIFICATION_OID "1.2.840.113556.1.4.528"
+
+/**
OID for extended DN
\sa <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ldap/ldap/ldap_server_extended_dn_oid.asp">Microsoft documentation of this OID</a>
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index df895350ee..df14aac0b2 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -216,6 +216,25 @@ static struct ldb_control **parse_controls(void *mem_ctx, char **control_strings
continue;
}
+ if (strncmp(control_strings[i], "notification:", 13) == 0) {
+ const char *p;
+ int crit, ret;
+
+ p = &(control_strings[i][13]);
+ ret = sscanf(p, "%d", &crit);
+ if ((ret != 1) || (crit < 0) || (crit > 1)) {
+ fprintf(stderr, "invalid notification control syntax\n");
+ return NULL;
+ }
+
+ ctrl[i] = talloc(ctrl, struct ldb_control);
+ ctrl[i]->oid = LDB_CONTROL_NOTIFICATION_OID;
+ ctrl[i]->critical = crit;
+ ctrl[i]->data = NULL;
+
+ continue;
+ }
+
/* no controls matched, throw an error */
fprintf(stderr, "Invalid control name\n");
return NULL;