summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-05 07:29:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:30 -0500
commit9fe5fa11d637252f1fbe79c7baf778e2d3cdade2 (patch)
tree40f628c02dcc23d3ec4724e43cb9a6fcdeb5c548 /source4/librpc
parent0a8dff9e475aea5312ecc4bc283e8007ee653185 (diff)
downloadsamba-9fe5fa11d637252f1fbe79c7baf778e2d3cdade2.tar.gz
samba-9fe5fa11d637252f1fbe79c7baf778e2d3cdade2.tar.bz2
samba-9fe5fa11d637252f1fbe79c7baf778e2d3cdade2.zip
r3545: initial support for using extended attributes to hold extended dos attributes of files.
I decided to use IDL/NDR to encode the attribute, as it gives us a simple way to describe and extend the saved attributes. The xattr code needs to hook into quite a few more places in the pvfs code, but this at least gets the basics done. I will start encoding alternate data streams streams, DOS EAs etc soon using the same basic mechanism. I'll probably stick to "version 1" for the xattr.idl for quite a while even though it will be changing, as I don't expect anyone to be deploying this in production just yet. Once we have production users we will need to keep compatibility by supporting all the old version numbers in xattr.idl. (This used to be commit c54253ed1b7dce1d14f43e747da61089aea87094)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/config.m446
-rw-r--r--source4/librpc/config.mk50
-rw-r--r--source4/librpc/idl/xattr.idl35
-rw-r--r--source4/librpc/ndr/ndr.c58
4 files changed, 105 insertions, 84 deletions
diff --git a/source4/librpc/config.m4 b/source4/librpc/config.m4
index 76dc8c9c0f..5c137b738b 100644
--- a/source4/librpc/config.m4
+++ b/source4/librpc/config.m4
@@ -1,50 +1,8 @@
dnl # LIBRPC subsystem
-SMB_SUBSYSTEM_MK(LIBNDR_RAW,librpc/config.mk)
-
SMB_SUBSYSTEM_NOPROTO(LIBNDR_GEN)
-SMB_SUBSYSTEM(LIBNDR_GEN,[],
- [librpc/gen_ndr/tables.o
- librpc/gen_ndr/ndr_audiosrv.o
- librpc/gen_ndr/ndr_dcerpc.o
- librpc/gen_ndr/ndr_echo.o
- librpc/gen_ndr/ndr_exchange.o
- librpc/gen_ndr/ndr_dsbackup.o
- librpc/gen_ndr/ndr_efs.o
- librpc/gen_ndr/ndr_misc.o
- librpc/gen_ndr/ndr_lsa.o
- librpc/gen_ndr/ndr_lsads.o
- librpc/gen_ndr/ndr_dfs.o
- librpc/gen_ndr/ndr_drsuapi.o
- librpc/gen_ndr/ndr_policyagent.o
- librpc/gen_ndr/ndr_samr.o
- librpc/gen_ndr/ndr_spoolss.o
- librpc/gen_ndr/ndr_wkssvc.o
- librpc/gen_ndr/ndr_srvsvc.o
- librpc/gen_ndr/ndr_svcctl.o
- librpc/gen_ndr/ndr_atsvc.o
- librpc/gen_ndr/ndr_eventlog.o
- librpc/gen_ndr/ndr_epmapper.o
- librpc/gen_ndr/ndr_dbgidl.o
- librpc/gen_ndr/ndr_dssetup.o
- librpc/gen_ndr/ndr_msgsvc.o
- librpc/gen_ndr/ndr_wins.o
- librpc/gen_ndr/ndr_winreg.o
- librpc/gen_ndr/ndr_mgmt.o
- librpc/gen_ndr/ndr_protected_storage.o
- librpc/gen_ndr/ndr_dcom.o
- librpc/gen_ndr/ndr_oxidresolver.o
- librpc/gen_ndr/ndr_remact.o
- librpc/gen_ndr/ndr_wzcsvc.o
- librpc/gen_ndr/ndr_browser.o
- librpc/gen_ndr/ndr_w32time.o
- librpc/gen_ndr/ndr_scerpc.o
- librpc/gen_ndr/ndr_ntsvcs.o
- librpc/gen_ndr/ndr_netlogon.o
- librpc/gen_ndr/ndr_trkwks.o
- librpc/gen_ndr/ndr_keysvc.o
- librpc/gen_ndr/ndr_krb5pac.o
- librpc/gen_ndr/ndr_schannel.o])
+SMB_SUBSYSTEM_MK(LIBNDR_GEN,librpc/config.mk)
+SMB_SUBSYSTEM_MK(LIBNDR_RAW,librpc/config.mk)
SMB_SUBSYSTEM_MK(LIBRPC_RAW,librpc/config.mk)
SMB_SUBSYSTEM_MK(LIBRPC,librpc/config.mk)
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 6e33b5c104..a359f13f54 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -28,6 +28,56 @@ ADD_OBJ_FILES = \
################################################
################################################
+# Start SUBSYSTEM LIBNDR_GEN
+[SUBSYSTEM::LIBNDR_GEN]
+INIT_OBJ_FILES = \
+ librpc/gen_ndr/tables.o
+ADD_OBJ_FILES = \
+ librpc/gen_ndr/ndr_audiosrv.o \
+ librpc/gen_ndr/ndr_dcerpc.o \
+ librpc/gen_ndr/ndr_echo.o \
+ librpc/gen_ndr/ndr_exchange.o \
+ librpc/gen_ndr/ndr_dsbackup.o \
+ librpc/gen_ndr/ndr_efs.o \
+ librpc/gen_ndr/ndr_misc.o \
+ librpc/gen_ndr/ndr_lsa.o \
+ librpc/gen_ndr/ndr_lsads.o \
+ librpc/gen_ndr/ndr_dfs.o \
+ librpc/gen_ndr/ndr_drsuapi.o \
+ librpc/gen_ndr/ndr_policyagent.o \
+ librpc/gen_ndr/ndr_samr.o \
+ librpc/gen_ndr/ndr_spoolss.o \
+ librpc/gen_ndr/ndr_wkssvc.o \
+ librpc/gen_ndr/ndr_srvsvc.o \
+ librpc/gen_ndr/ndr_svcctl.o \
+ librpc/gen_ndr/ndr_atsvc.o \
+ librpc/gen_ndr/ndr_eventlog.o \
+ librpc/gen_ndr/ndr_epmapper.o \
+ librpc/gen_ndr/ndr_dbgidl.o \
+ librpc/gen_ndr/ndr_dssetup.o \
+ librpc/gen_ndr/ndr_msgsvc.o \
+ librpc/gen_ndr/ndr_wins.o \
+ librpc/gen_ndr/ndr_winreg.o \
+ librpc/gen_ndr/ndr_mgmt.o \
+ librpc/gen_ndr/ndr_protected_storage.o \
+ librpc/gen_ndr/ndr_dcom.o \
+ librpc/gen_ndr/ndr_oxidresolver.o \
+ librpc/gen_ndr/ndr_remact.o \
+ librpc/gen_ndr/ndr_wzcsvc.o \
+ librpc/gen_ndr/ndr_browser.o \
+ librpc/gen_ndr/ndr_w32time.o \
+ librpc/gen_ndr/ndr_scerpc.o \
+ librpc/gen_ndr/ndr_ntsvcs.o \
+ librpc/gen_ndr/ndr_netlogon.o \
+ librpc/gen_ndr/ndr_trkwks.o \
+ librpc/gen_ndr/ndr_keysvc.o \
+ librpc/gen_ndr/ndr_krb5pac.o \
+ librpc/gen_ndr/ndr_xattr.o \
+ librpc/gen_ndr/ndr_schannel.o
+# End SUBSYSTEM LIBNDR_GEN
+################################################
+
+################################################
# Start SUBSYSTEM LIBRPC
[SUBSYSTEM::LIBRPC]
REQUIRED_SUBSYSTEMS = LIBNDR_RAW LIBNDR_GEN LIBRPC_RAW
diff --git a/source4/librpc/idl/xattr.idl b/source4/librpc/idl/xattr.idl
new file mode 100644
index 0000000000..aa5c0a0d6a
--- /dev/null
+++ b/source4/librpc/idl/xattr.idl
@@ -0,0 +1,35 @@
+#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
+*/
+
+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 */
+ typedef struct {
+ uint32 attrib;
+ uint32 ea_size;
+ uint64 size;
+ uint64 alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ } xattr_DosInfo1;
+
+ typedef union {
+ [case(1)] xattr_DosInfo1 info1;
+ } xattr_DosInfo;
+
+ typedef [public] struct {
+ uint16 version;
+ [switch_is(version)] xattr_DosInfo info;
+ } xattr_DosAttrib;
+}
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 8e8e49e220..71019030ac 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -318,9 +318,7 @@ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRI
/*
a useful helper function for printing idl structures via DEBUG()
*/
-void ndr_print_debug(void (*fn)(struct ndr_print *, const char *, void *),
- const char *name,
- void *ptr)
+void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr)
{
struct ndr_print *ndr;
@@ -337,10 +335,7 @@ void ndr_print_debug(void (*fn)(struct ndr_print *, const char *, void *),
/*
a useful helper function for printing idl unions via DEBUG()
*/
-void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint32_t, void *),
- const char *name,
- uint32_t level,
- void *ptr)
+void ndr_print_union_debug(ndr_print_union_fn_t fn, const char *name, uint32_t level, void *ptr)
{
struct ndr_print *ndr;
@@ -356,10 +351,7 @@ void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint32_t
/*
a useful helper function for printing idl function calls via DEBUG()
*/
-void ndr_print_function_debug(void (*fn)(struct ndr_print *, const char *, int , void *),
- const char *name,
- int flags,
- void *ptr)
+void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr)
{
struct ndr_print *ndr;
@@ -481,10 +473,8 @@ static NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
handle subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
-NTSTATUS ndr_pull_subcontext_fn(struct ndr_pull *ndr,
- size_t sub_size,
- void *base,
- NTSTATUS (*fn)(struct ndr_pull *, void *))
+NTSTATUS ndr_pull_subcontext_fn(struct ndr_pull *ndr, size_t sub_size,
+ void *base, ndr_pull_fn_t fn)
{
struct ndr_pull *ndr2;
NDR_ALLOC(ndr, ndr2);
@@ -499,10 +489,8 @@ NTSTATUS ndr_pull_subcontext_fn(struct ndr_pull *ndr,
}
-NTSTATUS ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr,
- size_t sub_size,
- void *base,
- NTSTATUS (*fn)(struct ndr_pull *, int , void *))
+NTSTATUS ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr, size_t sub_size,
+ void *base, ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr2;
NDR_ALLOC(ndr, ndr2);
@@ -516,11 +504,8 @@ NTSTATUS ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr,
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_subcontext_union_fn(struct ndr_pull *ndr,
- size_t sub_size,
- uint32_t level,
- void *base,
- NTSTATUS (*fn)(struct ndr_pull *, int , uint32_t , void *))
+NTSTATUS ndr_pull_subcontext_union_fn(struct ndr_pull *ndr, size_t sub_size,
+ uint32_t level, void *base, ndr_pull_union_fn_t fn)
{
struct ndr_pull *ndr2;
@@ -566,10 +551,8 @@ static NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr,
handle subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
-NTSTATUS ndr_push_subcontext_fn(struct ndr_push *ndr,
- size_t sub_size,
- void *base,
- NTSTATUS (*fn)(struct ndr_push *, void *))
+NTSTATUS ndr_push_subcontext_fn(struct ndr_push *ndr, size_t sub_size,
+ void *base, ndr_push_fn_t fn)
{
struct ndr_push *ndr2;
@@ -586,10 +569,8 @@ NTSTATUS ndr_push_subcontext_fn(struct ndr_push *ndr,
/*
handle subcontext buffers for function that take a flags arg
*/
-NTSTATUS ndr_push_subcontext_flags_fn(struct ndr_push *ndr,
- size_t sub_size,
- void *base,
- NTSTATUS (*fn)(struct ndr_push *, int, void *))
+NTSTATUS ndr_push_subcontext_flags_fn(struct ndr_push *ndr, size_t sub_size,
+ void *base, ndr_push_flags_fn_t fn)
{
struct ndr_push *ndr2;
@@ -606,11 +587,8 @@ NTSTATUS ndr_push_subcontext_flags_fn(struct ndr_push *ndr,
/*
handle subcontext buffers for function that take a union
*/
-NTSTATUS ndr_push_subcontext_union_fn(struct ndr_push *ndr,
- size_t sub_size,
- uint32_t level,
- void *base,
- NTSTATUS (*fn)(struct ndr_push *, int, uint32_t, void *))
+NTSTATUS ndr_push_subcontext_union_fn(struct ndr_push *ndr, size_t sub_size,
+ uint32_t level, void *base, ndr_push_union_fn_t fn)
{
struct ndr_push *ndr2;
@@ -763,7 +741,7 @@ NTSTATUS ndr_push_relative2(struct ndr_push *ndr, const void *p)
pull a union from a blob using NDR
*/
NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint32_t level, void *p,
- NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, uint32_t, void *))
+ ndr_pull_union_fn_t fn)
{
struct ndr_pull *ndr;
ndr = ndr_pull_init_blob(blob, mem_ctx);
@@ -777,7 +755,7 @@ NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint32_t leve
pull a struct from a blob using NDR
*/
NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- NTSTATUS (*fn)(struct ndr_pull *, int , void *))
+ ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr;
ndr = ndr_pull_init_blob(blob, mem_ctx);
@@ -791,7 +769,7 @@ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *
push a struct to a blob using NDR
*/
NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- NTSTATUS (*fn)(struct ndr_push *, int , void *))
+ ndr_push_flags_fn_t fn)
{
NTSTATUS status;
struct ndr_push *ndr;