The Samba-Bugzilla – Attachment 17467 Details for
Bug 14937
samba-tool ntacl sysvolcheck and sysvolreset crash when Policies directory is missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for better exceptions/messages
bug-14937.patch (text/plain), 4.01 KB, created by
Douglas Bagnall
on 2022-08-10 23:35:13 UTC
(
hide
)
Description:
patch for better exceptions/messages
Filename:
MIME Type:
Creator:
Douglas Bagnall
Created:
2022-08-10 23:35:13 UTC
Size:
4.01 KB
patch
obsolete
>From c51091842f1c19e716d701773ac57376d4bc214e Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Date: Thu, 11 Aug 2022 11:30:26 +1200 >Subject: [PATCH 1/2] pybindings: xattr_native raises OSError not TypeError > >Most likely it is a bad filename or attribute, not the wrong type of >argument. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14937 > >Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >--- > source4/ntvfs/posix/python/pyxattr_native.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/source4/ntvfs/posix/python/pyxattr_native.c b/source4/ntvfs/posix/python/pyxattr_native.c >index d242cd98a5d..7511e5c02bf 100644 >--- a/source4/ntvfs/posix/python/pyxattr_native.c >+++ b/source4/ntvfs/posix/python/pyxattr_native.c >@@ -52,7 +52,7 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args) > if (errno == ENOTSUP) { > PyErr_SetFromErrno(PyExc_IOError); > } else { >- PyErr_SetFromErrno(PyExc_TypeError); >+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename); > } > return NULL; > } >@@ -74,7 +74,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args) > if (errno == ENOTSUP) { > PyErr_SetFromErrno(PyExc_IOError); > } else { >- PyErr_SetFromErrno(PyExc_TypeError); >+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename); > } > talloc_free(mem_ctx); > return NULL; >@@ -86,7 +86,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args) > if (errno == ENOTSUP) { > PyErr_SetFromErrno(PyExc_IOError); > } else { >- PyErr_SetFromErrno(PyExc_TypeError); >+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename); > } > talloc_free(mem_ctx); > return NULL; >-- >2.25.1 > > >From f7f83c05fd4c5f6ae69a907577dd706590976894 Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Date: Thu, 11 Aug 2022 11:26:44 +1200 >Subject: [PATCH 2/2] samba-tool ntacl: better messages for missing files > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14937 > >Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >--- > python/samba/netcmd/ntacl.py | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > >diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py >index 7df75d247fe..bdf8fb7a550 100644 >--- a/python/samba/netcmd/ntacl.py >+++ b/python/samba/netcmd/ntacl.py >@@ -409,10 +409,15 @@ class cmd_ntacl_sysvolreset(Command): > if use_ntvfs: > logger.warning("Please note that POSIX permissions have NOT been changed, only the stored NT ACL") > >- provision.setsysvolacl(samdb, netlogon, sysvol, >- LA_uid, BA_gid, domain_sid, >- lp.get("realm").lower(), samdb.domain_dn(), >- lp, use_ntvfs=use_ntvfs) >+ try: >+ provision.setsysvolacl(samdb, netlogon, sysvol, >+ LA_uid, BA_gid, domain_sid, >+ lp.get("realm").lower(), samdb.domain_dn(), >+ lp, use_ntvfs=use_ntvfs) >+ except OSError as e: >+ if not e.filename: >+ raise >+ raise CommandError("Could not access {e.filename}: {e.strerror}") > > > class cmd_ntacl_sysvolcheck(Command): >@@ -440,10 +445,15 @@ class cmd_ntacl_sysvolcheck(Command): > > domain_sid = security.dom_sid(samdb.domain_sid) > >- provision.checksysvolacl(samdb, netlogon, sysvol, >- domain_sid, >- lp.get("realm").lower(), samdb.domain_dn(), >- lp) >+ try: >+ provision.checksysvolacl(samdb, netlogon, sysvol, >+ domain_sid, >+ lp.get("realm").lower(), samdb.domain_dn(), >+ lp) >+ except OSError as e: >+ if not e.filename: >+ raise >+ raise CommandError("Could not access {e.filename}: {e.strerror}") > > > class cmd_ntacl(SuperCommand): >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14937
: 17467