added cli_qfilename(), used in trans2 torture test
authorAndrew Tridgell <tridge@samba.org>
Thu, 21 Feb 2002 04:25:17 +0000 (04:25 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Feb 2002 04:25:17 +0000 (04:25 +0000)
source/libsmb/clirap.c

index 1cbadb43447dbc693f7256d28b960c8a0270e811..a2b6c8bb8b4a957e08b49ec58c2e6ea1e7b4ccc0 100644 (file)
@@ -514,6 +514,49 @@ BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
 }
 
 
+/****************************************************************************
+send a qfileinfo QUERY_FILE_NAME_INFO call
+****************************************************************************/
+BOOL cli_qfilename(struct cli_state *cli, int fnum, 
+                  pstring name)
+{
+       int data_len = 0;
+       int param_len = 0;
+       uint16 setup = TRANSACT2_QFILEINFO;
+       pstring param;
+       char *rparam=NULL, *rdata=NULL;
+
+       param_len = 4;
+       memset(param, 0, param_len);
+       SSVAL(param, 0, fnum);
+       SSVAL(param, 2, SMB_QUERY_FILE_NAME_INFO);
+
+       if (!cli_send_trans(cli, SMBtrans2, 
+                            NULL,                           /* name */
+                            -1, 0,                          /* fid, flags */
+                            &setup, 1, 0,                   /* setup, length, max */
+                            param, param_len, 2,            /* param, length, max */
+                            NULL, data_len, cli->max_xmit   /* data, length, max */
+                           )) {
+               return False;
+       }
+
+       if (!cli_receive_trans(cli, SMBtrans2,
+                               &rparam, &param_len,
+                               &rdata, &data_len)) {
+               return False;
+       }
+
+       if (!rdata || data_len < 4) {
+               return False;
+       }
+
+       clistr_pull(cli, name, rdata+4, sizeof(pstring), IVAL(rdata, 0), STR_UNICODE);
+
+       return True;
+}
+
+
 /****************************************************************************
 send a qfileinfo call
 ****************************************************************************/