From 1d37f72625eaa9195676e8c5b70836cc17fcddc6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Sep 2013 01:20:10 +0200 Subject: [PATCH 1/3] pidl:NDR/Client: fix dcerpc_function() with [out,ref] pointers Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit f50b561336c7b6c08300e6e477859d1f9fab62c2) --- pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index c796b46..fed94cd 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -693,6 +693,20 @@ sub ParseFunction_Sync($$$$) } $self->pidl(""); + $self->pidl("/* Out parameters */"); + foreach my $e (@{$fn->{ELEMENTS}}) { + next unless grep(/out/, @{$e->{DIRECTION}}); + + $self->ParseCopyArgument($fn, $e, "r.out.", "_"); + } + $self->pidl(""); + + if (defined($fn->{RETURN_TYPE})) { + $self->pidl("/* Result */"); + $self->pidl("ZERO_STRUCT(r.out.result);"); + $self->pidl(""); + } + $self->pidl("status = dcerpc_$name\_r(h, mem_ctx, &r);"); $self->pidl("if (!NT_STATUS_IS_OK(status)) {"); $self->indent; -- 1.7.9.5 From 2dca7d130f7c5c9af1fb06d4d3eafcdf1fbb9035 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Thu, 20 Feb 2014 13:14:31 +0100 Subject: [PATCH 2/3] s3:winbindd: fix _wbint_LookupSids() on error We need to make sure that r->out.domains remains valid, otherwise we're not able to marshall the response. Note that wbint_LookupSids() has [out,ref] lsa_RefDomainList *domains, while lsa_LookupSids() has [out,ref] lsa_RefDomainList **domains. Pair-Programmed-With: Stefan Metzmacher Bug: https://bugzilla.samba.org/show_bug.cgi?id=10458 Signed-off-by: Gregor Beck Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit 3413e64149702136429d7b5acaa7a52c49abf564) --- source3/winbindd/winbindd_dual_srv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index 5344063..4227d6a 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -74,6 +74,7 @@ NTSTATUS _wbint_LookupSid(struct pipes_struct *p, struct wbint_LookupSid *r) NTSTATUS _wbint_LookupSids(struct pipes_struct *p, struct wbint_LookupSids *r) { struct winbindd_domain *domain = wb_child_domain(); + struct lsa_RefDomainList *domains = r->out.domains; NTSTATUS status; if (domain == NULL) { @@ -87,7 +88,12 @@ NTSTATUS _wbint_LookupSids(struct pipes_struct *p, struct wbint_LookupSids *r) * done at the wbint RPC layer. */ status = rpc_lookup_sids(p->mem_ctx, domain, r->in.sids, - &r->out.domains, &r->out.names); + &domains, &r->out.names); + + if (domains != NULL) { + r->out.domains = domains; + } + reset_cm_connection_on_error(domain, status); return status; } -- 1.7.9.5 From 9c3ac77a25b424593daaa28ad3f90968e163e132 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Thu, 20 Feb 2014 11:25:53 +0100 Subject: [PATCH 3/3] s3:winbindd: avoid directly asking a trusted domain in wb_lookupsids*() As a domain member we should always use a DC of our own domain. It would be possible to pass all sids in one single dcerpc_wbint_LookupSids() call. For now we just fix bug. Pair-Programmed-With: Stefan Metzmacher Bug: https://bugzilla.samba.org/show_bug.cgi?id=10458 Signed-off-by: Gregor Beck Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit 66fb0ce9557553a4c01607b517e65ac4c93841d0) --- source3/winbindd/wb_lookupsids.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c index e10d511..b474220 100644 --- a/source3/winbindd/wb_lookupsids.c +++ b/source3/winbindd/wb_lookupsids.c @@ -320,7 +320,7 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain( } } - wb_domain = find_domain_from_sid_noinit(sid); + wb_domain = find_lookup_domain_from_sid(sid); if (wb_domain == NULL) { return NULL; } -- 1.7.9.5