1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

python: Compile security module, handle uint.

(This used to be commit dee64344fb)
This commit is contained in:
Jelmer Vernooij
2008-01-14 18:59:11 +01:00
parent 134e38ac28
commit d28eb21a98
4 changed files with 9 additions and 3 deletions

View File

@ -628,3 +628,6 @@ PRIVATE_DEPENDENCIES = dcerpc_samr
[PYTHON::python_lsa] [PYTHON::python_lsa]
OBJ_FILES = gen_ndr/py_lsa.o OBJ_FILES = gen_ndr/py_lsa.o
PRIVATE_DEPENDENCIES = RPC_NDR_LSA PRIVATE_DEPENDENCIES = RPC_NDR_LSA
[PYTHON::python_security]
OBJ_FILES = gen_ndr/py_security.o

View File

@ -612,7 +612,7 @@ sub ConvertObjectFromPythonData($$$$$$)
if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP" or if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP" or
$actual_ctype->{TYPE} eq "SCALAR" and ( $actual_ctype->{TYPE} eq "SCALAR" and (
expandAlias($actual_ctype->{NAME}) =~ /^(u?int[0-9]+|hyper|NTTIME|time_t|NTTIME_hyper|NTTIME_1sec|dlong|udlong|udlongr)$/)) { expandAlias($actual_ctype->{NAME}) =~ /^(u?int[0-9]*|hyper|NTTIME|time_t|NTTIME_hyper|NTTIME_1sec|dlong|udlong|udlongr)$/)) {
$self->pidl("PY_CHECK_TYPE(PyInt, $cvar, $fail);"); $self->pidl("PY_CHECK_TYPE(PyInt, $cvar, $fail);");
$self->pidl("$target = PyInt_AsLong($cvar);"); $self->pidl("$target = PyInt_AsLong($cvar);");
return; return;
@ -748,7 +748,7 @@ sub ConvertScalarToPython($$$)
$ctypename = expandAlias($ctypename); $ctypename = expandAlias($ctypename);
if ($ctypename =~ /^(int|long|char|u?int[0-9]+|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) { if ($ctypename =~ /^(char|u?int[0-9]*|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
return "PyInt_FromLong($cvar)"; return "PyInt_FromLong($cvar)";
} }
@ -938,7 +938,7 @@ sub Parse($$$$$)
} elsif ($cvar =~ /^".*"$/) { } elsif ($cvar =~ /^".*"$/) {
$py_obj = "PyString_FromString($cvar)"; $py_obj = "PyString_FromString($cvar)";
} else { } else {
$py_obj = $self->ConvertObjectToPythonData("NULL", $ctype, $cvar); $py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar);
} }
$self->pidl("PyModule_AddObject(m, \"$name\", $py_obj);"); $self->pidl("PyModule_AddObject(m, \"$name\", $py_obj);");

View File

@ -59,6 +59,7 @@ my %aliases = (
"boolean8" => "uint8", "boolean8" => "uint8",
"boolean32" => "uint32", "boolean32" => "uint32",
"DWORD" => "uint32", "DWORD" => "uint32",
"uint" => "uint32",
"int" => "int32", "int" => "int32",
"WORD" => "uint16", "WORD" => "uint16",
"char" => "uint8", "char" => "uint8",

View File

@ -42,6 +42,8 @@ static void initdcerpc_misc(void) {}
extern void initmgmt(void); extern void initmgmt(void);
extern void initatsvc(void); extern void initatsvc(void);
extern void initsamr(void); extern void initsamr(void);
extern void initsecurity(void);
extern void initlsa(void);
static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES }; static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES };