[SCM] Samba Shared Repository - branch v4-0-test updated
Karolin Seeger
kseeger at samba.org
Fri Feb 14 14:36:05 MST 2014
The branch, v4-0-test has been updated
via c10bc88 s3: modules: streaminfo: As we have no VFS function SMB_VFS_LLISTXATTR we can't cope with a symlink when lp_posix_pathnames() is true.
via 3d666cb s3: vfs_dirsort module.
via c86c98d s3: vfs_dirsort module.
via 9e39883 smbd: Fix an ancient oplock bug
via f847b5d kdc: Add belts-and-braces check that we fail if the hdb version changes
via 3bbccc5 Support for Heimdal's unified krb5 and hdb plugin system.
via 4b914d3 Cope with first element in hdb_method having a different name in different heimdal versions.
via 68048a5 smbd: Fix memory overwrites
from e8769b7 s3-winbind: Improve performance of wb_fill_pwent_sid2uid_done().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit c10bc8830df84797166742e3d628deb39ea59f26
Author: Jeremy Allison <jra at samba.org>
Date: Fri Feb 7 10:19:26 2014 -0800
s3: modules: streaminfo: As we have no VFS function SMB_VFS_LLISTXATTR we can't cope with a symlink when lp_posix_pathnames() is true.
Fix bug : Bug 10429 - samba returns STATUS_OBJECT_NAME_NOT_FOUND when attempting to remove dangling symlink
https://bugzilla.samba.org/show_bug.cgi?id=10429
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Jeff Layton <jlayton at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Feb 8 00:01:16 CET 2014 on sn-devel-104
(cherry picked from commit 17adbbcad7e401dd544dfa76f7ec9aeb6a847381)
Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-0-test): Fri Feb 14 22:35:40 CET 2014 on sn-devel-104
commit 3d666cb865c5b72fbc9131435d1ca08392e15aa6
Author: Jeremy Allison <jra at samba.org>
Date: Tue Feb 11 10:39:04 2014 -0800
s3: vfs_dirsort module.
Add raw.search torture test on a share definition with:
vfs objects = dirsort
https://bugzilla.samba.org/show_bug.cgi?id=10406
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 30cc8f41da58b87ff575860b7cde640520829923)
commit c86c98d18e2b0719238341d6b8d5554a9abaa350
Author: Jeremy Allison <jra at samba.org>
Date: Wed Jan 29 17:01:30 2014 -0800
s3: vfs_dirsort module.
Allow dirsort to work when multiple simultaneous
directories are open. The old code only keeps one
active private data pointer on the connection struct, opening
a second directory on the same connection will overwrite it.
This modification turns the private data pointer
into a linked list of open directories on the
connection struct, and finds the correct one by searching
on the passed in DIR *.
With this code in place, smbd passes raw.search
torture test on a share definition with:
vfs objects = dirsort
https://bugzilla.samba.org/show_bug.cgi?id=10406
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(back-ported from commit fd79652b0e598882e0c4d156bd897c29dae8ec04)
commit 9e398837bab5e520429fc93e3277f00b6081559c
Author: Volker Lendecke <vl at samba.org>
Date: Wed Sep 4 13:57:00 2013 +0200
smbd: Fix an ancient oplock bug
If we get an oplock break response, we forgot to remove the oplock break
timeout.
Found by stopping raw.oplock.exclusive5 after the 2nd open and watching a debug
level 10 log. This amends 08a9de89 from 2007.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 0670975261c5f29394f9e9d25f899a7de948dad1)
Fix bug #10436 - cancel fsp->oplock_timeout in downgrade_file_oplock().
commit f847b5dba7b6646cd28751e22a4d2f30fda51917
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Jan 14 11:23:04 2014 +1300
kdc: Add belts-and-braces check that we fail if the hdb version changes
This checks both if host system run-time Heimdal has changed version,
and that the build-time version is supported.
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-By: Jelmer Vernooij <jelmer at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Jan 20 22:26:49 CET 2014 on sn-devel-104
(cherry picked from commit e758f4111356fafce5b5c8393648c9ea5c400601)
The last 3 patches address bug #10418 - INTERNAL ERROR: Signal 11 in the kdc
pid.
commit 3bbccc5acf1358a76727a2739d80e85fd4c49e39
Author: Jeffrey Clark <dude at zaplabs.com>
Date: Fri Jan 10 17:20:14 2014 -0600
Support for Heimdal's unified krb5 and hdb plugin system.
Fixes exportkeytab and a kdc crash when building against heimdal master.
Bug-Debian: http://bugs.debian.org/732342
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
(cherry picked from commit 368208069e33a6d9b78a90f7326d5ac1bdd204f7)
commit 4b914d346e07a65a4eef567ffd82e8baee3e24cf
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sat Nov 23 19:46:29 2013 +0000
Cope with first element in hdb_method having a different name in different heimdal versions.
It's called `interface_version` in older Heimdal versions and
`version` in newer versions.
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Nov 28 04:17:55 CET 2013 on sn-devel-104
(cherry picked from commit 92489bfed4e6350b6858d5e39d538f41768912ae)
commit 68048a5e30465c0991baa487d75ac1b75e0106de
Author: Volker Lendecke <vl at samba.org>
Date: Mon Feb 10 10:08:46 2014 -0800
smbd: Fix memory overwrites
SIVAL writes 32 bit, not 16
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
Back-ported-from master git commit : 9088bde059e93a84745ec2158e2e640b5bb13844
Fix bug #10415 - *** glibc detected *** /usr/sbin/smbd: free(): invalid next
size (fast).
-----------------------------------------------------------------------
Summary of changes:
selftest/target/Samba3.pm | 4 +
source3/modules/vfs_dirsort.c | 119 ++++++++++++++++++++++++++++++++--
source3/modules/vfs_streams_depot.c | 13 ++++-
source3/modules/vfs_streams_xattr.c | 13 ++++-
source3/selftest/tests.py | 5 ++
source3/smbd/oplock.c | 2 +
source3/smbd/smb2_ioctl.c | 4 +-
source4/kdc/hdb-samba4-plugin.c | 24 +++++++-
source4/kdc/hdb-samba4.c | 5 ++
9 files changed, 177 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 792bbca..59a9f79 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -933,6 +933,10 @@ sub provision($$$$$$)
[tmp]
path = $shrdir
comment = smb username is [%U]
+[tmpsort]
+ path = $shrdir
+ comment = Load dirsort module
+ vfs objects = dirsort acl_xattr fake_acls xattr_tdb streams_depot
[tmpenc]
path = $shrdir
comment = encrypt smb username is [%U]
diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c
index 64d74d5..72b46c9 100644
--- a/source3/modules/vfs_dirsort.c
+++ b/source3/modules/vfs_dirsort.c
@@ -28,6 +28,7 @@ static int compare_dirent (const struct dirent *da, const struct dirent *db)
}
struct dirsort_privates {
+ struct dirsort_privates *prev, *next;
long pos;
struct dirent *directory_list;
unsigned int number_of_entries;
@@ -37,10 +38,6 @@ struct dirsort_privates {
struct smb_filename *smb_fname; /* If open via OPENDIR */
};
-static void free_dirsort_privates(void **datap) {
- TALLOC_FREE(*datap);
-}
-
static bool get_sorted_dir_mtime(vfs_handle_struct *handle,
struct dirsort_privates *data,
struct timespec *ret_mtime)
@@ -120,8 +117,15 @@ static DIR *dirsort_opendir(vfs_handle_struct *handle,
uint32 attr)
{
NTSTATUS status;
+ struct dirsort_privates *list_head = NULL;
struct dirsort_privates *data = NULL;
+ if (SMB_VFS_HANDLE_TEST_DATA(handle)) {
+ /* Find the list head of all open directories. */
+ SMB_VFS_HANDLE_GET_DATA(handle, list_head, struct dirsort_privates,
+ return NULL);
+ }
+
/* set up our private data about this directory */
data = talloc_zero(handle->conn, struct dirsort_privates);
if (!data) {
@@ -153,7 +157,9 @@ static DIR *dirsort_opendir(vfs_handle_struct *handle,
return NULL;
}
- SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates,
+ /* Add to the private list of all open directories. */
+ DLIST_ADD(list_head, data);
+ SMB_VFS_HANDLE_SET_DATA(handle, list_head, NULL,
struct dirsort_privates, return NULL);
return data->source_directory;
@@ -164,8 +170,15 @@ static DIR *dirsort_fdopendir(vfs_handle_struct *handle,
const char *mask,
uint32 attr)
{
+ struct dirsort_privates *list_head = NULL;
struct dirsort_privates *data = NULL;
+ if (SMB_VFS_HANDLE_TEST_DATA(handle)) {
+ /* Find the list head of all open directories. */
+ SMB_VFS_HANDLE_GET_DATA(handle, list_head, struct dirsort_privates,
+ return NULL);
+ }
+
/* set up our private data about this directory */
data = talloc_zero(handle->conn, struct dirsort_privates);
if (!data) {
@@ -191,7 +204,9 @@ static DIR *dirsort_fdopendir(vfs_handle_struct *handle,
return NULL;
}
- SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates,
+ /* Add to the private list of all open directories. */
+ DLIST_ADD(list_head, data);
+ SMB_VFS_HANDLE_SET_DATA(handle, list_head, NULL,
struct dirsort_privates, return NULL);
return data->source_directory;
@@ -207,12 +222,20 @@ static struct dirent *dirsort_readdir(vfs_handle_struct *handle,
SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates,
return NULL);
+ while(data && (data->source_directory != dirp)) {
+ data = data->next;
+ }
+ if (data == NULL) {
+ return NULL;
+ }
+
if (get_sorted_dir_mtime(handle, data, ¤t_mtime) == false) {
return NULL;
}
/* throw away cache and re-read the directory if we've changed */
- if (timespec_compare(¤t_mtime, &data->mtime) > 1) {
+ if (timespec_compare(¤t_mtime, &data->mtime)) {
+ SMB_VFS_NEXT_REWINDDIR(handle, data->source_directory);
open_and_sort_dir(handle, data);
}
@@ -226,10 +249,53 @@ static struct dirent *dirsort_readdir(vfs_handle_struct *handle,
static void dirsort_seekdir(vfs_handle_struct *handle, DIR *dirp,
long offset)
{
+ struct timespec current_mtime;
struct dirsort_privates *data = NULL;
+
SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, return);
+ /* Find the entry holding dirp. */
+ while(data && (data->source_directory != dirp)) {
+ data = data->next;
+ }
+ if (data == NULL) {
+ return;
+ }
+ if (offset > data->number_of_entries) {
+ return;
+ }
data->pos = offset;
+
+ if (get_sorted_dir_mtime(handle, data, ¤t_mtime) == false) {
+ return;
+ }
+
+ if (timespec_compare(¤t_mtime, &data->mtime)) {
+ /* Directory changed. We must re-read the
+ cache and search for the name that was
+ previously stored at the offset being
+ requested, otherwise after the re-sort
+ we will point to the wrong entry. The
+ OS/2 incremental delete code relies on
+ this. */
+ unsigned int i;
+ char *wanted_name = talloc_strdup(handle->conn,
+ data->directory_list[offset].d_name);
+ if (wanted_name == NULL) {
+ return;
+ }
+ SMB_VFS_NEXT_REWINDDIR(handle, data->source_directory);
+ open_and_sort_dir(handle, data);
+ /* Now search for where we were. */
+ data->pos = 0;
+ for (i = 0; i < data->number_of_entries; i++) {
+ if(strcmp(wanted_name, data->directory_list[i].d_name) == 0) {
+ data->pos = i;
+ break;
+ }
+ }
+ TALLOC_FREE(wanted_name);
+ }
}
static long dirsort_telldir(vfs_handle_struct *handle, DIR *dirp)
@@ -238,6 +304,13 @@ static long dirsort_telldir(vfs_handle_struct *handle, DIR *dirp)
SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates,
return -1);
+ /* Find the entry holding dirp. */
+ while(data && (data->source_directory != dirp)) {
+ data = data->next;
+ }
+ if (data == NULL) {
+ return -1;
+ }
return data->pos;
}
@@ -246,9 +319,40 @@ static void dirsort_rewinddir(vfs_handle_struct *handle, DIR *dirp)
struct dirsort_privates *data = NULL;
SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, return);
+ /* Find the entry holding dirp. */
+ while(data && (data->source_directory != dirp)) {
+ data = data->next;
+ }
+ if (data == NULL) {
+ return;
+ }
data->pos = 0;
}
+static int dirsort_closedir(vfs_handle_struct *handle, DIR *dirp)
+{
+ struct dirsort_privates *list_head = NULL;
+ struct dirsort_privates *data = NULL;
+ int ret;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, list_head, struct dirsort_privates, return -1);
+ /* Find the entry holding dirp. */
+ for(data = list_head; data && (data->source_directory != dirp); data = data->next) {
+ ;
+ }
+ if (data == NULL) {
+ return -1;
+ }
+ /* Remove from the list and re-store the list head. */
+ DLIST_REMOVE(list_head, data);
+ SMB_VFS_HANDLE_SET_DATA(handle, list_head, NULL,
+ struct dirsort_privates, return -1);
+
+ ret = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
+ TALLOC_FREE(data);
+ return ret;
+}
+
static struct vfs_fn_pointers vfs_dirsort_fns = {
.opendir_fn = dirsort_opendir,
.fdopendir_fn = dirsort_fdopendir,
@@ -256,6 +360,7 @@ static struct vfs_fn_pointers vfs_dirsort_fns = {
.seekdir_fn = dirsort_seekdir,
.telldir_fn = dirsort_telldir,
.rewind_dir_fn = dirsort_rewinddir,
+ .closedir_fn = dirsort_closedir,
};
NTSTATUS vfs_dirsort_init(void)
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 620a580..202cc78 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -892,8 +892,19 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
state.handle = handle;
state.status = NT_STATUS_OK;
- status = walk_streams(handle, smb_fname_base, NULL, collect_one_stream,
+ if (S_ISLNK(smb_fname_base->st.st_ex_mode)) {
+ /*
+ * Currently we do't have SMB_VFS_LLISTXATTR
+ * inside the VFS which means there's no way
+ * to cope with a symlink when lp_posix_pathnames().
+ * returns true. For now ignore links.
+ * FIXME - by adding SMB_VFS_LLISTXATTR. JRA.
+ */
+ status = NT_STATUS_OK;
+ } else {
+ status = walk_streams(handle, smb_fname_base, NULL, collect_one_stream,
&state);
+ }
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(state.streams);
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 6650021..c4d86ee 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -799,8 +799,19 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
state.handle = handle;
state.status = NT_STATUS_OK;
- status = walk_xattr_streams(handle->conn, fsp, fname,
+ if (S_ISLNK(sbuf.st_ex_mode)) {
+ /*
+ * Currently we do't have SMB_VFS_LLISTXATTR
+ * inside the VFS which means there's no way
+ * to cope with a symlink when lp_posix_pathnames().
+ * returns true. For now ignore links.
+ * FIXME - by adding SMB_VFS_LLISTXATTR. JRA.
+ */
+ status = NT_STATUS_OK;
+ } else {
+ status = walk_xattr_streams(handle->conn, fsp, fname,
collect_one_stream, &state);
+ }
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(state.streams);
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index a968665..2965aae 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -340,6 +340,11 @@ for t in tests:
plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio')
plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
+ elif t == "raw.search":
+ plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
+# test the dirsort module.
+ plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmpsort -U$USERNAME%$PASSWORD')
+ plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
else:
plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 406ffd1..95d88ef 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -150,6 +150,8 @@ static void downgrade_file_oplock(files_struct *fsp)
sconn->oplocks.exclusive_open--;
sconn->oplocks.level_II_open++;
fsp->sent_oplock_break = NO_BREAK_SENT;
+
+ TALLOC_FREE(fsp->oplock_timeout);
}
/****************************************************************************
diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index c46520a..8d24fb5 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -569,8 +569,8 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
SIVAL(state->out_output.data, 0x00, conn->smb2.server.capabilities);
memcpy(state->out_output.data+0x04, out_guid_blob.data, 16);
- SIVAL(state->out_output.data, 0x14, conn->smb2.server.security_mode);
- SIVAL(state->out_output.data, 0x16, conn->smb2.server.dialect);
+ SSVAL(state->out_output.data, 0x14, conn->smb2.server.security_mode);
+ SSVAL(state->out_output.data, 0x16, conn->smb2.server.dialect);
tevent_req_done(req);
return tevent_req_post(req, ev);
diff --git a/source4/kdc/hdb-samba4-plugin.c b/source4/kdc/hdb-samba4-plugin.c
index 568386d..6f76124 100644
--- a/source4/kdc/hdb-samba4-plugin.c
+++ b/source4/kdc/hdb-samba4-plugin.c
@@ -60,6 +60,8 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db,
if (NT_STATUS_IS_OK(nt_status)) {
return 0;
+ } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION)) {
+ return EINVAL;
} else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_CANT_ACCESS_DOMAIN_INFO)) {
krb5_set_error_message(context, EINVAL, "Failed to open Samba4 LDB at %s", lpcfg_private_path(base_ctx, base_ctx->lp_ctx, "sam.ldb"));
@@ -70,6 +72,22 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db,
return EINVAL;
}
+#if (HDB_INTERFACE_VERSION != 8 && HDB_INTERFACE_VERSION != 7)
+#error "Unsupported Heimdal HDB version"
+#endif
+
+#if HDB_INTERFACE_VERSION >= 8
+static krb5_error_code hdb_samba4_init(krb5_context context, void **ctx)
+{
+ *ctx = NULL;
+ return 0;
+}
+
+static void hdb_samba4_fini(void *ctx)
+{
+}
+#endif
+
/* Only used in the hdb-backed keytab code
* for a keytab of 'samba4&<address>' or samba4, to find
* kpasswd's key in the main DB, and to
@@ -78,7 +96,11 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db,
* The <address> is the string form of a pointer to a talloced struct hdb_samba_context
*/
struct hdb_method hdb_samba4_interface = {
- .interface_version = HDB_INTERFACE_VERSION,
+ HDB_INTERFACE_VERSION,
+#if HDB_INTERFACE_VERSION >= 8
+ .init = hdb_samba4_init,
+ .fini = hdb_samba4_fini,
+#endif
.prefix = "samba4",
.create = hdb_samba4_create
};
diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c
index 6a9e558..4519fb9 100644
--- a/source4/kdc/hdb-samba4.c
+++ b/source4/kdc/hdb-samba4.c
@@ -176,6 +176,11 @@ NTSTATUS hdb_samba4_create_kdc(struct samba_kdc_base_context *base_ctx,
struct samba_kdc_db_context *kdc_db_ctx;
NTSTATUS nt_status;
+ if (hdb_interface_version != HDB_INTERFACE_VERSION) {
+ krb5_set_error_message(context, EINVAL, "Heimdal HDB interface version mismatch between build-time and run-time libraries!");
+ return NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION;
+ }
+
*db = talloc(base_ctx, HDB);
if (!*db) {
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
--
Samba Shared Repository
More information about the samba-cvs
mailing list