[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Tue Nov 27 09:39:02 UTC 2018
The branch, master has been updated
via bb7c3b7c8f6 winbind: Use dom_sid_str_buf
via 0d5287fb96a libcli: Use dom_sid_str_buf
via b289d15b85c libcli: Use dom_sid_str_buf
via 8be87034d40 idmap_cache: Use dom_sid_str_buf
via e168a6738b2 winbind: Fix "wbint_Principals" definition
via a1ca40e63cf winbind: Use dom_sid_str_buf
via f1446533369 winbind: Use dom_sid_str_buf
via d2b2d89770a winbind: Use dom_sid_str_buf
via 1d548457372 libgpo: Align integer types
via 1de97717893 libgpo: Use dom_sid_str_buf
via f2e939b65b4 libads: Give krb5_errs.c its own header
via aa1fac69695 vfs_shadow_copy2: in fstat also convert fsp->fsp_name and fsp->base_fsp->fsp_name
via 9c462e1b324 s3:smbd: pass down twrp from SMB2_CREATE to filename_convert()
via 14b6e6842b7 s3:smbd: add twrp args to filename_convert()
via c69bd336a17 s3:smbd: add twrp processing to filename_convert_internal()
via bffc540bc84 s3:smbd: prepare filename_convert_internal() for twrp
via cfffa2e2428 s3:selftest: add a VSS test reading a stream
via cf95756235f vfs_shadow_copy2: nicely deal with attempts to open previous version for writing
via 14d6488d355 vfs_shadow_copy2: add shadow_copy2_strip_snapshot_converted
via 87bf06ed790 vfs_shadow_copy2: add _already_converted arg to shadow_copy2_strip_snapshot_internal()
via 12778f01598 s3:script/tests: add a test for VSS write behaviour
via 48ddb87a32c s4:torture: add a test-suite for VSS
via 523a9b312c9 vfs_error_inject: add EBADF error
via 55a82f907f6 vfs_error_inject: add pwrite
from 0d15c2be6a2 tests: Rework backup test inheritance to make LP constraints clearer
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit bb7c3b7c8f600c8e5e0c35325968163d7ffa3c53
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 13:25:25 2018 +0100
winbind: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Nov 27 10:38:11 CET 2018 on sn-devel-144
commit 0d5287fb96a7ac9c29ff65af90a7e0c4d099fde1
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 13:16:56 2018 +0100
libcli: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b289d15b85cd7d2e92b4d63d53eb6ea4d97d72b9
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 13:16:56 2018 +0100
libcli: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8be87034d40e51a8dd897fa5dae01e1ec8ebc648
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 13:14:23 2018 +0100
idmap_cache: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e168a6738b287524738615046f65a3298d717b70
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 09:03:13 2018 +0100
winbind: Fix "wbint_Principals" definition
A signed integer does not make any sense for an IDL array length
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a1ca40e63cfc7e575091fae5522639722086b0b8
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 08:58:59 2018 +0100
winbind: Use dom_sid_str_buf
Also fix a DBG format string specifier
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f14465333697f24bce8fb8430b72c64bfcb519d6
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 08:55:13 2018 +0100
winbind: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d2b2d89770ae1c9175564cf165e0cf2ea1898399
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 08:53:45 2018 +0100
winbind: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1d5484573725cb97b0c16e32985c44b15807028d
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 08:50:47 2018 +0100
libgpo: Align integer types
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1de97717893fd9619b46eaa04c3024f3d6461295
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 08:49:44 2018 +0100
libgpo: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f2e939b65b4cd79f8f06a49297853d6896176664
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 12:34:50 2018 +0100
libads: Give krb5_errs.c its own header
The protos were declared in lib/krb5_wrap but the functions are not
available there.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit aa1fac696956f96e89e54ddd4535a6e2844161b0
Author: Ralph Boehme <slow at samba.org>
Date: Wed Nov 21 17:20:30 2018 +0100
vfs_shadow_copy2: in fstat also convert fsp->fsp_name and fsp->base_fsp->fsp_name
Stacked VFS modules might use the file name, not the file
handle. Looking at you, vfs_fruit...
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9c462e1b324ebad60c51bd6e8e659b39a31ec02e
Author: Ralph Boehme <slow at samba.org>
Date: Sat Nov 24 10:54:06 2018 +0100
s3:smbd: pass down twrp from SMB2_CREATE to filename_convert()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 14b6e6842b76d7c3e53249ba026a3ff51615ebd7
Author: Ralph Boehme <slow at samba.org>
Date: Sat Nov 24 10:45:49 2018 +0100
s3:smbd: add twrp args to filename_convert()
All existing callers pass NULL, no change in behaviour.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c69bd336a17ca04dbfb4f5d04a963d25b9925118
Author: Ralph Boehme <slow at samba.org>
Date: Sat Nov 24 09:05:37 2018 +0100
s3:smbd: add twrp processing to filename_convert_internal()
Not used for now, existing callers pass NULL.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit bffc540bc8459cbb1bd1a98528fb1d3b2b54d1d2
Author: Ralph Boehme <slow at samba.org>
Date: Sat Nov 24 08:56:49 2018 +0100
s3:smbd: prepare filename_convert_internal() for twrp
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit cfffa2e2428b42db65a4ece00602e0cef8ceb5a3
Author: Ralph Boehme <slow at samba.org>
Date: Fri Nov 23 14:36:56 2018 +0100
s3:selftest: add a VSS test reading a stream
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit cf95756235f718478e556ce1fbf7c032f9c9acfb
Author: Ralph Boehme <slow at samba.org>
Date: Fri Nov 23 14:08:15 2018 +0100
vfs_shadow_copy2: nicely deal with attempts to open previous version for writing
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 14d6488d355e960ab02e72c414cbbc316f1db718
Author: Ralph Boehme <slow at samba.org>
Date: Thu Nov 22 11:04:54 2018 +0100
vfs_shadow_copy2: add shadow_copy2_strip_snapshot_converted
Can be used by callers to determine if a path is in fact pointing at a
file in a snapshot. Will be used in the next commit.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 87bf06ed790dad8a4f650c0cd1b6781864666cbf
Author: Ralph Boehme <slow at samba.org>
Date: Thu Nov 22 11:02:24 2018 +0100
vfs_shadow_copy2: add _already_converted arg to shadow_copy2_strip_snapshot_internal()
Not used for now, all existing callers pass NULL.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 12778f015988f7e8755016c72c26939998758dae
Author: Ralph Boehme <slow at samba.org>
Date: Fri Nov 23 10:18:44 2018 +0100
s3:script/tests: add a test for VSS write behaviour
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 48ddb87a32ca44c2fcc5aac0cc28c5527dc7eade
Author: Ralph Boehme <slow at samba.org>
Date: Wed Nov 14 13:45:11 2018 +0100
s4:torture: add a test-suite for VSS
This test will not be run from the main torture test runner in selftest,
as there we don't pass the required arguments 'twrp_file' and
'twrp_snapshot'.
The test needs a carefully prepared environment with provisioned
snapshot data, so the test will be started from a blackbox test
script. That comes next.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 523a9b312c9f09178a5afefb48343e684e41d817
Author: Ralph Boehme <slow at samba.org>
Date: Fri Nov 23 10:18:10 2018 +0100
vfs_error_inject: add EBADF error
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 55a82f907f6410ff478e82b0cf7f1caeacaf5ddd
Author: Ralph Boehme <slow at samba.org>
Date: Fri Nov 23 10:07:29 2018 +0100
vfs_error_inject: add pwrite
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/krb5_wrap/krb5_samba.h | 3 -
libcli/security/secdesc.c | 9 +-
libcli/security/security_token.c | 7 +-
libgpo/gpo_reg.c | 20 +-
librpc/idl/winbind.idl | 2 +-
selftest/target/Samba3.pm | 9 +
source3/lib/idmap_cache.c | 3 +-
source3/libads/ads_status.c | 1 +
source3/libads/authdata.c | 1 +
source3/libads/kerberos.c | 1 +
source3/libads/krb5_errs.c | 2 +
.../krb5_errs.h} | 18 +-
source3/libnet/libnet_dssync.c | 1 +
source3/libnet/libnet_dssync_keytab.c | 1 +
source3/libsmb/cliconnect.c | 1 +
source3/modules/vfs_error_inject.c | 19 ++
source3/modules/vfs_shadow_copy2.c | 230 +++++++++++++++++++--
source3/passdb/machine_account_secrets.c | 1 +
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 2 +
source3/script/tests/test_shadow_copy_torture.sh | 114 ++++++++++
source3/selftest/tests.py | 3 +-
source3/smbd/filename.c | 32 ++-
source3/smbd/nttrans.c | 4 +
source3/smbd/open.c | 1 +
source3/smbd/proto.h | 1 +
source3/smbd/reply.c | 15 ++
source3/smbd/smb2_create.c | 30 +--
source3/smbd/smb2_query_directory.c | 1 +
source3/smbd/trans2.c | 8 +
source3/winbindd/wb_lookupsids.c | 10 +-
source3/winbindd/wb_query_user_list.c | 2 +-
source3/winbindd/winbindd_cred_cache.c | 1 +
source3/winbindd/winbindd_getgroups.c | 5 +-
source3/winbindd/winbindd_getusersids.c | 12 +-
source3/winbindd/winbindd_lookuprids.c | 2 +-
source3/winbindd/winbindd_pam.c | 17 +-
source4/torture/smb2/create.c | 174 ++++++++++++++++
source4/torture/smb2/smb2.c | 1 +
38 files changed, 675 insertions(+), 89 deletions(-)
copy source3/{printing/nt_printing_migrate_internal.h => libads/krb5_errs.h} (68%)
create mode 100755 source3/script/tests/test_shadow_copy_torture.sh
Changeset truncated at 500 lines:
diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h
index 8305c1f77af..fb3cb5f2ad8 100644
--- a/lib/krb5_wrap/krb5_samba.h
+++ b/lib/krb5_wrap/krb5_samba.h
@@ -188,9 +188,6 @@ krb5_error_code smb_krb5_renew_ticket(const char *ccache_string, const char *cli
krb5_error_code smb_krb5_gen_netbios_krb5_address(smb_krb5_addresses **kerb_addr,
const char *netbios_name);
krb5_error_code smb_krb5_free_addresses(krb5_context context, smb_krb5_addresses *addr);
-NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error);
-krb5_error_code nt_status_to_krb5(NTSTATUS nt_status);
-
krb5_enctype smb_krb5_kt_get_enctype_from_entry(krb5_keytab_entry *kt_entry);
krb5_error_code smb_krb5_enctype_to_string(krb5_context context,
diff --git a/libcli/security/secdesc.c b/libcli/security/secdesc.c
index 8cf44347c7c..53e0e023a7b 100644
--- a/libcli/security/secdesc.c
+++ b/libcli/security/secdesc.c
@@ -492,6 +492,7 @@ NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
const struct dom_sid *ptrustee = &ace->trustee;
const struct dom_sid *creator = NULL;
uint8_t new_flags = ace->flags;
+ struct dom_sid_buf sidbuf1, sidbuf2;
if (!is_inheritable_ace(ace, container)) {
continue;
@@ -540,9 +541,9 @@ NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
DEBUG(5,("se_create_child_secdesc(): %s:%d/0x%02x/0x%08x"
" inherited as %s:%d/0x%02x/0x%08x\n",
- dom_sid_string(frame, &ace->trustee),
+ dom_sid_str_buf(&ace->trustee, &sidbuf1),
ace->type, ace->flags, ace->access_mask,
- dom_sid_string(frame, &new_ace->trustee),
+ dom_sid_str_buf(&new_ace->trustee, &sidbuf2),
new_ace->type, new_ace->flags,
new_ace->access_mask));
@@ -565,9 +566,9 @@ NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
DEBUG(5, ("se_create_child_secdesc(): %s:%d/0x%02x/0x%08x "
" inherited as %s:%d/0x%02x/0x%08x\n",
- dom_sid_string(frame, &ace->trustee),
+ dom_sid_str_buf(&ace->trustee, &sidbuf1),
ace->type, ace->flags, ace->access_mask,
- dom_sid_string(frame, &new_ace->trustee),
+ dom_sid_str_buf(&new_ace->trustee, &sidbuf2),
new_ace->type, new_ace->flags,
new_ace->access_mask));
diff --git a/libcli/security/security_token.c b/libcli/security/security_token.c
index 2e5a87be504..de75033deae 100644
--- a/libcli/security/security_token.c
+++ b/libcli/security/security_token.c
@@ -62,8 +62,11 @@ void security_token_debug(int dbg_class, int dbg_lev, const struct security_toke
DEBUGC(dbg_class, dbg_lev, ("Security token SIDs (%lu):\n",
(unsigned long)token->num_sids));
for (i = 0; i < token->num_sids; i++) {
- DEBUGADDC(dbg_class, dbg_lev, (" SID[%3lu]: %s\n", (unsigned long)i,
- dom_sid_string(mem_ctx, &token->sids[i])));
+ struct dom_sid_buf sidbuf;
+ DEBUGADDC(dbg_class,
+ dbg_lev,
+ (" SID[%3lu]: %s\n", (unsigned long)i,
+ dom_sid_str_buf(&token->sids[i], &sidbuf)));
}
security_token_debug_privileges(dbg_class, dbg_lev, token);
diff --git a/libgpo/gpo_reg.c b/libgpo/gpo_reg.c
index 18d0498c7e9..644b4d36d62 100644
--- a/libgpo/gpo_reg.c
+++ b/libgpo/gpo_reg.c
@@ -26,6 +26,7 @@
#include "registry/reg_api_util.h"
#include "registry/reg_init_basic.h"
#include "../libcli/security/security.h"
+#include "libcli/security/dom_sid.h"
#include "../libcli/registry/util_reg.h"
@@ -306,12 +307,17 @@ static const char *gp_reg_groupmembership_path(TALLOC_CTX *mem_ctx,
const struct dom_sid *sid,
uint32_t flags)
{
+ struct dom_sid_buf sidbuf;
+
if (flags & GPO_LIST_FLAG_MACHINE) {
return "GroupMembership";
}
- return talloc_asprintf(mem_ctx, "%s\\%s", sid_string_tos(sid),
- "GroupMembership");
+ return talloc_asprintf(
+ mem_ctx,
+ "%s\\%s",
+ dom_sid_str_buf(sid, &sidbuf),
+ "GroupMembership");
}
/****************************************************************
@@ -342,7 +348,7 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
{
struct registry_key *key = NULL;
WERROR werr;
- int i = 0;
+ uint32_t i = 0;
const char *valname = NULL;
const char *path = NULL;
const char *val = NULL;
@@ -435,11 +441,17 @@ static const char *gp_req_state_path(TALLOC_CTX *mem_ctx,
const struct dom_sid *sid,
uint32_t flags)
{
+ struct dom_sid_buf sidbuf;
+
if (flags & GPO_LIST_FLAG_MACHINE) {
return GPO_REG_STATE_MACHINE;
}
- return talloc_asprintf(mem_ctx, "%s\\%s", "State", sid_string_tos(sid));
+ return talloc_asprintf(
+ mem_ctx,
+ "%s\\%s",
+ "State",
+ dom_sid_str_buf(sid, &sidbuf));
}
/****************************************************************
diff --git a/librpc/idl/winbind.idl b/librpc/idl/winbind.idl
index f5e3507bff5..258dd284ad5 100644
--- a/librpc/idl/winbind.idl
+++ b/librpc/idl/winbind.idl
@@ -120,7 +120,7 @@ interface winbind
} wbint_Principal;
typedef [public] struct {
- int num_principals;
+ uint32 num_principals;
[size_is(num_principals)] wbint_Principal principals[];
} wbint_Principals;
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 363840e4521..888f3bd5154 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2190,6 +2190,15 @@ sub provision($$$$$$$$$)
vfs objects = shadow_copy2
shadow:mountpoint = $shadow_mntdir
wide links = yes
+
+[shadow_write]
+ path = $shadow_tstdir
+ comment = previous versions snapshots under mount point
+ vfs objects = shadow_copy2 streams_xattr error_inject
+ aio write size = 0
+ error_inject:pwrite = EBADF
+ shadow:mountpoint = $shadow_tstdir
+
[dfq]
path = $shrdir/dfree
vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 1d87bbdec45..77618dd5aa1 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -414,6 +414,7 @@ bool idmap_cache_del_sid(const struct dom_sid *sid)
bool ret = true;
bool expired;
struct unixid id;
+ struct dom_sid_buf sidbuf;
const char *sid_key;
if (!idmap_cache_find_sid2unixid(sid, &id, &expired)) {
@@ -438,7 +439,7 @@ bool idmap_cache_del_sid(const struct dom_sid *sid)
}
}
- sid_key = key_sid2xid_str(mem_ctx, dom_sid_string(mem_ctx, sid));
+ sid_key = key_sid2xid_str(mem_ctx, dom_sid_str_buf(sid, &sidbuf));
if (sid_key == NULL) {
return false;
}
diff --git a/source3/libads/ads_status.c b/source3/libads/ads_status.c
index 70569949aeb..fb3646386ca 100644
--- a/source3/libads/ads_status.c
+++ b/source3/libads/ads_status.c
@@ -25,6 +25,7 @@
#include "system/gssapi.h"
#include "smb_ldap.h"
#include "libads/ads_status.h"
+#include "krb5_errs.h"
/*
build a ADS_STATUS structure
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
index d8a6487dc27..86a1be71bf9 100644
--- a/source3/libads/authdata.c
+++ b/source3/libads/authdata.c
@@ -32,6 +32,7 @@
#include "auth/gensec/gensec.h"
#include "auth/gensec/gensec_internal.h" /* TODO: remove this */
#include "../libcli/auth/spnego.h"
+#include "krb5_errs.h"
#ifdef HAVE_KRB5
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 58f38cdc55d..418e5a72243 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -31,6 +31,7 @@
#include "secrets.h"
#include "../lib/tsocket/tsocket.h"
#include "lib/util/asn1.h"
+#include "krb5_errs.h"
#ifdef HAVE_KRB5
diff --git a/source3/libads/krb5_errs.c b/source3/libads/krb5_errs.c
index 8eb5d8247b1..0c2ada59966 100644
--- a/source3/libads/krb5_errs.c
+++ b/source3/libads/krb5_errs.c
@@ -20,6 +20,8 @@
#include "includes.h"
#include "smb_krb5.h"
+#include "krb5_errs.h"
+
#ifdef HAVE_KRB5
static const struct {
diff --git a/source3/printing/nt_printing_migrate_internal.h b/source3/libads/krb5_errs.h
similarity index 68%
copy from source3/printing/nt_printing_migrate_internal.h
copy to source3/libads/krb5_errs.h
index dfcf9142e9b..57b6391ff74 100644
--- a/source3/printing/nt_printing_migrate_internal.h
+++ b/source3/libads/krb5_errs.h
@@ -1,8 +1,7 @@
/*
* Unix SMB/CIFS implementation.
- * RPC Pipe client / server routines
- *
- * Copyright (c) Andreas Schneider 2010.
+ * Kerberos error mapping functions
+ * Copyright (C) Guenther Deschner 2005
*
* 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
@@ -18,9 +17,14 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NT_PRINTING_MIGRATE_INTERNAL_H_
-#define _NT_PRINTING_MIGRATE_INTERNAL_H_
+#ifndef __KRB5_ERRS_H__
+#define __KRB5_ERRS_H__
+
+#include "replace.h"
+#include "libcli/util/ntstatus.h"
+#include <krb5.h>
-bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx);
+NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error);
+krb5_error_code nt_status_to_krb5(NTSTATUS nt_status);
-#endif /* _NT_PRINTING_MIGRATE_INTERNAL_H_ */
+#endif
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index e593ae8536c..2b6995bd566 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -25,6 +25,7 @@
#include "rpc_client/cli_pipe.h"
#include "../libcli/drsuapi/drsuapi.h"
#include "../librpc/gen_ndr/ndr_drsuapi_c.h"
+#include "libads/krb5_errs.h"
/****************************************************************
****************************************************************/
diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c
index 8999a3535fb..7526cd3294e 100644
--- a/source3/libnet/libnet_dssync_keytab.c
+++ b/source3/libnet/libnet_dssync_keytab.c
@@ -23,6 +23,7 @@
#include "libnet/libnet_dssync.h"
#include "libnet/libnet_keytab.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "libads/krb5_errs.h"
#if defined(HAVE_ADS)
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 837299d9220..0a54d47227a 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -41,6 +41,7 @@
#include "../libcli/smb/smb_seal.h"
#include "lib/param/param.h"
#include "../libcli/smb/smb2_negotiate_context.h"
+#include "libads/krb5_errs.h"
#define STAR_SMBSERVER "*SMBSERVER"
diff --git a/source3/modules/vfs_error_inject.c b/source3/modules/vfs_error_inject.c
index bb5477a449f..c8c3ea4701f 100644
--- a/source3/modules/vfs_error_inject.c
+++ b/source3/modules/vfs_error_inject.c
@@ -28,6 +28,7 @@ struct unix_error_map {
int error;
} unix_error_map_array[] = {
{ "ESTALE", ESTALE },
+ { "EBADF", EBADF },
};
static int find_unix_error_from_string(const char *err_str)
@@ -88,8 +89,26 @@ static int vfs_error_inject_chdir(vfs_handle_struct *handle,
return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
}
+static ssize_t vfs_error_inject_pwrite(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const void *data,
+ size_t n,
+ off_t offset)
+{
+ int error;
+
+ error = inject_unix_error("pwrite", handle);
+ if (error != 0) {
+ errno = error;
+ return -1;
+ }
+
+ return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+}
+
static struct vfs_fn_pointers vfs_error_inject_fns = {
.chdir_fn = vfs_error_inject_chdir,
+ .pwrite_fn = vfs_error_inject_pwrite,
};
static_decl_vfs;
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 79c1ee5cf33..0ddc01737bb 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -36,6 +36,8 @@
#include "include/ntioctl.h"
#include "util_tdb.h"
#include "lib/util_path.h"
+#include "libcli/security/security.h"
+#include "lib/util/tevent_unix.h"
struct shadow_copy2_config {
char *gmt_format;
@@ -587,7 +589,8 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
const char *orig_name,
time_t *ptimestamp,
char **pstripped,
- char **psnappath)
+ char **psnappath,
+ bool *_already_converted)
{
struct tm tm;
time_t timestamp = 0;
@@ -608,6 +611,10 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
DEBUG(10, (__location__ ": enter path '%s'\n", name));
+ if (_already_converted != NULL) {
+ *_already_converted = false;
+ }
+
abs_path = make_path_absolute(mem_ctx, priv, name);
if (abs_path == NULL) {
ret = false;
@@ -630,6 +637,9 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
}
if (already_converted) {
+ if (_already_converted != NULL) {
+ *_already_converted = true;
+ }
goto out;
}
@@ -759,9 +769,26 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
orig_name,
ptimestamp,
pstripped,
+ NULL,
NULL);
}
+static bool shadow_copy2_strip_snapshot_converted(TALLOC_CTX *mem_ctx,
+ struct vfs_handle_struct *handle,
+ const char *orig_name,
+ time_t *ptimestamp,
+ char **pstripped,
+ bool *is_converted)
+{
+ return shadow_copy2_strip_snapshot_internal(mem_ctx,
+ handle,
+ orig_name,
+ ptimestamp,
+ pstripped,
+ NULL,
+ is_converted);
+}
+
static char *shadow_copy2_find_mount_point(TALLOC_CTX *mem_ctx,
vfs_handle_struct *handle)
{
@@ -1119,12 +1146,14 @@ static int shadow_copy2_rename(vfs_handle_struct *handle,
if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
smb_fname_src->base_name,
- ×tamp_src, NULL, &snappath_src)) {
+ ×tamp_src, NULL, &snappath_src,
+ NULL)) {
return -1;
}
if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
smb_fname_dst->base_name,
- ×tamp_dst, NULL, &snappath_dst)) {
+ ×tamp_dst, NULL, &snappath_dst,
+ NULL)) {
return -1;
}
if (timestamp_src != 0) {
@@ -1163,7 +1192,8 @@ static int shadow_copy2_symlink(vfs_handle_struct *handle,
link_contents,
×tamp_old,
NULL,
- &snappath_old)) {
+ &snappath_old,
+ NULL)) {
return -1;
}
if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
@@ -1171,7 +1201,8 @@ static int shadow_copy2_symlink(vfs_handle_struct *handle,
new_smb_fname->base_name,
×tamp_new,
NULL,
- &snappath_new)) {
+ &snappath_new,
+ NULL)) {
return -1;
}
if ((timestamp_old != 0) || (timestamp_new != 0)) {
@@ -1202,7 +1233,8 @@ static int shadow_copy2_link(vfs_handle_struct *handle,
old_smb_fname->base_name,
×tamp_old,
NULL,
- &snappath_old)) {
+ &snappath_old,
+ NULL)) {
return -1;
}
if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
@@ -1210,7 +1242,8 @@ static int shadow_copy2_link(vfs_handle_struct *handle,
new_smb_fname->base_name,
×tamp_new,
NULL,
- &snappath_new)) {
+ &snappath_new,
+ NULL)) {
return -1;
}
if ((timestamp_old != 0) || (timestamp_new != 0)) {
@@ -1321,21 +1354,63 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
time_t timestamp = 0;
+ struct smb_filename *orig_smb_fname = NULL;
+ struct smb_filename vss_smb_fname;
+ struct smb_filename *orig_base_smb_fname = NULL;
+ struct smb_filename vss_base_smb_fname;
+ char *stripped = NULL;
+ int saved_errno = 0;
+ bool ok;
int ret;
+ ok = shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ fsp->fsp_name->base_name,
+ ×tamp, &stripped);
+ if (!ok) {
+ return -1;
+ }
+
+ if (timestamp == 0) {
+ TALLOC_FREE(stripped);
+ return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
+ }
+
+ vss_smb_fname = *fsp->fsp_name;
+ vss_smb_fname.base_name = shadow_copy2_convert(talloc_tos(),
+ handle,
+ stripped,
--
Samba Shared Repository
More information about the samba-cvs
mailing list