[PATCH] selftest: Print error message when smbd does not have ADS support

Christof Schmitt christof.schmitt at us.ibm.com
Thu Jul 18 17:55:31 MDT 2013


On Thu, Jul 04, 2013 at 09:51:20AM +1000, Andrew Bartlett wrote:
> On Wed, 2013-07-03 at 13:09 -0700, Christof Schmitt wrote:
> > When smbd cannot be compiled with ADS support, setting up the s3member
> > environment fails with:
> > 
> > Can't use string ("UNKNOWN") as a HASH ref while "strict refs" in use at
> > /home/cschmit/test/samba/selftest/selftest.pl line 852.
> > 
> > Add an explicit error message for the missing ADS support to make this
> > easier to debug.
> > 
> > Signed-off-by: Christof Schmitt <christof.schmitt at us.ibm.com>
> > ---
> >  selftest/target/Samba3.pm |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
> > index 26f5e92..20587bf 100755
> > --- a/selftest/target/Samba3.pm
> > +++ b/selftest/target/Samba3.pm
> > @@ -25,6 +25,7 @@ sub have_ads($) {
> >  	close IN;
> >  
> >  	# If we were not built with ADS support, pretend we were never even available
> > +	print "smbd does not have ADS support\n" unless $found_ads;
> >  	return $found_ads;
> >  }
> 
> While this is good, we should also have a line like this at line 919
> 
> 		} elsif ($envvars eq "UNKNOWN") {
> 
> and never deference the magic marker as a hash.

The dereference happens some lines before that. Attached is an updated
version of the patch that also avoid the invalid hash dereference.

-- 
Christof Schmitt || IBM || SONAS System Development || Tucson, AZ
christof.schmitt at us.ibm.com  ||  +1-520-799-2469  (T/L: 321-2469)
-------------- next part --------------
>From 1de7eaa37934ecb6b436422fa84e53e0e9c9a3aa Mon Sep 17 00:00:00 2001
From: Christof Schmitt <christof.schmitt at us.ibm.com>
Date: Wed, 3 Jul 2013 12:49:43 -0700
Subject: [PATCH] selftest: Print error message when smbd does not have ADS support

When smbd cannot be compiled with ADS support, setting up the s3member
environment fails with:

samba: using 'standard' process model
Samba can't provide environment 's3member' at /test/samba/selftest/target/Samba.pm line 44.
Can't use string ("UNKNOWN") as a HASH ref while "strict refs" in use at /test/samba/selftest/selftest.pl line 852.
samba: EOF on stdin - terminating

Add an explicit error message for the missing ADS support to make this
easier to debug and also avoid the warning about the hash reference:

samba: using 'standard' process model
Samba can't provide environment 's3member' at /test/samba/selftest/target/Samba.pm line 44.
Unable to setup environment s3member at /test/samba/selftest/selftest.pl line 851.
smbd does not have ADS support
samba: EOF on stdin - terminating

Signed-off-by: Christof Schmitt <christof.schmitt at us.ibm.com>
---
 selftest/selftest.pl      |    4 +++-
 selftest/target/Samba3.pm |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index cc947a1..b60b762 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -847,7 +847,9 @@ if ($opt_testenv) {
 
 	my $testenv_vars = setup_env($testenv_name, $prefix);
 
-	die("Unable to setup environment $testenv_name") unless ($testenv_vars);
+	if (not $testenv_vars or $testenv_vars eq "UNKNOWN") {
+		die("Unable to setup environment $testenv_name");
+	}
 
 	$ENV{PIDDIR} = $testenv_vars->{PIDDIR};
 	$ENV{ENVNAME} = $testenv_name;
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 26f5e92..20587bf 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -25,6 +25,7 @@ sub have_ads($) {
 	close IN;
 
 	# If we were not built with ADS support, pretend we were never even available
+	print "smbd does not have ADS support\n" unless $found_ads;
 	return $found_ads;
 }
 
-- 
1.7.1



More information about the samba-technical mailing list