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>
Thu, 6 May 2010 12:08:36 +0000 (14:08 +0200)
metze
(cherry picked from commit d7bf30ef92031ffddcde3680b38e602510bcae24)
(cherry picked from commit 589f73924273e8a9b54669f42a92381661dcb33f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5a4bdb706b97857da67c791b81039b4bc4031c76)

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

index f078844a53f0bf4e806a858bd352ceaab9c16b1c..0b846949dfc4b20c0086c957c970dd9f2fbd9033 100644 (file)
@@ -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  */
 
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;
+}
+