From da0397bd2f1d4e299358a193a5223610571a9ae2 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 27 Aug 2003 20:04:23 +0000 Subject: Add CAP VFS module from Monyo. Primary purpose of this module is to provide CAP-compatible encoded file names for CJKV (This used to be commit e8a5a962ed2218144cbb9c593d8e996c7d034b0c) --- source3/modules/vfs_cap.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100644 source3/modules/vfs_cap.c (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c new file mode 100644 index 0000000000..a8a7fa487d --- /dev/null +++ b/source3/modules/vfs_cap.c @@ -0,0 +1,453 @@ +/* + * 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 + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +/* cap functions */ +static char *capencode(char *to, const char *from); +static char *capdecode(char *to, const char *from); + +static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, + BOOL small_query, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_DISK_FREE(handle, conn, cappath, small_query, bsize, + dfree, dsize); +} + +static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +{ + return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); +} + +static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +{ + pstring capname; + capencode(capname, fname); + return SMB_VFS_NEXT_OPENDIR(handle, conn, capname); +} + +static struct dirent *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + struct dirent *result; + DEBUG(3,("cap: cap_readdir\n")); + result = SMB_VFS_NEXT_READDIR(handle, conn, dirp); + if (result) { + DEBUG(3,("cap: cap_readdir: %s\n", result->d_name)); + capdecode(result->d_name, result->d_name); + } + return result; +} + +static int cap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_MKDIR(handle, conn, cappath, mode); +} + +static int cap_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_RMDIR(handle, conn, cappath); +} + +static int cap_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +{ + pstring capname; + DEBUG(3,("cap: cap_open for %s\n", fname)); + capencode(capname, fname); + return SMB_VFS_NEXT_OPEN(handle, conn, capname, flags, mode); +} + +static int cap_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +{ + pstring capold, capnew; + capencode(capold, old); + capencode(capnew, new); + + return SMB_VFS_NEXT_RENAME(handle, conn, capold, capnew); +} + +static int cap_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +{ + pstring capname; + capencode(capname, fname); + return SMB_VFS_NEXT_STAT(handle, conn, capname, sbuf); +} + +static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_LSTAT(handle, conn, cappath, sbuf); +} + +static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_UNLINK(handle, conn, cappath); +} + +static int cap_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_CHMOD(handle, conn, cappath, mode); +} + +static int cap_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_CHOWN(handle, conn, cappath, uid, gid); +} + +static int cap_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + pstring cappath; + DEBUG(3,("cap: cap_chdir for %s\n", path)); + capencode(cappath, path); + return SMB_VFS_NEXT_CHDIR(handle, conn, cappath); +} + +static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_UTIME(handle, conn, cappath, times); +} + + +static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + pstring capoldpath, capnewpath; + capencode(capoldpath, oldpath); + capencode(capnewpath, newpath); + return SMB_VFS_NEXT_SYMLINK(handle, conn, capoldpath, capnewpath); +} + +static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_READLINK(handle, conn, cappath, buf, bufsiz); +} + +static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + pstring capoldpath, capnewpath; + capencode(capoldpath, oldpath); + capencode(capnewpath, newpath); + return SMB_VFS_NEXT_LINK(handle, conn, capoldpath, capnewpath); +} + +static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_MKNOD(handle, conn, cappath, mode, dev); +} + +static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +{ + /* monyo need capencode'ed and capdecode'ed? */ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path); +} + +static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + pstring capname; + capencode(capname, name); + return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, capname, security_info_sent, psd); +} + +static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +{ + pstring capname; + capencode(capname, name); + + /* 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, conn, capname, mode); +} + +static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +{ + pstring cappath_p; + capencode(cappath_p, path_p); + return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, cappath_p, type); +} + +static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +{ + pstring capname; + capencode(capname, name); + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, capname, acltype, theacl); +} + +static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, cappath); +} + +static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_GETXATTR(handle, conn, cappath, capname, value, size); +} + +static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +size) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_LGETXATTR(handle, conn, cappath, capname, value, size); +} + +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +{ + pstring capname; + capencode(capname, name); + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, capname, value, size); +} + +static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_LISTXATTR(handle, conn, cappath, list, size); +} + +static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_LLISTXATTR(handle, conn, cappath, list, size); +} + +static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, cappath, capname); +} + +static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_LREMOVEXATTR(handle, conn, cappath, capname); +} + +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +{ + pstring capname; + capencode(capname, name); + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, capname); +} + +static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_SETXATTR(handle, conn, cappath, capname, value, size, flags); +} + +static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + pstring cappath, capname; + capencode(cappath, path); + capencode(capname, name); + return SMB_VFS_NEXT_LSETXATTR(handle, conn, cappath, capname, value, size, flags); +} + +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +{ + pstring capname; + capencode(capname, name); + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, capname, value, size, flags); +} + +/* VFS operations structure */ + +static vfs_op_tuple cap_op_tuples[] = { + + /* Disk operations */ + + {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, + + /* Directory operations */ + + {SMB_VFS_OP(cap_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_readdir), SMB_VFS_OP_READDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + + {SMB_VFS_OP(cap_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, + + /* NT File ACL operations */ + + {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + /* POSIX ACL operations */ + + {SMB_VFS_OP(skel_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + {SMB_VFS_OP(skel_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, + + /* EA operations. */ + {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fgetxattr), SMB_VFS_OP_FGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_llistxattr), SMB_VFS_OP_LLISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lremovexattr), SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_cap_init(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "cap", cap_op_tuples); +} + +/* For CAP functions */ +#define hex_tag ':' +#define hex2bin(c) hex2bin_table[(unsigned char)(c)] +#define bin2hex(c) bin2hex_table[(unsigned char)(c)] +#define is_hex(s) ((s)[0] == hex_tag) + +static unsigned char hex2bin_table[256] = { +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0x30 */ +0000, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0000, /* 0x40 */ +0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ +0000, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0000, /* 0x60 */ +0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 */ +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xf0 */ +}; +static unsigned char bin2hex_table[256] = "0123456789abcdef"; + +/******************************************************************* + original code -> ":xx" - CAP format +********************************************************************/ +static char *capencode(char *to, const char *from) +{ + pstring cvtbuf; + char *out; + + if (to == from) { + from = pstrcpy ((char *) cvtbuf, from); + } + + for (out = to; *from && (out - to < sizeof(pstring)-7);) { + /* buffer husoku error */ + if ((unsigned char)*from >= 0x80) { + *out++ = hex_tag; + *out++ = bin2hex (((*from)>>4)&0x0f); + *out++ = bin2hex ((*from)&0x0f); + from++; + } + else { + *out++ = *from++; + } + } + *out = '\0'; + return to; +} + +/******************************************************************* + CAP -> original code +********************************************************************/ +/* ":xx" -> a byte */ +static char *capdecode(char *to, const char *from) +{ + pstring cvtbuf; + char *out; + + if (to == from) { + from = pstrcpy ((char *) cvtbuf, from); + } + for (out = to; *from && (out - to < sizeof(pstring)-3);) { + if (is_hex(from)) { + *out++ = (hex2bin (from[1])<<4) | (hex2bin (from[2])); + from += 3; + } else { + *out++ = *from++; + } + } + *out = '\0'; + return to; +} -- cgit From 811bd3b3ba6446c42f7c89f22f5bcaf17f26e2c6 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 28 Aug 2003 12:30:35 +0000 Subject: skel_ -> cap_ (This used to be commit 8bb033273a0fa20ba88ad6797c9a6ba092224e3b) --- source3/modules/vfs_cap.c | 102 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index a8a7fa487d..6d7964be5f 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -28,7 +28,7 @@ static char *capencode(char *to, const char *from); static char *capdecode(char *to, const char *from); -static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, +static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { @@ -38,7 +38,7 @@ static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct dfree, dsize); } -static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +static int cap_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) { return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); } @@ -100,14 +100,14 @@ static int cap_stat(vfs_handle_struct *handle, connection_struct *conn, const ch return SMB_VFS_NEXT_STAT(handle, conn, capname, sbuf); } -static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +static int cap_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_LSTAT(handle, conn, cappath, sbuf); } -static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) { pstring cappath; capencode(cappath, path); @@ -136,7 +136,7 @@ static int cap_chdir(vfs_handle_struct *handle, connection_struct *conn, const c return SMB_VFS_NEXT_CHDIR(handle, conn, cappath); } -static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +static int cap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) { pstring cappath; capencode(cappath, path); @@ -144,7 +144,7 @@ static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const } -static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static BOOL cap_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { pstring capoldpath, capnewpath; capencode(capoldpath, oldpath); @@ -152,14 +152,14 @@ static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, con return SMB_VFS_NEXT_SYMLINK(handle, conn, capoldpath, capnewpath); } -static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static BOOL cap_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_READLINK(handle, conn, cappath, buf, bufsiz); } -static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int cap_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { pstring capoldpath, capnewpath; capencode(capoldpath, oldpath); @@ -167,14 +167,14 @@ static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const c return SMB_VFS_NEXT_LINK(handle, conn, capoldpath, capnewpath); } -static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +static int cap_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_MKNOD(handle, conn, cappath, mode, dev); } -static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +static char *cap_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) { /* monyo need capencode'ed and capdecode'ed? */ pstring cappath; @@ -182,14 +182,14 @@ static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, c return SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path); } -static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) { pstring capname; capencode(capname, name); return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, capname, security_info_sent, psd); } -static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +static int cap_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) { pstring capname; capencode(capname, name); @@ -202,28 +202,28 @@ static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, co return SMB_VFS_NEXT_CHMOD_ACL(handle, conn, capname, mode); } -static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) { pstring cappath_p; capencode(cappath_p, path_p); return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, cappath_p, type); } -static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int cap_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { pstring capname; capencode(capname, name); return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, capname, acltype, theacl); } -static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, cappath); } -static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +static ssize_t cap_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) { pstring cappath, capname; capencode(cappath, path); @@ -231,7 +231,7 @@ static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct return SMB_VFS_NEXT_GETXATTR(handle, conn, cappath, capname, value, size); } -static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +static ssize_t cap_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) { pstring cappath, capname; @@ -240,28 +240,28 @@ size) return SMB_VFS_NEXT_LGETXATTR(handle, conn, cappath, capname, value, size); } -static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) { pstring capname; capencode(capname, name); return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, capname, value, size); } -static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t cap_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_LISTXATTR(handle, conn, cappath, list, size); } -static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t cap_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) { pstring cappath; capencode(cappath, path); return SMB_VFS_NEXT_LLISTXATTR(handle, conn, cappath, list, size); } -static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int cap_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) { pstring cappath, capname; capencode(cappath, path); @@ -269,7 +269,7 @@ static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, cappath, capname); } -static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int cap_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) { pstring cappath, capname; capencode(cappath, path); @@ -277,14 +277,14 @@ static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct return SMB_VFS_NEXT_LREMOVEXATTR(handle, conn, cappath, capname); } -static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) { pstring capname; capencode(capname, name); return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, capname); } -static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int cap_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) { pstring cappath, capname; capencode(cappath, path); @@ -292,7 +292,7 @@ static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *co return SMB_VFS_NEXT_SETXATTR(handle, conn, cappath, capname, value, size, flags); } -static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int cap_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) { pstring cappath, capname; capencode(cappath, path); @@ -300,7 +300,7 @@ static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *c return SMB_VFS_NEXT_LSETXATTR(handle, conn, cappath, capname, value, size, flags); } -static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) { pstring capname; capencode(capname, name); @@ -313,7 +313,7 @@ static vfs_op_tuple cap_op_tuples[] = { /* Disk operations */ - {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, /* Directory operations */ @@ -327,42 +327,42 @@ static vfs_op_tuple cap_op_tuples[] = { {SMB_VFS_OP(cap_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, /* NT File ACL operations */ - {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, /* POSIX ACL operations */ - {SMB_VFS_OP(skel_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, /* EA operations. */ - {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_fgetxattr), SMB_VFS_OP_FGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_llistxattr), SMB_VFS_OP_LLISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_lremovexattr), SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_fgetxattr), SMB_VFS_OP_FGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_llistxattr), SMB_VFS_OP_LLISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_lremovexattr), SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit From 01e9f9788c3cd5a5895a32ec62bd815cbf79414a Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 29 Aug 2003 09:24:24 +0000 Subject: Remove cap_set_quota as it is the same as default one (This used to be commit e123f1a8c8ecc0958e640ed204348d0c831f90f5) --- source3/modules/vfs_cap.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 6d7964be5f..0526276acb 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -38,11 +38,6 @@ static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct * dfree, dsize); } -static int cap_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) -{ - return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); -} - static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) { pstring capname; @@ -64,9 +59,9 @@ static struct dirent *cap_readdir(vfs_handle_struct *handle, connection_struct * static int cap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { - pstring cappath; - capencode(cappath, path); - return SMB_VFS_NEXT_MKDIR(handle, conn, cappath, mode); + pstring cappath; + capencode(cappath, path); + return SMB_VFS_NEXT_MKDIR(handle, conn, cappath, mode); } static int cap_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) -- cgit From d1a939e89329c08f2162092a15a8620e389d0ce1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Nov 2004 23:03:26 +0000 Subject: r3671: More warning fixes from Rob Foehl . Jeremy. (This used to be commit 3850f142c174034397451de8457564b9604113c5) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 0526276acb..18fa04533f 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -45,9 +45,9 @@ static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, cons return SMB_VFS_NEXT_OPENDIR(handle, conn, capname); } -static struct dirent *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) { - struct dirent *result; + SMB_STRUCT_DIRENT *result; DEBUG(3,("cap: cap_readdir\n")); result = SMB_VFS_NEXT_READDIR(handle, conn, dirp); if (result) { -- cgit From 19ca97a70f6b7b41d251eaa76e4d3c980c6eedff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Jun 2005 20:25:18 +0000 Subject: r7882: Looks like a large patch - but what it actually does is make Samba safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a) --- source3/modules/vfs_cap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 18fa04533f..de61f41f3c 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -79,11 +79,11 @@ static int cap_open(vfs_handle_struct *handle, connection_struct *conn, const ch return SMB_VFS_NEXT_OPEN(handle, conn, capname, flags, mode); } -static int cap_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +static int cap_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) { pstring capold, capnew; - capencode(capold, old); - capencode(capnew, new); + capencode(capold, oldname); + capencode(capnew, newname); return SMB_VFS_NEXT_RENAME(handle, conn, capold, capnew); } -- cgit From ff7e5c26733c933d0ed71616c39e2d931ad1e597 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 25 Jun 2005 03:03:44 +0000 Subject: r7893: Add in the extra parameters to opendir() to fix the large directory/insane app problem. Rev vfs version. Doesn't change the normal codepath. Jeremy. (This used to be commit 0f03a6bdcdbdf60da81e0aeffa84ac6e48fc6a04) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index de61f41f3c..6ee63a577d 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -38,11 +38,11 @@ static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct * dfree, dsize); } -static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { pstring capname; capencode(capname, fname); - return SMB_VFS_NEXT_OPENDIR(handle, conn, capname); + return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr); } static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) -- cgit From f98f86394a654722fa13ef1dc3c4dea82d452442 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 22 Aug 2005 18:03:08 +0000 Subject: r9483: Changed DIR to SMB_STRUCT_DIR because of the amazing stupidity of a UNIX vendor not understanding abstract data types :-(. Jeremy. (This used to be commit be5b4e2fa3ed30b0ff01b47d2354e5f782a12e25) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 6ee63a577d..b1bfcd75f2 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -38,14 +38,14 @@ static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct * dfree, dsize); } -static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { pstring capname; capencode(capname, fname); return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr); } -static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result; DEBUG(3,("cap: cap_readdir\n")); -- cgit From fbdcf2663b56007a438ac4f0d8d82436b1bfe688 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/modules/vfs_cap.c | 124 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index b1bfcd75f2..54f74dde67 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -28,28 +28,28 @@ static char *capencode(char *to, const char *from); static char *capdecode(char *to, const char *from); -static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, +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); - return SMB_VFS_NEXT_DISK_FREE(handle, conn, cappath, small_query, bsize, + return SMB_VFS_NEXT_DISK_FREE(handle, cappath, small_query, bsize, dfree, dsize); } -static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { pstring capname; capencode(capname, fname); - return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr); + return SMB_VFS_NEXT_OPENDIR(handle, capname, mask, attr); } -static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result; DEBUG(3,("cap: cap_readdir\n")); - result = SMB_VFS_NEXT_READDIR(handle, conn, dirp); + 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); @@ -57,124 +57,124 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_stru return result; } -static int cap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int cap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_MKDIR(handle, conn, cappath, mode); + return SMB_VFS_NEXT_MKDIR(handle, cappath, mode); } -static int cap_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_rmdir(vfs_handle_struct *handle, const char *path) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_RMDIR(handle, conn, cappath); + return SMB_VFS_NEXT_RMDIR(handle, cappath); } -static int cap_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +static int cap_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode) { pstring capname; DEBUG(3,("cap: cap_open for %s\n", fname)); capencode(capname, fname); - return SMB_VFS_NEXT_OPEN(handle, conn, capname, flags, mode); + return SMB_VFS_NEXT_OPEN(handle, capname, fsp, flags, mode); } -static int cap_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) +static int cap_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { pstring capold, capnew; capencode(capold, oldname); capencode(capnew, newname); - return SMB_VFS_NEXT_RENAME(handle, conn, capold, capnew); + return SMB_VFS_NEXT_RENAME(handle, capold, capnew); } -static int cap_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +static int cap_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { pstring capname; capencode(capname, fname); - return SMB_VFS_NEXT_STAT(handle, conn, capname, sbuf); + return SMB_VFS_NEXT_STAT(handle, capname, sbuf); } -static int cap_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +static int cap_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_LSTAT(handle, conn, cappath, sbuf); + return SMB_VFS_NEXT_LSTAT(handle, cappath, sbuf); } -static int cap_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_unlink(vfs_handle_struct *handle, const char *path) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_UNLINK(handle, conn, cappath); + return SMB_VFS_NEXT_UNLINK(handle, cappath); } -static int cap_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int cap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_CHMOD(handle, conn, cappath, mode); + return SMB_VFS_NEXT_CHMOD(handle, cappath, mode); } -static int cap_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +static int cap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_CHOWN(handle, conn, cappath, uid, gid); + return SMB_VFS_NEXT_CHOWN(handle, cappath, uid, gid); } -static int cap_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_chdir(vfs_handle_struct *handle, const char *path) { pstring cappath; DEBUG(3,("cap: cap_chdir for %s\n", path)); capencode(cappath, path); - return SMB_VFS_NEXT_CHDIR(handle, conn, cappath); + return SMB_VFS_NEXT_CHDIR(handle, cappath); } -static int cap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +static int cap_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_UTIME(handle, conn, cappath, times); + return SMB_VFS_NEXT_UTIME(handle, cappath, times); } -static BOOL cap_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +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, conn, capoldpath, capnewpath); + return SMB_VFS_NEXT_SYMLINK(handle, capoldpath, capnewpath); } -static BOOL cap_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static BOOL cap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_READLINK(handle, conn, cappath, buf, bufsiz); + return SMB_VFS_NEXT_READLINK(handle, cappath, buf, bufsiz); } -static int cap_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +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, conn, capoldpath, capnewpath); + return SMB_VFS_NEXT_LINK(handle, capoldpath, capnewpath); } -static int cap_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +static int cap_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_MKNOD(handle, conn, cappath, mode, dev); + return SMB_VFS_NEXT_MKNOD(handle, cappath, mode, dev); } -static char *cap_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +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); - return SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path); + return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } static BOOL cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) @@ -184,7 +184,7 @@ static BOOL cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const c return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, capname, security_info_sent, psd); } -static int cap_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +static int cap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) { pstring capname; capencode(capname, name); @@ -194,45 +194,45 @@ static int cap_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, con errno = ENOSYS; return -1; } - return SMB_VFS_NEXT_CHMOD_ACL(handle, conn, capname, mode); + return SMB_VFS_NEXT_CHMOD_ACL(handle, capname, mode); } -static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, 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_p, SMB_ACL_TYPE_T type) { pstring cappath_p; capencode(cappath_p, path_p); - return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, cappath_p, type); + return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath_p, type); } -static int cap_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, 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 *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { pstring capname; capencode(capname, name); - return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, capname, acltype, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, capname, acltype, theacl); } -static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, cappath); + return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, cappath); } -static ssize_t cap_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +static ssize_t cap_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_GETXATTR(handle, conn, cappath, capname, value, size); + return SMB_VFS_NEXT_GETXATTR(handle, cappath, capname, value, size); } -static ssize_t cap_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +static ssize_t cap_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_LGETXATTR(handle, conn, cappath, capname, value, size); + return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size); } static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) @@ -242,34 +242,34 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, capname, value, size); } -static ssize_t cap_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_LISTXATTR(handle, conn, cappath, list, size); + return SMB_VFS_NEXT_LISTXATTR(handle, cappath, list, size); } -static ssize_t cap_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t cap_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_LLISTXATTR(handle, conn, cappath, list, size); + return SMB_VFS_NEXT_LLISTXATTR(handle, cappath, list, size); } -static int cap_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int cap_removexattr(vfs_handle_struct *handle, const char *path, const char *name) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, cappath, capname); + return SMB_VFS_NEXT_REMOVEXATTR(handle, cappath, capname); } -static int cap_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_LREMOVEXATTR(handle, conn, cappath, capname); + return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname); } static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) @@ -279,20 +279,20 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, capname); } -static int cap_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_SETXATTR(handle, conn, cappath, capname, value, size, flags); + return SMB_VFS_NEXT_SETXATTR(handle, cappath, capname, value, size, flags); } -static int cap_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { pstring cappath, capname; capencode(cappath, path); capencode(capname, name); - return SMB_VFS_NEXT_LSETXATTR(handle, conn, cappath, capname, value, size, flags); + return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags); } static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) -- cgit From 4db7642caa99c1b054322a8971c4b673556487ce Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Sep 2006 22:23:12 +0000 Subject: r18745: Use the Samba4 data structures for security descriptors and security descriptor buffers. Make security access masks simply a uint32 rather than a structure with a uint32 in it. (This used to be commit b41c52b9db5fc4a553b20a7a5a051a4afced9366) --- source3/modules/vfs_cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 54f74dde67..c4539ca34a 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -177,7 +177,7 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *res return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } -static BOOL cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor *psd) { pstring capname; capencode(capname, name); -- cgit From 55ed1d59455566d90a03e7123fbf7a05a4bd4539 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Tue, 19 Dec 2006 20:16:52 +0000 Subject: r20261: merge 20260 from samba_3_0_24 clean up a bunch of no previous prototype warnings (This used to be commit c60687db112405262adf26dbf267804b04074e67) --- source3/modules/vfs_cap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index c4539ca34a..c254ba0ed9 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -362,6 +362,7 @@ static vfs_op_tuple cap_op_tuples[] = { {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; +NTSTATUS vfs_cap_init(void); NTSTATUS vfs_cap_init(void) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "cap", cap_op_tuples); -- cgit From 4952fe368a40b239140b3035db6075427d237bb9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 5 Mar 2007 23:40:03 +0000 Subject: r21714: Change the VFS interface to use struct timespec for utimes - change the call to ntimes. This preserves nsec timestamps we get from stat (if the system supports it) and only maps back down to usec or sec resolution on time set. Looks bigger than it is as I had to move lots of internal code from using time_t and struct utimebuf to struct timespec. Jeremy. (This used to be commit 8f3d530c5a748ea90f42ed8fbe68ae92178d4875) --- source3/modules/vfs_cap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index c254ba0ed9..d495ed5d14 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -131,11 +131,11 @@ static int cap_chdir(vfs_handle_struct *handle, const char *path) return SMB_VFS_NEXT_CHDIR(handle, cappath); } -static int cap_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) +static int cap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]) { pstring cappath; capencode(cappath, path); - return SMB_VFS_NEXT_UTIME(handle, cappath, times); + return SMB_VFS_NEXT_NTIMES(handle, cappath, ts); } @@ -327,7 +327,7 @@ static vfs_op_tuple cap_op_tuples[] = { {SMB_VFS_OP(cap_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(cap_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From 57d6318a0b5ecc0154547a04acef8ac222c1d28f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 23 May 2007 23:55:12 +0000 Subject: r23105: Add lchown to the vfs layer. We need this in the POSIX code. Jeremy. (This used to be commit 932523cbb508db869b726768e86bfa8e248f768b) --- source3/modules/vfs_cap.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index d495ed5d14..ab99031e4d 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -123,6 +123,13 @@ static int cap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid 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); + return SMB_VFS_NEXT_LCHOWN(handle, cappath, uid, gid); +} + static int cap_chdir(vfs_handle_struct *handle, const char *path) { pstring cappath; @@ -326,6 +333,7 @@ static vfs_op_tuple cap_op_tuples[] = { {SMB_VFS_OP(cap_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(cap_lchown), SMB_VFS_OP_LCHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From a0ac7a7f4c0290787cdadb5866272cee2bd61b8a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 26 Jun 2007 22:49:10 +0000 Subject: r23620: Convert set_nt_acl to return NTSTATUS. Also fix the chown return to correctly return NT_STATUS_INVALID_OWNER if it should be disallowed. Matches better what W2K3R3 does. NFSv4 ACL module owners, please examine these changes. Jeremy. (This used to be commit fc6899a5506b272f8cd5f5837ca13300b4e69a5f) --- source3/modules/vfs_cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index ab99031e4d..04dbec95b6 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -184,7 +184,7 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *res return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } -static BOOL 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 *name, uint32 security_info_sent, struct security_descriptor *psd) { pstring capname; capencode(capname, name); -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/modules/vfs_cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 04dbec95b6..5f3cd64fb8 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -8,7 +8,7 @@ * * 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 2 of the License, or + * 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, -- cgit From 153cfb9c83534b09f15cc16205d7adb19b394928 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 05:23:25 +0000 Subject: r23801: The FSF has moved around a lot. This fixes their Mass Ave address. (This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227) --- source3/modules/vfs_cap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 5f3cd64fb8..84c6a6fd84 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -17,8 +17,7 @@ * 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/modules/vfs_cap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 84c6a6fd84..7dfbed0691 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -28,7 +28,7 @@ static char *capencode(char *to, const char *from); static char *capdecode(char *to, const char *from); static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, const char *path, - BOOL small_query, SMB_BIG_UINT *bsize, + bool small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { pstring cappath; @@ -145,7 +145,7 @@ static int cap_ntimes(vfs_handle_struct *handle, const char *path, const struct } -static BOOL cap_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) +static bool cap_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) { pstring capoldpath, capnewpath; capencode(capoldpath, oldpath); @@ -153,7 +153,7 @@ static BOOL cap_symlink(vfs_handle_struct *handle, const char *oldpath, const ch return SMB_VFS_NEXT_SYMLINK(handle, capoldpath, capnewpath); } -static BOOL cap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) +static bool cap_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) { pstring cappath; capencode(cappath, path); -- cgit From 882987594455c6676d0b01618d91bdbfc5e3b267 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Nov 2007 17:07:11 -0800 Subject: Remove pstring from modules directory. Jeremy. (This used to be commit 977dc3accb3d440e5fd19591c425da7dc3718d94) --- source3/modules/vfs_cap.c | 489 +++++++++++++++++++++++++++++++--------------- 1 file changed, 336 insertions(+), 153 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 7dfbed0691..f99891cb32 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/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 . */ @@ -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; + } return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, cappath); } static ssize_t cap_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_GETXATTR(handle, cappath, capname, value, size); } static ssize_t cap_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size); } -static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, void *value, size_t size) { - pstring capname; - capencode(capname, name); - return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, capname, value, size); + char *cappath = capencode(talloc_tos(), path); + + if (!cappath) { + errno = ENOMEM; + return -1; + } + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, cappath, value, size); } static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { - pstring cappath; - capencode(cappath, path); + char *cappath = capencode(talloc_tos(), path); + + if (!cappath) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_LISTXATTR(handle, cappath, list, size); } static ssize_t cap_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { - pstring cappath; - capencode(cappath, path); + char *cappath = capencode(talloc_tos(), path); + + if (!cappath) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_LLISTXATTR(handle, cappath, list, size); } static int cap_removexattr(vfs_handle_struct *handle, const char *path, const char *name) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_REMOVEXATTR(handle, cappath, capname); } static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname); } -static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path) { - pstring capname; - capencode(capname, name); - return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, capname); + char *cappath = capencode(talloc_tos(), path); + + if (!cappath) { + errno = ENOMEM; + return -1; + } + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, cappath); } static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_SETXATTR(handle, cappath, capname, value, size, flags); } static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { - pstring cappath, capname; - capencode(cappath, path); - capencode(capname, name); + char *cappath = capencode(talloc_tos(), path); + char *capname = capencode(talloc_tos(), name); + + if (!cappath || !capname) { + errno = ENOMEM; + return -1; + } return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags); } -static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, const void *value, size_t size, int flags) { - pstring capname; - capencode(capname, name); - return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, capname, value, size, flags); + char *cappath = capencode(talloc_tos(), path); + + if (!cappath) { + errno = ENOMEM; + return -1; + } + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, cappath, value, size, flags); } /* VFS operations structure */ @@ -315,7 +473,7 @@ static vfs_op_tuple cap_op_tuples[] = { /* Disk operations */ {SMB_VFS_OP(cap_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, - + /* Directory operations */ {SMB_VFS_OP(cap_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, @@ -352,7 +510,7 @@ static vfs_op_tuple cap_op_tuples[] = { {SMB_VFS_OP(cap_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, - + /* EA operations. */ {SMB_VFS_OP(cap_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, @@ -406,51 +564,76 @@ static unsigned char bin2hex_table[256] = "0123456789abcdef"; /******************************************************************* original code -> ":xx" - CAP format ********************************************************************/ -static char *capencode(char *to, const char *from) -{ - pstring cvtbuf; - char *out; - - if (to == from) { - from = pstrcpy ((char *) cvtbuf, from); - } - - for (out = to; *from && (out - to < sizeof(pstring)-7);) { - /* buffer husoku error */ - if ((unsigned char)*from >= 0x80) { - *out++ = hex_tag; - *out++ = bin2hex (((*from)>>4)&0x0f); - *out++ = bin2hex ((*from)&0x0f); - from++; - } - else { - *out++ = *from++; - } - } - *out = '\0'; - return to; + +static char *capencode(TALLOC_CTX *ctx, const char *from) +{ + char *out = NULL; + const char *p1; + char *to = NULL; + size_t len = 0; + + for (p1 = from; *p1; p1++) { + if ((unsigned char)*p1 >= 0x80) { + len += 3; + } else { + len++; + } + } + len++; + + to = TALLOC_ARRAY(ctx, char, len); + if (!to) { + return NULL; + } + + for (out = to; *from;) { + /* buffer husoku error */ + if ((unsigned char)*from >= 0x80) { + *out++ = hex_tag; + *out++ = bin2hex (((*from)>>4)&0x0f); + *out++ = bin2hex ((*from)&0x0f); + from++; + } else { + *out++ = *from++; + } + } + *out = '\0'; + return to; } /******************************************************************* CAP -> original code ********************************************************************/ /* ":xx" -> a byte */ -static char *capdecode(char *to, const char *from) -{ - pstring cvtbuf; - char *out; - - if (to == from) { - from = pstrcpy ((char *) cvtbuf, from); - } - for (out = to; *from && (out - to < sizeof(pstring)-3);) { - if (is_hex(from)) { - *out++ = (hex2bin (from[1])<<4) | (hex2bin (from[2])); - from += 3; - } else { - *out++ = *from++; - } - } - *out = '\0'; - return to; + +static char *capdecode(TALLOC_CTX *ctx, const char *from) +{ + const char *p1; + char *out = NULL; + char *to = NULL; + size_t len = 0; + + for (p1 = from; *p1; len++) { + if (is_hex(from)) { + p1 += 3; + } else { + p1++; + } + } + + to = TALLOC_ARRAY(ctx, char, len); + if (!to) { + return NULL; + } + + for (out = to; *from;) { + if (is_hex(from)) { + *out++ = (hex2bin(from[1])<<4) | (hex2bin(from[2])); + from += 3; + } else { + *out++ = *from++; + } + } + *out = '\0'; + return to; } -- cgit From 50ee744fa445b74136a8f2cef36c2b48ba7ee5f6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 10:00:47 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FGETXATTR(). Michael (This used to be commit 2cb739a82dc6bb194d60718cc74b26ee7c1c46a7) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index f99891cb32..56ab48f9e2 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -363,7 +363,7 @@ size) return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size); } -static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, void *value, size_t size) +static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, void *value, size_t size) { char *cappath = capencode(talloc_tos(), path); @@ -371,7 +371,7 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, cappath, value, size); + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, cappath, value, size); } static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) -- cgit From 1590dd32cfccd9ce73cd798330b5207bcc48bfaf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 11:29:09 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FREMOVEXATTR(). Michael (This used to be commit bfc3b5a27f707d3e4b8d5d66192891e22365fbb3) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 56ab48f9e2..ab76722f4c 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -420,7 +420,7 @@ static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const c return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname); } -static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path) +static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path) { char *cappath = capencode(talloc_tos(), path); @@ -428,7 +428,7 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, cappath); + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath); } static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) -- cgit From aab6704ce803a738ba125895b20a31f242fe2885 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 11:47:33 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSETXATTR(). Michael (This used to be commit 0bd2643463a9160c8a1c7e1c2f8cca7b89060e09) --- source3/modules/vfs_cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index ab76722f4c..2f2d6a7182 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -455,7 +455,7 @@ static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags); } -static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, const void *value, size_t size, int flags) +static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags) { char *cappath = capencode(talloc_tos(), path); @@ -463,7 +463,7 @@ static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, cappath, value, size, flags); + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, cappath, value, size, flags); } /* VFS operations structure */ -- cgit From 00b2cdf75e9bea25034440054b4acd91a179c86d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 May 2008 18:09:07 -0700 Subject: Yay ! Remove a VFS entry. Removed the set_nt_acl() call, this can only be done via fset_nt_acl() using an open file/directory handle. I'd like to do the same with get_nt_acl() but am concerned about efficiency problems with "hide unreadable/hide unwritable" when doing a directory listing (this would mean opening every file in the dir on list). Moving closer to rationalizing the ACL model and maybe moving the POSIX calls into a posix_acl VFS module rather than having them as first class citizens of the VFS. Jeremy. (This used to be commit f487f742cb903a06fbf2be006ddc9ce9063339ed) --- source3/modules/vfs_cap.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 2f2d6a7182..79537367d6 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -278,17 +278,6 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *res return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } -static NTSTATUS cap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *path, uint32 security_info_sent, struct security_descriptor *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 *path, mode_t mode) { char *cappath = capencode(talloc_tos(), path); @@ -499,10 +488,6 @@ static vfs_op_tuple cap_op_tuples[] = { {SMB_VFS_OP(cap_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cap_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, - /* NT File ACL operations */ - - {SMB_VFS_OP(cap_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - /* POSIX ACL operations */ {SMB_VFS_OP(cap_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, -- cgit