summaryrefslogtreecommitdiff
path: root/source4/libcli/cldap
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-13 06:08:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:42 -0500
commit06869ce014ffa249fb117df1d4d7182a1de24c5a (patch)
treef5df8e022cda9b5485f0d98c5f8611006bfa9f90 /source4/libcli/cldap
parent4029df5e602760a0a0f8851e9f7bb28e1434f4f0 (diff)
downloadsamba-06869ce014ffa249fb117df1d4d7182a1de24c5a.tar.gz
samba-06869ce014ffa249fb117df1d4d7182a1de24c5a.tar.bz2
samba-06869ce014ffa249fb117df1d4d7182a1de24c5a.zip
r6764: added support for DomainGuid, DomainSid, AAC, and User attributes in
cldap netlogon queries (This used to be commit 7c1d0f449d3922a309fc86e5d9cb1e962a39805d)
Diffstat (limited to 'source4/libcli/cldap')
-rw-r--r--source4/libcli/cldap/cldap.c42
-rw-r--r--source4/libcli/cldap/cldap.h6
2 files changed, 40 insertions, 8 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c
index 2f4d1e73a9..ed416532a2 100644
--- a/source4/libcli/cldap/cldap.c
+++ b/source4/libcli/cldap/cldap.c
@@ -489,6 +489,7 @@ NTSTATUS cldap_search(struct cldap_socket *cldap,
}
+
/*
queue a cldap netlogon for send
*/
@@ -499,11 +500,36 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
char *filter;
struct cldap_request *req;
const char *attr[] = { "NetLogon", NULL };
+ TALLOC_CTX *tmp_ctx = talloc_new(cldap);
- filter = talloc_asprintf(cldap,
- "(&(DnsDomain=%s)(Host=%s)(NtVer=\\%02X\\00\\00\\00))",
- io->in.realm, io->in.host, io->in.version);
- if (filter == NULL) return NULL;
+ filter = talloc_asprintf(tmp_ctx,
+ "(&(DnsDomain=%s)(Host=%s)(NtVer=%s)",
+ io->in.realm, io->in.host,
+ ldap_encode_ndr_uint32(tmp_ctx, io->in.version));
+ if (filter == NULL) goto failed;
+ if (io->in.user) {
+ filter = talloc_asprintf_append(filter, "(User=%s)", io->in.user);
+ }
+ if (io->in.acct_control != -1) {
+ filter = talloc_asprintf_append(filter, "(AAC=%s)",
+ ldap_encode_ndr_uint32(tmp_ctx, io->in.acct_control));
+ }
+ if (io->in.domain_sid) {
+ struct dom_sid *sid = dom_sid_parse_talloc(tmp_ctx, io->in.domain_sid);
+ if (sid == NULL) goto failed;
+ filter = talloc_asprintf_append(filter, "(domainSid=%s)",
+ ldap_encode_ndr_dom_sid(tmp_ctx, sid));
+ }
+ if (io->in.domain_guid) {
+ struct GUID guid;
+ NTSTATUS status;
+ status = GUID_from_string(io->in.domain_guid, &guid);
+ if (!NT_STATUS_IS_OK(status)) goto failed;
+ filter = talloc_asprintf_append(filter, "(DomainGuid=%s)",
+ ldap_encode_ndr_GUID(tmp_ctx, &guid));
+ }
+ filter = talloc_asprintf_append(filter, ")");
+ if (filter == NULL) goto failed;
search.in.dest_address = io->in.dest_address;
search.in.filter = filter;
@@ -513,9 +539,11 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
req = cldap_search_send(cldap, &search);
- talloc_free(filter);
-
+ talloc_free(tmp_ctx);
return req;
+failed:
+ talloc_free(tmp_ctx);
+ return NULL;
}
@@ -535,7 +563,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
return status;
}
if (search.out.response == NULL) {
- return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+ return NT_STATUS_NOT_FOUND;
}
if (search.out.response->num_attributes != 1 ||
diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h
index fbdaada8c9..632dbd1f65 100644
--- a/source4/libcli/cldap/cldap.h
+++ b/source4/libcli/cldap/cldap.h
@@ -143,7 +143,11 @@ struct cldap_netlogon {
const char *dest_address;
const char *realm;
const char *host;
- uint8_t version;
+ const char *user;
+ const char *domain_guid;
+ const char *domain_sid;
+ int acct_control;
+ uint32_t version;
} in;
struct {
union nbt_cldap_netlogon netlogon;