r22354: Make client select krb5 encrpyt if krb5 already on.
authorJeremy Allison <jra@samba.org>
Thu, 19 Apr 2007 00:51:18 +0000 (00:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:28 +0000 (12:19 -0500)
Jeremy.
(This used to be commit 7b89a5de57cd5fed814eda95e44dcc345f380fb2)

source3/client/client.c
source3/libsmb/clifsinfo.c

index a4c75f2735e39aade6f0a3bc4eda85d17fe1c7ce..2df5c67db12b1c77d0072f2d67ae2cb540de1084 100644 (file)
@@ -1789,34 +1789,39 @@ static int cmd_open(void)
 
 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;
-       }
-       fstrcpy(password,buf);
+               if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+               fstrcpy(user,buf);
 
-       status = cli_raw_ntlm_smb_encryption_start(cli,
-                                               user,
-                                               password,
-                                               domain);
+               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);
+       }
        
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("posix_encrypt failed with error %s\n", nt_errstr(status));
index 4924bfdba09c55f886e9362b4bd4cf137ffc83d2..e46456abb18ccb28d46648f81f67d59879cc23d5 100644 (file)
@@ -614,4 +614,9 @@ NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
        common_free_encryption_state(&es);
        return status;
 }
+#else
+NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
+{
+       return NT_STATUS_NOT_SUPPORTED;
+}
 #endif