compile error for drsblob

Matthieu Patou mat at
Sat Apr 10 07:41:03 MDT 2010

Hello Metze,

I tried to create a python lib for drs object manipulation and received 
this error :
[1228/1933] Compiling default/librpc/gen_ndr/py_drsblobs.c
default/librpc/gen_ndr/py_drsblobs.c: In function 
default/librpc/gen_ndr/py_drsblobs.c:3188: warning: passing argument 1 
of ‘PyString_FromString’ makes pointer from integer without a cast
/usr/include/python2.6/stringobject.h:63: note: expected ‘const char *’ 
but argument is of type ‘char’
default/librpc/gen_ndr/py_drsblobs.c: In function 
default/librpc/gen_ndr/py_drsblobs.c:3196: warning: passing argument 1 
of ‘_talloc_free’ discards qualifiers from pointer target type
../../lib/talloc/talloc.h:212: note: expected ‘void *’ but argument is 
of type ‘const char *’
default/librpc/gen_ndr/py_drsblobs.c:3201: error: assignment of 
read-only location ‘*object->string’
compilation terminated due to -Wfatal-errors.
Waf: Leaving directory `/usr/local/src/samba4/source4/bin'
Build failed: -> task failed (err #1):
{task: cc py_drsblobs.c -> py_drsblobs_146.o}
make: *** [all] Erreur 1

After some investigation I have the impression that something is not ok 
... but I don't really know how to fix it so that's why I ask you :-)

the generated code is

static int py_package_PrimaryKerberosString_set_string(PyObject *py_obj, 
PyObject *value, void *closure)
struct package_PrimaryKerberosString *object = (struct 
package_PrimaryKerberosString *)py_talloc_get_ptr(py_obj);
if (value == Py_None) {
object->string = NULL;
} else {
object->string = talloc_ptrtype(py_talloc_get_mem_ctx(py_obj), 
*object->string = talloc_strdup(py_talloc_get_mem_ctx(py_obj), 
return 0;


struct package_PrimaryKerberosString {
uint16_t length;/* [value(2*strlen_m(string))] */
uint16_t size;/* [value(2*strlen_m(string))] */
const char * string;/* 

It seems a bit wrong as if the object is a char* then we should do 
object->string = ...
My understanding is that the pidl is doing it wrong as we have *string 
and as string is already a char* then we should get a char**, but the 
fix in pidl is not obvious and I'm not sure that the analysis is correct.

What do you think ?

More information about the samba-technical mailing list