return ret;
}
-static NTSTATUS net_ads_join_ok(struct net_context *c)
+static ADS_STATUS net_ads_join_ok(struct net_context *c)
{
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
ADS_STRUCT *ads = NULL;
ADS_STATUS status;
fstring dc_name;
if (!secrets_init()) {
DEBUG(1,("Failed to initialise secrets database\n"));
- return NT_STATUS_ACCESS_DENIED;
+ TALLOC_FREE(tmp_ctx);
+ return ADS_ERROR_NT(NT_STATUS_ACCESS_DENIED);
}
net_use_krb_machine_account(c);
status = ads_startup(c, true, &ads);
if (!ADS_ERR_OK(status)) {
- return ads_ntstatus(status);
+ goto out;
}
+ status = ADS_ERROR_NT(NT_STATUS_OK);
+out:
ads_destroy(&ads);
- return NT_STATUS_OK;
+ TALLOC_FREE(tmp_ctx);
+ return status;
}
/*
*/
int net_ads_testjoin(struct net_context *c, int argc, const char **argv)
{
- NTSTATUS status;
+ ADS_STATUS status;
use_in_memory_ccache();
if (c->display_usage) {
/* Display success or failure */
status = net_ads_join_ok(c);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!ADS_ERR_OK(status)) {
fprintf(stderr, _("Join to domain is not valid: %s\n"),
- get_friendly_nt_error_msg(status));
+ get_friendly_nt_error_msg(ads_ntstatus(status)));
return -1;
}