summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/gen_ndr/ndr_xattr.c234
-rw-r--r--librpc/gen_ndr/ndr_xattr.h19
-rw-r--r--librpc/gen_ndr/xattr.h40
-rw-r--r--librpc/idl/xattr.idl53
-rw-r--r--librpc/ndr/ndr_xattr.c148
-rw-r--r--librpc/ndr/ndr_xattr.h37
-rw-r--r--source3/Makefile.in1
-rw-r--r--source4/librpc/config.mk2
8 files changed, 525 insertions, 9 deletions
diff --git a/librpc/gen_ndr/ndr_xattr.c b/librpc/gen_ndr/ndr_xattr.c
index 6bcc831ded..bbffd50e9f 100644
--- a/librpc/gen_ndr/ndr_xattr.c
+++ b/librpc/gen_ndr/ndr_xattr.c
@@ -4,6 +4,38 @@
#include "../librpc/gen_ndr/ndr_xattr.h"
#include "librpc/gen_ndr/ndr_security.h"
+static enum ndr_err_code ndr_push_xattr_DosInfoFFFFCompat(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfoFFFFCompat *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfoFFFFCompat(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfoFFFFCompat *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfoFFFFCompat(struct ndr_print *ndr, const char *name, const struct xattr_DosInfoFFFFCompat *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfoFFFFCompat");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "attrib", r->attrib);
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_xattr_DosInfo1(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo1 *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -117,13 +149,94 @@ _PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *nam
ndr->depth--;
}
-static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r)
+static enum ndr_err_code ndr_push_xattr_DosInfoValidFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfoValidFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfoValidFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+ ndr_print_uint32(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_ATTRIB", XATTR_DOSINFO_ATTRIB, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_EA_SIZE", XATTR_DOSINFO_EA_SIZE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_SIZE", XATTR_DOSINFO_SIZE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_ALLOC_SIZE", XATTR_DOSINFO_ALLOC_SIZE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_CREATE_TIME", XATTR_DOSINFO_CREATE_TIME, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "XATTR_DOSINFO_CHANGE_TIME", XATTR_DOSINFO_CHANGE_TIME, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_xattr_DosInfo3(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_xattr_DosInfoValidFlags(ndr, NDR_SCALARS, r->valid_flags));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo3(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_xattr_DosInfoValidFlags(ndr, NDR_SCALARS, &r->valid_flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo3(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo3 *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfo3");
+ ndr->depth++;
+ ndr_print_xattr_DosInfoValidFlags(ndr, "valid_flags", r->valid_flags);
+ ndr_print_uint32(ndr, "attrib", r->attrib);
+ ndr_print_uint32(ndr, "ea_size", r->ea_size);
+ ndr_print_udlong(ndr, "size", r->size);
+ ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
+ ndr_print_NTTIME(ndr, "create_time", r->create_time);
+ ndr_print_NTTIME(ndr, "change_time", r->change_time);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
int level = ndr_push_get_switch_value(ndr, r);
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
NDR_CHECK(ndr_push_union_align(ndr, 4));
switch (level) {
+ case 0xFFFF: {
+ NDR_CHECK(ndr_push_xattr_DosInfoFFFFCompat(ndr, NDR_SCALARS, &r->compatinfoFFFF));
+ break; }
+
case 1: {
NDR_CHECK(ndr_push_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
@@ -132,6 +245,10 @@ static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_fl
NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
break; }
+ case 3: {
+ NDR_CHECK(ndr_push_xattr_DosInfo3(ndr, NDR_SCALARS, &r->info3));
+ break; }
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
}
@@ -139,12 +256,18 @@ static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_fl
if (ndr_flags & NDR_BUFFERS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
+ case 0xFFFF:
+ break;
+
case 1:
break;
case 2:
break;
+ case 3:
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
}
@@ -152,7 +275,7 @@ static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_fl
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
{
int level;
uint16_t _level;
@@ -164,6 +287,10 @@ static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_fl
}
NDR_CHECK(ndr_pull_union_align(ndr, 4));
switch (level) {
+ case 0xFFFF: {
+ NDR_CHECK(ndr_pull_xattr_DosInfoFFFFCompat(ndr, NDR_SCALARS, &r->compatinfoFFFF));
+ break; }
+
case 1: {
NDR_CHECK(ndr_pull_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
@@ -172,18 +299,28 @@ static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_fl
NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
break; }
+ case 3: {
+ NDR_CHECK(ndr_pull_xattr_DosInfo3(ndr, NDR_SCALARS, &r->info3));
+ break; }
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
}
}
if (ndr_flags & NDR_BUFFERS) {
switch (level) {
+ case 0xFFFF:
+ break;
+
case 1:
break;
case 2:
break;
+ case 3:
+ break;
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
}
@@ -197,6 +334,10 @@ _PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, c
level = ndr_print_get_switch_value(ndr, r);
ndr_print_union(ndr, name, level, "xattr_DosInfo");
switch (level) {
+ case 0xFFFF:
+ ndr_print_xattr_DosInfoFFFFCompat(ndr, "compatinfoFFFF", &r->compatinfoFFFF);
+ break;
+
case 1:
ndr_print_xattr_DosInfo1(ndr, "info1", &r->info1);
break;
@@ -205,6 +346,10 @@ _PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, c
ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
break;
+ case 3:
+ ndr_print_xattr_DosInfo3(ndr, "info3", &r->info3);
+ break;
+
default:
ndr_print_bad_level(ndr, name, level);
}
@@ -893,3 +1038,88 @@ _PUBLIC_ void ndr_print_xattr_NTACL(struct ndr_print *ndr, const char *name, con
ndr->depth--;
}
+static enum ndr_err_code ndr_push_xattr_parse_DOSATTRIB(struct ndr_push *ndr, int flags, const struct xattr_parse_DOSATTRIB *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_xattr_DOSATTRIB(ndr, NDR_SCALARS, &r->in.x));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_parse_DOSATTRIB(struct ndr_pull *ndr, int flags, struct xattr_parse_DOSATTRIB *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_pull_xattr_DOSATTRIB(ndr, NDR_SCALARS, &r->in.x));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_parse_DOSATTRIB(struct ndr_print *ndr, const char *name, int flags, const struct xattr_parse_DOSATTRIB *r)
+{
+ ndr_print_struct(ndr, name, "xattr_parse_DOSATTRIB");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "xattr_parse_DOSATTRIB");
+ ndr->depth++;
+ ndr_print_xattr_DOSATTRIB(ndr, "x", &r->in.x);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "xattr_parse_DOSATTRIB");
+ ndr->depth++;
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+static const struct ndr_interface_call xattr_calls[] = {
+ {
+ "xattr_parse_DOSATTRIB",
+ sizeof(struct xattr_parse_DOSATTRIB),
+ (ndr_push_flags_fn_t) ndr_push_xattr_parse_DOSATTRIB,
+ (ndr_pull_flags_fn_t) ndr_pull_xattr_parse_DOSATTRIB,
+ (ndr_print_function_t) ndr_print_xattr_parse_DOSATTRIB,
+ false,
+ },
+ { NULL, 0, NULL, NULL, NULL, false }
+};
+
+static const char * const xattr_endpoint_strings[] = {
+ "ncacn_np:[\\pipe\\xattr]",
+};
+
+static const struct ndr_interface_string_array xattr_endpoints = {
+ .count = 1,
+ .names = xattr_endpoint_strings
+};
+
+static const char * const xattr_authservice_strings[] = {
+ "host",
+};
+
+static const struct ndr_interface_string_array xattr_authservices = {
+ .count = 1,
+ .names = xattr_authservice_strings
+};
+
+
+const struct ndr_interface_table ndr_table_xattr = {
+ .name = "xattr",
+ .syntax_id = {
+ {0x12345778,0x1234,0xabcd,{0x00,0x01},{0x00,0x00,0x00,0x02}},
+ NDR_XATTR_VERSION
+ },
+ .helpstring = NDR_XATTR_HELPSTRING,
+ .num_calls = 1,
+ .calls = xattr_calls,
+ .endpoints = &xattr_endpoints,
+ .authservices = &xattr_authservices
+};
+
diff --git a/librpc/gen_ndr/ndr_xattr.h b/librpc/gen_ndr/ndr_xattr.h
index 9bf49d00ef..0641eff54d 100644
--- a/librpc/gen_ndr/ndr_xattr.h
+++ b/librpc/gen_ndr/ndr_xattr.h
@@ -6,13 +6,29 @@
#ifndef _HEADER_NDR_xattr
#define _HEADER_NDR_xattr
-#define NDR_XATTR_CALL_COUNT (0)
+#include "../librpc/ndr/ndr_xattr.h"
+#define NDR_XATTR_UUID "12345778-1234-abcd-0001-00000002"
+#define NDR_XATTR_VERSION 0.0
+#define NDR_XATTR_NAME "xattr"
+#define NDR_XATTR_HELPSTRING NULL
+extern const struct ndr_interface_table ndr_table_xattr;
+#define NDR_XATTR_PARSE_DOSATTRIB (0x00)
+
+#define NDR_XATTR_CALL_COUNT (1)
+void ndr_print_xattr_DosInfoFFFFCompat(struct ndr_print *ndr, const char *name, const struct xattr_DosInfoFFFFCompat *r);
void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r);
void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r);
+void ndr_print_xattr_DosInfoValidFlags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_xattr_DosInfo3(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo3 *r);
+enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r);
+enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r);
void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r);
enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r);
enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r);
void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r);
+enum ndr_err_code ndr_push_xattr_DOSATTRIB(struct ndr_push *ndr, int ndr_flags, const struct xattr_DOSATTRIB *r);
+enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr, int ndr_flags, struct xattr_DOSATTRIB *r);
+void ndr_print_xattr_DOSATTRIB(struct ndr_print *ndr, const char *name, const struct xattr_DOSATTRIB *r);
void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r);
enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r);
enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r);
@@ -34,4 +50,5 @@ void ndr_print_xattr_NTACL_Info(struct ndr_print *ndr, const char *name, const u
enum ndr_err_code ndr_push_xattr_NTACL(struct ndr_push *ndr, int ndr_flags, const struct xattr_NTACL *r);
enum ndr_err_code ndr_pull_xattr_NTACL(struct ndr_pull *ndr, int ndr_flags, struct xattr_NTACL *r);
void ndr_print_xattr_NTACL(struct ndr_print *ndr, const char *name, const struct xattr_NTACL *r);
+void ndr_print_xattr_parse_DOSATTRIB(struct ndr_print *ndr, const char *name, int flags, const struct xattr_parse_DOSATTRIB *r);
#endif /* _HEADER_NDR_xattr */
diff --git a/librpc/gen_ndr/xattr.h b/librpc/gen_ndr/xattr.h
index 3138e6fa24..d85d21d0ba 100644
--- a/librpc/gen_ndr/xattr.h
+++ b/librpc/gen_ndr/xattr.h
@@ -20,6 +20,10 @@
#define XATTR_SD_HASH_SIZE ( 64 )
#define XATTR_SD_HASH_TYPE_NONE ( 0x0 )
#define XATTR_SD_HASH_TYPE_SHA256 ( 0x1 )
+struct xattr_DosInfoFFFFCompat {
+ uint32_t attrib;
+};
+
struct xattr_DosInfo1 {
uint32_t attrib;
uint32_t ea_size;
@@ -41,16 +45,42 @@ struct xattr_DosInfo2Old {
const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
};
+/* bitmap xattr_DosInfoValidFlags */
+#define XATTR_DOSINFO_ATTRIB ( 0x00000001 )
+#define XATTR_DOSINFO_EA_SIZE ( 0x00000002 )
+#define XATTR_DOSINFO_SIZE ( 0x00000004 )
+#define XATTR_DOSINFO_ALLOC_SIZE ( 0x00000008 )
+#define XATTR_DOSINFO_CREATE_TIME ( 0x00000010 )
+#define XATTR_DOSINFO_CHANGE_TIME ( 0x00000020 )
+
+struct xattr_DosInfo3 {
+ uint32_t valid_flags;
+ uint32_t attrib;
+ uint32_t ea_size;
+ uint64_t size;
+ uint64_t alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+};
+
union xattr_DosInfo {
+ struct xattr_DosInfoFFFFCompat compatinfoFFFF;/* [case(0xFFFF)] */
struct xattr_DosInfo1 info1;/* [case] */
struct xattr_DosInfo2Old oldinfo2;/* [case(2)] */
-}/* [switch_type(uint16)] */;
+ struct xattr_DosInfo3 info3;/* [case(3)] */
+}/* [public,switch_type(uint16)] */;
struct xattr_DosAttrib {
uint16_t version;
union xattr_DosInfo info;/* [switch_is(version)] */
}/* [public] */;
+struct xattr_DOSATTRIB {
+ const char * attrib_hex;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ uint16_t version;
+ union xattr_DosInfo info;/* [switch_is(version)] */
+}/* [noprint,nopull,public,nopush] */;
+
struct xattr_EA {
const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
DATA_BLOB value;
@@ -100,4 +130,12 @@ struct xattr_NTACL {
union xattr_NTACL_Info info;/* [switch_is(version)] */
}/* [public] */;
+
+struct xattr_parse_DOSATTRIB {
+ struct {
+ struct xattr_DOSATTRIB x;
+ } in;
+
+};
+
#endif /* _HEADER_xattr */
diff --git a/librpc/idl/xattr.idl b/librpc/idl/xattr.idl
index 4485caa48f..1dd98a9588 100644
--- a/librpc/idl/xattr.idl
+++ b/librpc/idl/xattr.idl
@@ -11,6 +11,9 @@
import "security.idl";
[
+ uuid("12345778-1234-abcd-0001-00000002"),
+ version(0.0),
+ helper("../librpc/ndr/ndr_xattr.h"),
pointer_default(unique)
]
interface xattr
@@ -22,6 +25,18 @@ interface xattr
using a union we can cope with new version of this
structure more easily */
+ /*
+ * the FFFF level is never really used,
+ * it's used to pass the information from
+ * the old hex string attrib information
+ * we have a handwritten parser which converts
+ * the hex string to the xattr_DosInfoFFFFCompat strucure
+ */
+
+ typedef struct {
+ uint32 attrib;
+ } xattr_DosInfoFFFFCompat;
+
typedef struct {
uint32 attrib;
uint32 ea_size;
@@ -51,16 +66,46 @@ interface xattr
utf8string name;
} xattr_DosInfo2Old;
- typedef [switch_type(uint16)] union {
- [case(1)] xattr_DosInfo1 info1;
- [case(2)] xattr_DosInfo2Old oldinfo2;
- } xattr_DosInfo;
+ typedef [bitmap32bit] bitmap {
+ XATTR_DOSINFO_ATTRIB = 0x00000001,
+ XATTR_DOSINFO_EA_SIZE = 0x00000002,
+ XATTR_DOSINFO_SIZE = 0x00000004,
+ XATTR_DOSINFO_ALLOC_SIZE = 0x00000008,
+ XATTR_DOSINFO_CREATE_TIME = 0x00000010,
+ XATTR_DOSINFO_CHANGE_TIME = 0x00000020
+ } xattr_DosInfoValidFlags;
+
+ typedef struct {
+ xattr_DosInfoValidFlags valid_flags;
+ uint32 attrib;
+ uint32 ea_size;
+ udlong size;
+ udlong alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ } xattr_DosInfo3;
+
+ typedef [public,switch_type(uint16)] union {
+ [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF;
+ [case(1)] xattr_DosInfo1 info1;
+ [case(2)] xattr_DosInfo2Old oldinfo2;
+ [case(3)] xattr_DosInfo3 info3;
+ } xattr_DosInfo;
typedef [public] struct {
uint16 version;
[switch_is(version)] xattr_DosInfo info;
} xattr_DosAttrib;
+ typedef [public,nopush,nopull,noprint] struct {
+ astring attrib_hex;
+ uint16 version;
+ [switch_is(version)] xattr_DosInfo info;
+ } xattr_DOSATTRIB;
+
+ void xattr_parse_DOSATTRIB(
+ [in] xattr_DOSATTRIB x
+ );
/* we store DOS style extended attributes in a DosEAs xattr */
const char *XATTR_DOSEAS_NAME = "user.DosEAs";
diff --git a/librpc/ndr/ndr_xattr.c b/librpc/ndr/ndr_xattr.c
new file mode 100644
index 0000000000..930f510612
--- /dev/null
+++ b/librpc/ndr/ndr_xattr.c
@@ -0,0 +1,148 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for XATTR marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+
+static char *ndr_compat_xattr_attrib_hex(TALLOC_CTX *mem_ctx,
+ const struct xattr_DOSATTRIB *r)
+{
+ char *attrib_hex = NULL;
+
+ switch (r->version) {
+ case 0xFFFF:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.compatinfoFFFF.attrib);
+ break;
+ case 1:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.info1.attrib);
+ break;
+ case 2:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.oldinfo2.attrib);
+ break;
+ case 3:
+ if (!(r->info.info3.valid_flags & XATTR_DOSINFO_ATTRIB)) {
+ attrib_hex = talloc_strdup(mem_ctx, "");
+ break;
+ }
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.info3.attrib);
+ break;
+ default:
+ attrib_hex = talloc_strdup(mem_ctx, "");
+ break;
+ }
+
+ return attrib_hex;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DOSATTRIB(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct xattr_DOSATTRIB *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ char *attrib_hex = NULL;
+
+ attrib_hex = ndr_compat_xattr_attrib_hex(ndr, r);
+ NDR_ERR_HAVE_NO_MEMORY(attrib_hex);
+
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, attrib_hex));
+ ndr->flags = _flags_save_string;
+ }
+ if (r->version == 0xFFFF) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_push_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr, int ndr_flags, struct xattr_DOSATTRIB *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->attrib_hex));
+ ndr->flags = _flags_save_string;
+ }
+ if (ndr->offset >= ndr->data_size) {
+ unsigned int dosattr;
+ int ret;
+
+ if (r->attrib_hex[0] != '0') {
+
+ }
+ if (r->attrib_hex[1] != 'x') {
+
+ }
+ ret = sscanf(r->attrib_hex, "%x", &dosattr);
+ if (ret != 1) {
+ }
+ r->version = 0xFFFF;
+ r->info.compatinfoFFFF.attrib = dosattr;
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
+ if (r->version == 0xFFFF) {
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH,
+ "ndr_pull_xattr_DOSATTRIB: "
+ "invalid level 0x%02X",
+ r->version);
+ }
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_pull_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DOSATTRIB(struct ndr_print *ndr, const char *name, const struct xattr_DOSATTRIB *r)
+{
+ char *attrib_hex;
+
+ ndr_print_struct(ndr, name, "xattr_DOSATTRIB");
+ ndr->depth++;
+
+ if (ndr->flags & LIBNDR_PRINT_SET_VALUES) {
+ attrib_hex = ndr_compat_xattr_attrib_hex(ndr, r);
+ } else {
+ attrib_hex = talloc_strdup(ndr, r->attrib_hex);
+ }
+ ndr_print_string(ndr, "attrib_hex", attrib_hex);
+
+ ndr_print_uint16(ndr, "version", r->version);
+ ndr_print_set_switch_value(ndr, &r->info, r->version);
+ ndr_print_xattr_DosInfo(ndr, "info", &r->info);
+ ndr->depth--;
+}
diff --git a/librpc/ndr/ndr_xattr.h b/librpc/ndr/ndr_xattr.h
new file mode 100644
index 0000000000..bdc530a0ae
--- /dev/null
+++ b/librpc/ndr/ndr_xattr.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for XATTR marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _LIBRPC_NDR_NDR_XATTR_H
+#define _LIBRPC_NDR_NDR_XATTR_H
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DOSATTRIB(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct xattr_DOSATTRIB *r);
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct xattr_DOSATTRIB *r);
+
+_PUBLIC_ void ndr_print_xattr_DOSATTRIB(struct ndr_print *ndr,
+ const char *name,
+ const struct xattr_DOSATTRIB *r);
+
+#endif /* _LIBRPC_NDR_NDR_XATTR_H */
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 0a9fb91ff8..6a150acd52 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -337,6 +337,7 @@ LIBNDR_GEN_OBJ = ../librpc/gen_ndr/ndr_wkssvc.o \
../librpc/gen_ndr/ndr_dssetup.o \
librpc/gen_ndr/ndr_notify.o \
../librpc/gen_ndr/ndr_xattr.o \
+ ../librpc/ndr/ndr_xattr.o \
../librpc/gen_ndr/ndr_epmapper.o \
../librpc/gen_ndr/ndr_named_pipe_auth.o \
../librpc/gen_ndr/ndr_ntsvcs.o \
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index a7871a627c..501b88bb36 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -251,7 +251,7 @@ NDR_KRB5PAC_OBJ_FILES = ../librpc/gen_ndr/ndr_krb5pac.o ../librpc/ndr/ndr_krb5pa
[SUBSYSTEM::NDR_XATTR]
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
-NDR_XATTR_OBJ_FILES = ../librpc/gen_ndr/ndr_xattr.o
+NDR_XATTR_OBJ_FILES = ../librpc/gen_ndr/ndr_xattr.o ../librpc/ndr/ndr_xattr.o
[SUBSYSTEM::NDR_OPENDB]
PUBLIC_DEPENDENCIES = LIBNDR