summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-31 09:52:25 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-11-01 07:01:39 +0100
commitbc8d2ee5c63de24d651425f4bc3800772734ae73 (patch)
treea95e1d6604de3c8df14db9f46fac28fbf0c17fe2 /source4/torture
parent27176e15d3bab6749fa02b1ec9a98b91ba01b512 (diff)
downloadsamba-bc8d2ee5c63de24d651425f4bc3800772734ae73.tar.gz
samba-bc8d2ee5c63de24d651425f4bc3800772734ae73.tar.bz2
samba-bc8d2ee5c63de24d651425f4bc3800772734ae73.zip
s4:torture/netlogon: Add more genereric tcp netlogon function
To be able to query custom attrs and filters later.
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/ldap/netlogon.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/source4/torture/ldap/netlogon.c b/source4/torture/ldap/netlogon.c
index 950feac86d..bdf30e95d4 100644
--- a/source4/torture/ldap/netlogon.c
+++ b/source4/torture/ldap/netlogon.c
@@ -348,24 +348,17 @@ static bool test_ldap_netlogon_flags(struct torture_context *tctx,
return true;
}
-static NTSTATUS tcp_ldap_netlogon(void *data,
- TALLOC_CTX *mem_ctx,
- struct cldap_netlogon *io)
+static NTSTATUS ldap_rootdse(struct ldap_connection *conn,
+ TALLOC_CTX *mem_ctx,
+ const char *filter,
+ const char **attrs,
+ int num_attr,
+ struct ldap_SearchResEntry **res)
{
- struct ldap_connection *conn = talloc_get_type(data,
- struct ldap_connection);
- char *filter;
struct ldap_message *msg, *result;
struct ldap_request *req;
- struct ldap_SearchResEntry *res;
- DATA_BLOB *blob;
NTSTATUS status;
- filter = cldap_netlogon_create_filter(mem_ctx, io);
- if (filter == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
msg = new_ldap_message(mem_ctx);
if (!msg) {
return NT_STATUS_NO_MEMORY;
@@ -379,8 +372,8 @@ static NTSTATUS tcp_ldap_netlogon(void *data,
msg->r.SearchRequest.sizelimit = 0;
msg->r.SearchRequest.attributesonly = false;
msg->r.SearchRequest.tree = ldb_parse_tree(msg, filter);
- msg->r.SearchRequest.num_attributes = 1;
- msg->r.SearchRequest.attributes = (const char *[]) { "netlogon" };
+ msg->r.SearchRequest.num_attributes = num_attr;
+ msg->r.SearchRequest.attributes = attrs;
req = ldap_request_send(conn, msg);
if (req == NULL) {
@@ -398,7 +391,33 @@ static NTSTATUS tcp_ldap_netlogon(void *data,
}
}
- res = &result->r.SearchResultEntry;
+ *res = &result->r.SearchResultEntry;
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS tcp_ldap_netlogon(void *data,
+ TALLOC_CTX *mem_ctx,
+ struct cldap_netlogon *io)
+{
+ struct ldap_connection *conn = talloc_get_type(data,
+ struct ldap_connection);
+ char *filter;
+ struct ldap_SearchResEntry *res;
+ NTSTATUS status;
+ DATA_BLOB *blob;
+
+ filter = cldap_netlogon_create_filter(mem_ctx, io);
+ if (filter == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = ldap_rootdse(conn, mem_ctx, filter,
+ (const char *[]) { "netlogon" }, 1, &res);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if (res->num_attributes != 1 ||
strcasecmp(res->attributes[0].name, "netlogon") != 0 ||
res->attributes[0].num_values != 1 ||