#include "includes.h"
#include "vfs_posix.h"
+#include "lib/util/unix_privs.h"
#include "librpc/gen_ndr/ndr_xattr.h"
/*
fd, estimated_size, blob);
/* if the filesystem doesn't support them, then tell pvfs not to try again */
- if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
- DEBUG(5,("pvfs_xattr: xattr not supported in filesystem\n"));
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)||
+ NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)||
+ NT_STATUS_EQUAL(status, NT_STATUS_INVALID_SYSTEM_SERVICE)) {
+ DEBUG(5,("pvfs_xattr: xattr not supported in filesystem: %s\n", nt_errstr(status)));
pvfs->flags &= ~PVFS_FLAG_XATTR_ENABLE;
status = NT_STATUS_NOT_FOUND;
}
/*
load a NDR structure from a xattr
*/
-static NTSTATUS pvfs_xattr_ndr_load(struct pvfs_state *pvfs,
- TALLOC_CTX *mem_ctx,
- const char *fname, int fd, const char *attr_name,
- void *p, ndr_pull_flags_fn_t pull_fn)
+_PUBLIC_ NTSTATUS pvfs_xattr_ndr_load(struct pvfs_state *pvfs,
+ TALLOC_CTX *mem_ctx,
+ const char *fname, int fd, const char *attr_name,
+ void *p, void *pull_fn)
{
NTSTATUS status;
DATA_BLOB blob;
}
/* pull the blob */
- status = ndr_pull_struct_blob(&blob, mem_ctx, p, pull_fn);
+ status = ndr_pull_struct_blob(&blob, mem_ctx, p, (ndr_pull_flags_fn_t)pull_fn);
data_blob_free(&blob);
/*
save a NDR structure into a xattr
*/
-static NTSTATUS pvfs_xattr_ndr_save(struct pvfs_state *pvfs,
- const char *fname, int fd, const char *attr_name,
- void *p, ndr_push_flags_fn_t push_fn)
+_PUBLIC_ NTSTATUS pvfs_xattr_ndr_save(struct pvfs_state *pvfs,
+ const char *fname, int fd, const char *attr_name,
+ void *p, void *push_fn)
{
TALLOC_CTX *mem_ctx = talloc_new(NULL);
DATA_BLOB blob;
NTSTATUS status;
- status = ndr_push_struct_blob(&blob, mem_ctx, p, push_fn);
+ status = ndr_push_struct_blob(&blob, mem_ctx, p, (ndr_push_flags_fn_t)push_fn);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return status;
return status;
}
+
+/*
+ probe for system support for xattrs
+*/
+void pvfs_xattr_probe(struct pvfs_state *pvfs)
+{
+ TALLOC_CTX *tmp_ctx = talloc_new(pvfs);
+ DATA_BLOB blob;
+ pull_xattr_blob(pvfs, tmp_ctx, "user.XattrProbe", pvfs->base_directory,
+ -1, 1, &blob);
+ pull_xattr_blob(pvfs, tmp_ctx, "security.XattrProbe", pvfs->base_directory,
+ -1, 1, &blob);
+ talloc_free(tmp_ctx);
+}