s3:libsmb: add cli_state_is_connected() function
authorStefan Metzmacher <metze@samba.org>
Thu, 25 Mar 2010 12:20:56 +0000 (13:20 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 29 Mar 2010 16:11:15 +0000 (18:11 +0200)
metze

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

index c270a1dd4e6cb0d395f092eab816b9c14ba8eabc..96ca32e22811e8916e2d241bf165c571af183bc4 100644 (file)
@@ -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  */
 
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;
+}
+