diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-04-27 18:07:09 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-04-27 18:45:41 +0200 |
commit | 79a29a8cd65534884934c60ae2fb2854e064722b (patch) | |
tree | ae3972cd004b7349bf498712855f782319449932 /source4/cldap_server | |
parent | eceffe690912b1fbce4ecddaffd29b52e2cf9cd1 (diff) | |
download | samba-79a29a8cd65534884934c60ae2fb2854e064722b.tar.gz samba-79a29a8cd65534884934c60ae2fb2854e064722b.tar.bz2 samba-79a29a8cd65534884934c60ae2fb2854e064722b.zip |
s4:cldap_server/netlogon.c - handle the domain SID correctly
Diffstat (limited to 'source4/cldap_server')
-rw-r--r-- | source4/cldap_server/netlogon.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 37d3b8386b..414f08a6f6 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -388,7 +388,7 @@ void cldapd_netlogon_request(struct cldap_socket *cldap, const char *host = NULL; const char *user = NULL; const char *domain_guid = NULL; - const char *domain_sid = NULL; + struct dom_sid *domain_sid = NULL; int acct_control = -1; int version = -1; struct netlogon_samlogon_response netlogon; @@ -420,9 +420,20 @@ void cldapd_netlogon_request(struct cldap_socket *cldap, } } if (strcasecmp(t->u.equality.attr, "DomainSid") == 0) { - domain_sid = talloc_strndup(tmp_ctx, - (const char *)t->u.equality.value.data, - t->u.equality.value.length); + enum ndr_err_code ndr_err; + + domain_sid = talloc(tmp_ctx, struct dom_sid); + if (domain_sid == NULL) { + goto failed; + } + ndr_err = ndr_pull_struct_blob(&t->u.equality.value, + domain_sid, NULL, + domain_sid, + (ndr_pull_flags_fn_t)ndr_pull_dom_sid); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(domain_sid); + goto failed; + } } if (strcasecmp(t->u.equality.attr, "User") == 0) { user = talloc_strndup(tmp_ctx, @@ -439,7 +450,7 @@ void cldapd_netlogon_request(struct cldap_socket *cldap, } } - if (domain_guid == NULL && domain == NULL) { + if ((domain == NULL) && (domain_guid == NULL) && (domain_sid == NULL)) { domain = lp_dnsdomain(cldapd->task->lp_ctx); } @@ -450,10 +461,13 @@ void cldapd_netlogon_request(struct cldap_socket *cldap, DEBUG(5,("cldap netlogon query domain=%s host=%s user=%s version=%d guid=%s\n", domain, host, user, version, domain_guid)); - status = fill_netlogon_samlogon_response(cldapd->samctx, tmp_ctx, domain, NULL, NULL, domain_guid, + status = fill_netlogon_samlogon_response(cldapd->samctx, tmp_ctx, + domain, NULL, domain_sid, + domain_guid, user, acct_control, tsocket_address_inet_addr_string(src, tmp_ctx), - version, cldapd->task->lp_ctx, &netlogon, false); + version, cldapd->task->lp_ctx, + &netlogon, false); if (!NT_STATUS_IS_OK(status)) { goto failed; } |