diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-04 21:19:46 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-05-06 07:51:24 +0200 |
commit | e3b858496ffe213f66387e4f11b311543af4dc54 (patch) | |
tree | 99265e20c62f48e218a16bb84716b3b5411a592a /source4 | |
parent | 8f1810362df7ef9e5c394a9cba83cf0e7c04bd9e (diff) | |
download | samba-e3b858496ffe213f66387e4f11b311543af4dc54.tar.gz samba-e3b858496ffe213f66387e4f11b311543af4dc54.tar.bz2 samba-e3b858496ffe213f66387e4f11b311543af4dc54.zip |
libcli/smb Move cifs posix helper functions and headers in common
unix_perms_to_wire() was a duplicate symbol in the top level build.
Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/clifile.c | 28 | ||||
-rw-r--r-- | source4/libcli/raw/interfaces.h | 4 | ||||
-rw-r--r-- | source4/libcli/raw/trans2.h | 157 | ||||
-rw-r--r-- | source4/torture/unix/whoami.c | 4 |
4 files changed, 2 insertions, 191 deletions
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c index f521b5f420..f5e02dd458 100644 --- a/source4/libcli/clifile.c +++ b/source4/libcli/clifile.c @@ -51,34 +51,6 @@ static NTSTATUS smbcli_link_internal(struct smbcli_tree *tree, } /**************************************************************************** - Map standard UNIX permissions onto wire representations. -****************************************************************************/ -uint32_t unix_perms_to_wire(mode_t perms) -{ - unsigned int ret = 0; - - ret |= ((perms & S_IXOTH) ? UNIX_X_OTH : 0); - ret |= ((perms & S_IWOTH) ? UNIX_W_OTH : 0); - ret |= ((perms & S_IROTH) ? UNIX_R_OTH : 0); - ret |= ((perms & S_IXGRP) ? UNIX_X_GRP : 0); - ret |= ((perms & S_IWGRP) ? UNIX_W_GRP : 0); - ret |= ((perms & S_IRGRP) ? UNIX_R_GRP : 0); - ret |= ((perms & S_IXUSR) ? UNIX_X_USR : 0); - ret |= ((perms & S_IWUSR) ? UNIX_W_USR : 0); - ret |= ((perms & S_IRUSR) ? UNIX_R_USR : 0); -#ifdef S_ISVTX - ret |= ((perms & S_ISVTX) ? UNIX_STICKY : 0); -#endif -#ifdef S_ISGID - ret |= ((perms & S_ISGID) ? UNIX_SET_GID : 0); -#endif -#ifdef S_ISUID - ret |= ((perms & S_ISUID) ? UNIX_SET_UID : 0); -#endif - return ret; -} - -/**************************************************************************** Symlink a file (UNIX extensions). ****************************************************************************/ NTSTATUS smbcli_unix_symlink(struct smbcli_tree *tree, const char *fname_src, diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index f3ce4e9c5f..d20367474a 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -924,8 +924,8 @@ enum smb_setfileinfo_level { RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO, RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC, RAW_SFILEINFO_UNIX_INFO2 = SMB_SFILEINFO_UNIX_INFO2, - RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK, - RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK, + RAW_SFILEINFO_UNIX_LINK = SMB_SET_FILE_UNIX_LINK, + RAW_SFILEINFO_UNIX_HLINK = SMB_SET_FILE_UNIX_HLINK, RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION, RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION, RAW_SFILEINFO_LINK_INFORMATION = SMB_SFILEINFO_LINK_INFORMATION, diff --git a/source4/libcli/raw/trans2.h b/source4/libcli/raw/trans2.h index 63632eb5ed..d9a3f5f7d2 100644 --- a/source4/libcli/raw/trans2.h +++ b/source4/libcli/raw/trans2.h @@ -316,161 +316,4 @@ Found 0 aliased levels #define MAX_MAC_INFO_LEVEL 0x3FF #define SMB_QFS_MAC_FS_INFO 0x301 - - -/* UNIX CIFS Extensions - created by HP */ -/* - * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved. - * Supposedly Microsoft have agreed to this. - */ - -#define MIN_UNIX_INFO_LEVEL 0x200 -#define MAX_UNIX_INFO_LEVEL 0x2FF - -#define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL)) - -#define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */ - /* means "don't change it" */ -#define SMB_UID_NO_CHANGE 0xFFFFFFFF -#define SMB_GID_NO_CHANGE 0xFFFFFFFF - -#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF -#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF - -#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF -#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF - -/* -UNIX_BASIC info level: - -Offset Size Name -0 LARGE_INTEGER EndOfFile File size -8 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks). -16 LARGE_INTEGER CreationTime Creation time -24 LARGE_INTEGER LastAccessTime Last access time -32 LARGE_INTEGER LastModificationTime Last modification time -40 LARGE_INTEGER Uid Numeric user id for the owner -48 LARGE_INTEGER Gid Numeric group id of owner -56 ULONG Type Enumeration specifying the pathname type: - 0 -- File - 1 -- Directory - 2 -- Symbolic link - 3 -- Character device - 4 -- Block device - 5 -- FIFO (named pipe) - 6 -- Unix domain socket - -60 LARGE_INTEGER devmajor Major device number if type is device -68 LARGE_INTEGER devminor Minor device number if type is device -76 LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client - will typically map this onto an inode number. The scope of - uniqueness is the share. -84 LARGE_INTEGER permissions Standard UNIX file permissions - see below. -92 LARGE_INTEGER nlinks The number of directory entries that map to this entry - (number of hard links) - -100 - end. -*/ - -/* -SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create -time and file flags appended. The corresponding info level for -findfirst/findnext is SMB_FIND_FILE_UNIX_UNIX2. - -Size Offset Value ---------------------- -0 LARGE_INTEGER EndOfFile File size -8 LARGE_INTEGER Blocks Number of blocks used on disk -16 LARGE_INTEGER ChangeTime Attribute change time -24 LARGE_INTEGER LastAccessTime Last access time -32 LARGE_INTEGER LastModificationTime Last modification time -40 LARGE_INTEGER Uid Numeric user id for the owner -48 LARGE_INTEGER Gid Numeric group id of owner -56 ULONG Type Enumeration specifying the file type -60 LARGE_INTEGER devmajor Major device number if type is device -68 LARGE_INTEGER devminor Minor device number if type is device -76 LARGE_INTEGER uniqueid This is a server-assigned unique id -84 LARGE_INTEGER permissions Standard UNIX permissions -92 LARGE_INTEGER nlinks Number of hard link) -100 LARGE_INTEGER CreationTime Create/birth time -108 ULONG FileFlags File flags enumeration -112 ULONG FileFlagsMask Mask of valid flags -*/ - -/* UNIX filetype mappings. */ - -#define UNIX_TYPE_FILE 0 -#define UNIX_TYPE_DIR 1 -#define UNIX_TYPE_SYMLINK 2 -#define UNIX_TYPE_CHARDEV 3 -#define UNIX_TYPE_BLKDEV 4 -#define UNIX_TYPE_FIFO 5 -#define UNIX_TYPE_SOCKET 6 -#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF - -/* - * Oh this is fun. "Standard UNIX permissions" has no - * meaning in POSIX. We need to define the mapping onto - * and off the wire as this was not done in the original HP - * spec. JRA. - */ - -#define UNIX_X_OTH 0000001 -#define UNIX_W_OTH 0000002 -#define UNIX_R_OTH 0000004 -#define UNIX_X_GRP 0000010 -#define UNIX_W_GRP 0000020 -#define UNIX_R_GRP 0000040 -#define UNIX_X_USR 0000100 -#define UNIX_W_USR 0000200 -#define UNIX_R_USR 0000400 -#define UNIX_STICKY 0001000 -#define UNIX_SET_GID 0002000 -#define UNIX_SET_UID 0004000 - -/* Masks for the above */ -#define UNIX_OTH_MASK 0000007 -#define UNIX_GRP_MASK 0000070 -#define UNIX_USR_MASK 0000700 -#define UNIX_PERM_MASK 0000777 -#define UNIX_EXTRA_MASK 0007000 -#define UNIX_ALL_MASK 0007777 - -/* Flags for the file_flags field in UNIX_INFO2: */ -#define EXT_SECURE_DELETE 0x00000001 -#define EXT_ENABLE_UNDELETE 0x00000002 -#define EXT_SYNCHRONOUS 0x00000004 -#define EXT_IMMUTABLE 0x00000008 -#define EXT_OPEN_APPEND_ONLY 0x00000010 -#define EXT_DO_NOT_BACKUP 0x00000020 -#define EXT_NO_UPDATE_ATIME 0x00000040 -#define EXT_HIDDEN 0x00000080 - -#define SMB_QFILEINFO_UNIX_LINK 0x201 -#define SMB_SFILEINFO_UNIX_LINK 0x201 -#define SMB_SFILEINFO_UNIX_HLINK 0x203 - -/* - Info level for QVOLINFO - returns version of CIFS UNIX extensions, plus - 64-bits worth of capability fun :-). -*/ - -#define SMB_QUERY_CIFS_UNIX_INFO 0x200 - -/* Returns the following. - - UINT16 major version number - UINT16 minor version number - LARGE_INTEGER capability bitfield - -*/ - -#define CIFS_UNIX_MAJOR_VERSION 1 -#define CIFS_UNIX_MINOR_VERSION 0 - -#define CIFS_UNIX_FCNTL_LOCKS_CAP 0x1 -#define CIFS_UNIX_POSIX_ACLS_CAP 0x2 - -/* ... more as we think of them :-). */ - #endif diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index 45b2775646..1e79d7eeb2 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -29,10 +29,6 @@ /* Size (in bytes) of the required fields in the SMBwhoami response. */ #define WHOAMI_REQUIRED_SIZE 40 -enum smb_whoami_flags { - SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */ -}; - /* SMBWhoami - Query the user mapping performed by the server for the connected tree. This is a subcommand of the TRANS2_QFSINFO. |