[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Thu Feb 25 19:47:03 UTC 2016
The branch, master has been updated
via cd1335e VFS: Modify rmdir to take a const struct smb_filename * instead of const char *
via de2bc1b vfs:ceph: Fix mkdir_fn to take struct smb_filename * insted of char *
via 72333a6 vfs:glusterfs: Fix mkdir_fn to take struct smb_filename * instead of char *
from 0c61dd1 lib/util: Expose strv_addn() for adding string with specified length
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cd1335e67dbfce0b6894ff209aa805d0314578da
Author: Jeremy Allison <jra at samba.org>
Date: Wed Feb 24 14:02:45 2016 -0800
VFS: Modify rmdir to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames().
Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8
(synthetic_smb_fname()) to cope with modules that
modify the incoming pathname.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
Autobuild-User(master): Michael Adam <obnox at samba.org>
Autobuild-Date(master): Thu Feb 25 20:46:49 CET 2016 on sn-devel-144
commit de2bc1bc3890bcdd1b3b97ecc3d7e96f58ff50d3
Author: Jeremy Allison <jra at samba.org>
Date: Wed Feb 24 14:00:27 2016 -0800
vfs:ceph: Fix mkdir_fn to take struct smb_filename * insted of char *
Missed in previous VFS change.
Signed-off-by: Jeremy Allison <jra at samba.org>
commit 72333a685526f6ac5699f076c8dd0e0ecddd3a33
Author: Jeremy Allison <jra at samba.org>
Date: Wed Feb 24 13:58:16 2016 -0800
vfs:glusterfs: Fix mkdir_fn to take struct smb_filename * instead of char *
Missed in previous VFS change.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_opaque.c | 3 ++-
examples/VFS/skel_transparent.c | 5 +++--
source3/include/vfs.h | 8 +++++--
source3/include/vfs_macros.h | 8 +++----
source3/modules/vfs_acl_common.c | 10 ++++-----
source3/modules/vfs_acl_tdb.c | 7 +++---
source3/modules/vfs_audit.c | 7 +++---
source3/modules/vfs_cap.c | 19 +++++++++++++---
source3/modules/vfs_catia.c | 21 ++++++++++++++----
source3/modules/vfs_ceph.c | 12 +++++++----
source3/modules/vfs_default.c | 5 +++--
source3/modules/vfs_extd_audit.c | 9 ++++----
source3/modules/vfs_fruit.c | 6 ++++--
source3/modules/vfs_full_audit.c | 7 +++---
source3/modules/vfs_glusterfs.c | 10 +++++----
source3/modules/vfs_media_harmony.c | 25 ++++++++++-----------
source3/modules/vfs_netatalk.c | 6 ++++--
source3/modules/vfs_posix_eadb.c | 6 ++++--
source3/modules/vfs_shadow_copy2.c | 24 ++++++++++++++++-----
source3/modules/vfs_snapper.c | 19 ++++++++++++----
source3/modules/vfs_streams_depot.c | 43 +++++++++++++++++++++++++++++++------
source3/modules/vfs_syncops.c | 5 +++--
source3/modules/vfs_time_audit.c | 8 ++++---
source3/modules/vfs_unityed_media.c | 24 ++++++++++-----------
source3/modules/vfs_xattr_tdb.c | 6 ++++--
source3/smbd/close.c | 9 ++++----
source3/smbd/vfs.c | 5 +++--
source3/torture/cmd_vfs.c | 20 ++++++++++-------
28 files changed, 222 insertions(+), 115 deletions(-)
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 9a855bc..8961627 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -165,7 +165,8 @@ static int skel_mkdir(vfs_handle_struct *handle,
return -1;
}
-static int skel_rmdir(vfs_handle_struct *handle, const char *path)
+static int skel_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
errno = ENOSYS;
return -1;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index ac8cbc8..ac82432 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -164,9 +164,10 @@ static int skel_mkdir(vfs_handle_struct *handle,
return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
}
-static int skel_rmdir(vfs_handle_struct *handle, const char *path)
+static int skel_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
- return SMB_VFS_NEXT_RMDIR(handle, path);
+ return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
}
static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 48bacb0..b291206 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -175,6 +175,8 @@
const struct smb_filename * */
/* Version 35 - Change mkdir from const char *, to
const struct smb_filename * */
+/* Version 35 - Change rmdir from const char *, to
+ const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 35
@@ -559,7 +561,8 @@ struct vfs_fn_pointers {
int (*mkdir_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
mode_t mode);
- int (*rmdir_fn)(struct vfs_handle_struct *handle, const char *path);
+ int (*rmdir_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname);
int (*closedir_fn)(struct vfs_handle_struct *handle, DIR *dir);
void (*init_search_op_fn)(struct vfs_handle_struct *handle, DIR *dirp);
@@ -978,7 +981,8 @@ void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
int smb_vfs_call_mkdir(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
mode_t mode);
-int smb_vfs_call_rmdir(struct vfs_handle_struct *handle, const char *path);
+int smb_vfs_call_rmdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname);
int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
DIR *dir);
void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 758938a..e50c6a6 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -114,10 +114,10 @@
#define SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode) \
smb_vfs_call_mkdir((handle)->next,(smb_fname), (mode))
-#define SMB_VFS_RMDIR(conn, path) \
- smb_vfs_call_rmdir((conn)->vfs_handles, (path))
-#define SMB_VFS_NEXT_RMDIR(handle, path) \
- smb_vfs_call_rmdir((handle)->next, (path))
+#define SMB_VFS_RMDIR(conn, smb_fname) \
+ smb_vfs_call_rmdir((conn)->vfs_handles, (smb_fname))
+#define SMB_VFS_NEXT_RMDIR(handle, smb_fname) \
+ smb_vfs_call_rmdir((handle)->next, (smb_fname))
#define SMB_VFS_CLOSEDIR(conn, dir) \
smb_vfs_call_closedir((conn)->vfs_handles, dir)
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 30574e0..0c0cf83 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -1007,7 +1007,7 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
become_root();
if (is_directory) {
- ret = SMB_VFS_NEXT_RMDIR(handle, final_component);
+ ret = SMB_VFS_NEXT_RMDIR(handle, &local_fname);
} else {
ret = SMB_VFS_NEXT_UNLINK(handle, &local_fname);
}
@@ -1031,12 +1031,12 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
}
static int rmdir_acl_common(struct vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
int ret;
/* Try the normal rmdir first. */
- ret = SMB_VFS_NEXT_RMDIR(handle, path);
+ ret = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
if (ret == 0) {
return 0;
}
@@ -1044,12 +1044,12 @@ static int rmdir_acl_common(struct vfs_handle_struct *handle,
/* Failed due to access denied,
see if we need to root override. */
return acl_common_remove_object(handle,
- path,
+ smb_fname->base_name,
true);
}
DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n",
- path,
+ smb_fname->base_name,
strerror(errno) ));
return -1;
}
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 62559a2..54edb87 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -275,19 +275,20 @@ static int unlink_acl_tdb(vfs_handle_struct *handle,
On rmdir we need to delete the tdb record (if using tdb).
*********************************************************************/
-static int rmdir_acl_tdb(vfs_handle_struct *handle, const char *path)
+static int rmdir_acl_tdb(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
SMB_STRUCT_STAT sbuf;
struct db_context *db = acl_db;
int ret = -1;
- ret = vfs_stat_smb_basename(handle->conn, path, &sbuf);
+ ret = vfs_stat_smb_basename(handle->conn, smb_fname->base_name, &sbuf);
if (ret == -1) {
return -1;
}
- ret = rmdir_acl_common(handle, path);
+ ret = rmdir_acl_common(handle, smb_fname);
if (ret == -1) {
return -1;
}
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index 8905d1f..e16355a 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -136,14 +136,15 @@ static int audit_mkdir(vfs_handle_struct *handle,
return result;
}
-static int audit_rmdir(vfs_handle_struct *handle, const char *path)
+static int audit_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
int result;
- result = SMB_VFS_NEXT_RMDIR(handle, path);
+ result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n",
- path,
+ smb_fname->base_name,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index b09a443..fb97412 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -122,15 +122,28 @@ static int cap_mkdir(vfs_handle_struct *handle,
return SMB_VFS_NEXT_MKDIR(handle, cap_smb_fname, mode);
}
-static int cap_rmdir(vfs_handle_struct *handle, const char *path)
+static int cap_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
- char *cappath = capencode(talloc_tos(), path);
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+ struct smb_filename *cap_smb_fname = NULL;
if (!cappath) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_RMDIR(handle, cappath);
+
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ cappath,
+ NULL,
+ NULL);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(cappath);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ return SMB_VFS_NEXT_RMDIR(handle, cap_smb_fname);
}
static int cap_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 524d987..f65ed4c 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -570,21 +570,34 @@ static int catia_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
}
static int catia_rmdir(vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
char *name = NULL;
NTSTATUS status;
int ret;
+ struct smb_filename *catia_smb_fname = NULL;
- status = catia_string_replace_allocate(handle->conn, path,
- &name, vfs_translate_to_unix);
+ status = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
}
+ catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+ name,
+ NULL,
+ NULL);
+ if (catia_smb_fname == NULL) {
+ TALLOC_FREE(name);
+ errno = ENOMEM;
+ return -1;
+ }
- ret = SMB_VFS_NEXT_RMDIR(handle, name);
+ ret = SMB_VFS_NEXT_RMDIR(handle, catia_smb_fname);
TALLOC_FREE(name);
+ TALLOC_FREE(catia_smb_fname);
return ret;
}
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index d51499d..a56740a 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -326,11 +326,14 @@ static void cephwrap_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
ceph_rewinddir(handle->data, (struct ceph_dir_result *) dirp);
}
-static int cephwrap_mkdir(struct vfs_handle_struct *handle, const char *path, mode_t mode)
+static int cephwrap_mkdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
bool has_dacl = False;
char *parent = NULL;
+ const char *path = smb_fname->base_name;
DEBUG(10, ("[CEPH] mkdir(%p, %s)\n", handle, path));
@@ -364,12 +367,13 @@ static int cephwrap_mkdir(struct vfs_handle_struct *handle, const char *path, m
return result;
}
-static int cephwrap_rmdir(struct vfs_handle_struct *handle, const char *path)
+static int cephwrap_rmdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
int result;
- DEBUG(10, ("[CEPH] rmdir(%p, %s)\n", handle, path));
- result = ceph_rmdir(handle->data, path);
+ DEBUG(10, ("[CEPH] rmdir(%p, %s)\n", handle, smb_fname->base_name));
+ result = ceph_rmdir(handle->data, smb_fname->base_name);
DEBUG(10, ("[CEPH] rmdir(...) = %d\n", result));
WRAP_RETURN(result);
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 28f0257..c3ff1bc 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -503,12 +503,13 @@ static int vfswrap_mkdir(vfs_handle_struct *handle,
return result;
}
-static int vfswrap_rmdir(vfs_handle_struct *handle, const char *path)
+static int vfswrap_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
int result;
START_PROFILE(syscall_rmdir);
- result = rmdir(path);
+ result = rmdir(smb_fname->base_name);
END_PROFILE(syscall_rmdir);
return result;
}
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index 7b7c2af..6429370 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -158,20 +158,21 @@ static int audit_mkdir(vfs_handle_struct *handle,
return result;
}
-static int audit_rmdir(vfs_handle_struct *handle, const char *path)
+static int audit_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
int result;
- result = SMB_VFS_NEXT_RMDIR(handle, path);
+ result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n",
- path,
+ smb_fname->base_name,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
}
DEBUG(0, ("vfs_extd_audit: rmdir %s %s %s\n",
- path,
+ smb_fname->base_name,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index e33521e..3cd8c65 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2576,11 +2576,13 @@ static int fruit_chown(vfs_handle_struct *handle,
return rc;
}
-static int fruit_rmdir(struct vfs_handle_struct *handle, const char *path)
+static int fruit_rmdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
DIR *dh = NULL;
struct dirent *de;
struct fruit_config_data *config;
+ const char *path = smb_fname->base_name;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1);
@@ -2618,7 +2620,7 @@ exit_rmdir:
if (dh) {
closedir(dh);
}
- return SMB_VFS_NEXT_RMDIR(handle, path);
+ return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
}
static ssize_t fruit_pread(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 6dd6140..3dd2005 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -857,13 +857,14 @@ static int smb_full_audit_mkdir(vfs_handle_struct *handle,
}
static int smb_full_audit_rmdir(vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
int result;
- result = SMB_VFS_NEXT_RMDIR(handle, path);
+ result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
- do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s", path);
+ do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s",
+ smb_fname->base_name);
return result;
}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 427b985..8e5316d 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -429,15 +429,17 @@ static void vfs_gluster_init_search_op(struct vfs_handle_struct *handle,
return;
}
-static int vfs_gluster_mkdir(struct vfs_handle_struct *handle, const char *path,
+static int vfs_gluster_mkdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
mode_t mode)
{
- return glfs_mkdir(handle->data, path, mode);
+ return glfs_mkdir(handle->data, smb_fname->base_name, mode);
}
-static int vfs_gluster_rmdir(struct vfs_handle_struct *handle, const char *path)
+static int vfs_gluster_rmdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
- return glfs_rmdir(handle->data, path);
+ return glfs_rmdir(handle->data, smb_fname->base_name);
}
static int vfs_gluster_open(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 594db83..b5173af 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1069,34 +1069,31 @@ out:
* Failure: set errno, return -1
*/
static int mh_rmdir(vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
-
+ struct smb_filename *clientFname = NULL;
+ const char *path = smb_fname->base_name;
DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
if (!is_in_media_files(path))
{
- status = SMB_VFS_NEXT_RMDIR(handle, path);
+ status = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_RMDIR(handle, clientPath);
+ status = SMB_VFS_NEXT_RMDIR(handle, clientFname);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
return status;
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index 269d1fd..487ab50 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -223,10 +223,12 @@ static DIR *atalk_fdopendir(struct vfs_handle_struct *handle, files_struct *fsp,
return ret;
}
-static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path)
+static int atalk_rmdir(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
bool add = False;
TALLOC_CTX *ctx = 0;
+ const char *path = smb_fname->base_name;
char *dpath;
if (!handle->conn->cwd || !path) goto exit_rmdir;
@@ -248,7 +250,7 @@ static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path)
exit_rmdir:
talloc_destroy(ctx);
- return SMB_VFS_NEXT_RMDIR(handle, path);
+ return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
}
/* File operations */
diff --git a/source3/modules/vfs_posix_eadb.c b/source3/modules/vfs_posix_eadb.c
index 20679e1..1d16529 100644
--- a/source3/modules/vfs_posix_eadb.c
+++ b/source3/modules/vfs_posix_eadb.c
--
Samba Shared Repository
More information about the samba-cvs
mailing list