s3:libsmb: add cli_state_is_connected() function
authorStefan Metzmacher <metze@samba.org>
Thu, 25 Mar 2010 12:20:56 +0000 (13:20 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 30 Mar 2010 08:33:40 +0000 (10:33 +0200)
metze
(cherry picked from commit d7bf30ef92031ffddcde3680b38e602510bcae24)
(cherry picked from commit 956514c98975d152c6ab50e0ee2d88971aa06f55)

source3/include/proto.h
source3/libsmb/clierror.c

index 65fd9a819a2f58705362c16f10ccbe1f77dad5e9..4e2c75f5d8429357e309e5f82199fa557b3f0a97 100644 (file)
@@ -2334,6 +2334,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  */
 
index 54f8a7a43cecc1ad4ea69855d002ea61c140ae20..015afb18aaa33c15596a9e3b9bc3e8b58cea33c3 100644 (file)
@@ -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;
+}
+