[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1576-g63ee2ef

Volker Lendecke vl at samba.org
Sun Jan 20 14:31:21 GMT 2008


The branch, v3-2-test has been updated
       via  63ee2ef775b48fcaecccf4dc7ef3601ceb8053c5 (commit)
       via  d7e6ec2258350c564053371361c8f1d7d0f775b1 (commit)
       via  96b9a7b3eb92c9f133a3f43ffc4d57d0212e4ebd (commit)
       via  9f7f6b812d89decea1456ccdc37978e645d11a63 (commit)
       via  023b313d0d4ed3beb8d77177bc8141cadeb86658 (commit)
       via  b7022f8f7bf83c9c5e73e98d1477b7da766e8c5f (commit)
       via  8db25aba63b1dffb0dfbc74012c7ebd0ce4d5682 (commit)
       via  d481dddc81699aba79e48bca79bfb10e586b5cbb (commit)
       via  c1794375d1fa27d72ec32946bb4bd7b9f96e59fc (commit)
       via  3509ee597f0977aadd4c70cfe8830a6aa95cd71f (commit)
       via  dac468216e7e103b6897f33ec3608412f77265cf (commit)
      from  9e71c89ac648040739ef2161a2e6c4299be1e35b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 63ee2ef775b48fcaecccf4dc7ef3601ceb8053c5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 14:10:51 2008 +0100

    Active RAW-STREAMS in make test

commit d7e6ec2258350c564053371361c8f1d7d0f775b1
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 15:09:53 2008 +0100

    Fix valgrind errors

commit 96b9a7b3eb92c9f133a3f43ffc4d57d0212e4ebd
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 14:44:07 2008 +0100

    NT_STATUS_OBJECT_NAME_NOT_FOUND also means "no streams around :-)"

commit 9f7f6b812d89decea1456ccdc37978e645d11a63
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 14:43:30 2008 +0100

    Don't test split_ntfs_stream_name
    
    This is a hot code path, and if it has a :, the name will be split later on
    anyway.

commit 023b313d0d4ed3beb8d77177bc8141cadeb86658
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 14:09:08 2008 +0100

    Do not use an unfinished fsp in streams_xattr_open

commit b7022f8f7bf83c9c5e73e98d1477b7da766e8c5f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 14:05:36 2008 +0100

    In streams_xattr_pwrite, base_fsp does not have an fd
    
    These bugs haven't shown up when I did my tests with real xattrs, not with the
    xattr_tdb backend. It worked because the stream fsp does has the base file as
    fd.

commit 8db25aba63b1dffb0dfbc74012c7ebd0ce4d5682
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 13:55:27 2008 +0100

    Add some DEBUG

commit d481dddc81699aba79e48bca79bfb10e586b5cbb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 13:51:52 2008 +0100

    For pread/pwrite we need to do the setxattr on base_fsp

commit c1794375d1fa27d72ec32946bb4bd7b9f96e59fc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 13:49:38 2008 +0100

    Really remove the _NEXT_ from vfs_xattr_tdb.c
    
    This must have been lost somewhere in my patch-mangling

commit 3509ee597f0977aadd4c70cfe8830a6aa95cd71f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 11:20:58 2008 +0100

    Support XATTR_CREATE and XATTR_REPLACE in vfs_xattr_tdb

commit dac468216e7e103b6897f33ec3608412f77265cf
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 20 11:10:06 2008 +0100

    Complete the ea->xattr rename in vfs_xattr_tdb

-----------------------------------------------------------------------

Summary of changes:
 source/modules/vfs_streams_xattr.c   |   62 ++++++++++++++++++++++------------
 source/modules/vfs_xattr_tdb.c       |   26 ++++++++++++--
 source/script/tests/selftest.sh      |    2 +-
 source/script/tests/test_posix_s3.sh |    2 +-
 source/smbd/open.c                   |    3 +-
 source/smbd/reply.c                  |    3 --
 6 files changed, 66 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/modules/vfs_streams_xattr.c b/source/modules/vfs_streams_xattr.c
index 3701cdd..87bcf22 100644
--- a/source/modules/vfs_streams_xattr.c
+++ b/source/modules/vfs_streams_xattr.c
@@ -92,6 +92,8 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
 	struct stream_io *io = (struct stream_io *)
 		VFS_FETCH_FSP_EXTENSION(handle, fsp);
 
+	DEBUG(10, ("streams_xattr_fstat called for %d\n", fsp->fh->fd));
+
 	if (io == NULL) {
 		return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 	}
@@ -105,6 +107,8 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
 		return -1;
 	}
 
+	DEBUG(10, ("sbuf->st_size = %d\n", (int)sbuf->st_size));
+
 	sbuf->st_ino = stream_inode(sbuf, io->xattr_name);
 	sbuf->st_mode &= ~S_IFMT;
         sbuf->st_mode |= S_IFREG;
@@ -117,7 +121,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname,
 			      SMB_STRUCT_STAT *sbuf)
 {
 	NTSTATUS status;
-	char *base, *sname;
+	char *base = NULL, *sname = NULL;
 	int result = -1;
 	char *xattr_name;
 
@@ -128,10 +132,10 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname,
 	status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
 	if (!NT_STATUS_IS_OK(status)) {
 		errno = EINVAL;
-		goto fail;
+		return -1;
 	}
 
-	if (SMB_VFS_NEXT_STAT(handle, base, sbuf) == -1) {
+	if (SMB_VFS_STAT(handle->conn, base, sbuf) == -1) {
 		goto fail;
 	}
 
@@ -178,7 +182,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname,
 		goto fail;
 	}
 
-	if (SMB_VFS_NEXT_LSTAT(handle, base, sbuf) == -1) {
+	if (SMB_VFS_LSTAT(handle->conn, base, sbuf) == -1) {
 		goto fail;
 	}
 
@@ -219,6 +223,8 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 	int baseflags;
 	int hostfd = -1;
 
+	DEBUG(10, ("streams_xattr_open called for %s\n", fname));
+
 	if (!is_ntfs_stream_name(fname)) {
 		return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
 	}
@@ -248,7 +254,7 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
         baseflags &= ~O_EXCL;
         baseflags &= ~O_CREAT;
 
-        hostfd = SMB_VFS_NEXT_OPEN(handle, base, fsp, baseflags, mode);
+        hostfd = SMB_VFS_OPEN(handle->conn, base, fsp, baseflags, mode);
 
         /* It is legit to open a stream on a directory, but the base
          * fd has to be read-only.
@@ -256,17 +262,19 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
         if ((hostfd == -1) && (errno == EISDIR)) {
                 baseflags &= ~O_ACCMODE;
                 baseflags |= O_RDONLY;
-                hostfd = SMB_VFS_NEXT_OPEN(handle, fname, fsp, baseflags,
-					   mode);
+                hostfd = SMB_VFS_OPEN(handle->conn, fname, fsp, baseflags,
+				      mode);
         }
 
         if (hostfd == -1) {
 		goto fail;
         }
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp, base,
+	status = get_ea_value(talloc_tos(), handle->conn, NULL, base,
 			      xattr_name, &ea);
 
+	DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
+
 	if (!NT_STATUS_IS_OK(status)
 	    && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
 		/*
@@ -274,6 +282,8 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 		 * O_CREAT, the higher levels should have created the base
 		 * file for us.
 		 */
+		DEBUG(10, ("streams_xattr_open: base file %s not around, "
+			   "returning ENOENT\n", base));
 		errno = ENOENT;
 		goto fail;
 	}
@@ -289,8 +299,12 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 			 */
                         char null = '\0';
 
-                        if (SMB_VFS_NEXT_SETXATTR(
-				handle, base, xattr_name, &null, sizeof(null),
+			DEBUG(10, ("creating attribute %s on file %s\n",
+				   xattr_name, base));
+
+                        if (SMB_VFS_SETXATTR(
+				handle->conn, base, xattr_name,
+				&null, sizeof(null),
 				flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
 				goto fail;
 			}
@@ -299,8 +313,9 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 
 	if (flags & O_TRUNC) {
 		char null = '\0';
-		if (SMB_VFS_NEXT_SETXATTR(
-			    handle, base, xattr_name, &null, sizeof(null),
+		if (SMB_VFS_SETXATTR(
+			    handle->conn, base, xattr_name,
+			    &null, sizeof(null),
 			    flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
 			goto fail;
 		}
@@ -332,7 +347,7 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 		 * BUGBUGBUG -- we would need to call fd_close_posix here, but
 		 * we don't have a full fsp yet
 		 */
-		SMB_VFS_NEXT_CLOSE(handle, fsp, hostfd);
+		SMB_VFS_CLOSE(fsp, hostfd);
 	}
 
 	TALLOC_FREE(frame);
@@ -364,7 +379,7 @@ static int streams_xattr_unlink(vfs_handle_struct *handle,  const char *fname)
 		goto fail;
 	}
 
-	ret = SMB_VFS_NEXT_REMOVEXATTR(handle, base, xattr_name);
+	ret = SMB_VFS_REMOVEXATTR(handle->conn, base, xattr_name);
 
 	if ((ret == -1) && (errno == ENOATTR)) {
 		errno = ENOENT;
@@ -497,13 +512,13 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
 		if (is_ntfs_stream_name(fsp->fsp_name)) {
 			return NT_STATUS_INVALID_PARAMETER;
 		}
-		ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf);
+		ret = SMB_VFS_FSTAT(fsp, &sbuf);
 	}
 	else {
 		if (is_ntfs_stream_name(fname)) {
 			return NT_STATUS_INVALID_PARAMETER;
 		}
-		ret = SMB_VFS_NEXT_STAT(handle, fname, &sbuf);
+		ret = SMB_VFS_STAT(handle->conn, fname, &sbuf);
 	}
 
 	if (ret == -1) {
@@ -567,12 +582,14 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
 	NTSTATUS status;
 	int ret;
 
+	DEBUG(10, ("streams_xattr_pwrite called for %d bytes\n", (int)n));
+
 	if (sio == NULL) {
 		return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 	}
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base,
-			      sio->xattr_name, &ea);
+	status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
+			      sio->base, sio->xattr_name, &ea);
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
 	}
@@ -595,8 +612,9 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
 
         memcpy(ea.value.data + offset, data, n);
 
-	ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, sio->xattr_name,
-				     ea.value.data, ea.value.length, 0);
+	ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
+				sio->xattr_name,
+				ea.value.data, ea.value.length, 0);
 
 	TALLOC_FREE(ea.value.data);
 
@@ -617,8 +635,8 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle,
 		return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 	}
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base,
-			      sio->xattr_name, &ea);
+	status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
+			      sio->base, sio->xattr_name, &ea);
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
 	}
diff --git a/source/modules/vfs_xattr_tdb.c b/source/modules/vfs_xattr_tdb.c
index 597dd38..208066b 100644
--- a/source/modules/vfs_xattr_tdb.c
+++ b/source/modules/vfs_xattr_tdb.c
@@ -165,6 +165,9 @@ static ssize_t xattr_tdb_getattr(struct db_context *db_ctx,
 	ssize_t result = -1;
 	NTSTATUS status;
 
+	DEBUG(10, ("xattr_tdb_getattr called for file %s, name %s\n",
+		   file_id_string_tos(id), name));
+
 	status = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -250,6 +253,9 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
 	struct tdb_xattrs *attribs;
 	uint32_t i;
 
+	DEBUG(10, ("xattr_tdb_setattr called for file %s, name %s\n",
+		   file_id_string_tos(id), name));
+
 	rec = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id);
 
 	if (rec == NULL) {
@@ -269,6 +275,11 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
 
 	for (i=0; i<attribs->num_xattrs; i++) {
 		if (strcmp(attribs->xattrs[i].name, name) == 0) {
+			if (flags & XATTR_CREATE) {
+				TALLOC_FREE(rec);
+				errno = EEXIST;
+				return -1;
+			}
 			break;
 		}
 	}
@@ -276,6 +287,12 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
 	if (i == attribs->num_xattrs) {
 		struct tdb_xattr *tmp;
 
+		if (flags & XATTR_REPLACE) {
+			TALLOC_FREE(rec);
+			errno = ENOATTR;
+			return -1;
+		}
+
 		tmp = TALLOC_REALLOC_ARRAY(
 			attribs, attribs->xattrs, struct tdb_xattr,
 			attribs->num_xattrs + 1);
@@ -558,7 +575,8 @@ static bool xattr_tdb_init(int snum, struct db_context **p_db)
 	struct db_context *db;
 	const char *dbname;
 
-	dbname = lp_parm_const_string(snum, "ea", "tdb", lock_path("eas.tdb"));
+	dbname = lp_parm_const_string(snum, "xattr", "tdb",
+				      lock_path("xattr.tdb"));
 
 	if (dbname == NULL) {
 		errno = ENOTSUP;
@@ -660,7 +678,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
  * Destructor for the VFS private data
  */
 
-static void close_ea_db(void **data)
+static void close_xattr_db(void **data)
 {
 	struct db_context **p_db = (struct db_context **)data;
 	TALLOC_FREE(*p_db);
@@ -688,14 +706,14 @@ static int xattr_tdb_connect(vfs_handle_struct *handle, const char *service,
 	}
 
 	if (!xattr_tdb_init(snum, &db)) {
-		DEBUG(5, ("Could not init ea tdb\n"));
+		DEBUG(5, ("Could not init xattr tdb\n"));
 		lp_do_parameter(snum, "ea support", "False");
 		return 0;
 	}
 
 	lp_do_parameter(snum, "ea support", "True");
 
-	SMB_VFS_HANDLE_SET_DATA(handle, db, close_ea_db,
+	SMB_VFS_HANDLE_SET_DATA(handle, db, close_xattr_db,
 				struct db_context, return -1);
 
 	return 0;
diff --git a/source/script/tests/selftest.sh b/source/script/tests/selftest.sh
index 5a170b2..c6232cf 100755
--- a/source/script/tests/selftest.sh
+++ b/source/script/tests/selftest.sh
@@ -186,7 +186,7 @@ cat >$SERVERCONFFILE<<EOF
 	map hidden = yes
 	map system = yes
 	create mask = 755
-	vfs objects = $BINDIR/xattr_tdb.so
+	vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_xattr.so
 [hideunread]
 	copy = tmp
 	hide unreadable = yes
diff --git a/source/script/tests/test_posix_s3.sh b/source/script/tests/test_posix_s3.sh
index 0b4a52d..91863b7 100755
--- a/source/script/tests/test_posix_s3.sh
+++ b/source/script/tests/test_posix_s3.sh
@@ -50,7 +50,7 @@ skipped="BASE-CHARSET BASE-DELAYWRITE BASE-TCONDEV"
 skipped="$skipped RAW-ACLS RAW-COMPOSITE RAW-CONTEXT"
 skipped="$skipped RAW-IOCTL"
 skipped="$skipped RAW-QFILEINFO RAW-QFSINFO RAW-SEARCH"
-skipped="$skipped RAW-SFILEINFO RAW-STREAMS"
+skipped="$skipped RAW-SFILEINFO"
 
 echo "WARNING: Skipping tests $skipped"
 
diff --git a/source/smbd/open.c b/source/smbd/open.c
index ad221c3..f557286 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -2464,7 +2464,8 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
 	status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
 				    &num_streams, &stream_info);
 
-	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
+	    || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
 		DEBUG(10, ("no streams around\n"));
 		TALLOC_FREE(frame);
 		return NT_STATUS_OK;
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 61ec611..5a5eb1e 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -168,9 +168,6 @@ static NTSTATUS check_path_syntax_internal(char *path,
 
 	*d = '\0';
 
-	if (NT_STATUS_IS_OK(ret) && !posix_path) {
-		ret = split_ntfs_stream_name(NULL, path, NULL, NULL);
-	}
 	return ret;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list