⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfs_cap.c

📁 samba-3.0.22.tar.gz 编译smb服务器的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*  * 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 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){        pstring cappath;        capencode(cappath, path);	return SMB_VFS_NEXT_DISK_FREE(handle, conn, 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){        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, SMB_STRUCT_DIR *dirp){        SMB_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 *oldname, const char *newname){	pstring capold, capnew;	capencode(capold, oldname);	capencode(capnew, newname);	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 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 cap_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 cap_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 cap_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 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 cap_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 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 *cap_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 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 cap_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 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 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 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 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);	capencode(capname, name);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -