From jra at samba.org Tue Dec 1 20:30:13 2020
From: jra at samba.org (Jeremy Allison)
Date: Tue, 1 Dec 2020 20:30:13 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID: <20201201203013.605B31404CA@sn.samba.org>
The branch, master has been updated
via 936f74daed0 vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
via a8457ac3c80 vfs_zfsacl: reformatting
via 89e2d68bb4d selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
via 20e0ce50884 clitar: Use do_list()'s recursion in clitar.c
via 16ffa17ee28 s3/script/tests: Ensure all remote test files are removed
via 6c7dc4959fd s3/script/tests: call smbclient deltree to remove remote files
via 363bfa4e1ca s3/script/tests: Make smb_client 'die' behaviour configurable
via 99ffa4a9828 s3/script/tests: Remove make_path (for remote dir)
via 6f246658cf0 selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
via 4bb3bffa4b7 s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
via fec1f8faffd s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
via be8dca68f89 s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
via 6cb0a00f4ab s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
via a250f733669 selftest: Add a new tarmode shares
via 4f5a7f11b77 s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
from b09f0bb4d40 test: Fix the FreeBSD build
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 936f74daed0d6221312f651f35c4ed357bbf1414
Author: Ralph Boehme
Date: Mon Nov 30 12:28:58 2020 +0100
vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
This was an omission in the fixes for bug 14470.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14587
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Tue Dec 1 20:29:34 UTC 2020 on sn-devel-184
commit a8457ac3c80e22588e33a343c2306b702734ca88
Author: Ralph Boehme
Date: Mon Nov 30 12:28:00 2020 +0100
vfs_zfsacl: reformatting
No change in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14587
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 89e2d68bb4d93dc391af97f35ff1148aec7930b0
Author: Noel Power
Date: Mon Nov 30 09:21:50 2020 +0000
selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 20e0ce508844fec2dd0011423b10484dc7ccfdb7
Author: Volker Lendecke
Date: Tue Dec 1 08:58:14 2020 +0100
clitar: Use do_list()'s recursion in clitar.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Volker Lendecke
Reviewed-by: Aurelien Aptel
Reviewed-by: Noel Power
commit 16ffa17ee28edfc3bc70c66abf41b5518aeab8fe
Author: Jeremy Allison
Date: Mon Nov 30 17:19:29 2020 +0000
s3/script/tests: Ensure all remote test files are removed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Jeremy Allison
Reviewed-by: Noel Power
commit 6c7dc4959fd5de4382aee413b4cc711cc6f281f4
Author: Noel Power
Date: Mon Nov 30 10:41:57 2020 +0000
s3/script/tests: call smbclient deltree to remove remote files
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 363bfa4e1ca10e64057a6d04d6faff7c788db89d
Author: Noel Power
Date: Mon Nov 30 10:18:32 2020 +0000
s3/script/tests: Make smb_client 'die' behaviour configurable
smb_client behaviour is to die if there is an error. This is
a little heavy handed and make it impossible for example to
use smb_client to run a command that might fail (where such
a failure isn't really an error) E.G. Calling deltree and
the directory doesn't exist
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 99ffa4a98287f125e45690e87b32616f4d4254e4
Author: Noel Power
Date: Mon Nov 30 09:59:58 2020 +0000
s3/script/tests: Remove make_path (for remote dir)
LOCALPATH is actually the local path to the share, we should
not need to create the share path (it should already exist)
Note: When we remove the tree located at LOCALPATH we keep the root
so the share path should always be there
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 6f246658cf003f7e2f393f7b7490d9e8ae84e21c
Author: Noel Power
Date: Mon Nov 30 11:15:06 2020 +0000
selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
samba3.blackbox.smbclient_tar is marked as flapping so it
seems we have missed that it has stopped working. The local path
passed to script/tests/test_smbclient_tarmode.pl must point to a
valid share
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 4bb3bffa4b7a770d36138c45f717a9048ef82cff
Author: Noel Power
Date: Mon Nov 30 17:39:25 2020 +0000
s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
Make sure samba3.blackbox.smbclient_tarmode removes data files
not just before running the test but also after
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit fec1f8faffd9eb1aae77e7c515e57897be34a255
Author: Noel Power
Date: Fri Nov 27 15:52:27 2020 +0000
s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
Replace rm -rf of local dir (that is hosted remotely)
with smbclient deltree
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit be8dca68f89f110ef5947e0c2a7258554772cf9a
Author: Noel Power
Date: Fri Nov 27 15:33:26 2020 +0000
s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
After this change both samba3.blackbox.smbclient_tar &
samba3.blackbox.smbclient_tarmode now use the same dedicated share
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 6cb0a00f4ab4bc1a8193d50cc076ec7174a5ece9
Author: Noel Power
Date: Fri Nov 27 15:25:21 2020 +0000
s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
The other tarmode torture test samba3.blackbox.smbclient_tar now uses a share
'tarmode' which uses the same source path as samba3.blackbox.smbclient_tarmode
Avoid conflicting paths and use a new subdir (of the test share) called
'smbclient_tarmode'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit a250f73366983d2a7397608a611f295f10dbb548
Author: Noel Power
Date: Thu Nov 26 17:31:50 2020 +0000
selftest: Add a new tarmode shares
samba3.blackbox.smbclient_tar & samba3.blackbox.smbclient_tar
need separate shares with own xattr tdb(s)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
commit 4f5a7f11b7732c3efb511e68f6b9d434d59bb3e8
Author: Noel Power
Date: Fri Nov 27 12:01:49 2020 +0000
s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
'keep_root' is an unrecognised option for make_path/mkpath
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
-----------------------------------------------------------------------
Summary of changes:
selftest/flapping | 1 -
selftest/target/Samba3.pm | 11 +++++
source3/client/clitar.c | 41 ++++-------------
source3/modules/vfs_zfsacl.c | 6 ++-
source3/script/tests/test_smbclient_tarmode.pl | 62 ++++++++++++++++++++++----
source3/script/tests/test_smbclient_tarmode.sh | 29 ++++++++----
source3/selftest/tests.py | 12 ++---
7 files changed, 102 insertions(+), 60 deletions(-)
Changeset truncated at 500 lines:
diff --git a/selftest/flapping b/selftest/flapping
index c9f0adbf1bd..8c3f9e8969a 100644
--- a/selftest/flapping
+++ b/selftest/flapping
@@ -31,6 +31,5 @@
# This test just is not reliable in finding the max search limit
#
^samba4.ldap.notification.python\(.*\).__main__.LDAPNotificationTest.test_max_search
-^samba3.blackbox.smbclient_tar.* # fails very, very often on sn-devel
^samba3.blackbox.smbclient_s3.*.sending a message to the remote server # flakey on sn-devel-104 and sn-devel-144
^samba3.blackbox.smbclient_s3.*.creating a good symlink and deleting it by path # flakey on sn-devel-104 and sn-devel-144
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 5623e2a149f..8b1d809c941 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1369,6 +1369,9 @@ sub setup_fileserver
my $tarmode_sharedir="$share_dir/tarmode";
push(@dirs,$tarmode_sharedir);
+ my $tarmode2_sharedir="$share_dir/tarmode2";
+ push(@dirs,$tarmode2_sharedir);
+
my $smbcacls_sharedir="$share_dir/smbcacls";
push(@dirs,$smbcacls_sharedir);
@@ -1397,6 +1400,14 @@ sub setup_fileserver
get quota command = $prefix_abs/getset_quota.py
set quota command = $prefix_abs/getset_quota.py
+[tarmode]
+ path = $tarmode_sharedir
+ comment = tar test share
+ xattr_tdb:file = $prefix_abs/tarmode-xattr.tdb
+[tarmode2]
+ path = $tarmode2_sharedir
+ comment = tar test share
+ xattr_tdb:file = $prefix_abs/tarmode2-xattr.tdb
[spotlight]
path = $share_dir
spotlight = yes
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 3fe3622aba6..4fd1f3c47d9 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -711,7 +711,7 @@ static int tar_create(struct tar* t)
goto out_close;
}
DBG(5, ("tar_process do_list with mask: %s\n", mask));
- status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+ status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
if (!NT_STATUS_IS_OK(status)) {
DBG(0, ("do_list fail %s\n", nt_errstr(status)));
err = 1;
@@ -806,7 +806,7 @@ static int tar_create_from_list(struct tar *t)
DBG(5, ("cd '%s' before do_list\n", base));
client_set_cur_dir(base);
}
- status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+ status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
if (base != NULL) {
client_set_cur_dir(start_dir);
}
@@ -837,7 +837,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
char *remote_name;
char *old_dir = NULL;
char *new_dir = NULL;
- const char *initial_dir = client_get_cur_dir();
+ const char *initial_dir = dir;
bool skip = false;
bool isdir;
int rc;
@@ -846,7 +846,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
return NT_STATUS_NO_MEMORY;
}
- remote_name = talloc_asprintf(ctx, "%s%s", initial_dir, finfo->name);
+ remote_name = talloc_asprintf(ctx, "%s\\%s", initial_dir, finfo->name);
if (remote_name == NULL) {
status = NT_STATUS_NO_MEMORY;
goto out;
@@ -884,35 +884,10 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
goto out;
}
- if (isdir) {
- char *mask;
- mask = talloc_asprintf(ctx, "%s*", new_dir);
- if (mask == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
- mask = client_clean_name(ctx, mask);
- if (mask == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
-
- rc = tar_get_file(&tar_ctx, remote_name, finfo);
- if (rc != 0) {
- status = NT_STATUS_UNSUCCESSFUL;
- goto out;
- }
-
- client_set_cur_dir(new_dir);
- do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
- client_set_cur_dir(old_dir);
- tar_ctx.numdir++;
- } else {
- rc = tar_get_file(&tar_ctx, remote_name, finfo);
- if (rc != 0) {
- status = NT_STATUS_UNSUCCESSFUL;
- goto out;
- }
+ rc = tar_get_file(&tar_ctx, remote_name, finfo);
+ if (rc != 0) {
+ status = NT_STATUS_UNSUCCESSFUL;
+ goto out;
}
out:
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 093eb5111e1..fba7253bbef 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -219,8 +219,10 @@ static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp,
}
if (must_add_empty_ace) {
acebuf[i].a_type = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE;
- acebuf[i].a_flags = SMB_ACE4_DIRECTORY_INHERIT_ACE| \
- SMB_ACE4_FILE_INHERIT_ACE|ACE_EVERYONE;
+ acebuf[i].a_flags = SMB_ACE4_DIRECTORY_INHERIT_ACE |
+ SMB_ACE4_FILE_INHERIT_ACE |
+ ACE_EVERYONE |
+ ACE_INHERITED_ACE;
acebuf[i].a_access_mask = 0;
i++;
}
diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl
index 877eec45cc8..bdbbd1a44a8 100755
--- a/source3/script/tests/test_smbclient_tarmode.pl
+++ b/source3/script/tests/test_smbclient_tarmode.pl
@@ -1,5 +1,4 @@
#!/usr/bin/perl
-
# Unix SMB/CIFS implementation.
# Test suite for the tar backup mode of smbclient.
# Copyright (C) Aur?lien Aptel 2013
@@ -304,6 +303,8 @@ sub test_creation_attr {
@inc = grep { $_->attr('a') && !$_->attr_any('h', 's') } @all;
smb_tar('tarmode inc nohidden nosystem', '-Tc', $TAR, $DIR);
$err += check_tar($TAR, \@inc);
+ # adjust attr so remote files can be deleted with deltree
+ File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
$err;
}
@@ -399,7 +400,10 @@ sub test_creation_incremental {
} else {
smb_tar('', '-Tcg', $TAR, $DIR);
}
- return check_tar($TAR, \@files);
+ my $res = check_tar($TAR, \@files);
+ # adjust attr so remote files can be deleted with deltree
+ File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
+ return $res
}
@@ -917,8 +921,22 @@ Remove all files in the server C<$DIR> (not root)
sub reset_remote {
# remove_tree($LOCALPATH . '/'. $DIR);
# make_path($LOCALPATH . '/'. $DIR);
- remove_tree($LOCALPATH, {keep_root => 1});
- make_path($LOCALPATH, {keep_root => 1});
+ my $DIR;
+ my @names;
+ my $name;
+
+ smb_client_cmd(0, '-c', "deltree ./*");
+
+ # Ensure all files are gone.
+
+ opendir(DIR,$LOCALPATH) or die "Can't open $LOCALPATH\n";
+ @names = readdir(DIR) or die "Unable to read $LOCALPATH\n";
+ closedir(DIR);
+ foreach $name (@names) {
+ next if ($name eq "."); # skip the current directory entry
+ next if ($name eq ".."); # skip the parent directory entry
+ die "$LOCALPATH not empty\n";
+ }
}
=head3 C
@@ -1120,7 +1138,9 @@ sub check_tar {
return (@more + @less + @diff); # nb of errors
}
-=head3 C
+=head3 C
+
+=head3 C
Run smbclient with C<@args> passed as argument and return output.
@@ -1131,11 +1151,12 @@ the command-line are already inserted.
The output contains both the C and C.
-Die if smbclient crashes or exits with an error code.
+if C<$will_die> then Die if smbclient crashes or exits with an error code.
+otherwise return output
=cut
-sub smb_client {
- my (@args) = @_;
+sub smb_client_cmd {
+ my ($will_die, @args) = @_;
my $fullpath = "//$HOST/$SHARE";
my $cmd = sprintf("%s %s %s",
@@ -1168,11 +1189,34 @@ sub smb_client {
}
if ($err) {
- die "ERROR: $errstr";
+ if ($will_die) {
+ die "ERROR: $errstr";
+ } else {
+ say "ERROR: $errstr";
+ }
}
return $out;
}
+=head3 C
+
+Run smbclient with C<@args> passed as argument and return output.
+
+Each element of C<@args> becomes one escaped argument of smbclient.
+
+Host, share, user, password and the additionnal arguments provided on
+the command-line are already inserted.
+
+The output contains both the C and C.
+
+Die if smbclient crashes or exits with an error code.
+
+=cut
+sub smb_client {
+ my (@args) = @_;
+ return smb_client_cmd(1, @args)
+}
+
sub smb_cmd {
return smb_client('-c', join(' ', @_));
}
diff --git a/source3/script/tests/test_smbclient_tarmode.sh b/source3/script/tests/test_smbclient_tarmode.sh
index 3779c38a5ca..8bc5b9947cf 100755
--- a/source3/script/tests/test_smbclient_tarmode.sh
+++ b/source3/script/tests/test_smbclient_tarmode.sh
@@ -94,7 +94,7 @@ test_tarmode_creation() {
# Clear temp data
rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
- rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
# Build the test data
if ! create_test_data "$LOCAL_PATH"; then
@@ -104,14 +104,15 @@ test_tarmode_creation() {
fi
# Create tarfile with smbclient
- if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
- $ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/tarmode"; then
+ if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+ $ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/smbclient_tar"; then
echo "Couldn't create tar file with tarmode -Tc"
false
return
fi
- # Extract data to verify
+ # Extract data to verify - this puts it into $PREFIX/smbclient_tar/
+ # but we must leave it there as it's used to verify in test_tarmode_extraction()
if ! tar -xf "$PREFIX/tarmode.tar" -C "$PREFIX"; then
echo "Couldn't extract data from created tarfile"
false
@@ -119,12 +120,16 @@ test_tarmode_creation() {
fi
# Verify data
- if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+ if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
echo "Data not equivalent"
false
return
fi
+ # Clear temp data
+ rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+ rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
true
return
@@ -136,7 +141,7 @@ test_tarmode_extraction() {
# Clear temp data
rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
- rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
# Build the test data
if ! create_test_data "$PREFIX/tarmode"; then
@@ -146,14 +151,14 @@ test_tarmode_extraction() {
fi
# Create tarfile to extract on client
- if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" tarmode; then
+ if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" smbclient_tar; then
echo "Couldn't create tar archive"
false
return
fi
# Extract tarfile with smbclient
- if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+ if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
$ADDARGS -c "tarmode full" -Tx "$PREFIX/tarmode.tar"; then
echo "Couldn't extact tar file with tarmode -Tx"
false
@@ -161,12 +166,18 @@ test_tarmode_extraction() {
fi
# Verify data
- if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+ if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
echo "Data not equivalent"
false
return
fi
+ # Clear temp data
+ rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+ rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
+ # Cleanup the verification data created by test_tarmode_creation().
+ rm -rf "$PREFIX"/smbclient_tar > /dev/null 2>&1
true
return
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 349be8cd7da..9b13ceaa4ab 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -484,23 +484,23 @@ for env in ["fileserver"]:
plantestsuite("samba3.blackbox.smbclient_tarmode.NT1", env + "_smb1_done",
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
'$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
- '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mNT1"])
+ '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mNT1"])
plantestsuite("samba3.blackbox.smbclient_tarmode.SMB3", env,
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
'$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
- '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mSMB3"])
+ '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mSMB3"])
# Test suite for new smbclient/tar with libarchive (GSoC 13)
plantestsuite("samba3.blackbox.smbclient_tar.NT1", env + "_smb1_done",
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
- '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
- '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+ '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+ '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
'-d', '$PREFIX', '-b', smbclient3,
'--subunit', '--', configuration, '-mNT1'])
plantestsuite("samba3.blackbox.smbclient_tar.SMB3", env,
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
- '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
- '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+ '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+ '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
'-d', '$PREFIX', '-b', smbclient3,
'--subunit', '--', configuration, '-mSMB3'])
--
Samba Shared Repository
From kseeger at samba.org Wed Dec 2 14:50:03 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Wed, 2 Dec 2020 14:50:03 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch v4-13-test updated
Message-ID: <20201202145005.25746140345@sn.samba.org>
The branch, v4-13-test has been updated
via 585c49f21f7 vfs_glusterfs: print exact cmdline for disabling write-behind translator
via 587fa331f62 manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
via 2ea7b5c43e8 selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
via 8cec2732890 clitar: Use do_list()'s recursion in clitar.c
via 2954051aa6d s3/script/tests: Ensure all remote test files are removed
via 5f1772d94a3 s3/script/tests: call smbclient deltree to remove remote files
via 257ce5ed541 s3/script/tests: Make smb_client 'die' behaviour configurable
via a0ab7adfd78 s3/script/tests: Remove make_path (for remote dir)
via c19198e8732 selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
via 53a91d6cdc0 s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
via 896d93091ab s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
via 5908aebf364 s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
via 5143b487532 s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
via 7fb13330380 selftest: Add a new tarmode shares
via d67c3ea864b s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
via e9b2be96ebc Revert "vfs_ceph: drop fdopendir handler"
from 441bf80265f smbclient: Fix recursive mget
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-13-test
- Log -----------------------------------------------------------------
commit 585c49f21f7db686f479ce02b2ae647a313f1184
Author: G?nther Deschner
Date: Tue Nov 24 15:38:41 2020 +0100
vfs_glusterfs: print exact cmdline for disabling write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Guenther
Signed-off-by: Guenther Deschner
Reviewed-by: Anoop C S
Autobuild-User(master): G?nther Deschner
Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184
(cherry picked from commit 369c1d539837b70e94fe9d533d44860c8a9380a1)
Autobuild-User(v4-13-test): Karolin Seeger
Autobuild-Date(v4-13-test): Wed Dec 2 14:49:18 UTC 2020 on sn-devel-184
commit 587fa331f62f6bd36fdb8688c8d0734d02f07ee8
Author: Anoop C S
Date: Thu Nov 5 16:12:09 2020 +0530
manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Signed-off-by: Anoop C S
Reviewed-by: Andrew Bartlett
Reviewed-by: Guenther Deschner
Autobuild-User(master): G??nther Deschner
Autobuild-Date(master): Mon Nov 9 13:30:06 UTC 2020 on sn-devel-184
(cherry picked from commit be03ce7d8bb213633eedcfc3299b8d9865a3c67f)
commit 2ea7b5c43e814faef44cf76b5ffad93e4a2f4840
Author: Noel Power
Date: Mon Nov 30 09:21:50 2020 +0000
selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 89e2d68bb4d93dc391af97f35ff1148aec7930b0)
commit 8cec27328904e47462051878db2de97033ecbd9b
Author: Volker Lendecke
Date: Tue Dec 1 08:58:14 2020 +0100
clitar: Use do_list()'s recursion in clitar.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Volker Lendecke
Reviewed-by: Aurelien Aptel
Reviewed-by: Noel Power
(cherry picked from commit 20e0ce508844fec2dd0011423b10484dc7ccfdb7)
commit 2954051aa6db3b38d24801fe451019ccec0b5c77
Author: Jeremy Allison
Date: Mon Nov 30 17:19:29 2020 +0000
s3/script/tests: Ensure all remote test files are removed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Jeremy Allison
Reviewed-by: Noel Power
(cherry picked from commit 16ffa17ee28edfc3bc70c66abf41b5518aeab8fe)
commit 5f1772d94a34922a4fc83ff8a036cbb3ce2dcdd5
Author: Noel Power
Date: Mon Nov 30 10:41:57 2020 +0000
s3/script/tests: call smbclient deltree to remove remote files
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 6c7dc4959fd5de4382aee413b4cc711cc6f281f4)
commit 257ce5ed541c0e46bbd565bd8a89d5905287897c
Author: Noel Power
Date: Mon Nov 30 10:18:32 2020 +0000
s3/script/tests: Make smb_client 'die' behaviour configurable
smb_client behaviour is to die if there is an error. This is
a little heavy handed and make it impossible for example to
use smb_client to run a command that might fail (where such
a failure isn't really an error) E.G. Calling deltree and
the directory doesn't exist
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 363bfa4e1ca10e64057a6d04d6faff7c788db89d)
commit a0ab7adfd788bc8cc58579b94c75386d492c2e02
Author: Noel Power
Date: Mon Nov 30 09:59:58 2020 +0000
s3/script/tests: Remove make_path (for remote dir)
LOCALPATH is actually the local path to the share, we should
not need to create the share path (it should already exist)
Note: When we remove the tree located at LOCALPATH we keep the root
so the share path should always be there
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 99ffa4a98287f125e45690e87b32616f4d4254e4)
commit c19198e873224c07a19dfae14d3871c577768344
Author: Noel Power
Date: Mon Nov 30 11:15:06 2020 +0000
selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
samba3.blackbox.smbclient_tar is marked as flapping so it
seems we have missed that it has stopped working. The local path
passed to script/tests/test_smbclient_tarmode.pl must point to a
valid share
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 6f246658cf003f7e2f393f7b7490d9e8ae84e21c)
commit 53a91d6cdc0e726d741ab217522da3f205392090
Author: Noel Power
Date: Mon Nov 30 17:39:25 2020 +0000
s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
Make sure samba3.blackbox.smbclient_tarmode removes data files
not just before running the test but also after
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 4bb3bffa4b7a770d36138c45f717a9048ef82cff)
commit 896d93091abe6b667c52e87273f22a91d9175eb0
Author: Noel Power
Date: Fri Nov 27 15:52:27 2020 +0000
s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
Replace rm -rf of local dir (that is hosted remotely)
with smbclient deltree
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit fec1f8faffd9eb1aae77e7c515e57897be34a255)
commit 5908aebf364802e7315aad8f116ad431544ac29d
Author: Noel Power
Date: Fri Nov 27 15:33:26 2020 +0000
s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
After this change both samba3.blackbox.smbclient_tar &
samba3.blackbox.smbclient_tarmode now use the same dedicated share
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit be8dca68f89f110ef5947e0c2a7258554772cf9a)
commit 5143b4875328196ed2766ba077055ce50704b5e2
Author: Noel Power
Date: Fri Nov 27 15:25:21 2020 +0000
s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
The other tarmode torture test samba3.blackbox.smbclient_tar now uses a share
'tarmode' which uses the same source path as samba3.blackbox.smbclient_tarmode
Avoid conflicting paths and use a new subdir (of the test share) called
'smbclient_tarmode'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 6cb0a00f4ab4bc1a8193d50cc076ec7174a5ece9)
commit 7fb1333038085529334e8e3109e5eda6b5df14ae
Author: Noel Power
Date: Thu Nov 26 17:31:50 2020 +0000
selftest: Add a new tarmode shares
samba3.blackbox.smbclient_tar & samba3.blackbox.smbclient_tar
need separate shares with own xattr tdb(s)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit a250f73366983d2a7397608a611f295f10dbb548)
commit d67c3ea864b26e440f15162e429dec199e7304e8
Author: Noel Power
Date: Fri Nov 27 12:01:49 2020 +0000
s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
'keep_root' is an unrecognised option for make_path/mkpath
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
Signed-off-by: Noel Power
Reviewed-by: Jeremy Allison
(cherry picked from commit 4f5a7f11b7732c3efb511e68f6b9d434d59bb3e8)
commit e9b2be96ebcc2dc8da8174f3333a744eff06f716
Author: David Disseldorp
Date: Mon Oct 5 12:28:27 2020 +0200
Revert "vfs_ceph: drop fdopendir handler"
This reverts commit 76d7d05b1da6c0703b1c2bade0c4467c7cc1adec.
OpenDir_fsp() no longer falls back to regular open, so this hook is
required.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14519
Signed-off-by: David Disseldorp
Reviewed-by: Samuel Cabrero
Autobuild-User(master): David Disseldorp
Autobuild-Date(master): Mon Oct 5 12:38:34 UTC 2020 on sn-devel-184
(cherry picked from commit 83ab59d929a6319c18341cb69d5084b563fb59bb)
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/vfs_glusterfs.8.xml | 9 ++++
selftest/flapping | 1 -
selftest/target/Samba3.pm | 11 +++++
source3/client/clitar.c | 41 ++++-------------
source3/modules/vfs_ceph.c | 15 +++++--
source3/modules/vfs_glusterfs.c | 7 ++-
source3/script/tests/test_smbclient_tarmode.pl | 62 ++++++++++++++++++++++----
source3/script/tests/test_smbclient_tarmode.sh | 29 ++++++++----
source3/selftest/tests.py | 12 ++---
9 files changed, 124 insertions(+), 63 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 7a4da1af919..d25135e14ac 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -179,7 +179,16 @@
translator and refuse to connect if detected.
Please disable the write-behind translator for the GlusterFS
volume to allow the plugin to connect to the volume.
+ The write-behind translator can easily be disabled via calling
+
+ gluster volume set <volumename> performance.write-behind off
+ on the commandline.
+
+ With GlusterFS versions >= 9, we silently bypass write-behind
+ translator during initial connect and failure is avoided.
+
+
diff --git a/selftest/flapping b/selftest/flapping
index c9f0adbf1bd..8c3f9e8969a 100644
--- a/selftest/flapping
+++ b/selftest/flapping
@@ -31,6 +31,5 @@
# This test just is not reliable in finding the max search limit
#
^samba4.ldap.notification.python\(.*\).__main__.LDAPNotificationTest.test_max_search
-^samba3.blackbox.smbclient_tar.* # fails very, very often on sn-devel
^samba3.blackbox.smbclient_s3.*.sending a message to the remote server # flakey on sn-devel-104 and sn-devel-144
^samba3.blackbox.smbclient_s3.*.creating a good symlink and deleting it by path # flakey on sn-devel-104 and sn-devel-144
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0a8cefa811d..e141f102ef1 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1334,6 +1334,9 @@ sub setup_fileserver
my $tarmode_sharedir="$share_dir/tarmode";
push(@dirs,$tarmode_sharedir);
+ my $tarmode2_sharedir="$share_dir/tarmode2";
+ push(@dirs,$tarmode2_sharedir);
+
my $smbcacls_sharedir="$share_dir/smbcacls";
push(@dirs,$smbcacls_sharedir);
@@ -1362,6 +1365,14 @@ sub setup_fileserver
get quota command = $prefix_abs/getset_quota.py
set quota command = $prefix_abs/getset_quota.py
+[tarmode]
+ path = $tarmode_sharedir
+ comment = tar test share
+ xattr_tdb:file = $prefix_abs/tarmode-xattr.tdb
+[tarmode2]
+ path = $tarmode2_sharedir
+ comment = tar test share
+ xattr_tdb:file = $prefix_abs/tarmode2-xattr.tdb
[spotlight]
path = $share_dir
spotlight = yes
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 3fe3622aba6..4fd1f3c47d9 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -711,7 +711,7 @@ static int tar_create(struct tar* t)
goto out_close;
}
DBG(5, ("tar_process do_list with mask: %s\n", mask));
- status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+ status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
if (!NT_STATUS_IS_OK(status)) {
DBG(0, ("do_list fail %s\n", nt_errstr(status)));
err = 1;
@@ -806,7 +806,7 @@ static int tar_create_from_list(struct tar *t)
DBG(5, ("cd '%s' before do_list\n", base));
client_set_cur_dir(base);
}
- status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+ status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
if (base != NULL) {
client_set_cur_dir(start_dir);
}
@@ -837,7 +837,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
char *remote_name;
char *old_dir = NULL;
char *new_dir = NULL;
- const char *initial_dir = client_get_cur_dir();
+ const char *initial_dir = dir;
bool skip = false;
bool isdir;
int rc;
@@ -846,7 +846,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
return NT_STATUS_NO_MEMORY;
}
- remote_name = talloc_asprintf(ctx, "%s%s", initial_dir, finfo->name);
+ remote_name = talloc_asprintf(ctx, "%s\\%s", initial_dir, finfo->name);
if (remote_name == NULL) {
status = NT_STATUS_NO_MEMORY;
goto out;
@@ -884,35 +884,10 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
goto out;
}
- if (isdir) {
- char *mask;
- mask = talloc_asprintf(ctx, "%s*", new_dir);
- if (mask == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
- mask = client_clean_name(ctx, mask);
- if (mask == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
-
- rc = tar_get_file(&tar_ctx, remote_name, finfo);
- if (rc != 0) {
- status = NT_STATUS_UNSUCCESSFUL;
- goto out;
- }
-
- client_set_cur_dir(new_dir);
- do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
- client_set_cur_dir(old_dir);
- tar_ctx.numdir++;
- } else {
- rc = tar_get_file(&tar_ctx, remote_name, finfo);
- if (rc != 0) {
- status = NT_STATUS_UNSUCCESSFUL;
- goto out;
- }
+ rc = tar_get_file(&tar_ctx, remote_name, finfo);
+ if (rc != 0) {
+ status = NT_STATUS_UNSUCCESSFUL;
+ goto out;
}
out:
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 0378d633782..a87d162e573 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -306,9 +306,18 @@ static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle,
const char *mask,
uint32_t attributes)
{
- /* OpenDir_fsp() falls back to regular open */
- errno = ENOSYS;
- return NULL;
+ int ret = 0;
+ struct ceph_dir_result *result;
+ DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp);
+
+ ret = ceph_opendir(handle->data, fsp->fsp_name->base_name, &result);
+ if (ret < 0) {
+ result = NULL;
+ errno = -ret; /* We return result which is NULL in this case */
+ }
+
+ DBG_DEBUG("[CEPH] fdopendir(...) = %d\n", ret);
+ return (DIR *) result;
}
static struct dirent *cephwrap_readdir(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 17e945f7e78..10af7e131b2 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -345,9 +345,12 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
if (write_behind_present) {
DBG_ERR("Write behind translator is enabled for "
"volume (%s), refusing to connect! "
- "Please check the vfs_glusterfs(8) manpage for "
+ "Please turn off the write behind translator by calling "
+ "'gluster volume set %s performance.write-behind off' "
+ "on the commandline. "
+ "Check the vfs_glusterfs(8) manpage for "
"further details.\n",
- volume);
+ volume, volume);
return -1;
}
diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl
index 877eec45cc8..bdbbd1a44a8 100755
--- a/source3/script/tests/test_smbclient_tarmode.pl
+++ b/source3/script/tests/test_smbclient_tarmode.pl
@@ -1,5 +1,4 @@
#!/usr/bin/perl
-
# Unix SMB/CIFS implementation.
# Test suite for the tar backup mode of smbclient.
# Copyright (C) Aur?lien Aptel 2013
@@ -304,6 +303,8 @@ sub test_creation_attr {
@inc = grep { $_->attr('a') && !$_->attr_any('h', 's') } @all;
smb_tar('tarmode inc nohidden nosystem', '-Tc', $TAR, $DIR);
$err += check_tar($TAR, \@inc);
+ # adjust attr so remote files can be deleted with deltree
+ File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
$err;
}
@@ -399,7 +400,10 @@ sub test_creation_incremental {
} else {
smb_tar('', '-Tcg', $TAR, $DIR);
}
- return check_tar($TAR, \@files);
+ my $res = check_tar($TAR, \@files);
+ # adjust attr so remote files can be deleted with deltree
+ File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
+ return $res
}
@@ -917,8 +921,22 @@ Remove all files in the server C<$DIR> (not root)
sub reset_remote {
# remove_tree($LOCALPATH . '/'. $DIR);
# make_path($LOCALPATH . '/'. $DIR);
- remove_tree($LOCALPATH, {keep_root => 1});
- make_path($LOCALPATH, {keep_root => 1});
+ my $DIR;
+ my @names;
+ my $name;
+
+ smb_client_cmd(0, '-c', "deltree ./*");
+
+ # Ensure all files are gone.
+
+ opendir(DIR,$LOCALPATH) or die "Can't open $LOCALPATH\n";
+ @names = readdir(DIR) or die "Unable to read $LOCALPATH\n";
+ closedir(DIR);
+ foreach $name (@names) {
+ next if ($name eq "."); # skip the current directory entry
+ next if ($name eq ".."); # skip the parent directory entry
+ die "$LOCALPATH not empty\n";
+ }
}
=head3 C
@@ -1120,7 +1138,9 @@ sub check_tar {
return (@more + @less + @diff); # nb of errors
}
-=head3 C
+=head3 C
+
+=head3 C
Run smbclient with C<@args> passed as argument and return output.
@@ -1131,11 +1151,12 @@ the command-line are already inserted.
The output contains both the C and C.
-Die if smbclient crashes or exits with an error code.
+if C<$will_die> then Die if smbclient crashes or exits with an error code.
+otherwise return output
=cut
-sub smb_client {
- my (@args) = @_;
+sub smb_client_cmd {
+ my ($will_die, @args) = @_;
my $fullpath = "//$HOST/$SHARE";
my $cmd = sprintf("%s %s %s",
@@ -1168,11 +1189,34 @@ sub smb_client {
}
if ($err) {
- die "ERROR: $errstr";
+ if ($will_die) {
+ die "ERROR: $errstr";
+ } else {
+ say "ERROR: $errstr";
+ }
}
return $out;
}
+=head3 C
+
+Run smbclient with C<@args> passed as argument and return output.
+
+Each element of C<@args> becomes one escaped argument of smbclient.
+
+Host, share, user, password and the additionnal arguments provided on
+the command-line are already inserted.
+
+The output contains both the C and C.
+
+Die if smbclient crashes or exits with an error code.
+
+=cut
+sub smb_client {
+ my (@args) = @_;
+ return smb_client_cmd(1, @args)
+}
+
sub smb_cmd {
return smb_client('-c', join(' ', @_));
}
diff --git a/source3/script/tests/test_smbclient_tarmode.sh b/source3/script/tests/test_smbclient_tarmode.sh
index 3779c38a5ca..8bc5b9947cf 100755
--- a/source3/script/tests/test_smbclient_tarmode.sh
+++ b/source3/script/tests/test_smbclient_tarmode.sh
@@ -94,7 +94,7 @@ test_tarmode_creation() {
# Clear temp data
rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
- rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
# Build the test data
if ! create_test_data "$LOCAL_PATH"; then
@@ -104,14 +104,15 @@ test_tarmode_creation() {
fi
# Create tarfile with smbclient
- if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
- $ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/tarmode"; then
+ if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+ $ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/smbclient_tar"; then
echo "Couldn't create tar file with tarmode -Tc"
false
return
fi
- # Extract data to verify
+ # Extract data to verify - this puts it into $PREFIX/smbclient_tar/
+ # but we must leave it there as it's used to verify in test_tarmode_extraction()
if ! tar -xf "$PREFIX/tarmode.tar" -C "$PREFIX"; then
echo "Couldn't extract data from created tarfile"
false
@@ -119,12 +120,16 @@ test_tarmode_creation() {
fi
# Verify data
- if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+ if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
echo "Data not equivalent"
false
return
fi
+ # Clear temp data
+ rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+ rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
true
return
@@ -136,7 +141,7 @@ test_tarmode_extraction() {
# Clear temp data
rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
- rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
# Build the test data
if ! create_test_data "$PREFIX/tarmode"; then
@@ -146,14 +151,14 @@ test_tarmode_extraction() {
fi
# Create tarfile to extract on client
- if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" tarmode; then
+ if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" smbclient_tar; then
echo "Couldn't create tar archive"
false
return
fi
# Extract tarfile with smbclient
- if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+ if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
$ADDARGS -c "tarmode full" -Tx "$PREFIX/tarmode.tar"; then
echo "Couldn't extact tar file with tarmode -Tx"
false
@@ -161,12 +166,18 @@ test_tarmode_extraction() {
fi
# Verify data
- if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+ if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
echo "Data not equivalent"
false
return
fi
+ # Clear temp data
+ rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+ rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+ $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
+ # Cleanup the verification data created by test_tarmode_creation().
+ rm -rf "$PREFIX"/smbclient_tar > /dev/null 2>&1
true
return
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index f9202f3f93a..27dc7587b17 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -476,23 +476,23 @@ for env in ["fileserver"]:
plantestsuite("samba3.blackbox.smbclient_tarmode.NT1", env + "_smb1_done",
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
'$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
- '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mNT1"])
+ '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mNT1"])
plantestsuite("samba3.blackbox.smbclient_tarmode.SMB3", env,
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
'$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
- '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mSMB3"])
+ '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mSMB3"])
# Test suite for new smbclient/tar with libarchive (GSoC 13)
plantestsuite("samba3.blackbox.smbclient_tar.NT1", env + "_smb1_done",
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
- '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
- '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+ '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+ '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
'-d', '$PREFIX', '-b', smbclient3,
'--subunit', '--', configuration, '-mNT1'])
plantestsuite("samba3.blackbox.smbclient_tar.SMB3", env,
[os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
- '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
- '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+ '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+ '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
'-d', '$PREFIX', '-b', smbclient3,
'--subunit', '--', configuration, '-mSMB3'])
--
Samba Shared Repository
From kseeger at samba.org Wed Dec 2 16:05:02 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Wed, 2 Dec 2020 16:05:02 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch v4-11-test updated
Message-ID: <20201202160502.E68DD140345@sn.samba.org>
The branch, v4-11-test has been updated
via f1b1dc12aba vfs_glusterfs: print exact cmdline for disabling write-behind translator
via eb525a3e070 manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
via d6fb44cba25 s3-vfs_glusterfs: always disable write-behind translator
from 49710332b59 s3: modules: gluster. Fix the error I made in preventing talloc leaks from a function.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-11-test
- Log -----------------------------------------------------------------
commit f1b1dc12abaecbdef68f752d9a424180b0e6890d
Author: G?nther Deschner
Date: Tue Nov 24 15:38:41 2020 +0100
vfs_glusterfs: print exact cmdline for disabling write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Guenther
Signed-off-by: Guenther Deschner
Reviewed-by: Anoop C S
Autobuild-User(master): G?nther Deschner
Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184
(cherry picked from commit 369c1d539837b70e94fe9d533d44860c8a9380a1)
Autobuild-User(v4-11-test): Karolin Seeger
Autobuild-Date(v4-11-test): Wed Dec 2 16:04:24 UTC 2020 on sn-devel-184
commit eb525a3e0704595550a130ae865304a90f22b0f8
Author: Anoop C S
Date: Thu Nov 5 16:12:09 2020 +0530
manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Signed-off-by: Anoop C S
Reviewed-by: Andrew Bartlett
Reviewed-by: Guenther Deschner
Autobuild-User(master): G??nther Deschner
Autobuild-Date(master): Mon Nov 9 13:30:06 UTC 2020 on sn-devel-184
(cherry picked from commit be03ce7d8bb213633eedcfc3299b8d9865a3c67f)
commit d6fb44cba256ce98feea3dc968653ca22aa715bd
Author: G?nther Deschner
Date: Mon Nov 2 16:10:44 2020 +0100
s3-vfs_glusterfs: always disable write-behind translator
The "pass-through" option has now been merged upstream as of:
https://github.com/gluster/glusterfs/pull/1640
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Guenther
Signed-off-by: Guenther Deschner
Pair-Programmed-With: Anoop C S
Pair-Programmed-With: Sachin Prabhu
Reviewed-by: Jeremy Allison
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Wed Nov 4 22:53:49 UTC 2020 on sn-devel-184
(cherry picked from commit a51cda69ec6a017ad04b5690a3ae67a5478deee9)
Autobuild-User(v4-13-test): Karolin Seeger
Autobuild-Date(v4-13-test): Thu Nov 5 13:54:25 UTC 2020 on sn-devel-184
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/vfs_glusterfs.8.xml | 9 +++++++++
source3/modules/vfs_glusterfs.c | 27 ++++++++++++++++++++++-----
source3/wscript | 3 +++
3 files changed, 34 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 7a4da1af919..d25135e14ac 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -179,7 +179,16 @@
translator and refuse to connect if detected.
Please disable the write-behind translator for the GlusterFS
volume to allow the plugin to connect to the volume.
+ The write-behind translator can easily be disabled via calling
+
+ gluster volume set <volumename> performance.write-behind off
+ on the commandline.
+
+ With GlusterFS versions >= 9, we silently bypass write-behind
+ translator during initial connect and failure is avoided.
+
+
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 190235cf8ae..ce31b5eba14 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -345,9 +345,12 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
if (write_behind_present) {
DBG_ERR("Write behind translator is enabled for "
"volume (%s), refusing to connect! "
- "Please check the vfs_glusterfs(8) manpage for "
+ "Please turn off the write behind translator by calling "
+ "'gluster volume set %s performance.write-behind off' "
+ "on the commandline. "
+ "Check the vfs_glusterfs(8) manpage for "
"further details.\n",
- volume);
+ volume, volume);
return -1;
}
@@ -365,6 +368,7 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
glfs_t *fs = NULL;
TALLOC_CTX *tmp_ctx;
int ret = 0;
+ bool write_behind_pass_through_set = false;
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
@@ -424,6 +428,17 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
goto done;
}
+#ifdef HAVE_GFAPI_VER_7_9
+ ret = glfs_set_xlator_option(fs, "*-write-behind", "pass-through",
+ "true");
+ if (ret < 0) {
+ DBG_ERR("%s: Failed to set xlator option: pass-through\n",
+ volume);
+ goto done;
+ }
+ write_behind_pass_through_set = true;
+#endif
+
ret = glfs_set_logging(fs, logfile, loglevel);
if (ret < 0) {
DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n",
@@ -438,9 +453,11 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
goto done;
}
- ret = check_for_write_behind_translator(tmp_ctx, fs, volume);
- if (ret < 0) {
- goto done;
+ if (!write_behind_pass_through_set) {
+ ret = check_for_write_behind_translator(tmp_ctx, fs, volume);
+ if (ret < 0) {
+ goto done;
+ }
}
ret = glfs_set_preopened(volume, handle->conn->connectpath, fs);
diff --git a/source3/wscript b/source3/wscript
index 7b257bcb845..47f97c60321 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1591,6 +1591,9 @@ main() {
conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.6" --cflags --libs',
msg='Checking for glusterfs-api >= 7.6',
uselib_store="GFAPI_VER_7_6")
+ conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.9" --cflags --libs',
+ msg='Checking for glusterfs-api >= 7.9',
+ uselib_store="GFAPI_VER_7_9")
else:
conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
conf.undefine('HAVE_GLUSTERFS')
--
Samba Shared Repository
From kseeger at samba.org Wed Dec 2 17:36:02 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Wed, 2 Dec 2020 17:36:02 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch v4-12-test updated
Message-ID: <20201202173602.BCB01140299@sn.samba.org>
The branch, v4-12-test has been updated
via ecdddde3c53 vfs_glusterfs: print exact cmdline for disabling write-behind translator
via 9bcd19c42ae manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
from b3665f70109 vfs_shadow_copy2: Preserve all open flags assuming ROFS
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test
- Log -----------------------------------------------------------------
commit ecdddde3c5387ec3749d9758a7191b9ff9bc91d8
Author: G?nther Deschner
Date: Tue Nov 24 15:38:41 2020 +0100
vfs_glusterfs: print exact cmdline for disabling write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Guenther
Signed-off-by: Guenther Deschner
Reviewed-by: Anoop C S
Autobuild-User(master): G?nther Deschner
Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184
(cherry picked from commit 369c1d539837b70e94fe9d533d44860c8a9380a1)
Autobuild-User(v4-12-test): Karolin Seeger
Autobuild-Date(v4-12-test): Wed Dec 2 17:35:21 UTC 2020 on sn-devel-184
commit 9bcd19c42aee884f79f19128bbf0293ad0da1fb6
Author: Anoop C S
Date: Thu Nov 5 16:12:09 2020 +0530
manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
Signed-off-by: Anoop C S
Reviewed-by: Andrew Bartlett
Reviewed-by: Guenther Deschner
Autobuild-User(master): G??nther Deschner
Autobuild-Date(master): Mon Nov 9 13:30:06 UTC 2020 on sn-devel-184
(cherry picked from commit be03ce7d8bb213633eedcfc3299b8d9865a3c67f)
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/vfs_glusterfs.8.xml | 9 +++++++++
source3/modules/vfs_glusterfs.c | 7 +++++--
2 files changed, 14 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 7a4da1af919..d25135e14ac 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -179,7 +179,16 @@
translator and refuse to connect if detected.
Please disable the write-behind translator for the GlusterFS
volume to allow the plugin to connect to the volume.
+ The write-behind translator can easily be disabled via calling
+
+ gluster volume set <volumename> performance.write-behind off
+ on the commandline.
+
+ With GlusterFS versions >= 9, we silently bypass write-behind
+ translator during initial connect and failure is avoided.
+
+
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index c338674ac3c..ee73512e31b 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -345,9 +345,12 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
if (write_behind_present) {
DBG_ERR("Write behind translator is enabled for "
"volume (%s), refusing to connect! "
- "Please check the vfs_glusterfs(8) manpage for "
+ "Please turn off the write behind translator by calling "
+ "'gluster volume set %s performance.write-behind off' "
+ "on the commandline. "
+ "Check the vfs_glusterfs(8) manpage for "
"further details.\n",
- volume);
+ volume, volume);
return -1;
}
--
Samba Shared Repository
From kseeger at samba.org Thu Dec 3 07:33:32 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Thu, 3 Dec 2020 07:33:32 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch v4-11-test updated
Message-ID: <20201203073332.71B6814052B@sn.samba.org>
The branch, v4-11-test has been updated
via 523c71f7ac7 VERSION: Bump version up to 4.11.18...
via 99f4a3daa25 VERSION: Disable GIT_SNAPSHOT for the 4.11.17 release.
via 1c76f331a69 WHATSNEW: Add release notes for Samba 4.11.17.
from f1b1dc12aba vfs_glusterfs: print exact cmdline for disabling write-behind translator
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-11-test
- Log -----------------------------------------------------------------
commit 523c71f7ac7536bee39b1c397f12082b10d1dbc8
Author: Karolin Seeger
Date: Thu Dec 3 08:31:30 2020 +0100
VERSION: Bump version up to 4.11.18...
and re-enable GIT_SNAPSHOT.
Signed-off-by: Karolin Seeger
commit 99f4a3daa25848fcf0ffd146768d5885be913de6
Author: Karolin Seeger
Date: Thu Dec 3 08:30:31 2020 +0100
VERSION: Disable GIT_SNAPSHOT for the 4.11.17 release.
Signed-off-by: Karolin Seeger
commit 1c76f331a696ffe001b4d997b44f4d86ce48e105
Author: Karolin Seeger
Date: Thu Dec 3 08:20:13 2020 +0100
WHATSNEW: Add release notes for Samba 4.11.17.
Signed-off-by: Karolin Seeger
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index 1c9c15fd82e..35e06c1e36c 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=4
SAMBA_VERSION_MINOR=11
-SAMBA_VERSION_RELEASE=17
+SAMBA_VERSION_RELEASE=18
########################################################
# If a official release has a serious bug #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 914e3cc3bf9..b8b5c0009af 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,51 @@
+ ===============================
+ Release Notes for Samba 4.11.17
+ December 03, 2020
+ ===============================
+
+
+This is an extraordinary release of the Samba 4.11 release series to fix a
+regression introduced with Samba 4.11.16.
+
+
+Changes since 4.11.16
+---------------------
+
+o Jeremy Allison
+ * BUG 14486: s3: vfs_glusterfs: Fix the error in preventing talloc leaks from
+ a function.
+
+o G?nther Deschner
+ * BUG 14486: s3-vfs_glusterfs: Always disable write-behind translator.
+
+o Anoop C S
+ * BUG 14486: manpages/vfs_glusterfs: Mention silent skipping of write-behind
+ translator.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored. All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
===============================
Release Notes for Samba 4.11.16
November 04, 2020
@@ -67,8 +115,8 @@ database (https://bugzilla.samba.org/).
======================================================================
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
===============================
Release Notes for Samba 4.11.15
--
Samba Shared Repository
From kseeger at samba.org Thu Dec 3 07:36:47 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Thu, 3 Dec 2020 07:36:47 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - annotated tag samba-4.11.17 created
Message-ID: <20201203073648.1636514052B@sn.samba.org>
The annotated tag, samba-4.11.17 has been created
at 59dc3bd48aa0bcbdb2966ff82ac3a38ea04d18dc (tag)
tagging 99f4a3daa25848fcf0ffd146768d5885be913de6 (commit)
replaces samba-4.11.16
tagged by Karolin Seeger
on Thu Dec 3 08:36:23 2020 +0100
- Log -----------------------------------------------------------------
samba: tag release samba-4.11.17
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRS+8C4bZVLCEMyTNxvM5FbZWi36gUCX8iVdwAKCRBvM5FbZWi3
6tx7AJ0ZD8NCFKSICpoXRwZjzreAubU3cwCfW5Pi8/9fDxiRBjUuznIu+obE/Ww=
=ItRL
-----END PGP SIGNATURE-----
Anoop C S (1):
manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
G?nther Deschner (2):
s3-vfs_glusterfs: always disable write-behind translator
vfs_glusterfs: print exact cmdline for disabling write-behind translator
Jeremy Allison (1):
s3: modules: gluster. Fix the error I made in preventing talloc leaks from a function.
Karolin Seeger (3):
VERSION: Bump version up to 4.11.17...
WHATSNEW: Add release notes for Samba 4.11.17.
VERSION: Disable GIT_SNAPSHOT for the 4.11.17 release.
-----------------------------------------------------------------------
--
Samba Shared Repository
From kseeger at samba.org Thu Dec 3 07:38:47 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Thu, 3 Dec 2020 07:38:47 +0000 (UTC)
Subject: [SCM] Samba Website Repository - branch master updated
Message-ID: <20201203073848.8A15614052B@sn.samba.org>
The branch, master has been updated
via 388b55f Add Samba 4.11.17 to the list.
via 5a9a37b NEWS[4.11.17]: Samba 4.11.17 Available for Download
from 8039336 NEWS[4.11.16]: Samba 4.11.16 Available for Download
https://git.samba.org/?p=samba-web.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 388b55f2744f00735ea5a6ed436603731a563605
Author: Karolin Seeger
Date: Thu Dec 3 08:38:20 2020 +0100
Add Samba 4.11.17 to the list.
Signed-off-by: Karolin Seeger
commit 5a9a37bfaf5202cc7358985c25f54c9ae2705308
Author: Karolin Seeger
Date: Thu Dec 3 08:36:37 2020 +0100
NEWS[4.11.17]: Samba 4.11.17 Available for Download
Signed-off-by: Karolin Seeger
-----------------------------------------------------------------------
Summary of changes:
history/header_history.html | 1 +
history/samba-4.11.17.html | 47 +++++++++++++++++++++++
posted_news/20201203-073753.4.11.17.body.html | 13 +++++++
posted_news/20201203-073753.4.11.17.headline.html | 3 ++
4 files changed, 64 insertions(+)
create mode 100644 history/samba-4.11.17.html
create mode 100644 posted_news/20201203-073753.4.11.17.body.html
create mode 100644 posted_news/20201203-073753.4.11.17.headline.html
Changeset truncated at 500 lines:
diff --git a/history/header_history.html b/history/header_history.html
index 98f1054..b0db88e 100755
--- a/history/header_history.html
+++ b/history/header_history.html
@@ -23,6 +23,7 @@
samba-4.12.2
samba-4.12.1
samba-4.12.0
+ samba-4.11.17
samba-4.11.16
samba-4.11.15
samba-4.11.14
diff --git a/history/samba-4.11.17.html b/history/samba-4.11.17.html
new file mode 100644
index 0000000..4913e70
--- /dev/null
+++ b/history/samba-4.11.17.html
@@ -0,0 +1,47 @@
+
+
+
+Samba 4.11.17 - Release Notes
+
+
+Samba 4.11.17 Available for Download
+
+Samba 4.11.17 (gzipped)
+Signature
+
+
+Patch (gzipped) against Samba 4.11.16
+Signature
+
+
+
+ ===============================
+ Release Notes for Samba 4.11.17
+ December 03, 2020
+ ===============================
+
+
+This is an extraordinary release of the Samba 4.11 release series to fix a
+regression introduced with Samba 4.11.16.
+
+
+Changes since 4.11.16
+---------------------
+
+o Jeremy Allison <jra at samba.org>
+ * BUG 14486: s3: vfs_glusterfs: Fix the error in preventing talloc leaks from
+ a function.
+
+o Günther Deschner <gd at samba.org>
+ * BUG 14486: s3-vfs_glusterfs: Always disable write-behind translator.
+
+o Anoop C S <anoopcs at samba.org>
+ * BUG 14486: manpages/vfs_glusterfs: Mention silent skipping of write-behind
+ translator.
+
+
+
+
+
+
diff --git a/posted_news/20201203-073753.4.11.17.body.html b/posted_news/20201203-073753.4.11.17.body.html
new file mode 100644
index 0000000..a1fe110
--- /dev/null
+++ b/posted_news/20201203-073753.4.11.17.body.html
@@ -0,0 +1,13 @@
+
+
+Samba 4.11.17 Available for Download
+
+This is the latest stable release of the Samba 4.11 release series.
+
+
+The uncompressed tarball has been signed using GnuPG (ID 6F33915B6568B7EA).
+The source code can be downloaded now.
+A patch against Samba 4.11.16 is also available.
+See the release notes for more info.
+
+
diff --git a/posted_news/20201203-073753.4.11.17.headline.html b/posted_news/20201203-073753.4.11.17.headline.html
new file mode 100644
index 0000000..bc3ce28
--- /dev/null
+++ b/posted_news/20201203-073753.4.11.17.headline.html
@@ -0,0 +1,3 @@
+
+ 03 December 2020 Samba 4.11.17 Available for Download
+
--
Samba Website Repository
From kseeger at samba.org Thu Dec 3 07:39:04 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Thu, 3 Dec 2020 07:39:04 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch v4-11-stable updated
Message-ID: <20201203073905.0B27614052B@sn.samba.org>
The branch, v4-11-stable has been updated
via 99f4a3daa25 VERSION: Disable GIT_SNAPSHOT for the 4.11.17 release.
via 1c76f331a69 WHATSNEW: Add release notes for Samba 4.11.17.
via f1b1dc12aba vfs_glusterfs: print exact cmdline for disabling write-behind translator
via eb525a3e070 manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
via d6fb44cba25 s3-vfs_glusterfs: always disable write-behind translator
via 49710332b59 s3: modules: gluster. Fix the error I made in preventing talloc leaks from a function.
via 09da9690e93 VERSION: Bump version up to 4.11.17...
from 9c32d5a99c1 VERSION: Disable GIT_SNAPSHOT for the 4.11.16 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-11-stable
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 52 +++++++++++++++++++++++++++++++++--
docs-xml/manpages/vfs_glusterfs.8.xml | 9 ++++++
source3/modules/vfs_glusterfs.c | 47 ++++++++++++++++++++++---------
source3/wscript | 3 ++
5 files changed, 97 insertions(+), 16 deletions(-)
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index d9245529268..64eda0f3add 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=4
SAMBA_VERSION_MINOR=11
-SAMBA_VERSION_RELEASE=16
+SAMBA_VERSION_RELEASE=17
########################################################
# If a official release has a serious bug #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 914e3cc3bf9..b8b5c0009af 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,51 @@
+ ===============================
+ Release Notes for Samba 4.11.17
+ December 03, 2020
+ ===============================
+
+
+This is an extraordinary release of the Samba 4.11 release series to fix a
+regression introduced with Samba 4.11.16.
+
+
+Changes since 4.11.16
+---------------------
+
+o Jeremy Allison
+ * BUG 14486: s3: vfs_glusterfs: Fix the error in preventing talloc leaks from
+ a function.
+
+o G?nther Deschner
+ * BUG 14486: s3-vfs_glusterfs: Always disable write-behind translator.
+
+o Anoop C S
+ * BUG 14486: manpages/vfs_glusterfs: Mention silent skipping of write-behind
+ translator.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored. All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
===============================
Release Notes for Samba 4.11.16
November 04, 2020
@@ -67,8 +115,8 @@ database (https://bugzilla.samba.org/).
======================================================================
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
===============================
Release Notes for Samba 4.11.15
diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 7a4da1af919..d25135e14ac 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -179,7 +179,16 @@
translator and refuse to connect if detected.
Please disable the write-behind translator for the GlusterFS
volume to allow the plugin to connect to the volume.
+ The write-behind translator can easily be disabled via calling
+
+ gluster volume set <volumename> performance.write-behind off
+ on the commandline.
+
+ With GlusterFS versions >= 9, we silently bypass write-behind
+ translator during initial connect and failure is avoided.
+
+
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 747176ecebb..ce31b5eba14 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -315,15 +315,25 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
return -1;
}
+ /*
+ * file_lines_parse() plays horrible tricks with
+ * the passed-in talloc pointers and the hierarcy
+ * which makes freeing hard to get right.
+ *
+ * As we know mem_ctx is freed by the caller, after
+ * this point don't free on exit and let the caller
+ * handle it. This violates good Samba coding practice
+ * but we know we're not leaking here.
+ */
+
lines = file_lines_parse(buf,
newlen,
&numlines,
mem_ctx);
if (lines == NULL || numlines <= 0) {
- TALLOC_FREE(option);
- TALLOC_FREE(buf);
return -1;
}
+ /* On success, buf is now a talloc child of lines !! */
for (i=0; i < numlines; i++) {
if (strequal(lines[i], option)) {
@@ -335,18 +345,15 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
if (write_behind_present) {
DBG_ERR("Write behind translator is enabled for "
"volume (%s), refusing to connect! "
- "Please check the vfs_glusterfs(8) manpage for "
+ "Please turn off the write behind translator by calling "
+ "'gluster volume set %s performance.write-behind off' "
+ "on the commandline. "
+ "Check the vfs_glusterfs(8) manpage for "
"further details.\n",
- volume);
- TALLOC_FREE(lines);
- TALLOC_FREE(option);
- TALLOC_FREE(buf);
+ volume, volume);
return -1;
}
- TALLOC_FREE(lines);
- TALLOC_FREE(option);
- TALLOC_FREE(buf);
return 0;
}
@@ -361,6 +368,7 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
glfs_t *fs = NULL;
TALLOC_CTX *tmp_ctx;
int ret = 0;
+ bool write_behind_pass_through_set = false;
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
@@ -420,6 +428,17 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
goto done;
}
+#ifdef HAVE_GFAPI_VER_7_9
+ ret = glfs_set_xlator_option(fs, "*-write-behind", "pass-through",
+ "true");
+ if (ret < 0) {
+ DBG_ERR("%s: Failed to set xlator option: pass-through\n",
+ volume);
+ goto done;
+ }
+ write_behind_pass_through_set = true;
+#endif
+
ret = glfs_set_logging(fs, logfile, loglevel);
if (ret < 0) {
DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n",
@@ -434,9 +453,11 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
goto done;
}
- ret = check_for_write_behind_translator(tmp_ctx, fs, volume);
- if (ret < 0) {
- goto done;
+ if (!write_behind_pass_through_set) {
+ ret = check_for_write_behind_translator(tmp_ctx, fs, volume);
+ if (ret < 0) {
+ goto done;
+ }
}
ret = glfs_set_preopened(volume, handle->conn->connectpath, fs);
diff --git a/source3/wscript b/source3/wscript
index 7b257bcb845..47f97c60321 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1591,6 +1591,9 @@ main() {
conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.6" --cflags --libs',
msg='Checking for glusterfs-api >= 7.6',
uselib_store="GFAPI_VER_7_6")
+ conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.9" --cflags --libs',
+ msg='Checking for glusterfs-api >= 7.9',
+ uselib_store="GFAPI_VER_7_9")
else:
conf.SET_TARGET_TYPE('gfapi', 'EMPTY')
conf.undefine('HAVE_GLUSTERFS')
--
Samba Shared Repository
From asn at samba.org Thu Dec 3 13:20:42 2020
From: asn at samba.org (Andreas Schneider)
Date: Thu, 3 Dec 2020 13:20:42 +0000 (UTC)
Subject: [SCM] pam wrapper repository - branch master updated
Message-ID: <20201203132042.9C9CC1401E6@sn.samba.org>
The branch, master has been updated
via 7401af4 pam_wrapper.c: fall back to pragma init/fini for constructor/destructor if possible
via f7ba680 configure: check for pragma init/fini for constructors/destructors
from ab2d90c Bump version to 1.1.3
https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7401af4dbe1a8dc5849c3d7fc2a7890413ab394e
Author: Bj?rn Jacke
Date: Fri Oct 30 15:52:40 2020 +0100
pam_wrapper.c: fall back to pragma init/fini for constructor/destructor if possible
Signed-off-by: Bjoern Jacke
Reviewed-by: Andreas Schneider
commit f7ba680493ec6ae191a633799682eededdea1d83
Author: Bj?rn Jacke
Date: Fri Oct 30 15:51:38 2020 +0100
configure: check for pragma init/fini for constructors/destructors
Signed-off-by: Bjoern Jacke
Reviewed-by: Andreas Schneider
-----------------------------------------------------------------------
Summary of changes:
ConfigureChecks.cmake | 26 ++++++++++++++++++++++++++
config.h.cmake | 2 ++
src/pam_wrapper.c | 7 +++++++
3 files changed, 35 insertions(+)
Changeset truncated at 500 lines:
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 8dcf978..dcf5f31 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -140,6 +140,32 @@ int main(void) {
return 0;
}" HAVE_DESTRUCTOR_ATTRIBUTE)
+check_c_source_compiles("
+#pragma init (test_constructor)
+void test_constructor(void);
+
+void test_constructor(void)
+{
+ return;
+}
+
+int main(void) {
+ return 0;
+}" HAVE_PRAGMA_INIT)
+
+check_c_source_compiles("
+#pragma fini (test_destructor)
+void test_destructor(void);
+
+void test_destructor(void)
+{
+ return;
+}
+
+int main(void) {
+ return 0;
+}" HAVE_PRAGMA_FINI)
+
check_c_source_compiles("
void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
diff --git a/config.h.cmake b/config.h.cmake
index 01a54f3..80208aa 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -40,6 +40,8 @@
#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1
#cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
#cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
+#cmakedefine HAVE_PRAGMA_INIT 1
+#cmakedefine HAVE_PRAGMA_FINI 1
#cmakedefine HAVE_FUNCTION_ATTRIBUTE_FORMAT 1
/*************************** ENDIAN *****************************/
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index dd69c43..6801d7b 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -311,7 +311,14 @@ static struct pwrap pwrap;
*********************************************************/
bool pam_wrapper_enabled(void);
+#if ! defined(HAVE_CONSTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_INIT)
+/* xlC and other oldschool compilers support (only) this */
+#pragma init (pwrap_constructor)
+#endif
void pwrap_constructor(void) CONSTRUCTOR_ATTRIBUTE;
+#if ! defined(HAVE_DESTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_FINI)
+#pragma fini (pwrap_destructor)
+#endif
void pwrap_destructor(void) DESTRUCTOR_ATTRIBUTE;
/*********************************************************
--
pam wrapper repository
From jra at samba.org Fri Dec 4 20:55:07 2020
From: jra at samba.org (Jeremy Allison)
Date: Fri, 4 Dec 2020 20:55:07 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID: <20201204205507.E079F1402E9@sn.samba.org>
The branch, master has been updated
via 8a0a7359fab s3: smbd: Quiet log messages from usershares for an unknown share.
from 936f74daed0 vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8a0a7359faba642baf55a8f98ff78c0d0884d0f0
Author: Jeremy Allison
Date: Wed Dec 2 11:47:02 2020 -0800
s3: smbd: Quiet log messages from usershares for an unknown share.
No need to log missing shares/sharenames at debug level zero.
Keep the debug level zero for all other usershare problems.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14590
Signed-off-by: Jeremy Allison
Reviewed-by: Rowland penny
Reviewed-by: Andrew Bartlett
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Fri Dec 4 20:54:06 UTC 2020 on sn-devel-184
-----------------------------------------------------------------------
Summary of changes:
source3/param/loadparm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Changeset truncated at 500 lines:
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index fbeed6782ad..3de22b350f1 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3424,6 +3424,11 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
open and fstat. Ensure this isn't a symlink link. */
if (sys_lstat(fname, &lsbuf, false) != 0) {
+ if (errno == ENOENT) {
+ /* Unknown share requested. Just ignore. */
+ goto out;
+ }
+ /* Only log messages for meaningful problems. */
DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
fname, strerror(errno) ));
goto out;
@@ -3629,6 +3634,11 @@ int load_usershare_service(const char *servicename)
int max_user_shares = Globals.usershare_max_shares;
int snum_template = -1;
+ if (servicename[0] == '\0') {
+ /* Invalid service name. */
+ return -1;
+ }
+
if (*usersharepath == 0 || max_user_shares == 0) {
return -1;
}
--
Samba Shared Repository
From jra at samba.org Fri Dec 4 22:33:05 2020
From: jra at samba.org (Jeremy Allison)
Date: Fri, 4 Dec 2020 22:33:05 +0000 (UTC)
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID: <20201204223305.980F41402E9@sn.samba.org>
The branch, master has been updated
via bbd94522b1e smbd: Remove "have_share_modes" from "struct share_mode_data"
via 1ba4672ee90 smbd: Simplify share_mode_entry_do()
via 7677c40fa55 smbd: Remove a comment that was not helpful for me
via 05f9e8f9997 smbd: Simplify share_mode_lock_destructor()
via 0f40c4ab637 smbd: Remove unused share_mode_have_entries()
via b712bd8173f smbd: Simplify open_mode_check()
via 2c7e8e3fc5c smbd: Simplify share_mode_memcache_fetch()
via a8d2654d52b build: Fix kernel oplock test
via 7d04b5a705f smbd: Align integer types
via 18146c6285f spoolssd: Align integer types
via 3bf9973d21f clitar: Align integer types
via 441fdc1280b lib: Align integer types
from 8a0a7359fab s3: smbd: Quiet log messages from usershares for an unknown share.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit bbd94522b1e626ed1a4e87c297cfebe982fdbbce
Author: Volker Lendecke
Date: Thu Dec 3 17:16:25 2020 +0100
smbd: Remove "have_share_modes" from "struct share_mode_data"
Nobody in share_mode_lock.c looked at that value anymore, so we don't
need to manually maintain it.
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Fri Dec 4 22:32:38 UTC 2020 on sn-devel-184
commit 1ba4672ee909251d41d2edb9af957549a72a1a36
Author: Volker Lendecke
Date: Thu Dec 3 17:12:20 2020 +0100
smbd: Simplify share_mode_entry_do()
Rely on the truth in locking.tdb wrt existence of share entries
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 7677c40fa5587e0ac29427639011ae4e7c562d04
Author: Volker Lendecke
Date: Thu Dec 3 17:03:32 2020 +0100
smbd: Remove a comment that was not helpful for me
Also avoid an "else" branch
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 05f9e8f9997a4e72be69ca085db0c6efbffade78
Author: Volker Lendecke
Date: Thu Dec 3 17:02:10 2020 +0100
smbd: Simplify share_mode_lock_destructor()
Rely on the truth in the database whether we found share modes or
not, share_mode_data_store() has that information for free.
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 0f40c4ab637cb0f74f0dbdf93611fe55b69c7f35
Author: Volker Lendecke
Date: Thu Dec 3 16:23:58 2020 +0100
smbd: Remove unused share_mode_have_entries()
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit b712bd8173f860be25652420ac94db265003fd62
Author: Volker Lendecke
Date: Thu Dec 3 16:18:25 2020 +0100
smbd: Simplify open_mode_check()
The call to share_mode_have_entries() was put in before
fresh_share_mode_lock() initialized d->flags to be completely
permissive. With that correct initialization the call to
share_conflict() a few lines down will also make open_mode_check()
pass for any share_access/access_mask.
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 2c7e8e3fc5c04326bae7bd4de69c6a41e5c2bf43
Author: Volker Lendecke
Date: Tue Dec 1 13:50:32 2020 +0100
smbd: Simplify share_mode_memcache_fetch()
Take a struct file_id instead of a locking.tdb key,
share_mode_memcache_store() also operates on the implicit fid in
struct share_mode_data.
To do this, parse_share_modes() also needs to take file_id.
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit a8d2654d52bd8539eb73cafe9da5666aad7c7d50
Author: Volker Lendecke
Date: Fri Nov 20 14:19:21 2020 +0100
build: Fix kernel oplock test
In a pure docker environment with overlayfs F_GETLEASE works on /tmp,
but F_SETLEASE does not. This test now correctly detects that.
The effect is that the samba-fileserver environment would run fine in
a shared gitlab runner, at the price of not testing kernel oplocks. We
could move the kernel oplock tests to another environment that for
other reasons can't run on shared gitlab runners.
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 7d04b5a705f0e97ae568a40b1d5fb13483e9afab
Author: Volker Lendecke
Date: Tue Dec 1 13:27:11 2020 +0100
smbd: Align integer types
full_path_tos() return ssize_t
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 18146c6285fa5a7f7e17dbe8b5481679ce8b8e2b
Author: Volker Lendecke
Date: Thu Dec 3 16:23:39 2020 +0100
spoolssd: Align integer types
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 3bf9973d21ffb261bbf8cbf257935c6c66855fe6
Author: Volker Lendecke
Date: Wed Dec 2 11:13:11 2020 +0100
clitar: Align integer types
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
commit 441fdc1280bc2158a3bc7cf9c9896cf93b7c8be3
Author: Volker Lendecke
Date: Mon Nov 30 13:39:15 2020 +0100
lib: Align integer types
Signed-off-by: Volker Lendecke
Reviewed-by: Jeremy Allison
-----------------------------------------------------------------------
Summary of changes:
source3/client/clitar.c | 2 +-
source3/lib/tldap.c | 3 +-
source3/librpc/idl/open_files.idl | 1 -
source3/locking/share_mode_lock.c | 86 +++++++++++++++------------------------
source3/locking/share_mode_lock.h | 1 -
source3/printing/spoolssd.c | 2 +-
source3/smbd/dir.c | 4 +-
source3/smbd/open.c | 11 +----
source3/wscript | 8 +++-
9 files changed, 45 insertions(+), 73 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 4fd1f3c47d9..7348420db5e 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -272,7 +272,6 @@ int cmd_tarmode(void)
{
const extern char *cmd_ptr;
char *buf;
- int i;
TALLOC_CTX *ctx;
struct {
@@ -298,6 +297,7 @@ int cmd_tarmode(void)
}
while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
+ size_t i;
for (i = 0; i < ARRAY_SIZE(table); i++) {
if (strequal(table[i].cmd, buf)) {
*table[i].p = table[i].value;
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 0e39a307728..e008b04e5e6 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -666,7 +666,8 @@ static void tldap_msg_received(struct tevent_req *subreq)
uint8_t *inbuf;
ssize_t received;
size_t num_pending;
- int i, err;
+ size_t i;
+ int err;
TLDAPRC status = TLDAP_PROTOCOL_ERROR;
int id;
uint8_t type;
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 891ff1f763d..49bc09d77b6 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -64,7 +64,6 @@ interface open_files
NTTIME changed_write_time;
[skip] boolean8 fresh;
[skip] boolean8 modified;
- [skip] boolean8 have_share_modes;
[ignore] file_id id; /* In memory key used to lookup cache. */
} share_mode_data;
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index c9012f7454b..8ad9341a765 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -274,26 +274,17 @@ static int share_mode_data_nofree_destructor(struct share_mode_data *d)
static struct share_mode_data *share_mode_memcache_fetch(
TALLOC_CTX *mem_ctx,
- const TDB_DATA id_key,
+ struct file_id id,
const uint8_t *buf,
size_t buflen)
{
+ const DATA_BLOB key = memcache_key(&id);
enum ndr_err_code ndr_err;
struct share_mode_data *d;
uint64_t unique_content_epoch;
uint16_t flags;
void *ptr;
- struct file_id id;
struct file_id_buf idbuf;
- DATA_BLOB key;
-
- /* Ensure this is a locking_key record. */
- if (id_key.dsize != sizeof(id)) {
- return NULL;
- }
-
- memcpy(&id, id_key.dptr, id_key.dsize);
- key = memcache_key(&id);
ptr = memcache_lookup_talloc(NULL,
SHARE_MODE_LOCK_CACHE,
@@ -592,7 +583,7 @@ static NTSTATUS locking_tdb_data_store(
static struct share_mode_data *parse_share_modes(
TALLOC_CTX *mem_ctx,
- const TDB_DATA key,
+ struct file_id id,
const uint8_t *buf,
size_t buflen)
{
@@ -601,7 +592,7 @@ static struct share_mode_data *parse_share_modes(
DATA_BLOB blob;
/* See if we already have a cached copy of this key. */
- d = share_mode_memcache_fetch(mem_ctx, key, buf, buflen);
+ d = share_mode_memcache_fetch(mem_ctx, id, buf, buflen);
if (d != NULL) {
return d;
}
@@ -629,14 +620,6 @@ static struct share_mode_data *parse_share_modes(
NDR_PRINT_DEBUG(share_mode_data, d);
}
- /*
- * We have a non-zero locking.tdb record that was correctly
- * parsed. This means a share_entries.tdb entry exists,
- * otherwise we'd have paniced before in
- * share_mode_data_store()
- */
- d->have_share_modes = true;
-
return d;
fail:
TALLOC_FREE(d);
@@ -647,7 +630,8 @@ fail:
If modified, store the share_mode_data back into the database.
********************************************************************/
-static NTSTATUS share_mode_data_store(struct share_mode_data *d)
+static NTSTATUS share_mode_data_store(
+ struct share_mode_data *d, bool *have_share_entries)
{
TDB_DATA key = locking_key(&d->id);
struct locking_tdb_data *ltdb = NULL;
@@ -685,6 +669,8 @@ static NTSTATUS share_mode_data_store(struct share_mode_data *d)
TALLOC_FREE(ltdb);
return ndr_map_error2ntstatus(ndr_err);
}
+
+ *have_share_entries = true;
}
ltdb->share_mode_data_buf = blob.data;
@@ -786,7 +772,6 @@ static void get_static_share_mode_data_fn(
void *private_data)
{
struct get_static_share_mode_data_state *state = private_data;
- TDB_DATA key = locking_key(&state->id);
struct share_mode_data *d = NULL;
struct locking_tdb_data ltdb = { 0 };
@@ -818,7 +803,7 @@ static void get_static_share_mode_data_fn(
} else {
d = parse_share_modes(
lock_ctx,
- key,
+ state->id,
ltdb.share_mode_data_buf,
ltdb.share_mode_data_len);
if (d == NULL) {
@@ -957,6 +942,7 @@ fail:
static int share_mode_lock_destructor(struct share_mode_lock *lck)
{
+ bool have_share_entries = false;
NTSTATUS status;
SMB_ASSERT(static_share_mode_data_refcount > 0);
@@ -966,7 +952,8 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck)
return 0;
}
- status = share_mode_data_store(static_share_mode_data);
+ status = share_mode_data_store(
+ static_share_mode_data, &have_share_entries);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("share_mode_data_store failed: %s\n",
nt_errstr(status));
@@ -985,7 +972,7 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck)
}
}
- if (static_share_mode_data->have_share_modes) {
+ if (have_share_entries) {
/*
* This is worth keeping. Without share modes,
* share_mode_data_store above has left nothing in the
@@ -993,17 +980,9 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck)
*/
share_mode_memcache_store(static_share_mode_data);
static_share_mode_data = NULL;
- } else {
- /*
- * The next opener of this file will find an empty
- * locking.tdb record. Don't store the share_mode_data
- * in the memcache, fresh_share_mode_lock() will
- * generate a fresh seqnum anyway, obsoleting the
- * cache entry.
- */
- TALLOC_FREE(static_share_mode_data);
}
+ TALLOC_FREE(static_share_mode_data);
return 0;
}
@@ -1117,11 +1096,6 @@ NTSTATUS share_mode_wakeup_waiters(struct file_id id)
return share_mode_do_locked(id, share_mode_wakeup_waiters_fn, NULL);
}
-bool share_mode_have_entries(struct share_mode_lock *lck)
-{
- return lck->data->have_share_modes;
-}
-
NTTIME share_mode_changed_write_time(struct share_mode_lock *lck)
{
return lck->data->changed_write_time;
@@ -1324,7 +1298,7 @@ NTSTATUS share_mode_watch_recv(
struct fetch_share_mode_unlocked_state {
TALLOC_CTX *mem_ctx;
- TDB_DATA key;
+ struct file_id id;
struct share_mode_lock *lck;
};
@@ -1360,7 +1334,7 @@ static void fetch_share_mode_unlocked_parser(
state->lck->data = parse_share_modes(
state->lck,
- state->key,
+ state->id,
ltdb.share_mode_data_buf,
ltdb.share_mode_data_len);
if (state->lck->data == NULL) {
@@ -1379,12 +1353,13 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
{
struct fetch_share_mode_unlocked_state state = {
.mem_ctx = mem_ctx,
- .key = locking_key(&id),
+ .id = id,
};
+ TDB_DATA key = locking_key(&id);
NTSTATUS status;
status = g_lock_dump(
- lock_ctx, state.key, fetch_share_mode_unlocked_parser, &state);
+ lock_ctx, key, fetch_share_mode_unlocked_parser, &state);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("g_lock_dump failed: %s\n", nt_errstr(status));
return NULL;
@@ -1497,7 +1472,7 @@ static void fetch_share_mode_fn(
state->lck->data = parse_share_modes(
state->lck,
- locking_key(&state->id),
+ state->id,
ltdb.share_mode_data_buf,
ltdb.share_mode_data_len);
if (state->lck->data == NULL) {
@@ -1593,7 +1568,7 @@ static void share_mode_forall_dump_fn(
d = parse_share_modes(
talloc_tos(),
- state->key,
+ fid,
ltdb.share_mode_data_buf,
ltdb.share_mode_data_len);
if (d == NULL) {
@@ -1892,7 +1867,6 @@ bool set_share_mode(struct share_mode_lock *lck,
/*
* Storing a fresh record with just one share entry
*/
- d->have_share_modes = true;
d->modified = true;
}
@@ -2086,9 +2060,9 @@ bool share_mode_forall_entries(
if ((ltdb->num_share_entries != 0 ) && (num_share_entries == 0)) {
/*
- * This routine wiped all share entries
+ * This routine wiped all share entries, let
+ * share_mode_data_store() delete the record
*/
- d->have_share_modes = false;
d->modified = true;
}
@@ -2177,7 +2151,7 @@ static bool share_mode_entry_do(
bool modified;
struct share_mode_entry e;
uint8_t *e_ptr = NULL;
- bool have_share_modes;
+ bool had_share_entries, have_share_entries;
NTSTATUS status;
bool ret = false;
@@ -2189,6 +2163,8 @@ static bool share_mode_entry_do(
}
DBG_DEBUG("num_share_modes=%zu\n", ltdb->num_share_entries);
+ had_share_entries = (ltdb->num_share_entries != 0);
+
idx = share_mode_entry_find(
ltdb->share_entries,
ltdb->num_share_entries,
@@ -2265,9 +2241,12 @@ static bool share_mode_entry_do(
goto done;
}
- have_share_modes = (ltdb->num_share_entries != 0);
- if (d->have_share_modes != have_share_modes) {
- d->have_share_modes = have_share_modes;
+ have_share_entries = (ltdb->num_share_entries != 0);
+ if (had_share_entries != have_share_entries) {
+ /*
+ * Make share_mode_data_store do the right thing wrt
+ * possibly deleting the locking.tdb record
+ */
d->modified = true;
}
@@ -2533,7 +2512,6 @@ bool reset_share_mode_entry(
goto done;
}
- d->have_share_modes = true;
d->modified = true;
ret = true;
done:
diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h
index 09a354c0d01..f2fe3d51a16 100644
--- a/source3/locking/share_mode_lock.h
+++ b/source3/locking/share_mode_lock.h
@@ -94,7 +94,6 @@ bool share_mode_forall_entries(
bool *modified,
void *private_data),
void *private_data);
-bool share_mode_have_entries(struct share_mode_lock *lck);
NTTIME share_mode_changed_write_time(struct share_mode_lock *lck);
const char *share_mode_servicepath(struct share_mode_lock *lck);
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index babec72e299..cd1f4b2188a 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -586,7 +586,7 @@ static NTSTATUS spoolssd_create_sockets(struct tevent_context *ev_ctx,
int fd = -1;
int rc;
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
- uint32_t i;
+ int i;
struct dcesrv_endpoint *e = NULL;
DBG_INFO("Initializing DCE/RPC connection endpoints\n");
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 5602fa9ea15..73eb2d17166 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1640,7 +1640,7 @@ bool SearchDir(struct smb_Dir *dir_hnd, const char *name, long *poffset)
struct files_below_forall_state {
char *dirpath;
- size_t dirpath_len;
+ ssize_t dirpath_len;
int (*fn)(struct file_id fid, const struct share_mode_data *data,
void *private_data);
void *private_data;
@@ -1653,7 +1653,7 @@ static int files_below_forall_fn(struct file_id fid,
struct files_below_forall_state *state = private_data;
char tmpbuf[PATH_MAX];
char *fullpath, *to_free;
- size_t len;
+ ssize_t len;
len = full_path_tos(data->servicepath, data->base_name,
tmpbuf, sizeof(tmpbuf),
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 3f5bc89cefe..bf612970458 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1761,7 +1761,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
uint32_t share_access)
{
struct open_mode_check_state state;
- bool ok, conflict, have_share_entries;
+ bool ok, conflict;
bool modified = false;
if (is_oplock_stat_open(access_mask)) {
@@ -1787,15 +1787,6 @@ static NTSTATUS open_mode_check(connection_struct *conn,
}
#endif
- have_share_entries = share_mode_have_entries(lck);
- if (!have_share_entries) {
- /*
- * This is a fresh share mode lock where no conflicts
- * can happen.
- */
- return NT_STATUS_OK;
- }
-
share_mode_flags_get(
lck, &state.access_mask, &state.share_access, NULL);
diff --git a/source3/wscript b/source3/wscript
index 011594b3844..a370fae667f 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -184,8 +184,12 @@ main() {
#ifndef F_GETLEASE
#define F_GETLEASE 1025
#endif
-main() {
- exit(fcntl(open("/tmp", O_RDONLY), F_GETLEASE, 0) == -1 ? 1 : 0);
+int main() {
+ const char *fname="/tmp/oplock-test.txt";
+ int fd = open(fname, O_RDWR|O_CREAT, 0644);
+ int ret = fcntl(fd, F_SETLEASE, F_WRLCK);
+ unlink(fname);
+ return (ret == -1) ? 1 : 0;
}''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
msg="Checking for Linux kernel oplocks")
--
Samba Shared Repository
From metze at samba.org Sat Dec 5 22:36:02 2020
From: metze at samba.org (Stefan Metzmacher)
Date: Sat, 05 Dec 2020 22:36:02 +0000
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID:
The branch, master has been updated
via ed21259358e WHATSNEW.txt: fix version to 4.14
from bbd94522b1e smbd: Remove "have_share_modes" from "struct share_mode_data"
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ed21259358e43594b655debb30dfc0e70aa9ed40
Author: Stefan Metzmacher
Date: Sat Dec 5 22:19:07 2020 +0100
WHATSNEW.txt: fix version to 4.14
Signed-off-by: Stefan Metzmacher
Autobuild-User(master): Stefan Metzmacher
Autobuild-Date(master): Sat Dec 5 22:35:04 UTC 2020 on sn-devel-184
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 7651b0af564..9cfd2840b17 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -6,7 +6,7 @@ intended for production environments and is designed for testing
purposes only. Please report any defects via the Samba bug reporting
system at https://bugzilla.samba.org/.
-Samba 4.13 will be the next version of the Samba suite.
+Samba 4.14 will be the next version of the Samba suite.
UPGRADING
--
Samba Shared Repository
From jra at samba.org Mon Dec 7 18:55:01 2020
From: jra at samba.org (Jeremy Allison)
Date: Mon, 07 Dec 2020 18:55:01 +0000
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID:
The branch, master has been updated
via 058f96f4c4e s4/samba: call force_check_log_size() in standard_new_task()
via 6fa5fb8ef26 s4/samba: call force_check_log_size() in standard_accept_connection()
via 82b64e930b0 s4/samba: call force_check_log_size() in prefork_reload_after_fork()
via 19413e76a46 s4: call reopen_logs_internal() in the SIGHUP handler of the prefork process model
via 9f71e6173ab s4: replace low-level SIGUP handler with a tevent handler
via 516c2a04a24 s4: install tevent tracing hooks to trigger logfile rotation
via 68f71f227b1 s4: add samba server tevent trace helper stuff
via 3651a51e93b debug: detect logrotation by checking inode number
via b7ee3614645 debug: pass struct debug_class *config to do_one_check_log_size()
via 29cd139a32d debug: pass struct debug_class *config to reopen_one_log()
via ab2c712c016 loadparm: setup debug subsystem setting max_log_size from config
from ed21259358e WHATSNEW.txt: fix version to 4.14
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 058f96f4c4eda42b404f0067521d3eafb495fe7d
Author: Ralph Boehme
Date: Thu Nov 26 15:24:44 2020 +0100
s4/samba: call force_check_log_size() in standard_new_task()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
RN: samba process does not honor max log size
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Mon Dec 7 18:54:29 UTC 2020 on sn-devel-184
commit 6fa5fb8ef26dab862df5c46bb5e74f19839c30e2
Author: Ralph Boehme
Date: Thu Nov 26 15:24:26 2020 +0100
s4/samba: call force_check_log_size() in standard_accept_connection()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 82b64e930b0e2d3b2e5186017d9f8e420994136c
Author: Ralph Boehme
Date: Thu Nov 26 15:23:58 2020 +0100
s4/samba: call force_check_log_size() in prefork_reload_after_fork()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
commit 19413e76a46f07fdd46fde5e60707bb6845a782d
Author: Ralph Boehme
Date: Mon Nov 23 16:44:04 2020 +0100
s4: call reopen_logs_internal() in the SIGHUP handler of the prefork process model
With debug_schedule_reopen_logs() the actual reopen only takes place at some
point in the future when a DEBUG message is processed.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 9f71e6173ab43a04804ba8061cb0e8ae6c0165bf
Author: Ralph Boehme
Date: Fri Nov 20 15:21:03 2020 +0100
s4: replace low-level SIGUP handler with a tevent handler
Replace the low-level signal handler for SIGHUP with a nice tevent signal
handler. The low-level handler sig_hup() installed by setup_signals() remains
being used during early startup before a tevent context is available.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 516c2a04a242a539f9fbddb2822295fee233644c
Author: Ralph Boehme
Date: Thu Nov 26 14:21:58 2020 +0100
s4: install tevent tracing hooks to trigger logfile rotation
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 68f71f227b17774a12c84575c1eecd82279fac95
Author: Ralph Boehme
Date: Mon Nov 23 17:53:57 2020 +0100
s4: add samba server tevent trace helper stuff
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 3651a51e93b45104323d5db1d5ea704d4f71acf1
Author: Ralph Boehme
Date: Mon Nov 23 16:04:03 2020 +0100
debug: detect logrotation by checking inode number
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit b7ee36146458bcc2c944f5670b7632df8281ae61
Author: Ralph Boehme
Date: Mon Nov 23 15:51:09 2020 +0100
debug: pass struct debug_class *config to do_one_check_log_size()
Pass a pointer to the struct instead of all struct members individually. No
change in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit 29cd139a32d5dbf36bef68eb9c7f1160201e3042
Author: Ralph Boehme
Date: Mon Nov 23 15:46:47 2020 +0100
debug: pass struct debug_class *config to reopen_one_log()
Pass a pointer to the struct instead of all struct members individually. No
change in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
commit ab2c712c016f4e4dacd5064b9eb8f6417f4b9b60
Author: Ralph Boehme
Date: Fri Nov 13 12:34:50 2020 +0100
loadparm: setup debug subsystem setting max_log_size from config
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison
-----------------------------------------------------------------------
Summary of changes:
lib/param/loadparm.c | 1 +
lib/util/debug.c | 63 ++++++++++-----
source4/samba/process_prefork.c | 16 +++-
source4/samba/process_standard.c | 4 +
source4/samba/server.c | 46 +++++++++++
source4/samba/server_util.c | 94 ++++++++++++++++++++++
.../winbindd_ads.h => source4/samba/server_util.h | 18 ++---
source4/samba/wscript_build | 9 ++-
8 files changed, 219 insertions(+), 32 deletions(-)
create mode 100644 source4/samba/server_util.c
copy source3/winbindd/winbindd_ads.h => source4/samba/server_util.h (67%)
Changeset truncated at 500 lines:
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index eaf992f209b..3548c47d857 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3201,6 +3201,7 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx)
settings.debug_pid = lp_ctx->globals->debug_pid;
settings.debug_uid = lp_ctx->globals->debug_uid;
settings.debug_class = lp_ctx->globals->debug_class;
+ settings.max_log_size = lp_ctx->globals->max_log_size;
debug_set_settings(&settings, lp_ctx->globals->logging,
lp_ctx->globals->syslog,
lp_ctx->globals->syslog_only);
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 402345222e5..18e5b4f6c72 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -113,6 +113,8 @@ struct debug_class {
*/
char *logfile;
int fd;
+ /* inode number of the logfile to detect logfile rotation */
+ ino_t ino;
};
static const char *default_classname_table[] = {
@@ -1082,14 +1084,17 @@ static void debug_callback_log(const char *msg, int msg_level)
Fix from dgibson at linuxcare.com.
**************************************************************************/
-static bool reopen_one_log(int *fd, const char *logfile)
+static bool reopen_one_log(struct debug_class *config)
{
- int old_fd = *fd;
+ int old_fd = config->fd;
+ const char *logfile = config->logfile;
+ struct stat st;
int new_fd;
+ int ret;
if (logfile == NULL) {
debug_close_fd(old_fd);
- *fd = -1;
+ config->fd = -1;
return true;
}
@@ -1104,8 +1109,18 @@ static bool reopen_one_log(int *fd, const char *logfile)
debug_close_fd(old_fd);
smb_set_close_on_exec(new_fd);
- *fd = new_fd;
+ config->fd = new_fd;
+ ret = fstat(new_fd, &st);
+ if (ret != 0) {
+ log_overflow = true;
+ DBG_ERR("Unable to fstat() new log file '%s': %s\n",
+ logfile, strerror(errno));
+ log_overflow = false;
+ return false;
+ }
+
+ config->ino = st.st_ino;
return true;
}
@@ -1164,8 +1179,7 @@ bool reopen_logs_internal(void)
state.reopening_logs = true;
for (i = DBGC_ALL; i < debug_num_classes; i++) {
- ok = reopen_one_log(&dbgc_config[i].fd,
- dbgc_config[i].logfile);
+ ok = reopen_one_log(&dbgc_config[i]);
if (!ok) {
break;
}
@@ -1249,51 +1263,62 @@ bool need_to_check_log_size(void)
Check to see if the log has grown to be too big.
**************************************************************************/
-static void do_one_check_log_size(off_t maxlog, int *_fd, const char *logfile)
+static void do_one_check_log_size(off_t maxlog, struct debug_class *config)
{
- char name[strlen(logfile) + 5];
+ char name[strlen(config->logfile) + 5];
struct stat st;
- int fd = *_fd;
int ret;
+ bool reopen = false;
bool ok;
if (maxlog == 0) {
return;
}
- ret = fstat(fd, &st);
+ ret = stat(config->logfile, &st);
if (ret != 0) {
return;
}
- if (st.st_size < maxlog ) {
+ if (st.st_size >= maxlog ) {
+ reopen = true;
+ }
+
+ if (st.st_ino != config->ino) {
+ reopen = true;
+ }
+
+ if (!reopen) {
return;
}
/* reopen_logs_internal() modifies *_fd */
(void)reopen_logs_internal();
- fd = *_fd;
- if (fd <= 2) {
+ if (config->fd <= 2) {
return;
}
- ret = fstat(fd, &st);
+ ret = fstat(config->fd, &st);
if (ret != 0) {
+ config->ino = (ino_t)0;
return;
}
+
+ config->ino = st.st_ino;
+
if (st.st_size < maxlog) {
return;
}
- snprintf(name, sizeof(name), "%s.old", logfile);
+ snprintf(name, sizeof(name), "%s.old", config->logfile);
- (void)rename(logfile, name);
+ (void)rename(config->logfile, name);
ok = reopen_logs_internal();
if (ok) {
return;
}
/* We failed to reopen a log - continue using the old name. */
- (void)rename(name, logfile);
+ (void)rename(name, config->logfile);
}
static void do_check_log_size(off_t maxlog)
@@ -1307,9 +1332,7 @@ static void do_check_log_size(off_t maxlog)
if (dbgc_config[i].logfile == NULL) {
continue;
}
- do_one_check_log_size(maxlog,
- &dbgc_config[i].fd,
- dbgc_config[i].logfile);
+ do_one_check_log_size(maxlog, &dbgc_config[i]);
}
}
diff --git a/source4/samba/process_prefork.c b/source4/samba/process_prefork.c
index f3387d87e61..6a2e3a0acfe 100644
--- a/source4/samba/process_prefork.c
+++ b/source4/samba/process_prefork.c
@@ -45,6 +45,7 @@
#include "lib/util/tfork.h"
#include "lib/messaging/irpc.h"
#include "lib/util/util_process.h"
+#include "server_util.h"
#define min(a, b) (((a) < (b)) ? (a) : (b))
@@ -114,7 +115,7 @@ static void sighup_signal_handler(struct tevent_context *ev,
int signum, int count, void *siginfo,
void *private_data)
{
- debug_schedule_reopen_logs();
+ reopen_logs_internal();
}
static void sigterm_signal_handler(struct tevent_context *ev,
@@ -154,6 +155,7 @@ static void prefork_reload_after_fork(void)
if (!NT_STATUS_IS_OK(status)) {
smb_panic("Failed to re-initialise imessaging after fork");
}
+ force_check_log_size();
}
/*
@@ -244,6 +246,7 @@ static void prefork_fork_master(
struct tevent_context *ev2;
struct task_server *task = NULL;
struct process_details pd = initial_process_details;
+ struct samba_tevent_trace_state *samba_tevent_trace_state = NULL;
int control_pipe[2];
t = tfork_create();
@@ -327,6 +330,17 @@ static void prefork_fork_master(
*/
ev2 = s4_event_context_init(NULL);
+ samba_tevent_trace_state = create_samba_tevent_trace_state(ev2);
+ if (samba_tevent_trace_state == NULL) {
+ TALLOC_FREE(ev);
+ TALLOC_FREE(ev2);
+ exit(127);
+ }
+
+ tevent_set_trace_callback(ev2,
+ samba_tevent_trace_callback,
+ samba_tevent_trace_state);
+
/* setup this new connection: process will bind to it's sockets etc
*
* While we can use ev for the child, which has been re-initialised
diff --git a/source4/samba/process_standard.c b/source4/samba/process_standard.c
index 2820e30eace..396054dbc9d 100644
--- a/source4/samba/process_standard.c
+++ b/source4/samba/process_standard.c
@@ -408,6 +408,8 @@ static void standard_accept_connection(
talloc_free(c);
talloc_free(s);
+ force_check_log_size();
+
/* setup this new connection. Cluster ID is PID based for this process model */
new_conn(ev, lp_ctx, sock2, cluster_id(pid, 0), private_data,
process_context);
@@ -514,6 +516,8 @@ static void standard_new_task(struct tevent_context *ev,
*/
prctl_set_comment("%s[task]", service_name);
+ force_check_log_size();
+
/*
* Set up the process context to be passed through to the terminate
* and accept_connection functions
diff --git a/source4/samba/server.c b/source4/samba/server.c
index d3cbd654d76..6e07f048c0f 100644
--- a/source4/samba/server.c
+++ b/source4/samba/server.c
@@ -46,6 +46,7 @@
#include "lib/util/tfork.h"
#include "dsdb/samdb/ldb_modules/util.h"
#include "lib/util/server_id.h"
+#include "server_util.h"
#ifdef HAVE_PTHREAD
#include
@@ -154,6 +155,19 @@ static void sigterm_signal_handler(struct tevent_context *ev,
sig_term(SIGTERM);
}
+static void sighup_signal_handler(struct tevent_context *ev,
+ struct tevent_signal *se,
+ int signum, int count, void *siginfo,
+ void *private_data)
+{
+ struct server_state *state = talloc_get_type_abort(
+ private_data, struct server_state);
+
+ DBG_DEBUG("Process %s got SIGHUP\n", state->binary_name);
+
+ reopen_logs_internal();
+}
+
/*
setup signal masks
*/
@@ -572,6 +586,7 @@ static int binary_smbd_main(const char *binary_name,
};
struct server_state *state = NULL;
struct tevent_signal *se = NULL;
+ struct samba_tevent_trace_state *samba_tevent_trace_state = NULL;
setproctitle("root process");
@@ -729,6 +744,21 @@ static int binary_smbd_main(const char *binary_name,
talloc_set_destructor(state->event_ctx, event_ctx_destructor);
+ samba_tevent_trace_state = create_samba_tevent_trace_state(state);
+ if (samba_tevent_trace_state == NULL) {
+ exit_daemon("Samba failed to setup tevent tracing state",
+ ENOTTY);
+ /*
+ * return is never reached but is here to satisfy static
+ * checkers
+ */
+ return 1;
+ }
+
+ tevent_set_trace_callback(state->event_ctx,
+ samba_tevent_trace_callback,
+ samba_tevent_trace_state);
+
if (opt_interactive) {
/* terminate when stdin goes away */
stdin_event_flags = TEVENT_FD_READ;
@@ -817,6 +847,22 @@ static int binary_smbd_main(const char *binary_name,
return 1;
}
+ se = tevent_add_signal(state->event_ctx,
+ state->event_ctx,
+ SIGHUP,
+ 0,
+ sighup_signal_handler,
+ state);
+ if (se == NULL) {
+ TALLOC_FREE(state);
+ exit_daemon("Initialize SIGHUP handler failed", ENOMEM);
+ /*
+ * return is never reached but is here to satisfy static
+ * checkers
+ */
+ return 1;
+ }
+
if (lpcfg_server_role(cmdline_lp_ctx) != ROLE_ACTIVE_DIRECTORY_DC
&& !lpcfg_parm_bool(cmdline_lp_ctx, NULL,
"server role check", "inhibit", false)
diff --git a/source4/samba/server_util.c b/source4/samba/server_util.c
new file mode 100644
index 00000000000..282ad9b17cd
--- /dev/null
+++ b/source4/samba/server_util.c
@@ -0,0 +1,94 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Utility routines
+
+ Copyright (C) 2020 Ralph Boehme
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "includes.h"
+#include "lib/tevent/tevent.h"
+#include "lib/util/unix_privs.h"
+#include "server_util.h"
+
+struct samba_tevent_trace_state {
+ size_t events;
+ time_t last_logsize_check;
+};
+
+struct samba_tevent_trace_state *create_samba_tevent_trace_state(
+ TALLOC_CTX *mem_ctx)
+{
+ return talloc_zero(mem_ctx, struct samba_tevent_trace_state);
+}
+
+void samba_tevent_trace_callback(enum tevent_trace_point point,
+ void *private_data)
+{
+ struct samba_tevent_trace_state *state =
+ talloc_get_type_abort(private_data,
+ struct samba_tevent_trace_state);
+ time_t now = time(NULL);
+ bool do_check_logs = false;
+ void *priv = NULL;
+
+ switch (point) {
+ case TEVENT_TRACE_BEFORE_WAIT:
+ break;
+ default:
+ return;
+ }
+
+ state->events++;
+
+ /*
+ * Throttling by some random numbers. smbd uses a similar logic
+ * checking every 50 SMB requests. Assuming 4 events per request
+ * we get to the number of 200.
+ */
+ if ((state->events % 200) == 0) {
+ do_check_logs = true;
+ }
+ /*
+ * Throttling by some delay, choosing 29 to avoid lockstep with
+ * the default tevent tickle timer.
+ */
+ if ((state->last_logsize_check + 29) < now) {
+ do_check_logs = true;
+ }
+
+ if (!do_check_logs) {
+ return;
+ }
+
+ /*
+ * need_to_check_log_size() checks both the number of messages
+ * that have been logged and if the logging backend is actually
+ * going to file. We want to bypass the "number of messages"
+ * check, so we have to call force_check_log_size() before.
+ */
+ force_check_log_size();
+ if (!need_to_check_log_size()) {
+ return;
+ }
+
+ priv = root_privileges();
+ check_log_size();
+ TALLOC_FREE(priv);
+
+ state->last_logsize_check = now;
+ return;
+}
diff --git a/source3/winbindd/winbindd_ads.h b/source4/samba/server_util.h
similarity index 67%
copy from source3/winbindd/winbindd_ads.h
copy to source4/samba/server_util.h
index 5f121c89e8f..08c09cc67c2 100644
--- a/source3/winbindd/winbindd_ads.h
+++ b/source4/samba/server_util.h
@@ -1,9 +1,9 @@
/*
Unix SMB/CIFS implementation.
- Winbind ADS backend functions
+ Utility routines
- Copyright (C) Volker Lendecke 2017
+ Copyright (C) 2020 Ralph Boehme
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,15 +19,15 @@
along with this program. If not, see .
*/
-#ifndef __WINBINDD_ADS_H__
-#define __WINBINDD_ADS_H__
+#ifndef SAMBA_SERVER_UTIL_H
+#define SAMBA_SERVER_UTIL_H
+struct samba_tevent_trace_state;
-#include "ads.h"
+struct samba_tevent_trace_state *create_samba_tevent_trace_state(
+ TALLOC_CTX *mem_ctx);
-extern struct winbindd_methods ads_methods;
-
-ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp,
- const char *dom_name);
+void samba_tevent_trace_callback(enum tevent_trace_point point,
+ void *private_data);
#endif
diff --git a/source4/samba/wscript_build b/source4/samba/wscript_build
index ef0aaf773c1..14267c1c9a5 100644
--- a/source4/samba/wscript_build
+++ b/source4/samba/wscript_build
@@ -17,11 +17,16 @@ bld.SAMBA_LIBRARY('process_model',
enabled=bld.AD_DC_BUILD_IS_ENABLED()
)
+bld.SAMBA_SUBSYSTEM('samba_server_util',
+ source='server_util.c',
+ deps='samba-util')
+
bld.SAMBA_BINARY('samba',
source='server.c',
subsystem_name='service',
deps='''events process_model service samba-hostconfig samba-util POPT_SAMBA
- popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS''',
+ popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS
+ samba_server_util''',
pyembed=True,
install_path='${SBINDIR}',
enabled=bld.AD_DC_BUILD_IS_ENABLED()
@@ -48,6 +53,6 @@ bld.SAMBA_MODULE('process_model_prefork',
source='process_prefork.c',
subsystem='process_model',
init_function='process_model_prefork_init',
- deps='MESSAGING events ldbsamba cluster samba-sockets process_model messages_dgm',
+ deps='MESSAGING events ldbsamba cluster samba-sockets process_model messages_dgm samba_server_util',
internal_module=False
)
--
Samba Shared Repository
From jra at samba.org Mon Dec 7 20:08:01 2020
From: jra at samba.org (Jeremy Allison)
Date: Mon, 07 Dec 2020 20:08:01 +0000
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID:
The branch, master has been updated
via 14768d0d544 s4:torture:smb2: remove unused fallback defines in oplock.c
via 30c1c153650 s3:smbd: remove unused fallback defines in oplock_linux.c
via 6d4ce53ecdc s3/wscript: only check for F_SETLEASE being available at compile time
via 1b2e67641f2 s3/wscript: remove unused check for F_NOTIFY
from 058f96f4c4e s4/samba: call force_check_log_size() in standard_new_task()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 14768d0d54420fe19d914fe4e507cbbf5cb84434
Author: Stefan Metzmacher
Date: Mon Dec 7 12:06:11 2020 +0100
s4:torture:smb2: remove unused fallback defines in oplock.c
F_SETLEASE/F_SETSIG were all included in the kernel
and glibc in 2002, there's no need to have fallbacks 18 years later.
Signed-off-by: Stefan Metzmacher
Reviewed-by: Jeremy Allison
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Mon Dec 7 20:07:18 UTC 2020 on sn-devel-184
commit 30c1c153650ec23860b59bbcd86bb8e6a1460c42
Author: Stefan Metzmacher
Date: Mon Dec 7 12:06:11 2020 +0100
s3:smbd: remove unused fallback defines in oplock_linux.c
F_GETLEASE/F_SETLEASE/F_SETSIG were all included in the kernel
and glibc in 2002, there's no need to have fallbacks 18 years later.
Signed-off-by: Stefan Metzmacher
Reviewed-by: Jeremy Allison
commit 6d4ce53ecdc92cd9693b8e63166ec672209b7268
Author: Stefan Metzmacher
Date: Mon Dec 7 11:38:59 2020 +0100
s3/wscript: only check for F_SETLEASE being available at compile time
F_GETLEASE/F_SETLEASE are available (at least) since Linux 2.4.0 from
2002.
We also should not have the configure check depend on the filesystem
we find at build time. It's very common that the build-environment is
much more restricted than the runtime-environment will be.
As a history we had this check on Samba 3.6:
AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
AC_TRY_RUN([
#include
#include
#ifndef F_GETLEASE
#define F_GETLEASE 1025
#endif
main() {
int fd = open("/dev/null", O_RDONLY);
return fcntl(fd, F_GETLEASE, 0) == -1;
}
],
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
fi
which didn't depend on the filesystem.
Then we got a broken check introduced in Samba 4.0 (a copy of the
F_NOTIFY check):
# Check for Linux kernel oplocks
conf.CHECK_CODE('''
#include
#include
#include
#ifndef F_NOTIFY
#define F_NOTIFY 1026
#endif
main() {
exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
}''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
msg="Checking for Linux kernel oplocks")
this got "fixed" in Samba 4.7 (and backports to 4.6, 4.5 and 4.4) into
# Check for Linux kernel oplocks
conf.CHECK_CODE('''
#include
#include
#include
#ifndef F_GETLEASE
#define F_GETLEASE 1025
#endif
main() {
exit(fcntl(open("/tmp", O_RDONLY), F_GETLEASE, 0) == -1 ? 1 : 0);
}''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
msg="Checking for Linux kernel oplocks")
Lately it became dependend on the filesystem in the build-environment:
# Check for Linux kernel oplocks
conf.CHECK_CODE('''
#include
#include
#include
#ifndef F_GETLEASE
#define F_GETLEASE 1025
#endif
main() {
const char *fname="/tmp/oplock-test.txt";
int fd = open(fname, O_RDWR|O_CREAT, 0644);
int ret = fcntl(fd, F_SETLEASE, F_WRLCK);
unlink(fname);
return (ret == -1) ? 1 : 0;
}''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
msg="Checking for Linux kernel oplocks")
Now we just check for F_SETLEASE being available in linux/fcntl.h.
Signed-off-by: Stefan Metzmacher
Reviewed-by: Jeremy Allison
commit 1b2e67641f2df766d099696a11e7b5122f5851cf
Author: Stefan Metzmacher
Date: Mon Dec 7 11:24:43 2020 +0100
s3/wscript: remove unused check for F_NOTIFY
There're no references to F_NOTIFY nor HAVE_KERNEL_CHANGE_NOTIFY in the
code, so the configure check is not needed at all.
We only use the inotify or fam abstractions.
Signed-off-by: Stefan Metzmacher
Reviewed-by: Jeremy Allison
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/oplock_linux.c | 12 ------------
source3/wscript | 28 ++--------------------------
source4/ntvfs/sysdep/wscript_configure | 1 -
source4/torture/smb2/oplock.c | 8 --------
4 files changed, 2 insertions(+), 47 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 44ed976b92c..a4f79297abd 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -25,22 +25,10 @@
#ifdef HAVE_KERNEL_OPLOCKS_LINUX
-#ifndef F_SETLEASE
-#define F_SETLEASE 1024
-#endif
-
-#ifndef F_GETLEASE
-#define F_GETLEASE 1025
-#endif
-
#ifndef RT_SIGNAL_LEASE
#define RT_SIGNAL_LEASE (SIGRTMIN+1)
#endif
-#ifndef F_SETSIG
-#define F_SETSIG 10
-#endif
-
/*
* Call to set the kernel lease signal handler
*/
diff --git a/source3/wscript b/source3/wscript
index a370fae667f..ba02a3586b9 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -165,33 +165,9 @@ long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);
if conf.env.HAVE_SYS_INOTIFY_H:
conf.DEFINE('HAVE_INOTIFY', 1)
- # Check for kernel change notify support
- conf.CHECK_CODE('''
-#ifndef F_NOTIFY
-#define F_NOTIFY 1026
-#endif
-main() {
- exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
-}''', 'HAVE_KERNEL_CHANGE_NOTIFY', addmain=False, execute=True,
- headers='fcntl.h signal.h',
- msg="Checking for kernel change notify support")
-
# Check for Linux kernel oplocks
- conf.CHECK_CODE('''
-#include
-#include
-#include
-#ifndef F_GETLEASE
-#define F_GETLEASE 1025
-#endif
-int main() {
- const char *fname="/tmp/oplock-test.txt";
- int fd = open(fname, O_RDWR|O_CREAT, 0644);
- int ret = fcntl(fd, F_SETLEASE, F_WRLCK);
- unlink(fname);
- return (ret == -1) ? 1 : 0;
-}''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
- msg="Checking for Linux kernel oplocks")
+ if conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True):
+ conf.DEFINE('HAVE_KERNEL_OPLOCKS_LINUX', 1)
# Check for kernel share modes
conf.CHECK_CODE('''
diff --git a/source4/ntvfs/sysdep/wscript_configure b/source4/ntvfs/sysdep/wscript_configure
index 274fc08b581..20358848cd3 100644
--- a/source4/ntvfs/sysdep/wscript_configure
+++ b/source4/ntvfs/sysdep/wscript_configure
@@ -10,5 +10,4 @@ if host_os.rfind('sunos') == -1:
if (conf.CONFIG_SET('HAVE_SYS_INOTIFY_H')):
conf.DEFINE('HAVE_LINUX_INOTIFY', 1)
-conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True)
conf.CHECK_DECLS('SA_SIGINFO', headers='signal.h', reverse=True)
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c
index a30657ef596..ad9ef625a5a 100644
--- a/source4/torture/smb2/oplock.c
+++ b/source4/torture/smb2/oplock.c
@@ -5079,18 +5079,10 @@ done:
#ifdef HAVE_KERNEL_OPLOCKS_LINUX
-#ifndef F_SETLEASE
-#define F_SETLEASE 1024
-#endif
-
#ifndef RT_SIGNAL_LEASE
#define RT_SIGNAL_LEASE (SIGRTMIN+1)
#endif
-#ifndef F_SETSIG
-#define F_SETSIG 10
-#endif
-
static int got_break;
/*
--
Samba Shared Repository
From kseeger at samba.org Tue Dec 8 10:22:02 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Tue, 08 Dec 2020 10:22:02 +0000
Subject: [SCM] Samba Shared Repository - branch v4-13-test updated
Message-ID:
The branch, v4-13-test has been updated
via 54d3d3cbf49 s3: smbd: Quiet log messages from usershares for an unknown share.
via f7490ec9d94 s3-libads: Pass timeout to open_socket_out in ms
from 585c49f21f7 vfs_glusterfs: print exact cmdline for disabling write-behind translator
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-13-test
- Log -----------------------------------------------------------------
commit 54d3d3cbf49b660f7e93aa45caa94fa6821c0999
Author: Jeremy Allison
Date: Wed Dec 2 11:47:02 2020 -0800
s3: smbd: Quiet log messages from usershares for an unknown share.
No need to log missing shares/sharenames at debug level zero.
Keep the debug level zero for all other usershare problems.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14590
Signed-off-by: Jeremy Allison
Reviewed-by: Rowland penny
Reviewed-by: Andrew Bartlett
Autobuild-User(master): Jeremy Allison
Autobuild-Date(master): Fri Dec 4 20:54:06 UTC 2020 on sn-devel-184
(cherry picked from commit 8a0a7359faba642baf55a8f98ff78c0d0884d0f0)
Autobuild-User(v4-13-test): Karolin Seeger
Autobuild-Date(v4-13-test): Tue Dec 8 10:21:11 UTC 2020 on sn-devel-184
commit f7490ec9d94edfc9cdc79e70580b3b226a2022d5
Author: Isaac Boukris
Date: Tue Jul 14 22:38:06 2020 +0200
s3-libads: Pass timeout to open_socket_out in ms
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13124
Signed-off-by: Isaac Boukris
Reviewed-by: Andreas Schneider
Autobuild-User(master): Andreas Schneider
Autobuild-Date(master): Thu Jul 16 10:41:40 UTC 2020 on sn-devel-184
(cherry picked from commit d67e9149a612044e247e7a4d78913ecf396c69fc)
-----------------------------------------------------------------------
Summary of changes:
source3/libads/ldap.c | 4 +++-
source3/param/loadparm.c | 10 ++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
Changeset truncated at 500 lines:
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 10ab043f721..ee4628a09a2 100755
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -96,9 +96,11 @@ static void gotalarm_sig(int signum)
{
int fd = -1;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ unsigned timeout_ms = 1000 * to;
- status = open_socket_out(ss, port, to, &fd);
+ status = open_socket_out(ss, port, timeout_ms, &fd);
if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(3, ("open_socket_out: failed to open socket\n"));
return NULL;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 6674485738a..a3abaa2ec67 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3418,6 +3418,11 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
open and fstat. Ensure this isn't a symlink link. */
if (sys_lstat(fname, &lsbuf, false) != 0) {
+ if (errno == ENOENT) {
+ /* Unknown share requested. Just ignore. */
+ goto out;
+ }
+ /* Only log messages for meaningful problems. */
DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
fname, strerror(errno) ));
goto out;
@@ -3623,6 +3628,11 @@ int load_usershare_service(const char *servicename)
int max_user_shares = Globals.usershare_max_shares;
int snum_template = -1;
+ if (servicename[0] == '\0') {
+ /* Invalid service name. */
+ return -1;
+ }
+
if (*usersharepath == 0 || max_user_shares == 0) {
return -1;
}
--
Samba Shared Repository
From npower at samba.org Wed Dec 9 17:05:01 2020
From: npower at samba.org (Noel Power)
Date: Wed, 09 Dec 2020 17:05:01 +0000
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID:
The branch, master has been updated
via cc9ff79d86c dbcheck: err_normalise-mismatch_replace: no msg if no error
via f1be8813b01 dbcheck: fix doc for err_normalise_mismatch*
via c28a3dd6d27 dbcheck: fix doc for do_rename()
via 17fb635532d dbcheck: remove unused fix_incorrect_deleted_objects flag
via 0aec5b930d9 dbcheck: improve some duplicate doc strings
via 99cdb2191e9 dbcheck: drop py2 support from dump_attr_values()
via 713117401c8 dbcheck: don't try to stringify values list twice
via 081d12de529 dbcheck: add docstring for err_odd_userParameters
via 9fabe3aafdb dbcheck: fix documentation for err_doubled_userParameters
via c7b39f1cea0 dbcheck: fix documentation and typo for err_utf_userParameters
via fa0350374d3 dbcheck: fix documentation for err_base64_userParameters
via 3afd594273f dbcheck: fix documentation for err_duplicate_values
via 9938a9f7db3 selftest/subunit: python file modernisation
via 02c3a66cbec drs_utils: remove unused sendRemoveDsServer()
via a8d1a6c59b4 python: remove unused provision.check_install()
via e253c45c6d1 samba-tool gpo: use common attr_default
via 816dee1a132 samba-tool drs: move attr_default to common
via 2c48e90fad0 samba-tool pso uses common timestamp functions
via c8d3547c5fa samba-tool domain: move timestamp functions to common
from 14768d0d544 s4:torture:smb2: remove unused fallback defines in oplock.c
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cc9ff79d86c64cc25c5618866c95f308204716dd
Author: Douglas Bagnall
Date: Fri Dec 4 11:53:48 2020 +1300
dbcheck: err_normalise-mismatch_replace: no msg if no error
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
Autobuild-User(master): Noel Power
Autobuild-Date(master): Wed Dec 9 17:04:23 UTC 2020 on sn-devel-184
commit f1be8813b01227c0c18052b622899026eb4b14d0
Author: Douglas Bagnall
Date: Fri Dec 4 11:52:40 2020 +1300
dbcheck: fix doc for err_normalise_mismatch*
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit c28a3dd6d27e60ca84933dac41f0f696eb963b41
Author: Douglas Bagnall
Date: Fri Dec 4 11:51:42 2020 +1300
dbcheck: fix doc for do_rename()
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 17fb635532dffb51a2237f1291d215d94e433146
Author: Douglas Bagnall
Date: Fri Dec 4 11:19:50 2020 +1300
dbcheck: remove unused fix_incorrect_deleted_objects flag
This was introduced in db15993401f927fd2fcea1687c4155dce2272aa8
but not actually referenced then or since.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 0aec5b930d9ca278c9045e6b58e4de2b34d8c591
Author: Douglas Bagnall
Date: Fri Dec 4 10:15:24 2020 +1300
dbcheck: improve some duplicate doc strings
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 99cdb2191e9ab633579f4e7951c2da042529b95d
Author: Douglas Bagnall
Date: Fri Dec 4 10:10:50 2020 +1300
dbcheck: drop py2 support from dump_attr_values()
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 713117401c85642dfa9de0772f0a9954a8b8d804
Author: Douglas Bagnall
Date: Fri Dec 4 10:12:08 2020 +1300
dbcheck: don't try to stringify values list twice
dump_attr_values already turns it into a comma separated list.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 081d12de529ba89e8eb3930dd3e1cbf394783394
Author: Douglas Bagnall
Date: Fri Dec 4 12:34:52 2020 +1300
dbcheck: add docstring for err_odd_userParameters
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 9fabe3aafdb799db31cf222e186b5ac84b1ed024
Author: Douglas Bagnall
Date: Fri Dec 4 12:34:22 2020 +1300
dbcheck: fix documentation for err_doubled_userParameters
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit c7b39f1cea0ef4b27c4897d20ca718c5eb195210
Author: Douglas Bagnall
Date: Fri Dec 4 12:34:02 2020 +1300
dbcheck: fix documentation and typo for err_utf_userParameters
pseudo, not psudo.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit fa0350374d3ffdf78e920361315556034730fde8
Author: Douglas Bagnall
Date: Fri Dec 4 12:33:27 2020 +1300
dbcheck: fix documentation for err_base64_userParameters
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 3afd594273f659056f15b6e6a1a45b68824bf113
Author: Douglas Bagnall
Date: Fri Dec 4 11:56:00 2020 +1300
dbcheck: fix documentation for err_duplicate_values
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 9938a9f7db37283a1e3d2c52e1246c573ecd649b
Author: Douglas Bagnall
Date: Thu Nov 19 16:44:42 2020 +1300
selftest/subunit: python file modernisation
Python idioms for iterating over a line and closing it have improved,
and we should keep up.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 02c3a66cbec2c670d809b186cacc7d075c16ec54
Author: Douglas Bagnall
Date: Thu Nov 19 12:43:01 2020 +1300
drs_utils: remove unused sendRemoveDsServer()
The only caller of this was `samba-tool domain demote` which stopped
using it in 2015 with commit f121173cbf46fe64746d73adf40015c43d5c55fc.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit a8d1a6c59b4e43869454a3e3528948613e9b0c61
Author: Douglas Bagnall
Date: Thu Nov 19 12:23:45 2020 +1300
python: remove unused provision.check_install()
Unused for at last 10 years.
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit e253c45c6d1cd76da682f72a0903f01bf094c8a1
Author: Douglas Bagnall
Date: Thu Nov 19 11:24:47 2020 +1300
samba-tool gpo: use common attr_default
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 816dee1a132e6b586de8b0123fd8e9572aff4c32
Author: Douglas Bagnall
Date: Thu Nov 19 11:24:25 2020 +1300
samba-tool drs: move attr_default to common
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit 2c48e90fad04db6a78fc4dc1f2cb12154db7f711
Author: Douglas Bagnall
Date: Thu Nov 19 11:20:35 2020 +1300
samba-tool pso uses common timestamp functions
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
commit c8d3547c5fa8724198541cb67b60e5c8e212a1ad
Author: Douglas Bagnall
Date: Thu Nov 19 11:19:04 2020 +1300
samba-tool domain: move timestamp functions to common
Other tools use identical functions, and they too can use common.py
Signed-off-by: Douglas Bagnall
Reviewed-by: Noel Power
-----------------------------------------------------------------------
Summary of changes:
python/samba/dbchecker.py | 55 ++++++++++++++++++--------------------
python/samba/drs_utils.py | 23 ----------------
python/samba/netcmd/common.py | 28 +++++++++++++++++++
python/samba/netcmd/domain.py | 23 +++-------------
python/samba/netcmd/drs.py | 8 +-----
python/samba/netcmd/gpo.py | 8 +-----
python/samba/netcmd/pso.py | 21 +++------------
python/samba/provision/__init__.py | 15 -----------
selftest/subunithelper.py | 16 +++--------
9 files changed, 66 insertions(+), 131 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 339af01cb1b..28b56edaafb 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -35,25 +35,20 @@ from samba.auth import system_session, admin_session
from samba.netcmd import CommandError
from samba.netcmd.fsmo import get_fsmo_roleowner
-# vals is a sequence of ldb.bytes objects which are a subclass
-# of 'byte' type in python3 and just a str type in python2, to
-# display as string these need to be converted to string via (str)
-# function in python3 but that may generate a UnicodeDecode error,
-# if so use repr instead. We need to at least try to get the 'str'
-# value if possible to allow some tests which check the strings
-# outputted to pass, these tests compare attr values logged to stdout
-# against those in various results files.
def dump_attr_values(vals):
- result = ""
+ """Stringify a value list, using utf-8 if possible (which some tests
+ want), or the python bytes representation otherwise (with leading
+ 'b' and escapes like b'\x00').
+ """
+ result = []
for value in vals:
- if len(result):
- result = "," + result
try:
- result = result + str(value)
+ result.append(value.decode('utf-8'))
except UnicodeDecodeError:
- result = result + repr(value)
- return result
+ result.append(repr(value))
+ return ','.join(result)
+
class dbcheck(object):
"""check a SAM database for errors"""
@@ -102,7 +97,6 @@ class dbcheck(object):
self.fix_replmetadata_wrong_attid = False
self.fix_replmetadata_unsorted_attid = False
self.fix_deleted_deleted_objects = False
- self.fix_incorrect_deleted_objects = False
self.fix_dn = False
self.fix_base64_userparameters = False
self.fix_utf8_userparameters = False
@@ -442,7 +436,7 @@ systemFlags: -1946157056%s""" % (dn, guid_suffix),
return True
def do_rename(self, from_dn, to_rdn, to_base, controls, msg):
- '''perform a modify with optional verbose output'''
+ '''perform a rename with optional verbose output'''
if self.verbose:
self.report("""dn: %s
changeType: modrdn
@@ -486,7 +480,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Removed empty attribute %s" % attrname)
def err_normalise_mismatch(self, dn, attrname, values):
- '''fix attribute normalisation errors'''
+ '''fix attribute normalisation errors, without altering sort order'''
self.report("ERROR: Normalisation error for attribute %s in %s" % (attrname, dn))
mod_list = []
for val in values:
@@ -517,12 +511,13 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Normalised attribute %s" % attrname)
def err_normalise_mismatch_replace(self, dn, attrname, values):
- '''fix attribute normalisation errors'''
+ '''fix attribute normalisation and/or sort errors'''
normalised = self.samdb.dsdb_normalise_attributes(self.samdb_schema, attrname, values)
- self.report("ERROR: Normalisation error for attribute '%s' in '%s'" % (attrname, dn))
- self.report("Values/Order of values do/does not match: %s/%s!" % (values, list(normalised)))
if list(normalised) == values:
+ # how we got here is a mystery.
return
+ self.report("ERROR: Normalisation error for attribute '%s' in '%s'" % (attrname, dn))
+ self.report("Values/Order of values do/does not match: %s/%s!" % (values, list(normalised)))
if not self.confirm_all("Fix normalisation for '%s' from '%s'?" % (attrname, dn), 'fix_all_normalisation'):
self.report("Not fixing attribute '%s'" % attrname)
return
@@ -537,9 +532,10 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Normalised attribute %s" % attrname)
def err_duplicate_values(self, dn, attrname, dup_values, values):
- '''fix attribute normalisation errors'''
+ '''fix duplicate attribute values'''
self.report("ERROR: Duplicate values for attribute '%s' in '%s'" % (attrname, dn))
- self.report("Values contain a duplicate: [%s]/[%s]!" % (','.join(dump_attr_values(dup_values)), ','.join(dump_attr_values(values))))
+ self.report("Values contain a duplicate: [%s]/[%s]!" %
+ (dump_attr_values(dup_values), dump_attr_values(values)))
if not self.confirm_all("Fix duplicates for '%s' from '%s'?" % (attrname, dn), 'fix_all_duplicates'):
self.report("Not fixing attribute '%s'" % attrname)
return
@@ -724,7 +720,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Fixed %s on attribute %s" % (errstr, attrname))
def err_dn_string_component_old(self, dn, attrname, val, dsdb_dn, correct_dn):
- """handle a DN string being incorrect"""
+ """handle a DN string being incorrect due to a rename or delete"""
self.report("NOTE: old (due to rename or delete) DN string component for %s in object %s - %s" % (attrname, dn, val))
dsdb_dn.dn = correct_dn
@@ -759,7 +755,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Fixed incorrect DN %s on attribute %s" % (mismatch_type, attrname))
def err_dn_component_missing_target_sid(self, dn, attrname, val, dsdb_dn, target_sid_blob):
- """handle a DN string being incorrect"""
+ """fix missing on linked attributes"""
self.report("ERROR: missing DN SID component for %s in object %s - %s" % (attrname, dn, val))
if len(dsdb_dn.prefix) != 0:
@@ -977,7 +973,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("ERROR: incorrect userParameters value on object %s. If you have another working DC that does not give this warning, please run 'samba-tool drs replicate --full-sync --local %s'" % (obj.dn, self.samdb.get_nc_root(obj.dn)))
def err_base64_userParameters(self, obj, attrname, value):
- '''handle a wrong userParameters'''
+ '''handle a userParameters that is wrongly base64 encoded'''
self.report("ERROR: wrongly formatted userParameters %s on %s, should not be base64-encoded" % (value, obj.dn))
if not self.confirm_all('Convert userParameters from base64 encoding on %s?' % (obj.dn), 'fix_base64_userparameters'):
self.report('Not changing userParameters from base64 encoding on %s' % (obj.dn))
@@ -991,8 +987,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Corrected base64-encoded userParameters on %s by converting from base64" % (obj.dn))
def err_utf8_userParameters(self, obj, attrname, value):
- '''handle a wrong userParameters'''
- self.report("ERROR: wrongly formatted userParameters on %s, should not be psudo-UTF8 encoded" % (obj.dn))
+ '''handle a userParameters that is wrongly utf-8 encoded'''
+ self.report("ERROR: wrongly formatted userParameters on %s, "
+ "should not be pseudo-UTF8 encoded" % (obj.dn))
if not self.confirm_all('Convert userParameters from UTF8 encoding on %s?' % (obj.dn), 'fix_utf8_userparameters'):
self.report('Not changing userParameters from UTF8 encoding on %s' % (obj.dn))
return
@@ -1006,7 +1003,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Corrected psudo-UTF8 encoded userParameters on %s by converting from UTF8" % (obj.dn))
def err_doubled_userParameters(self, obj, attrname, value):
- '''handle a wrong userParameters'''
+ '''handle a userParameters that has been utf-16 encoded twice'''
self.report("ERROR: wrongly formatted userParameters on %s, should not be double UTF16 encoded" % (obj.dn))
if not self.confirm_all('Convert userParameters from doubled UTF-16 encoding on %s?' % (obj.dn), 'fix_doubled_userparameters'):
self.report('Not changing userParameters from doubled UTF-16 encoding on %s' % (obj.dn))
@@ -1032,7 +1029,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
self.report("Corrected doubled-UTF16 encoded userParameters on %s by converting" % (obj.dn))
def err_odd_userParameters(self, obj, attrname):
- # This is a truncated userParameters due to a pre 4.1 replication bug
+ """Fix a truncated userParameters due to a pre 4.1 replication bug"""
self.report("ERROR: incorrect userParameters value on object %s (odd length). If you have another working DC that does not give this warning, please run 'samba-tool drs replicate --full-sync --local %s'" % (obj.dn, self.samdb.get_nc_root(obj.dn)))
def find_revealed_link(self, dn, attrname, guid):
diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py
index 43d1b4a2488..feab89b0d8e 100644
--- a/python/samba/drs_utils.py
+++ b/python/samba/drs_utils.py
@@ -92,29 +92,6 @@ def sendDsReplicaSync(drsuapiBind, drsuapi_handle, source_dsa_guid,
raise drsException("DsReplicaSync failed %s" % estr)
-def sendRemoveDsServer(drsuapiBind, drsuapi_handle, server_dsa_dn, domain):
- """Send RemoveDSServer request.
-
- :param drsuapiBind: a drsuapi Bind object
- :param drsuapi_handle: a drsuapi handle on the drsuapi connection
- :param server_dsa_dn: a DN object of the server's dsa that we want to
- demote
- :param domain: a DN object of the server's domain
- :raise drsException: if any error occur while sending and receiving the
- reply for the DsRemoveDSServer
- """
-
- try:
- req1 = drsuapi.DsRemoveDSServerRequest1()
- req1.server_dn = str(server_dsa_dn)
- req1.domain_dn = str(domain)
- req1.commit = 1
-
- drsuapiBind.DsRemoveDSServer(drsuapi_handle, 1, req1)
- except Exception as estr:
- raise drsException("DsRemoveDSServer failed %s" % estr)
-
-
def drs_DsBind(drs):
'''make a DsBind call, returning the binding handle'''
bind_info = drsuapi.DsBindInfoCtr()
diff --git a/python/samba/netcmd/common.py b/python/samba/netcmd/common.py
index f53ff4555a9..bb17bfa10f2 100644
--- a/python/samba/netcmd/common.py
+++ b/python/samba/netcmd/common.py
@@ -22,6 +22,11 @@ from samba.dcerpc import nbt
from samba.net import Net
import ldb
+
+# In MS AD, setting a timeout to '(never)' corresponds to this value
+NEVER_TIMESTAMP = int(-0x8000000000000000)
+
+
def _get_user_realm_domain(user):
r""" get the realm or the domain and the base user
from user like:
@@ -112,3 +117,26 @@ def get_ldif_for_editor(samdb, msg):
result_ldif = samdb.write_ldif(m, ldb.CHANGETYPE_NONE)
return result_ldif
+
+
+def timestamp_to_mins(timestamp_str):
+ """Converts a timestamp in -100 nanosecond units to minutes"""
+ # treat a timestamp of 'never' the same as zero (this should work OK for
+ # most settings, and it displays better than trying to convert
+ # -0x8000000000000000 to minutes)
+ if int(timestamp_str) == NEVER_TIMESTAMP:
+ return 0
+ else:
+ return abs(int(timestamp_str)) / (1e7 * 60)
+
+
+def timestamp_to_days(timestamp_str):
+ """Converts a timestamp in -100 nanosecond units to days"""
+ return timestamp_to_mins(timestamp_str) / (60 * 24)
+
+
+def attr_default(msg, attrname, default):
+ '''get an attribute from a ldap msg with a default'''
+ if attrname in msg:
+ return msg[attrname][0]
+ return default
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 71dacf67a89..6a02b2ecac0 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -62,6 +62,9 @@ from samba.netcmd import (
)
from samba.netcmd.fsmo import get_fsmo_roleowner
from samba.netcmd.common import netcmd_get_domain_infos_via_cldap
+from samba.netcmd.common import (NEVER_TIMESTAMP,
+ timestamp_to_mins,
+ timestamp_to_days)
from samba.samba3 import Samba3
from samba.samba3 import param as s3param
from samba.upgrade import upgrade_from_samba3
@@ -1210,26 +1213,6 @@ class cmd_domain_level(Command):
raise CommandError("invalid argument: '%s' (choose from 'show', 'raise')" % subcommand)
-# In MS AD, setting a timeout to '(never)' corresponds to this value
-NEVER_TIMESTAMP = int(-0x8000000000000000)
-
-
-def timestamp_to_mins(timestamp_str):
- """Converts a timestamp in -100 nanosecond units to minutes"""
- # treat a timestamp of 'never' the same as zero (this should work OK for
- # most settings, and it displays better than trying to convert
- # -0x8000000000000000 to minutes)
- if int(timestamp_str) == NEVER_TIMESTAMP:
- return 0
- else:
- return abs(int(timestamp_str)) / (1e7 * 60)
-
-
-def timestamp_to_days(timestamp_str):
- """Converts a timestamp in -100 nanosecond units to days"""
- return timestamp_to_mins(timestamp_str) / (60 * 24)
-
-
class cmd_domain_passwordsettings_show(Command):
"""Display current password settings for the domain."""
diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py
index 023b09d0506..5b439f8e6e1 100644
--- a/python/samba/netcmd/drs.py
+++ b/python/samba/netcmd/drs.py
@@ -33,6 +33,7 @@ from samba.netcmd import (
Option,
SuperCommand,
)
+from samba.netcmd.common import attr_default
from samba.samdb import SamDB
from samba import drs_utils, nttime2string, dsdb
from samba.dcerpc import drsuapi, misc
@@ -75,13 +76,6 @@ def drs_errmsg(werr):
return "failed, result %u (%s)" % (ecode, estring)
-def attr_default(msg, attrname, default):
- '''get an attribute from a ldap msg with a default'''
- if attrname in msg:
- return msg[attrname][0]
- return default
-
-
def drs_parse_ntds_dn(ntds_dn):
'''parse a NTDS DN returning a site and server'''
a = ntds_dn.split(',')
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index bbaa0c17881..ca479207d6e 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -63,13 +63,7 @@ from samba.gp_parse.gp_inf import GptTmplInfParser
from samba.gp_parse.gp_aas import GPAasParser
from samba import param
from samba.credentials import SMB_SIGNING_REQUIRED
-
-
-def attr_default(msg, attrname, default):
- '''get an attribute from a ldap msg with a default'''
- if attrname in msg:
- return msg[attrname][0]
- return default
+from samba.netcmd.common import attr_default
def gpo_flags_string(value):
diff --git a/python/samba/netcmd/pso.py b/python/samba/netcmd/pso.py
index 200b6ff2a9e..d260e3bd406 100644
--- a/python/samba/netcmd/pso.py
+++ b/python/samba/netcmd/pso.py
@@ -22,30 +22,15 @@ from samba.netcmd import (Command, CommandError, Option, SuperCommand)
from samba.dcerpc.samr import (DOMAIN_PASSWORD_COMPLEX,
DOMAIN_PASSWORD_STORE_CLEARTEXT)
from samba.auth import system_session
-
-NEVER_TIMESTAMP = int(-0x8000000000000000)
+from samba.netcmd.common import (NEVER_TIMESTAMP,
+ timestamp_to_mins,
+ timestamp_to_days)
def pso_container(samdb):
return "CN=Password Settings Container,CN=System,%s" % samdb.domain_dn()
-def timestamp_to_mins(timestamp_str):
- """Converts a timestamp in -100 nanosecond units to minutes"""
- # treat a timestamp of 'never' the same as zero (this should work OK for
- # most settings, and it displays better than trying to convert
- # -0x8000000000000000 to minutes)
- if int(timestamp_str) == NEVER_TIMESTAMP:
- return 0
- else:
- return abs(int(timestamp_str)) / (1e7 * 60)
-
-
-def timestamp_to_days(timestamp_str):
- """Converts a timestamp in -100 nanosecond units to days"""
- return timestamp_to_mins(timestamp_str) / (60 * 24)
-
-
def mins_to_timestamp(mins):
"""Converts a value in minutes to -100 nanosecond units"""
timestamp = -int((1e7) * 60 * mins)
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 0706f39c581..136267e7aad 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -499,21 +499,6 @@ class ProvisionResult(object):
self.backend_result.report_logger(logger)
-def check_install(lp, session_info, credentials):
- """Check whether the current install seems ok.
-
- :param lp: Loadparm context
- :param session_info: Session information
- :param credentials: Credentials
- """
- if lp.get("realm") == "":
- raise Exception("Realm empty")
- samdb = Ldb(lp.samdb_url(), session_info=session_info,
- credentials=credentials, lp=lp)
- if len(samdb.search("(cn=Administrator)")) != 1:
- raise ProvisioningError("No administrator account found")
-
-
def findnss(nssfn, names):
"""Find a user or group from a list of possibilities.
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py
index 26158cad339..4fbb5442839 100644
--- a/selftest/subunithelper.py
+++ b/selftest/subunithelper.py
@@ -45,10 +45,7 @@ def parse_results(msg_ops, statistics, fh):
exitcode = 0
open_tests = {}
- while fh:
- l = fh.readline()
- if l == "":
- break
+ for l in fh:
parts = l.split(None, 1)
if not len(parts) == 2 or not l.startswith(parts[0]):
msg_ops.output_msg(l)
@@ -80,10 +77,7 @@ def parse_results(msg_ops, statistics, fh):
reason = ""
# reason may be specified in next lines
terminated = False
- while fh:
- l = fh.readline()
- if l == "":
- break
+ for l in fh:
msg_ops.control_msg(l)
if l == "]\n":
terminated = True
@@ -250,8 +244,7 @@ def read_test_regexes(*names):
files.append(name)
for filename in files:
- f = open(filename, 'r')
- try:
+ with open(filename, 'r') as f:
for l in f:
l = l.strip()
if l == "" or l[0] == "#":
@@ -261,8 +254,7 @@ def read_test_regexes(*names):
ret[regex.strip()] = reason.strip()
else:
ret[l] = None
- finally:
- f.close()
+
return ret
--
Samba Shared Repository
From dmulder at samba.org Wed Dec 9 18:43:02 2020
From: dmulder at samba.org (David Mulder)
Date: Wed, 09 Dec 2020 18:43:02 +0000
Subject: [SCM] Samba Shared Repository - branch master updated
Message-ID:
The branch, master has been updated
via 4fa938e7e5f WHATSNEW: samba-tool gpo manage command
via ef5ea147ddc samba-tool: Add a gpo command for setting smb.conf Group Policy
via 2705d39bff3 samba-tool: Test gpo smb.conf set command
via fff3e0eb6af samba-tool: Add a gpo command for listing smb.conf Group Policies
via f74dea08be4 samba-tool: Test gpo smb.conf list command
via 111f07fd58b samba-tool: Add a gpo command for listing Security Group Policies
via aba8ece11d2 samba-tool: Test gpo Security list
via eea46a38ebe samba-tool: Add a gpo command for setting Security Group Policy
via 5b49e0ac71c samba-tool: Test gpo Security set command
via f509550f872 samba-tool: Add a gpo command for removing Sudoers Group Policy
via f67a3644f41 samba-tool: Test gpo Sudoers remove command
via 5f9d2456fba samba-tool: Add a gpo command for adding Sudoers Group Policy
via b0ccebd3ee6 samba-tool: Test gpo Sudoers add command
via b402c7642c5 samba-tool: Add a gpo command for listing Sudoers Group Policies
via 6f1374844c3 samba-tool: Test gpo Sudoers list command
from cc9ff79d86c dbcheck: err_normalise-mismatch_replace: no msg if no error
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4fa938e7e5f56b23eb4b3bfa560f50fabdcba8e4
Author: David Mulder
Date: Fri Dec 4 08:53:54 2020 -0700
WHATSNEW: samba-tool gpo manage command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
Autobuild-User(master): David Mulder
Autobuild-Date(master): Wed Dec 9 18:42:29 UTC 2020 on sn-devel-184
commit ef5ea147ddcc81830eec3405c648f2124c9d27cf
Author: David Mulder
Date: Fri Nov 13 08:39:26 2020 -0700
samba-tool: Add a gpo command for setting smb.conf Group Policy
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit 2705d39bff3ddb74c78659866079195b921af5ed
Author: David Mulder
Date: Fri Nov 13 07:28:00 2020 -0700
samba-tool: Test gpo smb.conf set command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit fff3e0eb6afe4ef2d6b74bf80413c74b176bc441
Author: David Mulder
Date: Thu Nov 12 11:19:37 2020 -0700
samba-tool: Add a gpo command for listing smb.conf Group Policies
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit f74dea08be48dcb194570d9ff0ef2a30c2cf878e
Author: David Mulder
Date: Thu Nov 12 11:13:50 2020 -0700
samba-tool: Test gpo smb.conf list command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit 111f07fd58b7a7f798cc10e40a44e7fcdd8e207f
Author: David Mulder
Date: Fri Nov 6 10:44:28 2020 -0700
samba-tool: Add a gpo command for listing Security Group Policies
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit aba8ece11d21aafbb3b42a3c24b18c5f9c5559f7
Author: David Mulder
Date: Mon Nov 9 16:28:11 2020 -0700
samba-tool: Test gpo Security list
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit eea46a38ebe3de36063f663068933818cef19ff6
Author: David Mulder
Date: Fri Nov 6 12:19:12 2020 -0700
samba-tool: Add a gpo command for setting Security Group Policy
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit 5b49e0ac71c2e10b73c8c67f0cb9547b70b8d021
Author: David Mulder
Date: Tue Nov 10 08:05:37 2020 -0700
samba-tool: Test gpo Security set command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit f509550f872424a67d4fbc9473c8959e53dffb70
Author: David Mulder
Date: Fri Nov 6 09:54:59 2020 -0700
samba-tool: Add a gpo command for removing Sudoers Group Policy
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit f67a3644f413dd4c902af6970cd18cf17f469cd2
Author: David Mulder
Date: Mon Nov 9 16:08:59 2020 -0700
samba-tool: Test gpo Sudoers remove command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit 5f9d2456fbaeeb5674edb228a3022ee749376715
Author: David Mulder
Date: Fri Nov 6 09:30:35 2020 -0700
samba-tool: Add a gpo command for adding Sudoers Group Policy
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit b0ccebd3ee65b8a9e4d09e1ef9121fc8c6a336b4
Author: David Mulder
Date: Mon Nov 9 15:48:28 2020 -0700
samba-tool: Test gpo Sudoers add command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit b402c7642c5569bd0d8a6a9df4859f8bd89784b7
Author: David Mulder
Date: Fri Nov 6 09:29:57 2020 -0700
samba-tool: Add a gpo command for listing Sudoers Group Policies
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
commit 6f1374844c3bced28ac59633d12f2125a74376db
Author: David Mulder
Date: Mon Nov 9 08:34:28 2020 -0700
samba-tool: Test gpo Sudoers list command
Signed-off-by: David Mulder
Reviewed-by: Douglas Bagnall
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 4 +-
python/samba/netcmd/gpo.py | 586 ++++++++++++++++++++++++++++++++++-
python/samba/tests/samba_tool/gpo.py | 232 ++++++++++++++
3 files changed, 820 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 9cfd2840b17..d53a7da1e8b 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -69,7 +69,9 @@ Administration of Samba policy requires that a Samba ADMX template be uploaded
to the SYSVOL share. The samba-tool command `samba-tool gpo admxload` is
provided as a convenient method for adding this policy. Once uploaded, policies
can be modified in the Group Policy Management Editor under Computer
-Configuration/Policies/Administrative Templates.
+Configuration/Policies/Administrative Templates. Alternatively, Samba policy
+may be managed using the `samba-tool gpo manage` command. This tool does not
+require the admx templates to be installed.
CTDB CHANGES
============
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index ca479207d6e..8be7368282f 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -37,7 +37,8 @@ from samba.netcmd import (
from samba.samdb import SamDB
from samba import dsdb
from samba.dcerpc import security
-from samba.ndr import ndr_unpack
+from samba.ndr import ndr_unpack, ndr_pack
+from samba.dcerpc import preg
import samba.security
import samba.auth
from samba.auth import AUTH_SESSION_INFO_DEFAULT_GROUPS, AUTH_SESSION_INFO_AUTHENTICATED, AUTH_SESSION_INFO_SIMPLE_PRIVILEGES
@@ -64,6 +65,9 @@ from samba.gp_parse.gp_aas import GPAasParser
from samba import param
from samba.credentials import SMB_SIGNING_REQUIRED
from samba.netcmd.common import attr_default
+from samba.common import get_bytes, get_string
+from configparser import ConfigParser
+from io import StringIO
def gpo_flags_string(value):
@@ -1664,6 +1668,585 @@ class cmd_admxload(Command):
raise CommandError("The authenticated user does "
"not have sufficient privileges")
+class cmd_add_sudoers(Command):
+ """Adds a Samba Sudoers Group Policy to the sysvol
+
+This command adds a sudo rule to the sysvol for applying to winbind clients.
+
+Example:
+samba-tool gpo manage sudoers add {31B2F340-016D-11D2-945F-00C04FB984F9} 'fakeu ALL=(ALL) NOPASSWD: ALL'
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo", "entry"]
+
+ def run(self, gpo, entry, H=None, sambaopts=None, credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ pol_dir = '\\'.join([realm.lower(), 'Policies', gpo, 'MACHINE'])
+ pol_file = '\\'.join([pol_dir, 'Registry.pol'])
+ try:
+ pol_data = ndr_unpack(preg.file, conn.loadfile(pol_file))
+ except NTSTATUSError as e:
+ # STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_NAME_NOT_FOUND
+ if e.args[0] in [0xC0000033, 0xC0000034]:
+ pol_data = preg.file() # The file doesn't exist
+ elif e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ else:
+ raise
+
+ e = preg.entry()
+ e.keyname = b'Software\\Policies\\Samba\\Unix Settings\\Sudo Rights'
+ e.valuename = b'Software\\Policies\\Samba\\Unix Settings'
+ e.type = 1
+ e.data = get_bytes(entry)
+ entries = list(pol_data.entries)
+ entries.append(e)
+ pol_data.entries = entries
+ pol_data.num_entries = len(entries)
+
+ try:
+ create_directory_hier(conn, pol_dir)
+ conn.savefile(pol_file, ndr_pack(pol_data))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ raise
+
+class cmd_list_sudoers(Command):
+ """List Samba Sudoers Group Policy from the sysvol
+
+This command lists sudo rules from the sysvol that will be applied to winbind clients.
+
+Example:
+samba-tool gpo manage sudoers list {31B2F340-016D-11D2-945F-00C04FB984F9}
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo"]
+
+ def run(self, gpo, H=None, sambaopts=None, credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ pol_file = '\\'.join([realm.lower(), 'Policies', gpo,
+ 'MACHINE\\Registry.pol'])
+ try:
+ pol_data = ndr_unpack(preg.file, conn.loadfile(pol_file))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000033: # STATUS_OBJECT_NAME_INVALID
+ return # The file doesn't exist, so there is nothing to list
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ raise
+
+ keyname = b'Software\\Policies\\Samba\\Unix Settings\\Sudo Rights'
+ for entry in pol_data.entries:
+ if get_bytes(entry.keyname) == keyname:
+ self.outf.write('%s\n' % entry.data)
+
+class cmd_remove_sudoers(Command):
+ """Removes a Samba Sudoers Group Policy from the sysvol
+
+This command removes a sudo rule from the sysvol from applying to winbind clients.
+
+Example:
+samba-tool gpo manage sudoers remove {31B2F340-016D-11D2-945F-00C04FB984F9} 'fakeu ALL=(ALL) NOPASSWD: ALL'
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo", "entry"]
+
+ def run(self, gpo, entry, H=None, sambaopts=None, credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ pol_file = '\\'.join([realm.lower(), 'Policies', gpo,
+ 'MACHINE\\Registry.pol'])
+ try:
+ pol_data = ndr_unpack(preg.file, conn.loadfile(pol_file))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000033: # STATUS_OBJECT_NAME_INVALID
+ raise CommandError("The specified entry does not exist")
+ elif e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ raise
+
+ if entry not in [e.data for e in pol_data.entries]:
+ raise CommandError("Cannot remove '%s' because it does not exist" %
+ entry)
+
+ entries = [e for e in pol_data.entries if e.data != entry]
+ pol_data.num_entries = len(entries)
+ pol_data.entries = entries
+
+ try:
+ conn.savefile(pol_file, ndr_pack(pol_data))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ raise
+
+class cmd_sudoers(SuperCommand):
+ """Manage Sudoers Group Policy Objects"""
+ subcommands = {}
+ subcommands["add"] = cmd_add_sudoers()
+ subcommands["list"] = cmd_list_sudoers()
+ subcommands["remove"] = cmd_remove_sudoers()
+
+class cmd_set_security(Command):
+ """Set Samba Security Group Policy to the sysvol
+
+This command sets a security setting to the sysvol for applying to winbind
+clients. Not providing a value will unset the policy.
+These settings only apply to the ADDC.
+
+Example:
+samba-tool gpo manage security set {31B2F340-016D-11D2-945F-00C04FB984F9} MaxTicketAge 10
+
+Possible policies:
+MaxTicketAge Maximum lifetime for user ticket
+ Defined in hours
+
+MaxServiceAge Maximum lifetime for service ticket
+ Defined in minutes
+
+MaxRenewAge Maximum lifetime for user ticket renewal
+ Defined in minutes
+
+MinimumPasswordAge Minimum password age
+ Defined in days
+
+MaximumPasswordAge Maximum password age
+ Defined in days
+
+MinimumPasswordLength Minimum password length
+ Defined in characters
+
+PasswordComplexity Password must meet complexity requirements
+ 1 is Enabled, 0 is Disabled
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo", "policy", "value?"]
+
+ def run(self, gpo, policy, value=None, H=None, sambaopts=None,
+ credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ inf_dir = '\\'.join([realm.lower(), 'Policies', gpo,
+ 'MACHINE\\Microsoft\\Windows NT\\SecEdit'])
+ inf_file = '\\'.join([inf_dir, 'GptTmpl.inf'])
+ try:
+ inf_data = ConfigParser(interpolation=None)
+ inf_data.optionxform=str
+ raw = conn.loadfile(inf_file)
+ try:
+ inf_data.readfp(StringIO(raw.decode()))
+ except UnicodeDecodeError:
+ inf_data.readfp(StringIO(raw.decode('utf-16')))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ # STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND
+ if e.args[0] not in [0xC0000033, 0xC000003A]:
+ raise
+
+ section_map = { 'MaxTicketAge' : 'Kerberos Policy',
+ 'MaxServiceAge' : 'Kerberos Policy',
+ 'MaxRenewAge' : 'Kerberos Policy',
+ 'MinimumPasswordAge' : 'System Access',
+ 'MaximumPasswordAge' : 'System Access',
+ 'MinimumPasswordLength' : 'System Access',
+ 'PasswordComplexity' : 'System Access'
+ }
+
+ section = section_map[policy]
+ if not inf_data.has_section(section):
+ inf_data.add_section(section)
+ if value is not None:
+ inf_data.set(section, policy, value)
+ else:
+ inf_data.remove_option(section, policy)
+
+ out = StringIO()
+ inf_data.write(out)
+ try:
+ create_directory_hier(conn, inf_dir)
+ conn.savefile(inf_file, get_bytes(out.getvalue()))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ else:
+ raise
+
+class cmd_list_security(Command):
+ """List Samba Security Group Policy from the sysvol
+
+This command lists security settings from the sysvol that will be applied to winbind clients.
+These settings only apply to the ADDC.
+
+Example:
+samba-tool gpo manage security list {31B2F340-016D-11D2-945F-00C04FB984F9}
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo"]
+
+ def run(self, gpo, H=None, sambaopts=None, credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ inf_file = '\\'.join([realm.lower(), 'Policies', gpo,
+ 'MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf'])
+ try:
+ inf_data = ConfigParser(interpolation=None)
+ inf_data.optionxform=str
+ raw = conn.loadfile(inf_file)
+ try:
+ inf_data.readfp(StringIO(raw.decode()))
+ except UnicodeDecodeError:
+ inf_data.readfp(StringIO(raw.decode('utf-16')))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000033: # STATUS_OBJECT_NAME_INVALID
+ return # The file doesn't exist, so there is nothing to list
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
+ raise
+
+ for section in inf_data.sections():
+ if section not in ['Kerberos Policy', 'System Access']:
+ continue
+ for key, value in inf_data.items(section):
+ self.outf.write('%s = %s\n' % (key, value))
+
+class cmd_security(SuperCommand):
+ """Manage Security Group Policy Objects"""
+ subcommands = {}
+ subcommands["set"] = cmd_set_security()
+ subcommands["list"] = cmd_list_security()
+
+class cmd_list_smb_conf(Command):
+ """List Samba smb.conf Group Policy from the sysvol
+
+This command lists smb.conf settings from the sysvol that will be applied to winbind clients.
+
+Example:
+samba-tool gpo manage smb_conf list {31B2F340-016D-11D2-945F-00C04FB984F9}
+ """
+
+ synopsis = "%prog [options]"
+
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "versionopts": options.VersionOptions,
+ "credopts": options.CredentialsOptions,
+ }
+
+ takes_options = [
+ Option("-H", "--URL", help="LDB URL for database or target server", type=str,
+ metavar="URL", dest="H"),
+ ]
+
+ takes_args = ["gpo"]
+
+ def run(self, gpo, H=None, sambaopts=None, credopts=None, versionopts=None):
+ self.lp = sambaopts.get_loadparm()
+ self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
+
+ # We need to know writable DC to setup SMB connection
+ if H and H.startswith('ldap://'):
+ dc_hostname = H[7:]
+ self.url = H
+ else:
+ dc_hostname = netcmd_finddc(self.lp, self.creds)
+ self.url = dc_url(self.lp, self.creds, dc=dc_hostname)
+
+ # SMB connect to DC
+ conn = smb_connection(dc_hostname,
+ 'sysvol',
+ lp=self.lp,
+ creds=self.creds)
+
+ realm = self.lp.get('realm')
+ pol_file = '\\'.join([realm.lower(), 'Policies', gpo,
+ 'MACHINE\\Registry.pol'])
+ try:
+ pol_data = ndr_unpack(preg.file, conn.loadfile(pol_file))
+ except NTSTATUSError as e:
+ if e.args[0] == 0xC0000033: # STATUS_OBJECT_NAME_INVALID
+ return # The file doesn't exist, so there is nothing to list
+ if e.args[0] == 0xC0000022: # STATUS_ACCESS_DENIED
+ raise CommandError("The authenticated user does "
+ "not have sufficient privileges")
--
Samba Shared Repository
From kseeger at samba.org Wed Dec 9 11:46:02 2020
From: kseeger at samba.org (Karolin Seeger)
Date: Wed, 09 Dec 2020 11:46:02 +0000
Subject: [SCM] Samba Shared Repository - branch v4-12-test updated
Message-ID:
The branch, v4-12-test has been updated
via 86d4448396b vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
via eaa736faf67 vfs_zfsacl: reformatting
via 20480f70ce0 s4/samba: call force_check_log_size() in standard_new_task()
via 91f2f2dedb7 s4/samba: call force_check_log_size() in standard_accept_connection()
via 4e6fdf5d8d9 s4/samba: call force_check_log_size() in prefork_reload_after_fork()
via b50ef6fa897 s4: call reopen_logs_internal() in the SIGHUP handler of the prefork process model
via 1a6f2871036 s4: replace low-level SIGUP handler with a tevent handler
via 7299ebb1215 s4: install tevent tracing hooks to trigger logfile rotation
via 5b838f5075c s4: add samba server tevent trace helper stuff
via 6c881025bfa debug: detect logrotation by checking inode number
via 5cd1e3c5a4a debug: pass struct debug_class *config to do_one_check_log_size()
via f6bd782cb3b debug: pass struct debug_class *config to reopen_one_log()
via ccf971eef5c loadparm: setup debug subsystem setting max_log_size from config
via a30aaa499db s3: smbd: Quiet log messages from usershares for an unknown share.
from ecdddde3c53 vfs_glusterfs: print exact cmdline for disabling write-behind translator
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test
- Log -----------------------------------------------------------------
commit 86d4448396b9cb715e5dd9cb3d34eb0e5f0d5a76
Author: Ralph Boehme
Date: Mon Nov 30 12:28:58 2020 +0100
vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
This was an omission in the fixes for bug 14470.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14587
Signed-off-by: Ralph Boehme
Reviewed-by: Jeremy Allison