Programmer error! Bad Admin server handle
raeburn at MIT.EDU
Thu Feb 14 18:41:29 EST 2008
On Feb 14, 2008, at 11:30, Torsten Kurbad wrote:
>> kadm5_ret_t kadm5_init_with_password(char *client_name,
>> char *pass,
>> char *service_name,
>> kadm5_config_params *params,
>> krb5_ui_4 struct_version,
>> krb5_ui_4 api_version,
>> /* Heh, look at me, I'm new ----> */ char **db_args,
>> void **server_handle);
>> Which has bit me more than once.
> It's there indeed, even for 1.5.3.
That new argument is a pointer to a series of input strings, not just
> --- snip ---
> static PyObject *getPrincipals(PyObject *self, PyObject *args)
> char *client;
> char *pass;
> char *realm;
> void *handle;
> char *db_args;
If you do it this way, db_args should be initialized to NULL, to mark
the end of the list. Or you could pass a null pointer instead of
&db_args, to indicate that there aren't any arguments to provide.
> So far, so good. Now I get the 0th principal and a count of 245,
> which is exactly the number of princs in our current DB. But I need to
> transform all 0 -> *count principals into a Python structure. Whenever
> I try to access *count, e.g. do sth. (probably stupid) like
> int i = *count;
> I get a segmentation fault.
> Any suggestions?
The "count" argument is an "int *" -- you should pass it the address
of an int variable of yours. You declared count as "int *" and
passed its address, so there's an integer being stored in your
pointer variable, and you're trying to use it as a pointer.
If you're including our internal admin.h (it's not a published
interface, nor considered necessarily stable, hence the above
changes), you should be getting complaints from the compiler about
errors in number or type of function arguments. Check where your
admin.h came from and see if there's a problem there....
Ken Raeburn, Senior Programmer
MIT Kerberos Consortium
More information about the krbdev