talloc_get_type problems again.

Stefan (metze) Metzmacher metze at samba.org
Thu Aug 16 05:44:23 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Kai,

> +	state = talloc(result, struct cmd_list_users_state);
> +	if (composite_nomem(state, result)) return result;
> +
> +	state->ctx = result;
> +	result->private_data = state;

here you set ->private_data

> +	state->service = service;
> +	state->resume_index = 0;
> +	state->result = talloc_new(state);
why talloc_new() here?
shouldn't it be ->result = NULL here?

> +	if (composite_nomem(state->result, state->ctx)) return result;
> +
> +	/*FIXME: We should look up the domain in the winbind request if it is
> +	 * set, not just take the primary domain. However, I want to get the
> +	 * libnet logic to work first. */
> +
> +	if(*domain_name != '\0') {
are you sure domain_name is always a valid pointer?

> +		state->domain_name = talloc_strdup(state, domain_name);
> +		if (composite_nomem(state->domain_name, state->ctx))
> +			return result;
> +	}
> +	else
> +		state->domain_name = NULL;

> +	if (NT_STATUS_IS_OK(status)) {
> +		struct cmd_list_users_state *state = talloc_get_type(
> +			ctx->async.private_data, struct cmd_list_users_state);

...and here you need to get ctx->private_data

ctx->async.private_data belongs to the caller!

metze
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGw+Q3m70gjA5TCD8RAn9aAJ9/DwxCsYnF2vjj6RCQoTL6w92odgCgqJ26
arrCKAjta6hD7c1YmV9on38=
=GNP4
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list