[PATCH] DRAFT: Add new test which covers force user bug

Andrew Bartlett abartlet at samba.org
Thu Jan 7 10:07:43 UTC 2016


On Thu, 2016-01-07 at 09:43 +0100, Michael Adam wrote:
> Hi Robin,
> 
> Thanks a lot for working on the testsuite!!
> 
> Some comments:
> 
> - Have you run a full 'make test' with your patch?
>   (You should, in this case, since it modifies the test
>   environment...)
> 
> - I don't quite understand the patch yet:
>   See comments inline below.
> 
> 
> On 2016-01-04 at 14:35 +0100, Robin Hack wrote:
> > Patch is here :).
> > 
> > On Mon, Jan 4, 2016 at 2:28 PM, Robin Hack <rhack at redhat.com>
> > wrote:
> > 
> > > Hi Jeremy.
> > > 
> > > Sorry for such a big delay. I was on vacation. And thank you very
> > > much for
> > > heads up.
> > > 
> > > I looked at issue which you described and I hope that I fixed it.
> > > 
> > > In previous case I used $unix_gids[0] for $unix_name user.
> > > I use newly generated gid now.
> > > 
> > > Could you please check and review my changes again and test them?
> > > I ran
> > > $ make test TESTS=samba3.local.nss
> > > and issue seems gone. I'm not sure if other issues will not
> > > raise.
> > > 
> > > Sorry for issues with my patch. I didn't realized how fragile it
> > > can be :(.
> > > 
> > > 
> > > Have nice day
> > > Robin Hack
> 
> 
> > From cae478de1f577b181eab68f0bef7d6e49ba1c1a7 Mon Sep 17 00:00:00
> > 2001
> > From: Robin Hack <rhack at redhat.com>
> > Date: Fri, 4 Dec 2015 14:50:56 +0100
> > Subject: [PATCH] samba3.blackbox.smbclient.forceuser: Add new test
> > for force
> >  user option.
> > 
> > Test covers commit
> > a85d6eb355e8277fe69db6e5837a7f65f57d9c1d
> > 
> > BUG: https://bugzilla.samba.org/show_bug.cgi?id=9878
> > RH BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1077651
> > 
> > Signed-off-by: Robin Hack <rhack at redhat.com>
> > ---
> >  selftest/target/Samba3.pm              | 31 ++++++++++++++++
> >  source3/script/tests/test_forceuser.sh | 66
> > ++++++++++++++++++++++++++++++++++
> >  source3/selftest/tests.py              |  6 ++--
> >  3 files changed, 101 insertions(+), 2 deletions(-)
> >  create mode 100755 source3/script/tests/test_forceuser.sh
> > 
> > diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
> > index 94612b2..ccb2751 100755
> > --- a/selftest/target/Samba3.pm
> > +++ b/selftest/target/Samba3.pm
> > @@ -790,11 +790,36 @@ $ret->{USERNAME} = KTEST\\Administrator
> >  sub setup_maptoguest($$)
> >  {
> >  	my ($self, $path) = @_;
> > +	my $prefix_abs = abs_path($path);
> >  
> >  	print "PROVISIONING maptoguest...";
> >  
> > +	my @dirs = ();
> > +
> > +	mkdir($prefix_abs, 0777);
> > +	my $share_dir="$prefix_abs/share";
> > +	push(@dirs, $share_dir);
> > +
> > +	my $force_user_not_work_dir =
> > "$share_dir/force_user_not_work";
> > +	push(@dirs, $force_user_not_work_dir);
> > +
> > +	my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or
> > `PATH=/usr/ucb:$ENV{PATH} whoami`);
> > +	chomp $unix_name;
> > +
> > +
> >  	my $options = "
> >  map to guest = bad user
> > +
> > +# BUG: https://bugzilla.samba.org/show_bug.cgi?id=9878
> > +# BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1077651
> 
> These bugs are not at all related to map to guest.
> But your test and comments seem to suggest that.
> 
> I think you should either remove the references to map-to-guest
> and do it (maybe additionally?) with a non-map-to-guest share,
> or else you should remove the above BZ references.

The tests are of the combination of force user and map to guest = bad
user. 

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba






More information about the samba-technical mailing list