Author: jra
Date: 2007-04-19 00:51:18 +0000 (Thu, 19 Apr 2007)
New Revision: 22354

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

Log:
Make client select krb5 encrpyt if krb5 already on.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SAMBA_3_0/source/client/client.c   2007-04-19 00:45:01 UTC (rev 
22353)
+++ branches/SAMBA_3_0/source/client/client.c   2007-04-19 00:51:18 UTC (rev 
22354)
@@ -1789,34 +1789,39 @@
 
 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;
-       }
-       fstrcpy(domain,buf);
+       if (cli->use_kerberos) {
+               status = cli_gss_smb_encryption_start(cli);
+       } else {        
+               fstring buf;
+               fstring domain;
+               fstring user;
+               fstring password;
 
-       if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
-               d_printf("posix_encrypt domain user password\n");
-               return 1;
-       }
-       fstrcpy(user,buf);
+               if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+               fstrcpy(domain,buf);
 
-       if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
-               d_printf("posix_encrypt domain user password\n");
-               return 1;
+               if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+               fstrcpy(user,buf);
+
+               if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+               fstrcpy(password,buf);
+
+               status = cli_raw_ntlm_smb_encryption_start(cli,
+                                                       user,
+                                                       password,
+                                                       domain);
        }
-       fstrcpy(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));

Modified: branches/SAMBA_3_0/source/libsmb/clifsinfo.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clifsinfo.c        2007-04-19 00:45:01 UTC 
(rev 22353)
+++ branches/SAMBA_3_0/source/libsmb/clifsinfo.c        2007-04-19 00:51:18 UTC 
(rev 22354)
@@ -614,4 +614,9 @@
        common_free_encryption_state(&es);
        return status;
 }
+#else
+NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
+{
+       return NT_STATUS_NOT_SUPPORTED;
+}
 #endif

Reply via email to