diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-05 11:31:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:31 -0500 |
commit | 12f4a44cf549b4ccd729494c242a5ec186d2d670 (patch) | |
tree | 28045ce9c687afe92430fd0caa71243136c39e14 /source4/librpc | |
parent | 2b4e716f7aec49469b2b523c86762c8d4bacb4d1 (diff) | |
download | samba-12f4a44cf549b4ccd729494c242a5ec186d2d670.tar.gz samba-12f4a44cf549b4ccd729494c242a5ec186d2d670.tar.bz2 samba-12f4a44cf549b4ccd729494c242a5ec186d2d670.zip |
r3549: added support for DOS extended attribute lists (name/value pairs)
stored in posix xattrs
(This used to be commit bad6a88371264cffce2bf5d6ce904b7b357081de)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/idl_types.h | 6 | ||||
-rw-r--r-- | source4/librpc/idl/xattr.idl | 20 | ||||
-rw-r--r-- | source4/librpc/ndr/libndr.h | 3 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 14 |
4 files changed, 39 insertions, 4 deletions
diff --git a/source4/librpc/idl/idl_types.h b/source4/librpc/idl/idl_types.h index 860c9d7260..54943ce78c 100644 --- a/source4/librpc/idl/idl_types.h +++ b/source4/librpc/idl/idl_types.h @@ -8,6 +8,7 @@ #define STR_FIXLEN32 LIBNDR_FLAG_STR_FIXLEN32 #define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT #define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN +#define STR_UTF8 LIBNDR_FLAG_STR_UTF8 /* a UCS2 string prefixed with [size] [offset] [length], all 32 bits @@ -64,6 +65,11 @@ */ #define astring [flag(STR_ASCII|STR_NULLTERM)] string +/* + a null terminated UTF8 string +*/ +#define utf8string [flag(STR_UTF8|STR_NULLTERM)] string + #define NDR_NOALIGN LIBNDR_FLAG_NOALIGN #define NDR_REMAINING LIBNDR_FLAG_REMAINING diff --git a/source4/librpc/idl/xattr.idl b/source4/librpc/idl/xattr.idl index aa5c0a0d6a..c2487b705c 100644 --- a/source4/librpc/idl/xattr.idl +++ b/source4/librpc/idl/xattr.idl @@ -13,8 +13,9 @@ interface xattr const string XATTR_DOSATTRIB_NAME = "user.DosAttrib"; const string XATTR_DOSATTRIB_ESTIMATED_SIZE = 64; - /* by using a union we can cope with new version of - this structure more easily */ + /* 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; @@ -32,4 +33,19 @@ interface xattr uint16 version; [switch_is(version)] xattr_DosInfo info; } xattr_DosAttrib; + + + /* we store DOS style extended attributes in a DosEAs xattr */ + const string XATTR_DOSEAS_NAME = "user.DosEAs"; + const string XATTR_DOSEAS_ESTIMATED_SIZE = 100; + + typedef struct { + utf8string name; + DATA_BLOB value; + } xattr_EA; + + typedef [public] struct { + uint16 num_eas; + [size_is(num_eas)] xattr_EA *eas; + } xattr_DosEAs; } diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 72d75f7d47..86312b0906 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -99,7 +99,8 @@ struct ndr_print { #define LIBNDR_FLAG_STR_FIXLEN32 (1<<9) #define LIBNDR_FLAG_STR_CONFORMANT (1<<10) #define LIBNDR_FLAG_STR_CHARLEN (1<<11) -#define LIBNDR_STRING_FLAGS (0xFFC) +#define LIBNDR_FLAG_STR_UTF8 (1<<12) +#define LIBNDR_STRING_FLAGS (0x1FFC) #define LIBNDR_FLAG_REF_ALLOC (1<<20) diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 2dc28c3783..ed591a2e5e 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -522,6 +522,12 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) flags &= ~LIBNDR_FLAG_STR_ASCII; } + if (flags & LIBNDR_FLAG_STR_UTF8) { + chset = CH_UTF8; + byte_mul = 1; + flags &= ~LIBNDR_FLAG_STR_UTF8; + } + flags &= ~LIBNDR_FLAG_STR_CONFORMANT; flags &= ~LIBNDR_FLAG_STR_CHARLEN; @@ -762,6 +768,12 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) flags &= ~LIBNDR_FLAG_STR_ASCII; } + if (flags & LIBNDR_FLAG_STR_UTF8) { + chset = CH_UTF8; + byte_mul = 1; + flags &= ~LIBNDR_FLAG_STR_UTF8; + } + flags &= ~LIBNDR_FLAG_STR_CONFORMANT; if (flags & LIBNDR_FLAG_STR_CHARLEN) { @@ -902,7 +914,7 @@ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) c_len = s?strlen_m(s):0; - if (flags & LIBNDR_FLAG_STR_ASCII) { + if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_UTF8)) { byte_mul = 1; } |