bec1a9
From dc05cb5cd01b3264109ddee8d1bc095cd585e09e Mon Sep 17 00:00:00 2001
bec1a9
From: Andreas Schneider <asn@samba.org>
bec1a9
Date: Mon, 20 Mar 2017 16:08:20 +0100
bec1a9
Subject: [PATCH] s3:libsmb: Only print error message if kerberos use is forced
bec1a9
bec1a9
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12704
bec1a9
bec1a9
Signed-off-by: Andreas Schneider <asn@samba.org>
bec1a9
Reviewed-by: Ralph Boehme <slow@samba.org>
bec1a9
---
bec1a9
 source3/libsmb/cliconnect.c | 12 +++++++++---
bec1a9
 1 file changed, 9 insertions(+), 3 deletions(-)
bec1a9
bec1a9
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
bec1a9
index 029c3d4760e..93f873079db 100644
bec1a9
--- a/source3/libsmb/cliconnect.c
bec1a9
+++ b/source3/libsmb/cliconnect.c
bec1a9
@@ -349,9 +349,15 @@ NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
bec1a9
 				0 /* no time correction for now */,
bec1a9
 				NULL);
bec1a9
 	if (ret != 0) {
bec1a9
-		DEBUG(0, ("Kinit for %s to access %s failed: %s\n",
bec1a9
-			  user_principal, target_hostname,
bec1a9
-			  error_message(ret)));
bec1a9
+		int dbglvl = DBGLVL_WARNING;
bec1a9
+
bec1a9
+		if (krb5_state == CRED_MUST_USE_KERBEROS) {
bec1a9
+			dbglvl = DBGLVL_ERR;
bec1a9
+		}
bec1a9
+
bec1a9
+		DEBUG(dbglvl, ("Kinit for %s to access %s failed: %s\n",
bec1a9
+			       user_principal, target_hostname,
bec1a9
+			       error_message(ret)));
bec1a9
 		if (krb5_state == CRED_MUST_USE_KERBEROS) {
bec1a9
 			TALLOC_FREE(frame);
bec1a9
 			return krb5_to_nt_status(ret);
bec1a9
-- 
bec1a9
2.12.0
bec1a9