The branch, master has been updated via 875beef samba-tool: add command to dump dosinfo xattr from a file from 44aff1a ctdb-build: Use socket_wrapper only with selftest
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 875beefcedd2ef9d608c7f58cec18a86a3fd51e1 Author: Ralph Boehme <s...@samba.org> Date: Sat Sep 26 01:16:50 2015 +0200 samba-tool: add command to dump dosinfo xattr from a file Add a new command "getdosinfo" to samba-tool to dump dosinfo xattr from a file. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Tue Sep 29 06:00:49 CEST 2015 on sn-devel-104 ----------------------------------------------------------------------- Summary of changes: librpc/idl/xattr.idl | 1 + python/samba/netcmd/ntacl.py | 24 +++++++++++++++++++++++- python/samba/ntacls.py | 8 ++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) Changeset truncated at 500 lines: diff --git a/librpc/idl/xattr.idl b/librpc/idl/xattr.idl index b4c1b98..efbc84e 100644 --- a/librpc/idl/xattr.idl +++ b/librpc/idl/xattr.idl @@ -20,6 +20,7 @@ import "security.idl"; interface xattr { const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib"; + const char *XATTR_DOSATTRIB_NAME_S3 = "user.DOSATTRIB"; const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64; /* we store basic dos attributes in a DosAttrib xattr. By diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py index dff1550..eaea0e7 100644 --- a/python/samba/netcmd/ntacl.py +++ b/python/samba/netcmd/ntacl.py @@ -19,7 +19,7 @@ from samba.credentials import DONT_USE_KERBEROS import samba.getopt as options from samba.dcerpc import security, idmap -from samba.ntacls import setntacl, getntacl +from samba.ntacls import setntacl, getntacl,getdosinfo from samba import Ldb from samba.ndr import ndr_unpack, ndr_print from samba.samdb import SamDB @@ -95,6 +95,27 @@ class cmd_ntacl_set(Command): logger.warning("Please note that POSIX permissions have NOT been changed, only the stored NT ACL") +class cmd_dosinfo_get(Command): + """Get DOS info of a file from xattr.""" + synopsis = "%prog <file> [options]" + + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + + takes_args = ["file"] + + def run(self, file, credopts=None, sambaopts=None, versionopts=None): + lp = sambaopts.get_loadparm() + s3conf = s3param.get_context() + s3conf.load(lp.configfile) + + dosinfo = getdosinfo(lp, file) + if dosinfo: + self.outf.write(ndr_print(dosinfo)) + class cmd_ntacl_get(Command): """Get ACLs of a file.""" synopsis = "%prog <file> [options]" @@ -257,4 +278,5 @@ class cmd_ntacl(SuperCommand): subcommands["get"] = cmd_ntacl_get() subcommands["sysvolreset"] = cmd_ntacl_sysvolreset() subcommands["sysvolcheck"] = cmd_ntacl_sysvolcheck() + subcommands["getdosinfo"] = cmd_dosinfo_get() diff --git a/python/samba/ntacls.py b/python/samba/ntacls.py index 53438d8..0eeb497 100644 --- a/python/samba/ntacls.py +++ b/python/samba/ntacls.py @@ -54,6 +54,14 @@ def checkset_backend(lp, backend, eadbfile): else: raise XattrBackendError("Invalid xattr backend choice %s"%backend) +def getdosinfo(lp, file): + try: + attribute = samba.xattr_native.wrap_getxattr(file, + xattr.XATTR_DOSATTRIB_NAME_S3) + except Exception: + return + + return ndr_unpack(xattr.DOSATTRIB, attribute) def getntacl(lp, file, backend=None, eadbfile=None, direct_db_access=True, service=None): if direct_db_access: -- Samba Shared Repository