Allow providing extra module-level Python functions.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 21 Dec 2008 17:46:59 +0000 (18:46 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 21 Dec 2008 17:46:59 +0000 (18:46 +0100)
pidl/lib/Parse/Pidl/Samba4/Python.pm
source4/librpc/ndr/py_security.c

index 120a35a1cf49c5864f753bf0cc9f312b5f7f7178..69365416a5e52f9bd04ca304844414a121b8136c 100644 (file)
@@ -1183,6 +1183,12 @@ sub Parse($$$$$)
                my ($fn_name, $pyfn_name, $flags, $doc) = @$_;
                $self->pidl("{ \"$fn_name\", (PyCFunction)$pyfn_name, $flags, $doc },");
        }
+
+       $self->deindent;
+       $self->pidl("#ifdef ".uc("py_mod_$basename\_extra_methods"));
+       $self->pidl("\t" .uc("py_mod_$basename\_extra_methods"));
+       $self->pidl("#endif");
+       $self->indent;
        
        $self->pidl("{ NULL, NULL, 0, NULL }");
        $self->deindent;
index a7cb0515cf9bc0cd307f75b85c1601a58e5653b9..d79ad58f7dca518f57b69bbf3c53f96829561a57 100644 (file)
@@ -301,7 +301,12 @@ static PyObject *py_random_sid(PyObject *self)
 
         sid = dom_sid_parse_talloc(NULL, str);
        talloc_free(str);
-       ret = py_talloc_import(&PyDomSidType, sid);
+       ret = py_talloc_import(&dom_sid_Type, sid);
        talloc_free(sid);
        return ret;
 }
+
+#define PY_MOD_SECURITY_EXTRA_METHODS \
+       { "random_sid", (PyCFunction)py_random_sid, METH_NOARGS, NULL }, \
+       { "privilege_id", (PyCFunction)py_privilege_id, METH_VARARGS, NULL }, \
+       { "privilege_name", (PyCFunction)py_privilege_name, METH_VARARGS, NULL },