summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-14 14:28:07 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:50:22 +0100
commitdf8c7da800f75ff45fb48de59d7ce3f0667d375f (patch)
tree65c17e04d7f2e83d2266b6f71ef04c8e79a94d3f /source4/libcli
parent43ac3d9b44b98d44db9b1550c47e8f96a410d1e9 (diff)
downloadsamba-df8c7da800f75ff45fb48de59d7ce3f0667d375f.tar.gz
samba-df8c7da800f75ff45fb48de59d7ce3f0667d375f.tar.bz2
samba-df8c7da800f75ff45fb48de59d7ce3f0667d375f.zip
r26454: Add simple SWIG macro for wrapping talloced types.
(This used to be commit 760fcc8bfa2a7cd7641465cb3bae889e9e0fbc75)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/security/security.i9
-rw-r--r--source4/libcli/security/security_wrap.c148
2 files changed, 80 insertions, 77 deletions
diff --git a/source4/libcli/security/security.i b/source4/libcli/security/security.i
index 1f100b0b8f..7e48251e51 100644
--- a/source4/libcli/security/security.i
+++ b/source4/libcli/security/security.i
@@ -60,10 +60,11 @@ enum sec_privilege {
%rename(SecurityToken) security_token;
+%talloctype(security_token);
+
typedef struct security_token {
%extend {
security_token(TALLOC_CTX *mem_ctx) { return security_token_initialise(mem_ctx); }
- ~security_token() { talloc_free($self); }
bool is_sid(const struct dom_sid *sid);
bool is_system();
bool is_anonymous();
@@ -75,10 +76,11 @@ typedef struct security_token {
}
} security_token;
+%talloctype(security_descriptor);
+
typedef struct security_descriptor {
%extend {
security_descriptor(TALLOC_CTX *mem_ctx) { return security_descriptor_initialise(mem_ctx); }
- ~security_descriptor() { talloc_free($self); }
NTSTATUS sacl_add(const struct security_ace *ace);
NTSTATUS dacl_add(const struct security_ace *ace);
NTSTATUS dacl_del(const struct security_ace *ace);
@@ -92,12 +94,13 @@ typedef struct security_descriptor {
%rename(Sid) dom_sid;
+%talloctype(dom_sid);
+
typedef struct dom_sid {
%extend {
dom_sid(TALLOC_CTX *mem_ctx, const char *text) {
return dom_sid_parse_talloc(mem_ctx, text);
}
- ~dom_sid() { talloc_free($self); }
#ifdef SWIGPYTHON
const char *__str__(TALLOC_CTX *mem_ctx) {
return dom_sid_string(mem_ctx, $self);
diff --git a/source4/libcli/security/security_wrap.c b/source4/libcli/security/security_wrap.c
index 633537f951..9c572425eb 100644
--- a/source4/libcli/security/security_wrap.c
+++ b/source4/libcli/security/security_wrap.c
@@ -2529,7 +2529,6 @@ SWIG_From_int (int value)
}
SWIGINTERN security_token *new_security_token(TALLOC_CTX *mem_ctx){ return security_token_initialise(mem_ctx); }
-SWIGINTERN void delete_security_token(security_token *self){ talloc_free(self); }
SWIGINTERNINLINE PyObject*
SWIG_From_bool (bool value)
@@ -2682,6 +2681,7 @@ SWIG_AsVal_int (PyObject * obj, int *val)
return res;
}
+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); }
@@ -2755,7 +2755,6 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
SWIGINTERN dom_sid *new_dom_sid(TALLOC_CTX *mem_ctx,char const *text){
return dom_sid_parse_talloc(mem_ctx, text);
}
-SWIGINTERN void delete_dom_sid(dom_sid *self){ talloc_free(self); }
SWIGINTERN char const *dom_sid___str__(dom_sid *self,TALLOC_CTX *mem_ctx){
return dom_sid_string(mem_ctx, self);
}
@@ -2783,6 +2782,7 @@ SWIG_FromCharPtr(const char *cptr)
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
+SWIGINTERN void delete_dom_sid(dom_sid *self){ talloc_free(self); }
static struct dom_sid *random_sid(TALLOC_CTX *mem_ctx)
{
@@ -2814,29 +2814,6 @@ fail:
}
-SWIGINTERN PyObject *_wrap_delete_SecurityToken(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- security_token *arg1 = (security_token *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_security_token, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SecurityToken" "', argument " "1"" of type '" "security_token *""'");
- }
- arg1 = (security_token *)(argp1);
- delete_security_token(arg1);
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_SecurityToken_is_sid(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
security_token *arg1 = (security_token *) 0 ;
@@ -3064,6 +3041,29 @@ fail:
}
+SWIGINTERN PyObject *_wrap_delete_SecurityToken(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ security_token *arg1 = (security_token *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_security_token, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SecurityToken" "', argument " "1"" of type '" "security_token *""'");
+ }
+ arg1 = (security_token *)(argp1);
+ delete_security_token(arg1);
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *SecurityToken_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
@@ -3092,29 +3092,6 @@ fail:
}
-SWIGINTERN PyObject *_wrap_delete_security_descriptor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- security_descriptor *arg1 = (security_descriptor *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_security_descriptor, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_security_descriptor" "', argument " "1"" of type '" "security_descriptor *""'");
- }
- arg1 = (security_descriptor *)(argp1);
- delete_security_descriptor(arg1);
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_security_descriptor_sacl_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
security_descriptor *arg1 = (security_descriptor *) 0 ;
@@ -3313,6 +3290,29 @@ fail:
}
+SWIGINTERN PyObject *_wrap_delete_security_descriptor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ security_descriptor *arg1 = (security_descriptor *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_security_descriptor, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_security_descriptor" "', argument " "1"" of type '" "security_descriptor *""'");
+ }
+ arg1 = (security_descriptor *)(argp1);
+ delete_security_descriptor(arg1);
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *security_descriptor_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
@@ -3356,29 +3356,6 @@ fail:
}
-SWIGINTERN PyObject *_wrap_delete_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- dom_sid *arg1 = (dom_sid *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Sid" "', argument " "1"" of type '" "dom_sid *""'");
- }
- arg1 = (dom_sid *)(argp1);
- delete_dom_sid(arg1);
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_Sid___str__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
dom_sid *arg1 = (dom_sid *) 0 ;
@@ -3440,6 +3417,29 @@ fail:
}
+SWIGINTERN PyObject *_wrap_delete_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ dom_sid *arg1 = (dom_sid *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Sid" "', argument " "1"" of type '" "dom_sid *""'");
+ }
+ arg1 = (dom_sid *)(argp1);
+ delete_dom_sid(arg1);
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *Sid_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
@@ -3523,7 +3523,6 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"new_SecurityToken", (PyCFunction)_wrap_new_SecurityToken, METH_NOARGS, NULL},
- { (char *)"delete_SecurityToken", (PyCFunction)_wrap_delete_SecurityToken, METH_O, 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},
@@ -3532,21 +3531,22 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"SecurityToken_has_nt_authenticated_users", (PyCFunction)_wrap_SecurityToken_has_nt_authenticated_users, METH_O, NULL},
{ (char *)"SecurityToken_has_privilege", (PyCFunction) _wrap_SecurityToken_has_privilege, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"SecurityToken_set_privilege", (PyCFunction) _wrap_SecurityToken_set_privilege, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"delete_SecurityToken", (PyCFunction)_wrap_delete_SecurityToken, METH_O, NULL},
{ (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 *)"delete_security_descriptor", (PyCFunction)_wrap_delete_security_descriptor, METH_O, NULL},
{ (char *)"security_descriptor_sacl_add", (PyCFunction) _wrap_security_descriptor_sacl_add, METH_VARARGS | METH_KEYWORDS, NULL},
{ (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},
{ (char *)"security_descriptor___eq__", (PyCFunction) _wrap_security_descriptor___eq__, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (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 *)"new_Sid", (PyCFunction) _wrap_new_Sid, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"delete_Sid", (PyCFunction)_wrap_delete_Sid, METH_O, NULL},
{ (char *)"Sid___str__", (PyCFunction)_wrap_Sid___str__, METH_O, NULL},
{ (char *)"Sid___eq__", (PyCFunction) _wrap_Sid___eq__, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (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},