[PATCH] vfs_fruit: three minor fixes
Ralph Böhme
rb at sernet.de
Mon Sep 29 06:17:27 MDT 2014
Hi
attached is a series of three small patches for vfs_fruit.
Review and push (if ok) appreciated.
-Ralph
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
>From b72fee246ec54deee9d38c03f363b9e8fd897507 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Sat, 27 Sep 2014 08:03:12 +0200
Subject: [PATCH 1/3] vfs_fruit: fix possible uninitialized use
Signed-off-by: Ralph Boehme <rb at sernet.de>
---
source3/modules/vfs_fruit.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 0441d5e..dd40490 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -755,11 +755,14 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
struct adouble *meta_ad = NULL;
SMB_STRUCT_STAT sbuf;
bool ok;
- int saved_errno;
+ int saved_errno = 0;
SMB_VFS_HANDLE_GET_DATA(ad->ad_handle, config,
struct fruit_config_data, return -1);
+ /* Try rw first so we can use the fd in ad_convert() */
+ mode = O_RDWR;
+
if (ad->ad_fsp && ad->ad_fsp->fh && (ad->ad_fsp->fh->fd != -1)) {
fd = ad->ad_fsp->fh->fd;
} else {
@@ -772,9 +775,6 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
}
}
- /* Try rw first so we can use the fd in ad_convert() */
- mode = O_RDWR;
-
retry:
if (config->rsrc == FRUIT_RSRC_XATTR) {
#ifndef HAVE_ATTROPEN
--
1.9.3
>From bd5c8973ac0e03e7c7c8a5153f32ecb7cedf07c7 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Sat, 27 Sep 2014 08:04:11 +0200
Subject: [PATCH 2/3] vfs_fruit: remove redundant assignment
Signed-off-by: Ralph Boehme <rb at sernet.de>
---
source3/modules/vfs_fruit.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index dd40490..242a6cb 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -817,7 +817,6 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
lp_fake_directory_create_times(
SNUM(ad->ad_handle->conn)));
if (rc != 0) {
- rc = -1;
goto exit;
}
ad_setentrylen(ad, ADEID_RFORK, sbuf.st_ex_size);
--
1.9.3
>From b6e4f480cd852d34e23e2b7053ccf4484e604a99 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Sat, 27 Sep 2014 08:54:57 +0200
Subject: [PATCH 3/3] vfs_fruit: deal with vfs_catia not being loaded
Signed-off-by: Ralph Boehme <rb at sernet.de>
---
source3/modules/vfs_fruit.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 242a6cb..c1555f0 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2242,7 +2242,13 @@ static ssize_t fruit_pread(vfs_handle_struct *handle,
fsp->base_fsp->fsp_name->base_name,
vfs_translate_to_unix,
talloc_tos(), &name);
- if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ name = talloc_strdup(talloc_tos(), tmp_base_name);
+ if (name == NULL) {
+ rc = -1;
+ goto exit;
+ }
+ } else if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
rc = -1;
goto exit;
@@ -2332,7 +2338,13 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
fsp->base_fsp->fsp_name->base_name,
vfs_translate_to_unix,
talloc_tos(), &name);
- if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ name = talloc_strdup(talloc_tos(), tmp_base_name);
+ if (name == NULL) {
+ rc = -1;
+ goto exit;
+ }
+ } else if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
rc = -1;
goto exit;
@@ -2613,7 +2625,13 @@ static int fruit_fstat(vfs_handle_struct *handle, files_struct *fsp,
vfs_translate_to_unix,
talloc_tos(), &name);
- if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ name = talloc_strdup(talloc_tos(), tmp_base_name);
+ if (name == NULL) {
+ rc = -1;
+ goto exit;
+ }
+ } else if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
rc = -1;
goto exit;
--
1.9.3
More information about the samba-technical
mailing list