[PATCHES] fix some build errors and warnings

Guenther Deschner gd at samba.org
Thu Jul 23 12:18:30 UTC 2015


Hi,

attached some patches to:
- resolve build failure with --with-system-mitkrb5
(https://bugzilla.samba.org/show_bug.cgi?id=11411)
- merge multiple copies of genpad in pidl
- fix an annoying const build warning

Please review & push,

Guenther
-- 
Günther Deschner                    GPG-ID: 8EE11688
Red Hat                         gdeschner at redhat.com
Samba Team                              gd at samba.org
-------------- next part --------------
From 9e09878c7741ea67307932bb9cfeb3b6177d032e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 10 Jul 2015 09:44:40 +0200
Subject: [PATCH 1/3] s4-torture: don't build the lsa forest trust krb5 tests
 when building with MIT Kerberos.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11411

Guenther

Signed-off-by: Günther Deschner <gd at samba.org>
---
 source4/torture/rpc/lsa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 95caebb..44cdbdc 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -2903,6 +2903,8 @@ static bool check_pw_with_ServerAuthenticate3(struct dcerpc_pipe *p,
 	return true;
 }
 
+#ifdef SAMBA4_USES_HEIMDAL
+
 /*
  * This function is set in torture_krb5_init_context as krb5
  * send_and_recv function.  This allows us to override what server the
@@ -4103,6 +4105,7 @@ static bool check_pw_with_krb5(struct torture_context *tctx,
 	TALLOC_FREE(ctx);
 	return true;
 }
+#endif
 
 static bool check_dom_trust_pw(struct dcerpc_pipe *p,
 			       struct torture_context *tctx,
@@ -4234,9 +4237,13 @@ static bool check_dom_trust_pw(struct dcerpc_pipe *p,
 				 "check_pw_with_ServerAuthenticate3");
 
 	if (trusted->trust_type != LSA_TRUST_TYPE_DOWNLEVEL) {
+#ifdef SAMBA4_USES_HEIMDAL
 		ok = check_pw_with_krb5(tctx, incoming_creds, trusted);
 		torture_assert_int_equal(tctx, ok, expected_result,
 					 "check_pw_with_krb5");
+#else
+		torture_comment(tctx, "skipping check_pw_with_krb5 for MIT Kerberos build");
+#endif
 	}
 
 	if (expected_result != true || next_password == NULL) {
@@ -4319,8 +4326,12 @@ static bool check_dom_trust_pw(struct dcerpc_pipe *p,
 	torture_assert(tctx, ok, "check_pw_with_ServerAuthenticate3 with changed password");
 
 	if (trusted->trust_type != LSA_TRUST_TYPE_DOWNLEVEL) {
+#if SAMBA4_USES_HEIMDAL
 		ok = check_pw_with_krb5(tctx, incoming_creds, trusted);
 		torture_assert(tctx, ok, "check_pw_with_krb5 with changed password");
+#else
+		torture_comment(tctx, "skipping check_pw_with_krb5 for MIT Kerberos build");
+#endif
 	}
 
 	TALLOC_FREE(p2);
-- 
2.4.3


From 895e3570b94b021f9de78c9edd07875bdaf99c44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 22 Jul 2015 14:52:06 +0200
Subject: [PATCH 2/3] vfs: fix build warning in smb traffic analyzer.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Guenther

Signed-off-by: Günther Deschner <gd at samba.org>
---
 source3/modules/vfs_smb_traffic_analyzer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
index 06ff1f6..4938ff7 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.c
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -185,10 +185,10 @@ static char *smb_traffic_analyzer_encrypt( TALLOC_CTX *ctx,
 	*len = ((s1 + 1)*16);
 	output = talloc_array(ctx, char, *len);
 	for (h = 0; h < s1; h++) {
-		samba_AES_encrypt((unsigned char *) str+(16*h), output+16*h,
+		samba_AES_encrypt((const unsigned char *) str+(16*h), (unsigned char *)output+16*h,
 			&key);
 	}
-	samba_AES_encrypt(filler, (const unsigned char *)(output+(16*h)), &key);
+	samba_AES_encrypt(filler, (unsigned char *)(output+(16*h)), &key);
 	*len = (s1*16)+16;
 	return output;
 }
-- 
2.4.3


From bec2d5764e4e84dc2d0875087190ceda49f2aced Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 22 Jul 2015 18:57:57 +0200
Subject: [PATCH 3/3] pidl: merge multiple 'genpad' implementations into one.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Guenther

Signed-off-by: Günther Deschner <gd at samba.org>
---
 pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm  | 11 +----------
 pidl/lib/Parse/Pidl/Samba3/Template.pm   | 11 ++---------
 pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 11 +----------
 pidl/lib/Parse/Pidl/Samba4/Template.pm   | 11 ++---------
 pidl/lib/Parse/Pidl/Util.pm              | 16 +++++++++++++++-
 5 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index aa913f1..28d5245 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -13,7 +13,7 @@ use Exporter;
 
 use strict;
 use Parse::Pidl qw(fatal warning error);
-use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::Util qw(has_property ParseExpr genpad);
 use Parse::Pidl::NDR qw(ContainsPipe);
 use Parse::Pidl::Typelist qw(mapTypeName);
 use Parse::Pidl::Samba4 qw(DeclLong);
@@ -28,15 +28,6 @@ sub pidl($$) { my ($self,$txt) = @_; $self->{res} .= $txt ? "$self->{tabs}$txt\n
 sub pidl_hdr($$) { my ($self, $txt) = @_; $self->{res_hdr} .= "$txt\n"; } 
 sub fn_declare($$) { my ($self,$n) = @_; $self->pidl($n); $self->pidl_hdr("$n;"); }
 
-sub genpad($)
-{
-	my ($s) = @_;
-	my $nt = int((length($s)+1)/8);
-	my $lt = ($nt*8)-1;
-	my $ns = (length($s)-$lt);
-	return "\t"x($nt)." "x($ns);
-}
-
 sub new($)
 {
 	my ($class) = shift;
diff --git a/pidl/lib/Parse/Pidl/Samba3/Template.pm b/pidl/lib/Parse/Pidl/Samba3/Template.pm
index 3496927..4750cef 100644
--- a/pidl/lib/Parse/Pidl/Samba3/Template.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/Template.pm
@@ -8,19 +8,12 @@ package Parse::Pidl::Samba3::Template;
 use vars qw($VERSION);
 $VERSION = '0.01';
 
+use Parse::Pidl::Util qw(genpad);
+
 use strict;
 
 my($res);
 
-sub genpad($)
-{
-	my ($s) = @_;
-	my $nt = int((length($s)+1)/8);
-	my $lt = ($nt*8)-1;
-	my $ns = (length($s)-$lt);
-	return "\t"x($nt)." "x($ns);
-}
-
 #####################################################################
 # produce boilerplate code for a interface
 sub Template($)
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
index ee68090..040cd5a 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
@@ -11,7 +11,7 @@ use Exporter;
 @EXPORT_OK = qw(Parse);
 
 use Parse::Pidl qw(fatal warning error);
-use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::Util qw(has_property ParseExpr genpad);
 use Parse::Pidl::NDR qw(ContainsPipe);
 use Parse::Pidl::Typelist qw(mapTypeName);
 use Parse::Pidl::Samba4 qw(choose_header is_intree DeclLong);
@@ -29,15 +29,6 @@ sub pidl_hdr($$) { my ($self, $txt) = @_; $self->{res_hdr} .= "$txt\n"; }
 sub pidl_both($$) { my ($self, $txt) = @_; $self->{hdr} .= "$txt\n"; $self->{res_hdr} .= "$txt\n"; }
 sub fn_declare($$) { my ($self,$n) = @_; $self->pidl($n); $self->pidl_hdr("$n;"); }
 
-sub genpad($)
-{
-	my ($s) = @_;
-	my $nt = int((length($s)+1)/8);
-	my $lt = ($nt*8)-1;
-	my $ns = (length($s)-$lt);
-	return "\t"x($nt)." "x($ns);
-}
-
 sub new($)
 {
 	my ($class) = shift;
diff --git a/pidl/lib/Parse/Pidl/Samba4/Template.pm b/pidl/lib/Parse/Pidl/Samba4/Template.pm
index e79af85..d9fb304 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Template.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Template.pm
@@ -8,19 +8,12 @@ package Parse::Pidl::Samba4::Template;
 use vars qw($VERSION);
 $VERSION = '0.01';
 
+use Parse::Pidl::Util qw(genpad);
+
 use strict;
 
 my($res);
 
-sub genpad($)
-{
-	my ($s) = @_;
-	my $nt = int((length($s)+1)/8);
-	my $lt = ($nt*8)-1;
-	my $ns = (length($s)-$lt);
-	return "\t"x($nt)." "x($ns);
-}
-
 #####################################################################
 # produce boilerplate code for a interface
 sub Template($)
diff --git a/pidl/lib/Parse/Pidl/Util.pm b/pidl/lib/Parse/Pidl/Util.pm
index 421cb8f..83e2393 100644
--- a/pidl/lib/Parse/Pidl/Util.pm
+++ b/pidl/lib/Parse/Pidl/Util.pm
@@ -6,7 +6,7 @@ package Parse::Pidl::Util;
 
 require Exporter;
 @ISA = qw(Exporter);
- at EXPORT = qw(has_property property_matches ParseExpr ParseExprExt is_constant make_str unmake_str print_uuid MyDumper);
+ at EXPORT = qw(has_property property_matches ParseExpr ParseExprExt is_constant make_str unmake_str print_uuid MyDumper genpad);
 use vars qw($VERSION);
 $VERSION = '0.01';
 
@@ -176,6 +176,20 @@ sub ParseExprExt($$$$$)
 		$deref, $use);
 }
 
+=item B<genpad>
+return an empty string consisting of tabs and spaces suitable for proper indent
+of C-functions.
+
+=cut
+sub genpad($)
+{
+	my ($s) = @_;
+	my $nt = int((length($s)+1)/8);
+	my $lt = ($nt*8)-1;
+	my $ns = (length($s)-$lt);
+	return "\t"x($nt)." "x($ns);
+}
+
 =back
 
 =cut
-- 
2.4.3



More information about the samba-technical mailing list