Author: jra
Date: 2007-03-21 00:44:15 +0000 (Wed, 21 Mar 2007)
New Revision: 21898

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21898

Log:
Added test command, fixed first valgrind bugs.
Now to investigate why it doesn't work :-).
Jeremy.

Modified:
   branches/SAMBA_3_0/source/client/client.c
   branches/SAMBA_3_0/source/libsmb/clifsinfo.c
   branches/SAMBA_3_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SAMBA_3_0/source/client/client.c   2007-03-21 00:25:08 UTC (rev 
21897)
+++ branches/SAMBA_3_0/source/client/client.c   2007-03-21 00:44:15 UTC (rev 
21898)
@@ -1787,6 +1787,48 @@
 /****************************************************************************
 ****************************************************************************/
 
+static int cmd_posix_encrypt(void)
+{
+       fstring buf;
+       fstring domain;
+       fstring user;
+       fstring password;
+       NTSTATUS status;
+
+       if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+               d_printf("posix_encrypt domain user password\n");
+               return 1;
+       }
+       fstrcat(domain,buf);
+       if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+               d_printf("posix_encrypt domain user password\n");
+               return 1;
+       }
+       fstrcat(user,buf);
+
+       if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+               d_printf("posix_encrypt domain user password\n");
+               return 1;
+       }
+       fstrcat(password,buf);
+
+       status = cli_raw_ntlm_smb_encryption_start(cli,
+                                               user,
+                                               password,
+                                               domain);
+       
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("posix_encrypt failed with error %s\n", 
nt_errstr(status));
+       } else {
+               d_printf("encryption on\n");
+       }
+
+       return 0;
+}
+
+/****************************************************************************
+****************************************************************************/
+
 static int cmd_posix_open(void)
 {
        pstring mask;
@@ -3227,6 +3269,7 @@
   {"newer",cmd_newer,"<file> only mget files newer than the specified local 
file",{COMPL_LOCAL,COMPL_NONE}},
   {"open",cmd_open,"<mask> open a file",{COMPL_REMOTE,COMPL_NONE}},
   {"posix", cmd_posix, "turn on all POSIX capabilities", 
{COMPL_REMOTE,COMPL_NONE}},
+  {"posix_encrypt",cmd_posix_encrypt,"<domain> <user> <password> start up 
transport encryption",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_open",cmd_posix_open,"<name> 0<mode> open_flags mode open a file 
using POSIX interface",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_mkdir",cmd_posix_mkdir,"<name> 0<mode> creates a directory using 
POSIX interface",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_rmdir",cmd_posix_rmdir,"<name> removes a directory using POSIX 
interface",{COMPL_REMOTE,COMPL_NONE}},

Modified: branches/SAMBA_3_0/source/libsmb/clifsinfo.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clifsinfo.c        2007-03-21 00:25:08 UTC 
(rev 21897)
+++ branches/SAMBA_3_0/source/libsmb/clifsinfo.c        2007-03-21 00:44:15 UTC 
(rev 21898)
@@ -310,20 +310,21 @@
 static NTSTATUS enc_blob_send_receive(struct cli_state *cli, DATA_BLOB *in, 
DATA_BLOB *out)
 {
        uint16 setup;
-       char param[2];
+       char param[4];
        char *rparam=NULL, *rdata=NULL;
        unsigned int rparam_count=0, rdata_count=0;
        NTSTATUS status = NT_STATUS_OK;
 
        setup = TRANSACT2_SETFSINFO;
 
-       SSVAL(param,0,SMB_REQUEST_TRANSPORT_ENCRYPTION);
+       SSVAL(param,0,0);
+       SSVAL(param,2,SMB_REQUEST_TRANSPORT_ENCRYPTION);
 
        if (!cli_send_trans(cli, SMBtrans2,
                                NULL,
                                0, 0,
                                &setup, 1, 0,
-                               param, 2, 0,
+                               param, 4, 0,
                                (char *)in->data, in->length, CLI_BUFFER_SIZE)) 
{
                status = cli_nt_error(cli);
                goto out;

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c     2007-03-21 00:25:08 UTC (rev 
21897)
+++ branches/SAMBA_3_0/source/smbd/trans2.c     2007-03-21 00:44:15 UTC (rev 
21898)
@@ -2769,7 +2769,7 @@
 
                                DEBUG( 4,("call_trans2setfsinfo: request 
transport encrption.\n"));
 
-                               status = srv_request_encryption_setup((unsigned 
char **)&pdata, &data_len);
+                               status = srv_request_encryption_setup((unsigned 
char **)ppdata, &data_len);
 
                                if (NT_STATUS_EQUAL(status, 
NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                                        error_packet_set(outbuf, 0, 0, status, 
__LINE__,__FILE__);
@@ -2777,7 +2777,7 @@
                                        return ERROR_NT(status);
                                }
 
-                               send_trans2_replies( outbuf, bufsize, params, 
0, pdata, data_len, max_data_bytes);
+                               send_trans2_replies( outbuf, bufsize, params, 
0, *ppdata, data_len, max_data_bytes);
 
                                if (NT_STATUS_IS_OK(status)) {
                                        /* Server-side transport encryption is 
now *on*. */

Reply via email to