The branch, master has been updated
       via  8b7c66512d2021e6e7b299adb3e93807b6b3516d (commit)
       via  a849183f9492d09ccd7e273f955d4d8f2668fdf3 (commit)
      from  d6497aa0894b20392d759e1762ad1bb6ab29f5c8 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8b7c66512d2021e6e7b299adb3e93807b6b3516d
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Jan 28 17:28:51 2009 +0100

    s3:selftest: fix 'make selftest'
    
    metze

commit a849183f9492d09ccd7e273f955d4d8f2668fdf3
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Jan 28 17:24:38 2009 +0100

    s3:selftest: create BUILTIN\\Administrators at startup
    
    And add and remove the alias member via net rpc group
    instead of net sam.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm                 |  128 ++++++++++++++++++++++------
 source3/script/tests/selftest.sh          |    7 ++
 source3/script/tests/test_net_registry.sh |   15 +--
 3 files changed, 112 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 7c3c0b0..c43b61e 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -36,14 +36,14 @@ sub teardown_env($$)
 
        my $smbdpid = read_pid($envvars, "smbd");
        my $nmbdpid = read_pid($envvars, "nmbd");
-#      my $winbinddpid = read_pid($envvars, "winbindd");
+       my $winbinddpid = read_pid($envvars, "winbindd");
 
        $self->stop_sig_term($smbdpid);
        $self->stop_sig_term($nmbdpid);
-#      $self->stop_sig_term($winbinddpid);
+       $self->stop_sig_term($winbinddpid);
        $self->stop_sig_kill($smbdpid);
        $self->stop_sig_kill($nmbdpid);
-#      $self->stop_sig_kill($winbinddpid);
+       $self->stop_sig_kill($winbinddpid);
 
        return 0;
 }
@@ -76,7 +76,7 @@ sub getlog_env($$)
 
        $ret .= $self->getlog_env_app($envvars, "SMBD");
        $ret .= $self->getlog_env_app($envvars, "NMBD");
-#      $ret .= $self->getlog_env_app($envvars, "WINBINDD");
+       $ret .= $self->getlog_env_app($envvars, "WINBINDD");
 
        return $ret;
 }
@@ -160,8 +160,13 @@ sub check_or_start($$$$) {
                open STDOUT, ">$env_vars->{NMBD_TEST_LOG}";
                open STDERR, '>&STDOUT';
 
+               
SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
                $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
 
+               $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+               $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
                my @optargs = ("-d0");
                if (defined($ENV{NMBD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{NMBD_OPTIONS});
@@ -186,16 +191,26 @@ sub check_or_start($$$$) {
                open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}";
                open STDERR, '>&STDOUT';
 
+               
SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
                $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
 
+               $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+               $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
                my @optargs = ("-d0");
                if (defined($ENV{WINBINDD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
                }
 
-               $ENV{$ENV{LIB_PATH_VAR}} = $self->{bindir};
                $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
-               exec($self->binpath("timelimit"), $winbindd_maxtime, 
$ENV{WINBINDD_VALGRIND}, $self->binpath("winbindd"), "-F", "-S", 
"--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or 
die("Unable to start winbindd: $!");
+
+               my @preargs = ($self->binpath("timelimit"), $winbindd_maxtime);
+               if(defined($ENV{WINBINDD_VALGRIND})) {
+                       @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
+               }
+
+               exec(@preargs, $self->binpath("winbindd"), "-F", "-S", 
"--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or 
die("Unable to start winbindd: $!");
        }
        write_pid($env_vars, "winbindd", $pid);
        print "DONE\n";
@@ -207,8 +222,13 @@ sub check_or_start($$$$) {
                open STDOUT, ">$env_vars->{SMBD_TEST_LOG}";
                open STDERR, '>&STDOUT';
 
+               
SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
                $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
 
+               $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+               $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
                $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd");
                my @optargs = ("-d0");
                if (defined($ENV{SMBD_OPTIONS})) {
@@ -273,13 +293,17 @@ sub provision($$$)
        my $server_ip = "127.0.0.2";
        my $domain = "SAMBA-TEST";
 
-       my $username = `PATH=/usr/ucb:$ENV{PATH} whoami`;
-       chomp $username;
+       my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or 
`PATH=/usr/ucb:$ENV{PATH} whoami`);
+       chomp $unix_name;
+       my $unix_uid = $>;
+       my $unix_gids_str = $);
+       my @unix_gids = split(" ", $unix_gids_str);
        my $password = "test";
 
        my $srcdir="$RealBin/..";
        my $scriptdir="$srcdir/selftest";
        my $prefix_abs = abs_path($prefix);
+       my $bindir_abs = abs_path($self->{bindir});
 
        my @dirs = ();
 
@@ -315,9 +339,18 @@ sub provision($$$)
 
        my $conffile="$libdir/server.conf";
 
+       my $nss_wrapper_pl = "$ENV{PERL} 
$srcdir/../lib/nss_wrapper/nss_wrapper.pl";
+       my $nss_wrapper_passwd = "$privatedir/passwd";
+       my $nss_wrapper_group = "$privatedir/group";
+
        open(CONF, ">$conffile") or die("Unable to open $conffile");
        print CONF "
 [global]
+       netbios name = $server
+       interfaces = $server_ip/8
+       bind interfaces only = yes
+       panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
+
        workgroup = $domain
 
        private dir = $privatedir
@@ -328,42 +361,51 @@ sub provision($$$)
 
        name resolve order = bcast
 
-       netbios name = $server
-       interfaces = $server_ip/8
-       bind interfaces only = yes
-       panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
+       state directory = $lockdir
+       cache directory = $lockdir
 
        passdb backend = tdbsam
 
-       ; Necessary to add the build farm hacks
-       add user script = /bin/false
-       add machine script = /bin/false
-
-       kernel oplocks = no
-       kernel change notify = no
-
-       syslog = no
-       printing = bsd
-       printcap name = /dev/null
-
 ";
 
        if ($role eq "dc") {
-               print CONF "\tdomain logons = yes\n";
                print CONF "\tdomain master = yes\n";
+               print CONF "\tdomain logons = yes\n";
        }
 
 print CONF "
+       time server = yes
+
+       add user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type 
passwd --action add --name %u
+       add machine script = $nss_wrapper_pl --path $nss_wrapper_passwd --type 
passwd --action add --name %u
+       delete user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type 
passwd --action delete --name %u
+
+       kernel oplocks = no
+       kernel change notify = no
+
+       syslog = no
+       printing = bsd
+       printcap name = /dev/null
 
        winbindd:socket dir = $wbsockdir
+       idmap uid = 100000-200000
+       idmap gid = 100000-200000
+
+#      min receivefile size = 4000
 
-[tmp]
-       path = $shrdir
        read only = no
        smbd:sharedelay = 100000
+       smbd:writetimeupdatedelay = 500000
        map hidden = yes
        map system = yes
        create mask = 755
+       vfs objects = $bindir_abs/xattr_tdb.so $bindir_abs/streams_depot.so
+
+       #Include user defined custom parameters if set
+       $ENV{INCLUDE_CUSTOM_CONF}
+
+[tmp]
+       path = $shrdir
 [hideunread]
        copy = tmp
        hide unreadable = yes
@@ -387,10 +429,31 @@ print CONF "
        ## create a test account
        ##
 
-       open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a 
$username >/dev/null");
+       open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open 
$nss_wrapper_passwd");
+       print PASSWD "
+nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
+$unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
+";
+       close(PASSWD);
+
+       open(GROUP, ">$nss_wrapper_group") or die("Unable to open 
$nss_wrapper_group");
+       print GROUP "
+nobody:x:65533:
+nogroup:x:65534:nobody
+$unix_name-group:x:$unix_gids[0]:
+";
+       close(GROUP);
+
+       $ENV{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
+       $ENV{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
+
+       open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a 
$unix_name >/dev/null");
        print PWD "$password\n$password\n";
        close(PWD) or die("Unable to set password for test account");
 
+       $ENV{NSS_WRAPPER_PASSWD} = undef;
+       $ENV{NSS_WRAPPER_GROUP} = undef;
+
        print "DONE\n";
 
        $ret{SERVER_IP} = $server_ip;
@@ -400,13 +463,17 @@ print CONF "
        $ret{SERVERCONFFILE} = $conffile;
        $ret{CONFIGURATION} ="-s $conffile";
        $ret{SERVER} = $server;
-       $ret{USERNAME} = $username;
+       $ret{USERNAME} = $unix_name;
        $ret{DOMAIN} = $domain;
        $ret{NETBIOSNAME} = $server;
        $ret{PASSWORD} = $password;
        $ret{PIDDIR} = $piddir;
        $ret{WINBINDD_SOCKET_DIR} = $wbsockdir;
        $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir;
+       $ret{SOCKET_WRAPPER_DEFAULT_IFACE} => 2,
+       $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
+       $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
+
        return \%ret;
 }
 
@@ -428,6 +495,11 @@ sub wait_for_start($$)
        system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L 
$envvars->{SERVER_IP} -U% -p 139 | head -2");
        system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L 
$envvars->{SERVER_IP} -U% -p 139 | head -2");
 
+       print "creating BUILTIN\\Administrators\n";
+       $ENV{WINBINDD_SOCKET_DIR} = $envvars->{WINBINDD_SOCKET_DIR};
+       system($self->binpath("net") ." $envvars->{CONFIGURATION} sam 
createbuiltingroup Administrators");
+       $ENV{WINBINDD_SOCKET_DIR} = undef;
+
        print $self->getlog_env($envvars);
 }
 
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index 9462184..c02e0ee 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -345,6 +345,13 @@ START=`date`
  bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
  MAKE_TEST_BINARY=""
 
+ MAKE_TEST_BINARY="bin/net"
+ printf "%s" "creating BUILTIN\\Administrators..."
+ bin/net -s $SERVERCONFFILE sam createbuiltingroup \
+   Administrators > /dev/null 2>&1 ||  exit 1
+ echo "DONE"
+ MAKE_TEST_BINARY=""
+
  failed=0
 
  . $SCRIPTDIR/tests_$SUBTESTS.sh
diff --git a/source3/script/tests/test_net_registry.sh 
b/source3/script/tests/test_net_registry.sh
index e9f56a2..22081ec 100755
--- a/source3/script/tests/test_net_registry.sh
+++ b/source3/script/tests/test_net_registry.sh
@@ -7,8 +7,10 @@ RPC="$1"
 
 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
 
+NETREMOTE="${NET} -U${USERNAME}%${PASSWORD} -S ${SERVER} -I ${SERVER_IP}"
+
 if test "x${RPC}" = "xrpc" ; then
-       NETREG="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry"
+       NETREG="${NETREMOTE} rpc registry"
 else
        NETREG="${NET} registry"
 fi
@@ -332,14 +334,7 @@ test_setvalue_twice()
 
 give_administrative_rights()
 {
-       bin/net -s $SERVERCONFFILE sam createbuiltingroup Administrators
-       if test "x$?" != "x0" ; then
-               echo "ERROR: creating builtin group Administrators"
-               false
-               return
-       fi
-
-       bin/net -s $SERVERCONFFILE sam addmem BUILTIN\\Administrators $USERNAME
+       ${NETREMOTE} rpc group addmem BUILTIN\\Administrators $USERNAME
        if test "x$?" != "x0" ; then
                echo "ERROR: adding user $USERNAME to BUILTIN\\Administrators"
                false
@@ -350,7 +345,7 @@ give_administrative_rights()
 
 take_administrative_rights()
 {
-       bin/net -s $SERVERCONFFILE sam delmem BUILTIN\\Administrators $USERNAME
+       ${NETREMOTE} rpc group delmem BUILTIN\\Administrators $USERNAME
        if test "x$?" != "x0" ; then
                echo "ERROR: removing user $USERNAME from 
BUILTIN\\Administrators"
                false


-- 
Samba Shared Repository

Reply via email to