referring_cli == NULL means a new initial connection.
********************************************************************/
-static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx,
- struct cli_state *referring_cli,
- const char *server,
- const char *share,
- const struct user_auth_info *auth_info,
- bool show_hdr,
- bool force_encrypt,
- int max_protocol,
- int port,
- int name_type)
+static NTSTATUS cli_cm_connect(TALLOC_CTX *ctx,
+ struct cli_state *referring_cli,
+ const char *server,
+ const char *share,
+ const struct user_auth_info *auth_info,
+ bool show_hdr,
+ bool force_encrypt,
+ int max_protocol,
+ int port,
+ int name_type,
+ struct cli_state **pcli)
{
struct cli_state *cli;
NTSTATUS status;
port, name_type, &cli);
if (!NT_STATUS_IS_OK(status)) {
- return NULL;
+ return status;
}
/* Enter into the list. */
}
}
- return cli;
+ *pcli = cli;
+ return NT_STATUS_OK;
}
/********************************************************************
{
/* Try to reuse an existing connection in this list. */
struct cli_state *c = cli_cm_find(referring_cli, server, share);
+ NTSTATUS status;
if (c) {
return c;
return NULL;
}
- return cli_cm_connect(ctx,
+ status = cli_cm_connect(ctx,
referring_cli,
server,
share,
force_encrypt,
max_protocol,
port,
- name_type);
+ name_type,
+ &c);
+ if (!NT_STATUS_IS_OK(status)) {
+ return NULL;
+ }
+ return c;
}
/****************************************************************************