Make Sid member variables accessible from Python.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 30 Sep 2008 14:02:09 +0000 (16:02 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 30 Sep 2008 14:02:09 +0000 (16:02 +0200)
source4/libcli/security/security.i
source4/libcli/security/security.py
source4/libcli/security/security_wrap.c

index 6ba106bb5f3f05f7b11e0d337a58bdca32197467..420439d147a47baa573f6c3212c79a6a64ddac48 100644 (file)
@@ -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);
index c310dde56bb2de56b76eedf3c46f2dc299c50687..8afb3eda610b8e292c370f0a902fe5e3ab727c30 100644 (file)
@@ -147,6 +147,10 @@ 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):
index b7d66b5aec4da92233eb110a0a85674ff9c7de8f..f7e3c2fb21fd854cadc25ff29715c43831889769 100644 (file)
@@ -2712,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)
 {
@@ -3337,6 +3359,98 @@ 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 ;
@@ -3561,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},