summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-15 15:57:39 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-15 15:57:39 +0200
commit0c840bd8d2f650e805bd7d03c2b3fe530b431a4f (patch)
tree8cbf02b27578ea8a4fc382c35691778dd8539660 /librpc
parent760dfa76d9c912fd352e26be9be8a3d567f12375 (diff)
downloadsamba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.tar.gz
samba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.tar.bz2
samba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.zip
Share xattr implementation.
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/xattr.idl140
1 files changed, 140 insertions, 0 deletions
diff --git a/librpc/idl/xattr.idl b/librpc/idl/xattr.idl
new file mode 100644
index 0000000000..c1af4791ae
--- /dev/null
+++ b/librpc/idl/xattr.idl
@@ -0,0 +1,140 @@
+#include "idl_types.h"
+
+/*
+ IDL structures for xattr file attributes
+
+ this has nothing to do with RPC, we are just using our NDR/IDL
+ infrastructure as a convenient way to store linearised information
+ about a file in a architecture independent manner
+*/
+
+import "security.idl";
+
+[
+ pointer_default(unique)
+]
+interface xattr
+{
+ const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib";
+ const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64;
+
+ /* we store basic dos attributes in a DosAttrib xattr. By
+ using a union we can cope with new version of this
+ structure more easily */
+
+ typedef struct {
+ uint32 attrib;
+ uint32 ea_size;
+ udlong size;
+ udlong alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ } xattr_DosInfo1;
+
+/*
+ We use xattrDosInfo1 again when we store values.
+ Because the sticky write time is now stored in the opendb
+ and xattr_DosInfo2Old is only present to parse existing
+ values from disk.
+
+ const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1;
+*/
+ typedef struct {
+ uint32 flags;
+ uint32 attrib;
+ uint32 ea_size;
+ udlong size;
+ udlong alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ NTTIME write_time; /* only used when sticky write time is set */
+ utf8string name;
+ } xattr_DosInfo2Old;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] xattr_DosInfo1 info1;
+ [case(2)] xattr_DosInfo2Old oldinfo2;
+ } xattr_DosInfo;
+
+ typedef [public] struct {
+ uint16 version;
+ [switch_is(version)] xattr_DosInfo info;
+ } xattr_DosAttrib;
+
+
+ /* we store DOS style extended attributes in a DosEAs xattr */
+ const char *XATTR_DOSEAS_NAME = "user.DosEAs";
+
+ typedef struct {
+ utf8string name;
+ DATA_BLOB value;
+ } xattr_EA;
+
+ typedef [public] struct {
+ uint16 num_eas;
+ [size_is(num_eas)] xattr_EA *eas;
+ } xattr_DosEAs;
+
+ /* Slightly different version, used by the vfs_xattr_tdb module */
+ typedef [public] struct {
+ uint32 num_eas;
+ xattr_EA eas[num_eas];
+ } tdb_xattrs;
+
+ /* we store stream information in this xattr structure. Then
+ the streams themselves are stored in
+ user.DosStream.STREAMNAME or in external files, according
+ to the flags */
+ const char *XATTR_DOSSTREAMS_NAME = "user.DosStreams";
+
+ const int XATTR_STREAM_FLAG_INTERNAL = 0x00000001;
+
+ /* stream data is stored in attributes with the given prefix */
+ const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
+
+ const int XATTR_MAX_STREAM_SIZE = 0x4000;
+ const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000;
+
+ typedef struct {
+ uint32 flags;
+ udlong size;
+ udlong alloc_size;
+ utf8string name;
+ } xattr_DosStream;
+
+ typedef [public] struct {
+ uint32 num_streams;
+ [size_is(num_streams)] xattr_DosStream *streams;
+ } xattr_DosStreams;
+
+
+ /* we store the NT ACL a NTACL xattr. It is versioned so we
+ can later add other acl attribs (such as posix acl mapping)
+
+ we put this xattr in the security namespace to ensure that
+ only trusted users can write to the ACL
+
+ stored in "security.NTACL"
+
+ Version 1. raw SD stored as Samba4 does it.
+ Version 2. raw SD + last changed timestamp so we
+ can discard if this doesn't match the POSIX st_ctime.
+ */
+
+ const char *XATTR_NTACL_NAME = "security.NTACL";
+
+ typedef [public] struct {
+ security_descriptor *sd;
+ NTTIME last_changed;
+ } security_descriptor_timestamp;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] security_descriptor *sd;
+ [case(2)] security_descriptor_timestamp *sd_ts;
+ } xattr_NTACL_Info;
+
+ typedef [public] struct {
+ uint16 version;
+ [switch_is(version)] xattr_NTACL_Info info;
+ } xattr_NTACL;
+}