diff options
author | Günther Deschner <gd@samba.org> | 2008-04-10 22:04:04 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-04-10 22:04:04 +0200 |
commit | aeb7f7db4014695eb6510cc7a713db4c6228bd1f (patch) | |
tree | 01fa3c8dc3429ba5622b66ba516f370c20a5c735 /source3/lib/netapi/joindomain.c | |
parent | deb6362f1f1ac12d6e2a245370ca36accc9506b1 (diff) | |
download | samba-aeb7f7db4014695eb6510cc7a713db4c6228bd1f.tar.gz samba-aeb7f7db4014695eb6510cc7a713db4c6228bd1f.tar.xz samba-aeb7f7db4014695eb6510cc7a713db4c6228bd1f.zip |
Use libnetapi_open_ipc_connection in libnetapi.
Guenther
(This used to be commit d9f19fc61586d606393368799dee9757c169d602)
Diffstat (limited to 'source3/lib/netapi/joindomain.c')
-rw-r--r-- | source3/lib/netapi/joindomain.c | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 96c2f3d1fc4..056d8d27e25 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -103,18 +103,8 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx, WERROR werr; unsigned int old_timeout = 0; - status = cli_full_connection(&cli, NULL, r->in.server, - NULL, 0, - "IPC$", "IPC", - ctx->username, - ctx->workgroup, - ctx->password, - CLI_FULL_CONNECTION_USE_KERBEROS | - CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS, - Undefined, NULL); - - if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + werr = libnetapi_open_ipc_connection(ctx, r->in.server, &cli); + if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -152,7 +142,6 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx, if (old_timeout) { cli_set_timeout(cli, old_timeout); } - cli_shutdown(cli); } return werr; @@ -245,18 +234,8 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx, WERROR werr; unsigned int old_timeout = 0; - status = cli_full_connection(&cli, NULL, r->in.server_name, - NULL, 0, - "IPC$", "IPC", - ctx->username, - ctx->workgroup, - ctx->password, - CLI_FULL_CONNECTION_USE_KERBEROS | - CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS, - Undefined, NULL); - - if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli); + if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -289,8 +268,9 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx, done: if (cli) { - cli_set_timeout(cli, old_timeout); - cli_shutdown(cli); + if (old_timeout) { + cli_set_timeout(cli, old_timeout); + } } return werr; @@ -307,18 +287,8 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx, NTSTATUS status; WERROR werr; - status = cli_full_connection(&cli, NULL, r->in.server_name, - NULL, 0, - "IPC$", "IPC", - ctx->username, - ctx->workgroup, - ctx->password, - CLI_FULL_CONNECTION_USE_KERBEROS | - CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS, - Undefined, NULL); - - if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli); + if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -340,10 +310,6 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx, } done: - if (cli) { - cli_shutdown(cli); - } - return werr; } @@ -451,18 +417,8 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx, NTSTATUS status; WERROR werr; - status = cli_full_connection(&cli, NULL, r->in.server_name, - NULL, 0, - "IPC$", "IPC", - ctx->username, - ctx->workgroup, - ctx->password, - CLI_FULL_CONNECTION_USE_KERBEROS | - CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS, - Undefined, NULL); - - if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli); + if (!W_ERROR_IS_OK(werr)) { goto done; } |