Samba 4 libnet_join and RPC-JOIN torture test
Stefan (metze) Metzmacher
metze at samba.org
Tue Sep 13 05:51:31 GMT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brad Henry schrieb:
> Here's the patch redone using NT_STATUS_HAVE_NO_MEMORY_TMPMEM(data,
> tmp_mem) and NT_STATUS_NOT_OK_RETURN_TMPMEM(status, tmp_mem).
> I think it looks better.
much better:-)
> tmp_ctx = talloc_named(mem_ctx, 0, "libnet_Join temp context");
> if (!tmp_ctx) {
> r->out.error_string = NULL;
> return NT_STATUS_NO_MEMORY;
> }
as talloc_free(NULL) is a noop, you can use the macro here too.
> - status = dcerpc_lsa_OpenPolicy2(c.out.dcerpc_pipe, tmp_ctx, &lsa_open_policy);
> - if (!NT_STATUS_IS_OK(status)) {
> - r->out.error_string = talloc_asprintf(mem_ctx,
> - "lsa_OpenPolicy2 failed: %s",
> - nt_errstr(status));
> - talloc_free(tmp_ctx);
> - return status;
> - }
> + status = dcerpc_lsa_OpenPolicy2(dcerpc_pipe, tmp_ctx, &lsa_open_policy);
> + NT_STATUS_NOT_OK_RETURN_TMPMEM(status, tmp_ctx);
using the standard macro, we loose the error string here, so I would propose to use a libnet
specific macro here,
#define LIBNET_NOT_OK_RETURN(status, tmp_mem, error) do {\
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf error;
talloc_free(tmp_mem);
return status;
}
} while(0)
and use it like this:
status = dcerpc_lsa_OpenPolicy2(c.out.dcerpc_pipe, tmp_ctx, &lsa_open_policy);
LIBNET_NOT_OK_RETURN(status, tmp_ctx,(mem_ctx,
"lsa_OpenPolicy2 failed: %s",
nt_errstr(status)));
abartlet, mimir: happy with such libnet specific macros?
- --
metze
Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDJmjim70gjA5TCD8RAqvxAKCQTh1eUXdWF5/CTggSvQlvhJJDQwCfU4LJ
LhMX0DmTtlMAkZxSqDWng48=
=gSch
-----END PGP SIGNATURE-----
More information about the samba-technical
mailing list