summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/libsmb/clierror.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c270a1dd4e..96ca32e228 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2314,6 +2314,7 @@ bool cli_is_dos_error(struct cli_state *cli);
NTSTATUS cli_get_nt_error(struct cli_state *cli);
void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
void cli_reset_error(struct cli_state *cli);
+bool cli_state_is_connected(struct cli_state *cli);
/* The following definitions come from libsmb/clifile.c */
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 54f8a7a43c..015afb18aa 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -359,3 +359,21 @@ void cli_reset_error(struct cli_state *cli)
SSVAL(cli->inbuf,smb_err,0);
}
}
+
+bool cli_state_is_connected(struct cli_state *cli)
+{
+ if (cli == NULL) {
+ return false;
+ }
+
+ if (!cli->initialised) {
+ return false;
+ }
+
+ if (cli->fd == -1) {
+ return false;
+ }
+
+ return true;
+}
+