summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-07-03 19:59:37 +0200
committerVolker Lendecke <vlendec@samba.org>2011-07-03 23:57:53 +0200
commit80838491e6ac9f4299daccfc5506b3e1e79fab38 (patch)
tree0a9afeda9aa2b6d6140125c546ec4abc9a538395 /source3/libsmb
parent714e1014c59979d9a7a7c12f21185fdf7bcab818 (diff)
downloadsamba-80838491e6ac9f4299daccfc5506b3e1e79fab38.tar.gz
samba-80838491e6ac9f4299daccfc5506b3e1e79fab38.tar.bz2
samba-80838491e6ac9f4299daccfc5506b3e1e79fab38.zip
s3: Make cli_cm_open return NTSTATUS
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Jul 3 23:57:53 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clidfs.c57
-rw-r--r--source3/libsmb/proto.h5
2 files changed, 35 insertions, 27 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index da4150dee9..bb08b22c8d 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -343,7 +343,7 @@ static struct cli_state *cli_cm_find(struct cli_state *cli,
Open a client connection to a \\server\share.
****************************************************************************/
-struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
+NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
struct cli_state *referring_cli,
const char *server,
const char *share,
@@ -352,14 +352,16 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
bool force_encrypt,
int max_protocol,
int port,
- int name_type)
+ int name_type,
+ struct cli_state **pcli)
{
/* 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;
+ *pcli = c;
+ return NT_STATUS_OK;
}
if (auth_info == NULL) {
@@ -368,7 +370,7 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
d_printf("cli_cm_open() Unable to open connection [\\%s\\%s] "
"without auth info\n",
server, share );
- return NULL;
+ return NT_STATUS_INVALID_PARAMETER;
}
status = cli_cm_connect(ctx,
@@ -383,9 +385,10 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
name_type,
&c);
if (!NT_STATUS_IS_OK(status)) {
- return NULL;
+ return status;
}
- return c;
+ *pcli = c;
+ return NT_STATUS_OK;
}
/****************************************************************************
@@ -829,16 +832,18 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
/* Check for the referral. */
- if (!(cli_ipc = cli_cm_open(ctx,
- rootcli,
- rootcli->desthost,
- "IPC$",
- dfs_auth_info,
- false,
- (rootcli->trans_enc_state != NULL),
- rootcli->protocol,
- 0,
- 0x20))) {
+ status = cli_cm_open(ctx,
+ rootcli,
+ rootcli->desthost,
+ "IPC$",
+ dfs_auth_info,
+ false,
+ (rootcli->trans_enc_state != NULL),
+ rootcli->protocol,
+ 0,
+ 0x20,
+ &cli_ipc);
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}
@@ -879,15 +884,17 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
*/
/* Open the connection to the target server & share */
- if ((*targetcli = cli_cm_open(ctx, rootcli,
- server,
- share,
- dfs_auth_info,
- false,
- (rootcli->trans_enc_state != NULL),
- rootcli->protocol,
- 0,
- 0x20)) == NULL) {
+ status = cli_cm_open(ctx, rootcli,
+ server,
+ share,
+ dfs_auth_info,
+ false,
+ (rootcli->trans_enc_state != NULL),
+ rootcli->protocol,
+ 0,
+ 0x20,
+ targetcli);
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("Unable to follow dfs referral [\\%s\\%s]\n",
server, share );
return false;
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 89b1ecd9b6..1caf0f904a 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -113,7 +113,7 @@ NTSTATUS cli_cm_force_encryption(struct cli_state *c,
const char *password,
const char *domain,
const char *sharename);
-struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
+NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
struct cli_state *referring_cli,
const char *server,
const char *share,
@@ -122,7 +122,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
bool force_encrypt,
int max_protocol,
int port,
- int name_type);
+ int name_type,
+ struct cli_state **pcli);
void cli_cm_display(const struct cli_state *c);
struct client_dfs_referral;
NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,