summaryrefslogtreecommitdiff
path: root/source3/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 /source3/librpc
parent760dfa76d9c912fd352e26be9be8a3d567f12375 (diff)
downloadsamba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.tar.gz
samba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.tar.bz2
samba-0c840bd8d2f650e805bd7d03c2b3fe530b431a4f.zip
Share xattr implementation.
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/ndr_xattr.c492
-rw-r--r--source3/librpc/gen_ndr/ndr_xattr.h17
-rw-r--r--source3/librpc/gen_ndr/xattr.h63
-rw-r--r--source3/librpc/idl/xattr.idl54
4 files changed, 543 insertions, 83 deletions
diff --git a/source3/librpc/gen_ndr/ndr_xattr.c b/source3/librpc/gen_ndr/ndr_xattr.c
index 92369835cf..0e9dda9f47 100644
--- a/source3/librpc/gen_ndr/ndr_xattr.c
+++ b/source3/librpc/gen_ndr/ndr_xattr.c
@@ -3,7 +3,244 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_xattr.h"
-_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r)
+#include "librpc/gen_ndr/ndr_security.h"
+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) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ 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));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo1(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo1 *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_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));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfo1");
+ ndr->depth++;
+ 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--;
+}
+
+static enum ndr_err_code ndr_push_xattr_DosInfo2Old(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo2Old *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->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_NTTIME(ndr, NDR_SCALARS, r->write_time));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo2Old(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo2Old *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->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_NTTIME(ndr, NDR_SCALARS, &r->write_time));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfo2Old");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "flags", r->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_print_NTTIME(ndr, "write_time", r->write_time);
+ ndr_print_string(ndr, "name", r->name);
+ ndr->depth--;
+}
+
+static 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));
+ switch (level) {
+ case 1: {
+ NDR_CHECK(ndr_push_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case 1:
+ break;
+
+ case 2:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
+{
+ int level;
+ uint16_t _level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+ if (_level != level) {
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+ }
+ switch (level) {
+ case 1: {
+ NDR_CHECK(ndr_pull_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case 1:
+ break;
+
+ case 2:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "xattr_DosInfo");
+ switch (level) {
+ case 1:
+ ndr_print_xattr_DosInfo1(ndr, "info1", &r->info1);
+ break;
+
+ case 2:
+ ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_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) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ 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));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &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)
+{
+ ndr_print_struct(ndr, name, "xattr_DosAttrib");
+ ndr->depth++;
+ 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--;
+}
+
+static enum ndr_err_code ndr_push_xattr_EA(struct ndr_push *ndr, int ndr_flags, const struct xattr_EA *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
@@ -20,7 +257,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flag
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r)
+static enum ndr_err_code ndr_pull_xattr_EA(struct ndr_pull *ndr, int ndr_flags, struct xattr_EA *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
@@ -37,23 +274,103 @@ _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flag
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r)
+_PUBLIC_ void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r)
{
- ndr_print_struct(ndr, name, "tdb_xattr");
+ ndr_print_struct(ndr, name, "xattr_EA");
ndr->depth++;
ndr_print_string(ndr, "name", r->name);
ndr_print_DATA_BLOB(ndr, "value", r->value);
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r)
+{
+ uint32_t cntr_eas_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_eas));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->eas));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->eas) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
+ for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
+ NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r)
+{
+ uint32_t _ptr_eas;
+ uint32_t cntr_eas_1;
+ TALLOC_CTX *_mem_save_eas_0;
+ TALLOC_CTX *_mem_save_eas_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_eas));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_eas));
+ if (_ptr_eas) {
+ NDR_PULL_ALLOC(ndr, r->eas);
+ } else {
+ r->eas = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->eas) {
+ _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->eas));
+ NDR_PULL_ALLOC_N(ndr, r->eas, ndr_get_array_size(ndr, &r->eas));
+ _mem_save_eas_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
+ NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
+ }
+ if (r->eas) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->eas, r->num_eas));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r)
+{
+ uint32_t cntr_eas_1;
+ ndr_print_struct(ndr, name, "xattr_DosEAs");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "num_eas", r->num_eas);
+ ndr_print_ptr(ndr, "eas", r->eas);
+ ndr->depth++;
+ if (r->eas) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
+ ndr->depth++;
+ for (cntr_eas_1=0;cntr_eas_1<r->num_eas;cntr_eas_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_eas_1) != -1) {
+ ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r)
{
- uint32_t cntr_xattrs_0;
+ uint32_t cntr_eas_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_xattrs));
- for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) {
- NDR_CHECK(ndr_push_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0]));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
+ for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
+ NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -63,18 +380,18 @@ _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_fla
_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r)
{
- uint32_t cntr_xattrs_0;
- TALLOC_CTX *_mem_save_xattrs_0;
+ uint32_t cntr_eas_0;
+ TALLOC_CTX *_mem_save_eas_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_xattrs));
- NDR_PULL_ALLOC_N(ndr, r->xattrs, r->num_xattrs);
- _mem_save_xattrs_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->xattrs, 0);
- for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) {
- NDR_CHECK(ndr_pull_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0]));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_eas));
+ NDR_PULL_ALLOC_N(ndr, r->eas, r->num_eas);
+ _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
+ NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_xattrs_0, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -83,16 +400,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_fla
_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
{
- uint32_t cntr_xattrs_0;
+ uint32_t cntr_eas_0;
ndr_print_struct(ndr, name, "tdb_xattrs");
ndr->depth++;
- ndr_print_uint32(ndr, "num_xattrs", r->num_xattrs);
- ndr->print(ndr, "%s: ARRAY(%d)", "xattrs", (int)r->num_xattrs);
+ ndr_print_uint32(ndr, "num_eas", r->num_eas);
+ ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
ndr->depth++;
- for (cntr_xattrs_0=0;cntr_xattrs_0<r->num_xattrs;cntr_xattrs_0++) {
+ for (cntr_eas_0=0;cntr_eas_0<r->num_eas;cntr_eas_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_xattrs_0) != -1) {
- ndr_print_tdb_xattr(ndr, "xattrs", &r->xattrs[cntr_xattrs_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_eas_0) != -1) {
+ ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_0]);
free(idx_0);
}
}
@@ -100,6 +417,135 @@ _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, cons
ndr->depth--;
}
+static enum ndr_err_code ndr_push_xattr_DosStream(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStream *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosStream(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStream *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosStream");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "flags", r->flags);
+ ndr_print_udlong(ndr, "size", r->size);
+ ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
+ ndr_print_string(ndr, "name", r->name);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r)
+{
+ uint32_t cntr_streams_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->streams));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->streams) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
+ for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
+ NDR_CHECK(ndr_push_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r)
+{
+ uint32_t _ptr_streams;
+ uint32_t cntr_streams_1;
+ TALLOC_CTX *_mem_save_streams_0;
+ TALLOC_CTX *_mem_save_streams_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_streams));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_streams));
+ if (_ptr_streams) {
+ NDR_PULL_ALLOC(ndr, r->streams);
+ } else {
+ r->streams = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->streams) {
+ _mem_save_streams_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->streams));
+ NDR_PULL_ALLOC_N(ndr, r->streams, ndr_get_array_size(ndr, &r->streams));
+ _mem_save_streams_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
+ for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
+ NDR_CHECK(ndr_pull_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_0, 0);
+ }
+ if (r->streams) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->streams, r->num_streams));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r)
+{
+ uint32_t cntr_streams_1;
+ ndr_print_struct(ndr, name, "xattr_DosStreams");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "num_streams", r->num_streams);
+ ndr_print_ptr(ndr, "streams", r->streams);
+ ndr->depth++;
+ if (r->streams) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "streams", (int)r->num_streams);
+ ndr->depth++;
+ for (cntr_streams_1=0;cntr_streams_1<r->num_streams;cntr_streams_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_streams_1) != -1) {
+ ndr_print_xattr_DosStream(ndr, "streams", &r->streams[cntr_streams_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_timestamp(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_timestamp *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/source3/librpc/gen_ndr/ndr_xattr.h b/source3/librpc/gen_ndr/ndr_xattr.h
index 21c5ae03b5..38701b1aca 100644
--- a/source3/librpc/gen_ndr/ndr_xattr.h
+++ b/source3/librpc/gen_ndr/ndr_xattr.h
@@ -7,12 +7,23 @@
#define _HEADER_NDR_xattr
#define NDR_XATTR_CALL_COUNT (0)
-enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r);
-enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r);
-void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *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_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);
+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);
+void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r);
enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r);
enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r);
void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r);
+void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r);
+enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r);
+enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r);
+void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r);
enum ndr_err_code ndr_push_security_descriptor_timestamp(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_timestamp *r);
enum ndr_err_code ndr_pull_security_descriptor_timestamp(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_timestamp *r);
void ndr_print_security_descriptor_timestamp(struct ndr_print *ndr, const char *name, const struct security_descriptor_timestamp *r);
diff --git a/source3/librpc/gen_ndr/xattr.h b/source3/librpc/gen_ndr/xattr.h
index b0b9db99c1..1d8da3f5e2 100644
--- a/source3/librpc/gen_ndr/xattr.h
+++ b/source3/librpc/gen_ndr/xattr.h
@@ -2,18 +2,75 @@
#include <stdint.h>
+#include "librpc/gen_ndr/security.h"
#ifndef _HEADER_xattr
#define _HEADER_xattr
+#define XATTR_DOSATTRIB_NAME ( "user.DosAttrib" )
+#define XATTR_DOSATTRIB_ESTIMATED_SIZE ( 64 )
+#define XATTR_DOSEAS_NAME ( "user.DosEAs" )
+#define XATTR_DOSSTREAMS_NAME ( "user.DosStreams" )
+#define XATTR_STREAM_FLAG_INTERNAL ( 0x00000001 )
+#define XATTR_DOSSTREAM_PREFIX ( "user.DosStream." )
+#define XATTR_MAX_STREAM_SIZE ( 0x4000 )
+#define XATTR_MAX_STREAM_SIZE_TDB ( 0x100000 )
#define XATTR_NTACL_NAME ( "security.NTACL" )
-struct tdb_xattr {
+struct xattr_DosInfo1 {
+ uint32_t attrib;
+ uint32_t ea_size;
+ uint64_t size;
+ uint64_t alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+};
+
+struct xattr_DosInfo2Old {
+ uint32_t flags;
+ uint32_t attrib;
+ uint32_t ea_size;
+ uint64_t size;
+ uint64_t alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ NTTIME write_time;
+ const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+union xattr_DosInfo {
+ struct xattr_DosInfo1 info1;/* [case] */
+ struct xattr_DosInfo2Old oldinfo2;/* [case(2)] */
+}/* [switch_type(uint16)] */;
+
+struct xattr_DosAttrib {
+ uint16_t version;
+ union xattr_DosInfo info;/* [switch_is(version)] */
+}/* [public] */;
+
+struct xattr_EA {
const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
DATA_BLOB value;
+};
+
+struct xattr_DosEAs {
+ uint16_t num_eas;
+ struct xattr_EA *eas;/* [unique,size_is(num_eas)] */
}/* [public] */;
struct tdb_xattrs {
- uint32_t num_xattrs;
- struct tdb_xattr *xattrs;
+ uint32_t num_eas;
+ struct xattr_EA *eas;
+}/* [public] */;
+
+struct xattr_DosStream {
+ uint32_t flags;
+ uint64_t size;
+ uint64_t alloc_size;
+ const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct xattr_DosStreams {
+ uint32_t num_streams;
+ struct xattr_DosStream *streams;/* [unique,size_is(num_streams)] */
}/* [public] */;
struct security_descriptor_timestamp {
diff --git a/source3/librpc/idl/xattr.idl b/source3/librpc/idl/xattr.idl
deleted file mode 100644
index 23af2df404..0000000000
--- a/source3/librpc/idl/xattr.idl
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "idl_types.h"
-
-/*
- IDL structures for xattrs
-*/
-
-[
- pointer_default(unique)
-]
-interface xattr
-{
- /* xattrs for file systems that don't have any */
-
- typedef [public] struct {
- utf8string name;
- DATA_BLOB value;
- } tdb_xattr;
-
- typedef [public] struct {
- uint32 num_xattrs;
- tdb_xattr xattrs[num_xattrs];
- } tdb_xattrs;
-
- /* 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;
-
-}