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