From aeb7f7db4014695eb6510cc7a713db4c6228bd1f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 10 Apr 2008 22:04:04 +0200 Subject: Use libnetapi_open_ipc_connection in libnetapi. Guenther (This used to be commit d9f19fc61586d606393368799dee9757c169d602) --- source3/lib/netapi/joindomain.c | 66 +++++++---------------------------------- 1 file changed, 11 insertions(+), 55 deletions(-) (limited to 'source3/lib/netapi/joindomain.c') diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 96c2f3d1fc..056d8d27e2 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; } -- cgit