diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-25 13:20:56 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-03-29 18:11:15 +0200 |
commit | d7bf30ef92031ffddcde3680b38e602510bcae24 (patch) | |
tree | 3f30c38c489949b994c3b36ba94ec00d803edda7 /source3 | |
parent | 47e10ab9a85960c78af807b66b99bcd139713644 (diff) | |
download | samba-d7bf30ef92031ffddcde3680b38e602510bcae24.tar.gz samba-d7bf30ef92031ffddcde3680b38e602510bcae24.tar.bz2 samba-d7bf30ef92031ffddcde3680b38e602510bcae24.zip |
s3:libsmb: add cli_state_is_connected() function
metze
Diffstat (limited to 'source3')
-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 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; +} + |