summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-08-15 14:27:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:39 -0500
commitdb21dceb43a0bb049fa87cc5c30861e3a5a53cd2 (patch)
tree00932c6373c939392f4767fd87b4306e1f18a9aa
parent3fc9b7e626e196b9692f1a29cde246355f608499 (diff)
downloadsamba-db21dceb43a0bb049fa87cc5c30861e3a5a53cd2.tar.gz
samba-db21dceb43a0bb049fa87cc5c30861e3a5a53cd2.tar.bz2
samba-db21dceb43a0bb049fa87cc5c30861e3a5a53cd2.zip
r17557: Change net_join_domain to return NTSTATUS instead of int.
Thanks to Michael Adam <ma@sernet.de>. Volker (This used to be commit c4e10afadb39ff562287ab2294df0a1f83b28908)
-rw-r--r--source3/utils/net_ads.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 37bdd4e456..8b8790a1f0 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -887,27 +887,26 @@ static int check_ads_config( void )
Do the domain join
********************************************************************/
-static int net_join_domain( TALLOC_CTX *ctx, const char *servername,
- struct in_addr *ip, DOM_SID **dom_sid, const char *password )
+static NTSTATUS net_join_domain(TALLOC_CTX *ctx, const char *servername,
+ struct in_addr *ip, DOM_SID **dom_sid,
+ const char *password)
{
- int ret = -1;
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct cli_state *cli = NULL;
- if ( !NT_STATUS_IS_OK(connect_to_ipc_krb5(&cli, ip, servername)) )
+ ret = connect_to_ipc_krb5(&cli, ip, servername);
+ if ( !NT_STATUS_IS_OK(ret) ) {
goto done;
+ }
saf_store( cli->server_domain, cli->desthost );
- if ( !NT_STATUS_IS_OK(netdom_get_domain_sid( ctx, cli, dom_sid )) )
- goto done;
-
- if ( !NT_STATUS_IS_OK(netdom_join_domain( ctx, cli, *dom_sid,
- password, ND_TYPE_AD )) )
- {
+ ret = netdom_get_domain_sid( ctx, cli, dom_sid );
+ if ( !NT_STATUS_IS_OK(ret) ) {
goto done;
}
-
- ret = 0;
+
+ ret = netdom_join_domain( ctx, cli, *dom_sid, password, ND_TYPE_AD );
done:
if ( cli )
@@ -1171,6 +1170,7 @@ int net_ads_join(int argc, const char **argv)
{
ADS_STRUCT *ads = NULL;
ADS_STATUS status;
+ NTSTATUS nt_status;
char *machine_account = NULL;
const char *short_domain_name = NULL;
char *tmp_password, *password;
@@ -1239,9 +1239,10 @@ int net_ads_join(int argc, const char **argv)
tmp_password = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
password = talloc_strdup(ctx, tmp_password);
- if ( net_join_domain( ctx, ads->config.ldap_server_name, &ads->ldap_ip, &domain_sid, password ) != 0 ) {
- /* There should be more detailed output here... */
- d_fprintf(stderr, "call of net_join_domain failed\n");
+ nt_status = net_join_domain(ctx, ads->config.ldap_server_name,
+ &ads->ldap_ip, &domain_sid, password);
+ if ( !NT_STATUS_IS_OK(nt_status) ) {
+ d_fprintf(stderr, "call of net_join_domain failed: %s\n", nt_errstr(nt_status));
goto fail;
}