s3:libsmb: pass an optional const struct sockaddr_storage *dest_ss to cli_cm_open()
[metze/samba/wip.git] / source3 / lib / netapi / cm.c
index dbb6b6f02d181f6e9499c0d1341d695ea0de8462..c9d9b9bfac5f6a01db103ead0c59493c96544caf 100644 (file)
@@ -73,7 +73,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
        NTSTATUS status;
 
        if (!ctx || !pp || !server_name) {
-               return WERR_INVALID_PARAM;
+               return WERR_INVALID_PARAMETER;
        }
 
        priv_ctx = (struct libnetapi_private_ctx *)ctx->private_data;
@@ -86,9 +86,9 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
 
        auth_info = user_auth_info_init(ctx);
        if (!auth_info) {
-               return WERR_NOMEM;
+               return WERR_NOT_ENOUGH_MEMORY;
        }
-       auth_info->signing_state = SMB_SIGNING_DEFAULT;
+       set_cmdline_auth_info_signing_state_raw(auth_info, SMB_SIGNING_IPC_DEFAULT);
        set_cmdline_auth_info_use_kerberos(auth_info, ctx->use_kerberos);
        set_cmdline_auth_info_username(auth_info, ctx->username);
        if (ctx->password) {
@@ -108,16 +108,12 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
        }
 
        status = cli_cm_open(ctx, NULL,
-                            server_name, "IPC$",
+                            server_name, NULL, "IPC$",
                             auth_info,
-                            false, false,
-                            lp_cli_maxprotocol(),
+                            false,
+                            lp_client_ipc_max_protocol(),
                             0, 0x20, &cli_ipc);
-       if (NT_STATUS_IS_OK(status)) {
-               cli_set_username(cli_ipc, ctx->username);
-               cli_set_password(cli_ipc, ctx->password);
-               cli_set_domain(cli_ipc, ctx->workgroup);
-       } else {
+       if (!NT_STATUS_IS_OK(status)) {
                cli_ipc = NULL;
        }
        TALLOC_FREE(auth_info);
@@ -130,7 +126,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
 
        p = talloc_zero(ctx, struct client_ipc_connection);
        if (p == NULL) {
-               return WERR_NOMEM;
+               return WERR_NOT_ENOUGH_MEMORY;
        }
 
        p->cli = cli_ipc;
@@ -243,7 +239,7 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
        struct client_ipc_connection *ipc = NULL;
 
        if (!presult) {
-               return WERR_INVALID_PARAM;
+               return WERR_INVALID_PARAMETER;
        }
 
        werr = libnetapi_open_ipc_connection(ctx, server_name, &ipc);
@@ -256,7 +252,7 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
                libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s",
                        table->name,
                        get_friendly_nt_error_msg(status));
-               return WERR_DEST_NOT_FOUND;
+               return WERR_NERR_DESTNOTFOUND;
        }
 
        *presult = result;