[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-331-g977dc3a

Jeremy Allison jra at samba.org
Sat Nov 17 01:07:49 GMT 2007


The branch, v3-2-test has been updated
       via  977dc3accb3d440e5fd19591c425da7dc3718d94 (commit)
       via  a90ef69350c5efcf8dcf95d4853cbe3c662d1ba3 (commit)
       via  f3bd5e828af04f33178a66f9f332199f7d395b7b (commit)
       via  01e85f146b32d3ec91f2affb070bfd3516a28333 (commit)
       via  629406cbe77a5d56a258ac414ab47f3e89183e52 (commit)
      from  118fd6213d5f6419f654e9226a41d527c04346f7 (commit)

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


- Log -----------------------------------------------------------------
commit 977dc3accb3d440e5fd19591c425da7dc3718d94
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 16 17:07:11 2007 -0800

    Remove pstring from modules directory.
    Jeremy.

commit a90ef69350c5efcf8dcf95d4853cbe3c662d1ba3
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 16 17:06:57 2007 -0800

    Ensure we use PATH_MAX for symlinks.
    Jeremy.

commit f3bd5e828af04f33178a66f9f332199f7d395b7b
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 16 17:06:36 2007 -0800

    Fix bug #4393 smbclient does not store files with zero filesize in tar-archives
    from tometzky at batory.org.pl.
    Jeremy.

commit 01e85f146b32d3ec91f2affb070bfd3516a28333
Merge: 629406cbe77a5d56a258ac414ab47f3e89183e52 118fd6213d5f6419f654e9226a41d527c04346f7
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 16 13:29:42 2007 -0800

    Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test

commit 629406cbe77a5d56a258ac414ab47f3e89183e52
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 16 13:14:24 2007 -0800

    Match the 3.0.27a version of this function.
    Jeremy.

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

Summary of changes:
 source/client/clitar.c            |    7 +-
 source/modules/vfs_afsacl.c       |   14 +-
 source/modules/vfs_cap.c          |  489 +++++++++++++++++++++++++------------
 source/modules/vfs_catia.c        |  269 ++++++++++++--------
 source/modules/vfs_expand_msdfs.c |   89 ++++---
 source/modules/vfs_full_audit.c   |   38 ++-
 source/smbd/srvstr.c              |   18 +-
 source/smbd/trans2.c              |    4 +-
 8 files changed, 598 insertions(+), 330 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/clitar.c b/source/client/clitar.c
index 4ce92c6..cb7a5de 100644
--- a/source/client/clitar.c
+++ b/source/client/clitar.c
@@ -608,7 +608,6 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
 	SMB_BIG_UINT nread=0;
 	char ftype;
 	file_info2 finfo;
-	bool close_done = False;
 	bool shallitime=True;
 	char data[65520];
 	int read_size = 65520;
@@ -694,7 +693,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
 		DEBUG(3,("getting file %s of size %.0f bytes as a tar file %s",
 			finfo.name, (double)finfo.size, lname));
       
-		while (nread < finfo.size && !close_done) {
+		do {
 	      
 			DEBUG(3,("nread=%.0f\n",(double)nread));
 	      
@@ -733,13 +732,13 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
 				break;
 			}
 	      
-			if (datalen == 0) {
+			if ( (datalen == 0) && (finfo.size != 0) ) {
 				DEBUG(0,("Error reading file %s. Got 0 bytes\n", rname));
 				break;
 			}
 
 			datalen=0;
-		}
+		} while ( nread < finfo.size );
 
 		if (wrote_tar_header) {
 			/* pad tar file with zero's if we couldn't get entire file */
diff --git a/source/modules/vfs_afsacl.c b/source/modules/vfs_afsacl.c
index eac70f4..3e57a88 100644
--- a/source/modules/vfs_afsacl.c
+++ b/source/modules/vfs_afsacl.c
@@ -891,7 +891,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 	char acl_string[2049];
 	struct afs_iob iob;
 	int ret = -1;
-	pstring name;
+	char *name = NULL;
 	const char *fileacls;
 
 	fileacls = lp_parm_const_string(SNUM(handle->conn), "afsacl", "fileacls",
@@ -904,7 +904,10 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 	ZERO_STRUCT(dir_acl);
 	ZERO_STRUCT(file_acl);
 
-	pstrcpy(name, fsp->fsp_name);
+	name = talloc_strdup(talloc_tos(), fsp->fsp_name);
+	if (!name) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	if (!fsp->is_directory) {
 		/* We need to get the name of the directory containing the
@@ -913,7 +916,10 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 		if (p != NULL) {
 			*p = '\0';
 		} else {
-			pstrcpy(name, ".");
+			name = talloc_strdup(talloc_tos(), ".");
+			if (!name) {
+				return NT_STATUS_NO_MEMORY;
+			}
 		}
 	}
 
@@ -1017,7 +1023,7 @@ static int afsacl_connect(vfs_handle_struct *handle,
 			  const char *service, 
 			  const char *user)
 {
-	const char *spc;
+			const char *spc;
 
 	spc = lp_parm_const_string(SNUM(handle->conn), "afsacl", "space", "%");
 
diff --git a/source/modules/vfs_cap.c b/source/modules/vfs_cap.c
index 7dfbed0..f99891c 100644
--- a/source/modules/vfs_cap.c
+++ b/source/modules/vfs_cap.c
@@ -1,21 +1,22 @@
-/* 
+/*
  * CAP VFS module for Samba 3.x Version 0.3
  *
  * Copyright (C) Tim Potter, 1999-2000
  * Copyright (C) Alexander Bokovoy, 2002-2003
  * Copyright (C) Stefan (metze) Metzmacher, 2003
  * Copyright (C) TAKAHASHI Motonobu (monyo), 2003
+ * Copyright (C) Jeremy Allison, 2007
  *
  * 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
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
- *  
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *  
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,288 +25,445 @@
 #include "includes.h"
 
 /* cap functions */
-static char *capencode(char *to, const char *from);
-static char *capdecode(char *to, const char *from);
+static char *capencode(TALLOC_CTX *ctx, const char *from);
+static char *capdecode(TALLOC_CTX *ctx, const char *from);
 
 static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, const char *path,
 	bool small_query, SMB_BIG_UINT *bsize,
 	SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
 {
-        pstring cappath;
-        capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return (SMB_BIG_UINT)-1;
+	}
 	return SMB_VFS_NEXT_DISK_FREE(handle, cappath, small_query, bsize,
-					 dfree, dsize);
+					dfree, dsize);
 }
 
 static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
 {
-        pstring capname;
-        capencode(capname, fname);
+	char *capname = capencode(talloc_tos(), fname);
+
+	if (!capname) {
+		errno = ENOMEM;
+		return NULL;
+	}
 	return SMB_VFS_NEXT_OPENDIR(handle, capname, mask, attr);
 }
 
 static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
 {
-        SMB_STRUCT_DIRENT *result;
+	SMB_STRUCT_DIRENT *result;
+	SMB_STRUCT_DIRENT *newdirent;
+	char *newname;
+	size_t newnamelen;
 	DEBUG(3,("cap: cap_readdir\n"));
+
 	result = SMB_VFS_NEXT_READDIR(handle, dirp);
-	if (result) {
-	  DEBUG(3,("cap: cap_readdir: %s\n", result->d_name));
-	  capdecode(result->d_name, result->d_name);
-        }
-        return result;
+	if (!result) {
+		return NULL;
+	}
+
+	newname = capdecode(talloc_tos(), result->d_name);
+	if (!newname) {
+		return NULL;
+	}
+	DEBUG(3,("cap: cap_readdir: %s\n", newname));
+	newnamelen = strlen(newname)+1;
+	newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(talloc_tos(),
+			char,
+			sizeof(SMB_STRUCT_DIRENT)+
+				newnamelen);
+	if (!newdirent) {
+		return NULL;
+	}
+	memcpy(newdirent, result, sizeof(SMB_STRUCT_DIRENT));
+	memcpy(&newdirent->d_name, newname, newnamelen);
+	return newdirent;
 }
 
 static int cap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
 {
-	pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_MKDIR(handle, cappath, mode);
 }
 
 static int cap_rmdir(vfs_handle_struct *handle, const char *path)
 {
-        pstring cappath;
-        capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_RMDIR(handle, cappath);
 }
 
 static int cap_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode)
 {
-        pstring capname;
+	char *cappath = capencode(talloc_tos(), fname);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	DEBUG(3,("cap: cap_open for %s\n", fname));
-	capencode(capname, fname);
-	return SMB_VFS_NEXT_OPEN(handle, capname, fsp, flags, mode);
+	return SMB_VFS_NEXT_OPEN(handle, cappath, fsp, flags, mode);
 }
 
 static int cap_rename(vfs_handle_struct *handle, const char *oldname, const char *newname)
 {
-	pstring capold, capnew;
-	capencode(capold, oldname);
-	capencode(capnew, newname);
+	char *capold = capencode(talloc_tos(), oldname);
+	char *capnew = capencode(talloc_tos(), newname);
 
+	if (!capold || !capnew) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_RENAME(handle, capold, capnew);
 }
 
-static int cap_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf)
+static int cap_stat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
 {
-        pstring capname;
-	capencode(capname, fname);
-	return SMB_VFS_NEXT_STAT(handle, capname, sbuf);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
+	return SMB_VFS_NEXT_STAT(handle, cappath, sbuf);
 }
 
 static int cap_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
 {
-	pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_LSTAT(handle, cappath, sbuf);
 }
 
 static int cap_unlink(vfs_handle_struct *handle, const char *path)
 {
-	pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_UNLINK(handle, cappath);
 }
 
 static int cap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_CHMOD(handle, cappath, mode);
 }
 
 static int cap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_CHOWN(handle, cappath, uid, gid);
 }
 
 static int cap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_LCHOWN(handle, cappath, uid, gid);
 }
 
 static int cap_chdir(vfs_handle_struct *handle, const char *path)
 {
-        pstring cappath;
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	DEBUG(3,("cap: cap_chdir for %s\n", path));
-	capencode(cappath, path);
 	return SMB_VFS_NEXT_CHDIR(handle, cappath);
 }
 
 static int cap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_NTIMES(handle, cappath, ts);
 }
 
 
 static bool cap_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
 {
-        pstring capoldpath, capnewpath;
-        capencode(capoldpath, oldpath);
-        capencode(capnewpath, newpath);
-	return SMB_VFS_NEXT_SYMLINK(handle, capoldpath, capnewpath);
+	char *capold = capencode(talloc_tos(), oldpath);
+	char *capnew = capencode(talloc_tos(), newpath);
+
+	if (!capold || !capnew) {
+		errno = ENOMEM;
+		return -1;
+	}
+	return SMB_VFS_NEXT_SYMLINK(handle, capold, capnew);
 }
 
 static bool cap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_READLINK(handle, cappath, buf, bufsiz);
 }
 
 static int cap_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
 {
-        pstring capoldpath, capnewpath;
-        capencode(capoldpath, oldpath);
-        capencode(capnewpath, newpath);
-	return SMB_VFS_NEXT_LINK(handle, capoldpath, capnewpath);
+	char *capold = capencode(talloc_tos(), oldpath);
+	char *capnew = capencode(talloc_tos(), newpath);
+
+	if (!capold || !capnew) {
+		errno = ENOMEM;
+		return -1;
+	}
+	return SMB_VFS_NEXT_LINK(handle, capold, capnew);
 }
 
 static int cap_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
 	return SMB_VFS_NEXT_MKNOD(handle, cappath, mode, dev);
 }
 
 static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path)
 {
         /* monyo need capencode'ed and capdecode'ed? */
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return NULL;
+	}
 	return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
 }
 
-static NTSTATUS cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor *psd)
+static NTSTATUS cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *path, uint32 security_info_sent, struct security_descriptor *psd)
 {
-        pstring capname;
-	capencode(capname, name);
-	return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, capname, security_info_sent, psd);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return NT_STATUS_NO_MEMORY;
+	}
+	return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, cappath, security_info_sent, psd);
 }
 
-static int cap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
+static int cap_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
 {
-        pstring capname;
-	capencode(capname, name);
+	char *cappath = capencode(talloc_tos(), path);
 
 	/* If the underlying VFS doesn't have ACL support... */
 	if (!handle->vfs_next.ops.chmod_acl) {
 		errno = ENOSYS;
 		return -1;
 	}
-	return SMB_VFS_NEXT_CHMOD_ACL(handle, capname, mode);
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
+	return SMB_VFS_NEXT_CHMOD_ACL(handle, cappath, mode);
 }
 
-static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
+static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type)
 {
-        pstring cappath_p;
-	capencode(cappath_p, path_p);
-	return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath_p, type);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return (SMB_ACL_T)NULL;
+	}
+	return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath, type);
 }
 
-static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
 {
-        pstring capname;
-	capencode(capname, name);
-	return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, capname, acltype, theacl);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}
+	return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, cappath, acltype, theacl);
 }
 
 static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
 {
-        pstring cappath;
-	capencode(cappath, path);
+	char *cappath = capencode(talloc_tos(), path);
+
+	if (!cappath) {
+		errno = ENOMEM;
+		return -1;
+	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list