summaryrefslogtreecommitdiff
path: root/source4/libcli/security
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/security')
-rw-r--r--source4/libcli/security/security.i13
-rw-r--r--source4/libcli/security/security.py40
-rw-r--r--source4/libcli/security/security_wrap.c25
3 files changed, 71 insertions, 7 deletions
diff --git a/source4/libcli/security/security.i b/source4/libcli/security/security.i
index 647c9aea09..1d964cc3d5 100644
--- a/source4/libcli/security/security.i
+++ b/source4/libcli/security/security.i
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-%module(package="samba.security") security
+%module(docstring="Security-related classes.",package="samba.security") security
%{
#include "includes.h"
@@ -65,8 +65,14 @@ enum sec_privilege {
typedef struct security_token {
%extend {
security_token(TALLOC_CTX *mem_ctx) { return security_token_initialise(mem_ctx); }
+ %feature("docstring") is_sid "S.is_sid(sid) -> bool\n" \
+ "Check whether this token is of the specified SID.";
bool is_sid(const struct dom_sid *sid);
+ %feature("docstring") is_system "S.is_system() -> bool\n" \
+ "Check whether this is a system token.";
bool is_system();
+ %feature("docstring") is_anonymous "S.is_anonymus() -> bool\n" \
+ "Check whether this is an anonymous token.";
bool is_anonymous();
bool has_sid(const struct dom_sid *sid);
bool has_builtin_administrators();
@@ -81,6 +87,8 @@ typedef struct security_token {
typedef struct security_descriptor {
%extend {
security_descriptor(TALLOC_CTX *mem_ctx) { return security_descriptor_initialise(mem_ctx); }
+ %feature("docstring") sacl_add "S.sacl_add(ace) -> None\n" \
+ "Add a security ace to this security descriptor";
NTSTATUS sacl_add(const struct security_ace *ace);
NTSTATUS dacl_add(const struct security_ace *ace);
NTSTATUS dacl_del(const struct dom_sid *trustee);
@@ -111,6 +119,9 @@ typedef struct dom_sid {
}
} dom_sid;
+%feature("docstring") random_sid "random_sid() -> sid\n" \
+ "Generate a random SID";
+
%inline %{
static struct dom_sid *random_sid(TALLOC_CTX *mem_ctx)
{
diff --git a/source4/libcli/security/security.py b/source4/libcli/security/security.py
index 7e56e22cef..065c7a19e4 100644
--- a/source4/libcli/security/security.py
+++ b/source4/libcli/security/security.py
@@ -3,6 +3,10 @@
#
# Don't modify this file, modify the SWIG interface instead.
+"""
+Security-related classes.
+"""
+
import _security
import new
new_instancemethod = new.instancemethod
@@ -86,6 +90,27 @@ class SecurityToken(object):
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
_security.SecurityToken_swiginit(self,_security.new_SecurityToken(*args, **kwargs))
+ def is_sid(*args, **kwargs):
+ """
+ S.is_sid(sid) -> bool
+ Check whether this token is of the specified SID.
+ """
+ return _security.SecurityToken_is_sid(*args, **kwargs)
+
+ def is_system(*args, **kwargs):
+ """
+ S.is_system() -> bool
+ Check whether this is a system token.
+ """
+ return _security.SecurityToken_is_system(*args, **kwargs)
+
+ def is_anonymous(*args, **kwargs):
+ """
+ S.is_anonymus() -> bool
+ Check whether this is an anonymous token.
+ """
+ return _security.SecurityToken_is_anonymous(*args, **kwargs)
+
__swig_destroy__ = _security.delete_SecurityToken
SecurityToken.is_sid = new_instancemethod(_security.SecurityToken_is_sid,None,SecurityToken)
SecurityToken.is_system = new_instancemethod(_security.SecurityToken_is_system,None,SecurityToken)
@@ -103,6 +128,13 @@ class security_descriptor(object):
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
_security.security_descriptor_swiginit(self,_security.new_security_descriptor(*args, **kwargs))
+ def sacl_add(*args, **kwargs):
+ """
+ S.sacl_add(ace) -> None
+ Add a security ace to this security descriptor
+ """
+ return _security.security_descriptor_sacl_add(*args, **kwargs)
+
__swig_destroy__ = _security.delete_security_descriptor
security_descriptor.sacl_add = new_instancemethod(_security.security_descriptor_sacl_add,None,security_descriptor)
security_descriptor.dacl_add = new_instancemethod(_security.security_descriptor_dacl_add,None,security_descriptor)
@@ -123,7 +155,13 @@ Sid.__eq__ = new_instancemethod(_security.Sid___eq__,None,Sid)
Sid_swigregister = _security.Sid_swigregister
Sid_swigregister(Sid)
-random_sid = _security.random_sid
+
+def random_sid(*args):
+ """
+ random_sid() -> sid
+ Generate a random SID
+ """
+ return _security.random_sid(*args)
privilege_name = _security.privilege_name
privilege_id = _security.privilege_id
diff --git a/source4/libcli/security/security_wrap.c b/source4/libcli/security/security_wrap.c
index aabf6c27ee..a10626c043 100644
--- a/source4/libcli/security/security_wrap.c
+++ b/source4/libcli/security/security_wrap.c
@@ -3527,9 +3527,18 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"new_SecurityToken", (PyCFunction)_wrap_new_SecurityToken, METH_NOARGS, NULL},
- { (char *)"SecurityToken_is_sid", (PyCFunction) _wrap_SecurityToken_is_sid, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"SecurityToken_is_system", (PyCFunction)_wrap_SecurityToken_is_system, METH_O, NULL},
- { (char *)"SecurityToken_is_anonymous", (PyCFunction)_wrap_SecurityToken_is_anonymous, METH_O, NULL},
+ { (char *)"SecurityToken_is_sid", (PyCFunction) _wrap_SecurityToken_is_sid, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.is_sid(sid) -> bool\n"
+ "Check whether this token is of the specified SID.\n"
+ ""},
+ { (char *)"SecurityToken_is_system", (PyCFunction)_wrap_SecurityToken_is_system, METH_O, (char *)"\n"
+ "S.is_system() -> bool\n"
+ "Check whether this is a system token.\n"
+ ""},
+ { (char *)"SecurityToken_is_anonymous", (PyCFunction)_wrap_SecurityToken_is_anonymous, METH_O, (char *)"\n"
+ "S.is_anonymus() -> bool\n"
+ "Check whether this is an anonymous token.\n"
+ ""},
{ (char *)"SecurityToken_has_sid", (PyCFunction) _wrap_SecurityToken_has_sid, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"SecurityToken_has_builtin_administrators", (PyCFunction)_wrap_SecurityToken_has_builtin_administrators, METH_O, NULL},
{ (char *)"SecurityToken_has_nt_authenticated_users", (PyCFunction)_wrap_SecurityToken_has_nt_authenticated_users, METH_O, NULL},
@@ -3539,7 +3548,10 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"SecurityToken_swigregister", SecurityToken_swigregister, METH_VARARGS, NULL},
{ (char *)"SecurityToken_swiginit", SecurityToken_swiginit, METH_VARARGS, NULL},
{ (char *)"new_security_descriptor", (PyCFunction)_wrap_new_security_descriptor, METH_NOARGS, NULL},
- { (char *)"security_descriptor_sacl_add", (PyCFunction) _wrap_security_descriptor_sacl_add, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"security_descriptor_sacl_add", (PyCFunction) _wrap_security_descriptor_sacl_add, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.sacl_add(ace) -> None\n"
+ "Add a security ace to this security descriptor\n"
+ ""},
{ (char *)"security_descriptor_dacl_add", (PyCFunction) _wrap_security_descriptor_dacl_add, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"security_descriptor_dacl_del", (PyCFunction) _wrap_security_descriptor_dacl_del, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"security_descriptor_sacl_del", (PyCFunction) _wrap_security_descriptor_sacl_del, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -3553,7 +3565,10 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"delete_Sid", (PyCFunction)_wrap_delete_Sid, METH_O, NULL},
{ (char *)"Sid_swigregister", Sid_swigregister, METH_VARARGS, NULL},
{ (char *)"Sid_swiginit", Sid_swiginit, METH_VARARGS, NULL},
- { (char *)"random_sid", (PyCFunction)_wrap_random_sid, METH_NOARGS, NULL},
+ { (char *)"random_sid", (PyCFunction)_wrap_random_sid, METH_NOARGS, (char *)"\n"
+ "random_sid() -> sid\n"
+ "Generate a random SID\n"
+ ""},
{ (char *)"privilege_name", (PyCFunction) _wrap_privilege_name, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"privilege_id", (PyCFunction) _wrap_privilege_id, METH_VARARGS | METH_KEYWORDS, NULL},
{ NULL, NULL, 0, NULL }