summaryrefslogtreecommitdiff
path: root/source4/libcli/security
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/security')
-rw-r--r--source4/libcli/security/access_check.c15
-rw-r--r--source4/libcli/security/security.i14
-rw-r--r--source4/libcli/security/security.py9
-rw-r--r--source4/libcli/security/security_wrap.c180
-rw-r--r--source4/libcli/security/tests/bindings.py4
5 files changed, 188 insertions, 34 deletions
diff --git a/source4/libcli/security/access_check.c b/source4/libcli/security/access_check.c
index e2ede05545..d5a0a13445 100644
--- a/source4/libcli/security/access_check.c
+++ b/source4/libcli/security/access_check.c
@@ -38,6 +38,10 @@ static uint32_t access_check_max_allowed(const struct security_descriptor *sd,
granted |= SEC_STD_DELETE;
}
+ if (sd->dacl == NULL) {
+ return granted & ~denied;
+ }
+
for (i = 0;i<sd->dacl->num_aces; i++) {
struct security_ace *ace = &sd->dacl->aces[i];
@@ -101,10 +105,14 @@ NTSTATUS sec_access_check(const struct security_descriptor *sd,
return NT_STATUS_OK;
}
- /* empty dacl denies access */
+#if 0
+ /* tridge: previously we had empty dacl denying access, but
+ that can lead to undeletable directories, where
+ nobody can change the ACL on a directory */
if (sd->dacl == NULL || sd->dacl->num_aces == 0) {
return NT_STATUS_ACCESS_DENIED;
}
+#endif
/* the owner always gets SEC_STD_WRITE_DAC, SEC_STD_READ_CONTROL and SEC_STD_DELETE */
if ((bits_remaining & (SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL|SEC_STD_DELETE)) &&
@@ -116,6 +124,10 @@ NTSTATUS sec_access_check(const struct security_descriptor *sd,
bits_remaining &= ~SEC_STD_DELETE;
}
+ if (sd->dacl == NULL) {
+ goto done;
+ }
+
/* check each ace in turn. */
for (i=0; bits_remaining && i < sd->dacl->num_aces; i++) {
struct security_ace *ace = &sd->dacl->aces[i];
@@ -143,6 +155,7 @@ NTSTATUS sec_access_check(const struct security_descriptor *sd,
}
}
+done:
if (bits_remaining != 0) {
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source4/libcli/security/security.i b/source4/libcli/security/security.i
index 1d964cc3d5..420439d147 100644
--- a/source4/libcli/security/security.i
+++ b/source4/libcli/security/security.i
@@ -27,8 +27,8 @@ typedef struct security_token security_token;
typedef struct security_descriptor security_descriptor;
%}
-%import "../../lib/talloc/talloc.i"
-%import "../util/errors.i"
+%import "../lib/talloc/talloc.i"
+%include "../util/errors.i"
%import "stdint.i"
enum sec_privilege {
@@ -105,6 +105,12 @@ typedef struct security_descriptor {
%talloctype(dom_sid);
typedef struct dom_sid {
+ %immutable;
+ uint8_t sid_rev_num;
+ int8_t num_auths;/* [range(0,15)] */
+ uint8_t id_auth[6];
+ uint32_t *sub_auths;
+ %mutable;
%extend {
dom_sid(TALLOC_CTX *mem_ctx, const char *text) {
return dom_sid_parse_talloc(mem_ctx, text);
@@ -117,6 +123,10 @@ typedef struct dom_sid {
#endif
bool equal(const struct dom_sid *other);
}
+%pythoncode {
+ def __repr__(self):
+ return "Sid(%r)" % str(self)
+}
} dom_sid;
%feature("docstring") random_sid "random_sid() -> sid\n" \
diff --git a/source4/libcli/security/security.py b/source4/libcli/security/security.py
index 065c7a19e4..8afb3eda61 100644
--- a/source4/libcli/security/security.py
+++ b/source4/libcli/security/security.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.35
+# Version 1.3.36
#
# Don't modify this file, modify the SWIG interface instead.
@@ -147,8 +147,15 @@ security_descriptor_swigregister(security_descriptor)
class Sid(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
+ sid_rev_num = _swig_property(_security.Sid_sid_rev_num_get)
+ num_auths = _swig_property(_security.Sid_num_auths_get)
+ id_auth = _swig_property(_security.Sid_id_auth_get)
+ sub_auths = _swig_property(_security.Sid_sub_auths_get)
def __init__(self, *args, **kwargs):
_security.Sid_swiginit(self,_security.new_Sid(*args, **kwargs))
+ def __repr__(self):
+ return "Sid(%r)" % str(self)
+
__swig_destroy__ = _security.delete_Sid
Sid.__str__ = new_instancemethod(_security.Sid___str__,None,Sid)
Sid.__eq__ = new_instancemethod(_security.Sid___eq__,None,Sid)
diff --git a/source4/libcli/security/security_wrap.c b/source4/libcli/security/security_wrap.c
index a10626c043..f7e3c2fb21 100644
--- a/source4/libcli/security/security_wrap.c
+++ b/source4/libcli/security/security_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
+ * Version 1.3.36
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -52,6 +52,12 @@
# endif
#endif
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+# pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
@@ -2521,7 +2527,7 @@ static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
#define SWIG_name "_security"
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010336
#define SWIG_VERSION SWIGVERSION
@@ -2537,6 +2543,9 @@ typedef struct security_token security_token;
typedef struct security_descriptor security_descriptor;
+#include "libcli/util/pyerrors.h"
+
+
#define SWIG_From_long PyInt_FromLong
@@ -2703,6 +2712,28 @@ SWIGINTERN void delete_security_token(security_token *self){ talloc_free(self);
SWIGINTERN security_descriptor *new_security_descriptor(TALLOC_CTX *mem_ctx){ return security_descriptor_initialise(mem_ctx); }
SWIGINTERN void delete_security_descriptor(security_descriptor *self){ talloc_free(self); }
+SWIGINTERNINLINE PyObject*
+SWIG_From_unsigned_SS_long (unsigned long value)
+{
+ return (value > LONG_MAX) ?
+ PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
+}
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_unsigned_SS_char (unsigned char value)
+{
+ return SWIG_From_unsigned_SS_long (value);
+}
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_signed_SS_char (signed char value)
+{
+ return SWIG_From_long (value);
+}
+
+
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
@@ -2834,7 +2865,6 @@ SWIGINTERN PyObject *_wrap_SecurityToken_is_sid(PyObject *SWIGUNUSEDPARM(self),
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
struct dom_sid *arg2 = (struct dom_sid *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -2844,6 +2874,7 @@ SWIGINTERN PyObject *_wrap_SecurityToken_is_sid(PyObject *SWIGUNUSEDPARM(self),
char * kwnames[] = {
(char *) "self",(char *) "sid", NULL
};
+ bool result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SecurityToken_is_sid",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_token, 0 | 0 );
@@ -2867,10 +2898,10 @@ fail:
SWIGINTERN PyObject *_wrap_SecurityToken_is_system(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
+ bool result;
if (!args) SWIG_fail;
swig_obj[0] = args;
@@ -2890,10 +2921,10 @@ fail:
SWIGINTERN PyObject *_wrap_SecurityToken_is_anonymous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
+ bool result;
if (!args) SWIG_fail;
swig_obj[0] = args;
@@ -2914,7 +2945,6 @@ SWIGINTERN PyObject *_wrap_SecurityToken_has_sid(PyObject *SWIGUNUSEDPARM(self),
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
struct dom_sid *arg2 = (struct dom_sid *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -2924,6 +2954,7 @@ SWIGINTERN PyObject *_wrap_SecurityToken_has_sid(PyObject *SWIGUNUSEDPARM(self),
char * kwnames[] = {
(char *) "self",(char *) "sid", NULL
};
+ bool result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SecurityToken_has_sid",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_token, 0 | 0 );
@@ -2947,10 +2978,10 @@ fail:
SWIGINTERN PyObject *_wrap_SecurityToken_has_builtin_administrators(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
+ bool result;
if (!args) SWIG_fail;
swig_obj[0] = args;
@@ -2970,10 +3001,10 @@ fail:
SWIGINTERN PyObject *_wrap_SecurityToken_has_nt_authenticated_users(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
+ bool result;
if (!args) SWIG_fail;
swig_obj[0] = args;
@@ -2994,7 +3025,6 @@ SWIGINTERN PyObject *_wrap_SecurityToken_has_privilege(PyObject *SWIGUNUSEDPARM(
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
enum sec_privilege arg2 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
@@ -3004,6 +3034,7 @@ SWIGINTERN PyObject *_wrap_SecurityToken_has_privilege(PyObject *SWIGUNUSEDPARM(
char * kwnames[] = {
(char *) "self",(char *) "privilege", NULL
};
+ bool result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SecurityToken_has_privilege",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_token, 0 | 0 );
@@ -3072,7 +3103,6 @@ SWIGINTERN PyObject *_wrap_delete_SecurityToken(PyObject *SWIGUNUSEDPARM(self),
}
arg1 = (security_token *)(argp1);
delete_security_token(arg1);
-
resultobj = SWIG_Py_Void();
return resultobj;
fail:
@@ -3110,7 +3140,6 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_add(PyObject *SWIGUNUSEDPARM
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
struct security_ace *arg2 = (struct security_ace *) 0 ;
- NTSTATUS result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3120,6 +3149,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_add(PyObject *SWIGUNUSEDPARM
char * kwnames[] = {
(char *) "self",(char *) "ace", NULL
};
+ NTSTATUS result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:security_descriptor_sacl_add",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_descriptor, 0 | 0 );
@@ -3134,8 +3164,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_add(PyObject *SWIGUNUSEDPARM
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_sacl_add(arg1,(struct security_ace const *)arg2);
if (NT_STATUS_IS_ERR(result)) {
- PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
- PyErr_SetObject(PyExc_RuntimeError, obj);
+ PyErr_SetNTSTATUS(result);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
@@ -3150,7 +3179,6 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_add(PyObject *SWIGUNUSEDPARM
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
struct security_ace *arg2 = (struct security_ace *) 0 ;
- NTSTATUS result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3160,6 +3188,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_add(PyObject *SWIGUNUSEDPARM
char * kwnames[] = {
(char *) "self",(char *) "ace", NULL
};
+ NTSTATUS result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:security_descriptor_dacl_add",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_descriptor, 0 | 0 );
@@ -3174,8 +3203,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_add(PyObject *SWIGUNUSEDPARM
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_dacl_add(arg1,(struct security_ace const *)arg2);
if (NT_STATUS_IS_ERR(result)) {
- PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
- PyErr_SetObject(PyExc_RuntimeError, obj);
+ PyErr_SetNTSTATUS(result);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
@@ -3190,7 +3218,6 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_del(PyObject *SWIGUNUSEDPARM
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
struct dom_sid *arg2 = (struct dom_sid *) 0 ;
- NTSTATUS result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3200,6 +3227,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_del(PyObject *SWIGUNUSEDPARM
char * kwnames[] = {
(char *) "self",(char *) "trustee", NULL
};
+ NTSTATUS result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:security_descriptor_dacl_del",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_descriptor, 0 | 0 );
@@ -3214,8 +3242,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_del(PyObject *SWIGUNUSEDPARM
arg2 = (struct dom_sid *)(argp2);
result = security_descriptor_dacl_del(arg1,(struct dom_sid const *)arg2);
if (NT_STATUS_IS_ERR(result)) {
- PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
- PyErr_SetObject(PyExc_RuntimeError, obj);
+ PyErr_SetNTSTATUS(result);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
@@ -3230,7 +3257,6 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_del(PyObject *SWIGUNUSEDPARM
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
struct dom_sid *arg2 = (struct dom_sid *) 0 ;
- NTSTATUS result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3240,6 +3266,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_del(PyObject *SWIGUNUSEDPARM
char * kwnames[] = {
(char *) "self",(char *) "trustee", NULL
};
+ NTSTATUS result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:security_descriptor_sacl_del",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_descriptor, 0 | 0 );
@@ -3254,8 +3281,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_del(PyObject *SWIGUNUSEDPARM
arg2 = (struct dom_sid *)(argp2);
result = security_descriptor_sacl_del(arg1,(struct dom_sid const *)arg2);
if (NT_STATUS_IS_ERR(result)) {
- PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
- PyErr_SetObject(PyExc_RuntimeError, obj);
+ PyErr_SetNTSTATUS(result);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
@@ -3270,7 +3296,6 @@ SWIGINTERN PyObject *_wrap_security_descriptor___eq__(PyObject *SWIGUNUSEDPARM(s
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
struct security_descriptor *arg2 = (struct security_descriptor *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3280,6 +3305,7 @@ SWIGINTERN PyObject *_wrap_security_descriptor___eq__(PyObject *SWIGUNUSEDPARM(s
char * kwnames[] = {
(char *) "self",(char *) "other", NULL
};
+ bool result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:security_descriptor___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_security_descriptor, 0 | 0 );
@@ -3315,7 +3341,6 @@ SWIGINTERN PyObject *_wrap_delete_security_descriptor(PyObject *SWIGUNUSEDPARM(s
}
arg1 = (security_descriptor *)(argp1);
delete_security_descriptor(arg1);
-
resultobj = SWIG_Py_Void();
return resultobj;
fail:
@@ -3334,11 +3359,102 @@ SWIGINTERN PyObject *security_descriptor_swiginit(PyObject *SWIGUNUSEDPARM(self)
return SWIG_Python_InitShadowInstance(args);
}
+SWIGINTERN PyObject *_wrap_Sid_sid_rev_num_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ dom_sid *arg1 = (dom_sid *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+ uint8_t result;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Sid_sid_rev_num_get" "', argument " "1"" of type '" "dom_sid *""'");
+ }
+ arg1 = (dom_sid *)(argp1);
+ result = (uint8_t) ((arg1)->sid_rev_num);
+ resultobj = SWIG_From_unsigned_SS_char((unsigned char)(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Sid_num_auths_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ dom_sid *arg1 = (dom_sid *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+ int8_t result;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Sid_num_auths_get" "', argument " "1"" of type '" "dom_sid *""'");
+ }
+ arg1 = (dom_sid *)(argp1);
+ result = (int8_t) ((arg1)->num_auths);
+ resultobj = SWIG_From_signed_SS_char((signed char)(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Sid_id_auth_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ dom_sid *arg1 = (dom_sid *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+ uint8_t *result = 0 ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Sid_id_auth_get" "', argument " "1"" of type '" "dom_sid *""'");
+ }
+ arg1 = (dom_sid *)(argp1);
+ result = (uint8_t *)(uint8_t *) ((arg1)->id_auth);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_char, 0 | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Sid_sub_auths_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ dom_sid *arg1 = (dom_sid *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+ uint32_t *result = 0 ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Sid_sub_auths_get" "', argument " "1"" of type '" "dom_sid *""'");
+ }
+ arg1 = (dom_sid *)(argp1);
+ result = (uint32_t *) ((arg1)->sub_auths);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_new_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
char *arg2 = (char *) 0 ;
- dom_sid *result = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
@@ -3346,6 +3462,7 @@ SWIGINTERN PyObject *_wrap_new_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
char * kwnames[] = {
(char *) "text", NULL
};
+ dom_sid *result = 0 ;
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:new_Sid",kwnames,&obj0)) SWIG_fail;
@@ -3368,10 +3485,10 @@ SWIGINTERN PyObject *_wrap_Sid___str__(PyObject *SWIGUNUSEDPARM(self), PyObject
PyObject *resultobj = 0;
dom_sid *arg1 = (dom_sid *) 0 ;
TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
- char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
+ char *result = 0 ;
arg2 = NULL;
if (!args) SWIG_fail;
@@ -3393,7 +3510,6 @@ SWIGINTERN PyObject *_wrap_Sid___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *
PyObject *resultobj = 0;
dom_sid *arg1 = (dom_sid *) 0 ;
struct dom_sid *arg2 = (struct dom_sid *) 0 ;
- bool result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@@ -3403,6 +3519,7 @@ SWIGINTERN PyObject *_wrap_Sid___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *
char * kwnames[] = {
(char *) "self",(char *) "other", NULL
};
+ bool result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Sid___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
@@ -3438,7 +3555,6 @@ SWIGINTERN PyObject *_wrap_delete_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *
}
arg1 = (dom_sid *)(argp1);
delete_dom_sid(arg1);
-
resultobj = SWIG_Py_Void();
return resultobj;
fail:
@@ -3475,13 +3591,13 @@ fail:
SWIGINTERN PyObject *_wrap_privilege_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
enum sec_privilege arg1 ;
- char *result = 0 ;
int val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
char * kwnames[] = {
(char *) "privilege", NULL
};
+ char *result = 0 ;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:privilege_name",kwnames,&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -3500,7 +3616,6 @@ fail:
SWIGINTERN PyObject *_wrap_privilege_id(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
- enum sec_privilege result;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
@@ -3508,6 +3623,7 @@ SWIGINTERN PyObject *_wrap_privilege_id(PyObject *SWIGUNUSEDPARM(self), PyObject
char * kwnames[] = {
(char *) "name", NULL
};
+ enum sec_privilege result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:privilege_id",kwnames,&obj0)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
@@ -3559,6 +3675,10 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"delete_security_descriptor", (PyCFunction)_wrap_delete_security_descriptor, METH_O, NULL},
{ (char *)"security_descriptor_swigregister", security_descriptor_swigregister, METH_VARARGS, NULL},
{ (char *)"security_descriptor_swiginit", security_descriptor_swiginit, METH_VARARGS, NULL},
+ { (char *)"Sid_sid_rev_num_get", (PyCFunction)_wrap_Sid_sid_rev_num_get, METH_O, NULL},
+ { (char *)"Sid_num_auths_get", (PyCFunction)_wrap_Sid_num_auths_get, METH_O, NULL},
+ { (char *)"Sid_id_auth_get", (PyCFunction)_wrap_Sid_id_auth_get, METH_O, NULL},
+ { (char *)"Sid_sub_auths_get", (PyCFunction)_wrap_Sid_sub_auths_get, METH_O, NULL},
{ (char *)"new_Sid", (PyCFunction) _wrap_new_Sid, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Sid___str__", (PyCFunction)_wrap_Sid___str__, METH_O, NULL},
{ (char *)"Sid___eq__", (PyCFunction) _wrap_Sid___eq__, METH_VARARGS | METH_KEYWORDS, NULL},
diff --git a/source4/libcli/security/tests/bindings.py b/source4/libcli/security/tests/bindings.py
index 82ce7aeba8..b539de833d 100644
--- a/source4/libcli/security/tests/bindings.py
+++ b/source4/libcli/security/tests/bindings.py
@@ -65,6 +65,10 @@ class DomSidTests(unittest.TestCase):
sid = security.random_sid()
self.assertTrue(str(sid).startswith("S-1-5-21-"))
+ def test_repr(self):
+ sid = security.random_sid()
+ self.assertTrue(repr(sid).startswith("Sid('S-1-5-21-"))
+
class PrivilegeTests(unittest.TestCase):
def test_privilege_name(self):