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

Robin Hack rhack at redhat.com
Fri Jan 8 10:56:05 UTC 2016


HI all.

Thank you for review.

I discovered other bugs so I decided to do some changes:
* test were moved to fileserver test env
* new samba/unix accound named force_user were created
   - change solves previous issue with make test TESTS=samba3.local.nss
   - additionally it solves "bug" in test itself. While setup, 2 groups
with same GID were created which is not nice and taint test env
* test script were renamed to:
samba3.blackbox.smbclient.forceuser_validusers
  - user name has been hard coded but set of arguments for script remains
(it's for future use :))

New patch is attached.

Have nice day
Robin Hack



On Thu, Jan 7, 2016 at 11:31 AM, Michael Adam <obnox at samba.org> wrote:

> On 2016-01-07 at 23:07 +1300, Andrew Bartlett wrote:
> > 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.
>
> Correct. My point is that the referenced bugs have no
> relationship whatsoever to map-to-guest, as far as I can tell.
>
> Michael
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-samba3.blackbox.smbclient.forceuser_validusers-Add-n.patch
Type: text/x-patch
Size: 6824 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160108/b8047f41/0001-samba3.blackbox.smbclient.forceuser_validusers-Add-n.bin>


More information about the samba-technical mailing list