diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-25 13:20:56 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2010-05-06 14:08:36 +0200 |
commit | 4a884a31e41fc3544e12aab2f5fa48aa18617b21 (patch) | |
tree | 19f11c2de6a62115811025c6e6621570293bc6b8 | |
parent | 82b69cf7907132b4b4064aa734a8e8b15a3c0449 (diff) | |
download | samba-4a884a31e41fc3544e12aab2f5fa48aa18617b21.tar.gz |
s3:libsmb: add cli_state_is_connected() function
metze
(cherry picked from commit d7bf30ef92031ffddcde3680b38e602510bcae24)
(cherry picked from commit 589f73924273e8a9b54669f42a92381661dcb33f)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5a4bdb706b97857da67c791b81039b4bc4031c76)
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/libsmb/clierror.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index f078844a53f..0b846949dfc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2456,6 +2456,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 54f8a7a43ce..015afb18aaa 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; +} + |