linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andros@netapp.com
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>
Subject: [PATCH 1/3] GSSD: cleanup process_krb5_upcall indentation
Date: Fri, 30 Nov 2012 13:30:04 -0500	[thread overview]
Message-ID: <1354300204-2509-1-git-send-email-andros@netapp.com> (raw)

From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 utils/gssd/gssd_proc.c |  107 +++++++++++++++++++++++++-----------------------
 1 files changed, 56 insertions(+), 51 deletions(-)

diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index d01ba2f..97e8f99 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -996,58 +996,63 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
 				break;
 		}
 	}
-	if (create_resp != 0) {
-		if (uid == 0 && (root_uses_machine_creds == 1 ||
-				service != NULL)) {
-			int nocache = 0;
-			int success = 0;
-			do {
-				gssd_refresh_krb5_machine_credential(clp->servername,
-								     NULL, service,
-								     tgtname);
-				/*
-				 * Get a list of credential cache names and try each
-				 * of them until one works or we've tried them all
-				 */
-				if (gssd_get_krb5_machine_cred_list(&credlist)) {
-					printerr(0, "ERROR: No credentials found "
-						 "for connection to server %s\n",
-						 clp->servername);
-						goto out_return_error;
-				}
-				for (ccname = credlist; ccname && *ccname; ccname++) {
-					gssd_setup_krb5_machine_gss_ccache(*ccname);
-					if ((create_auth_rpc_client(clp, &rpc_clnt,
-								    &auth, uid,
-								    AUTHTYPE_KRB5)) == 0) {
-						/* Success! */
-						success++;
-						break;
-					} 
-					printerr(2, "WARNING: Failed to create machine krb5 context "
-						 "with credentials cache %s for server %s\n",
-						 *ccname, clp->servername);
-				}
-				gssd_free_krb5_machine_cred_list(credlist);			
-				if (!success) {
-					if(nocache == 0) {
-						nocache++;
-						printerr(2, "WARNING: Machine cache is prematurely expired or corrupted "
-						            "trying to recreate cache for server %s\n", clp->servername);
-					} else {
-						printerr(1, "WARNING: Failed to create machine krb5 context "
-						 "with any credentials cache for server %s\n",
-						 clp->servername);
-						goto out_return_error;
-					}
+	if (create_resp == 0)
+		goto resp_found;
+	if (uid == 0 && (root_uses_machine_creds == 1 || service != NULL)) {
+		int nocache = 0;
+		int success = 0;
+		do {
+			gssd_refresh_krb5_machine_credential(clp->servername,
+							     NULL, service,
+							     tgtname);
+			/*
+			 * Get a list of credential cache names and try each
+			 * of them until one works or we've tried them all
+			 */
+			if (gssd_get_krb5_machine_cred_list(&credlist)) {
+				printerr(0, "ERROR: No credentials found "
+					"for connection to server %s\n",
+					clp->servername);
+				goto out_return_error;
+			}
+			for (ccname = credlist; ccname && *ccname; ccname++) {
+				gssd_setup_krb5_machine_gss_ccache(*ccname);
+				if ((create_auth_rpc_client(clp, &rpc_clnt,
+							&auth, uid,
+							AUTHTYPE_KRB5)) == 0) {
+					/* Success! */
+					success++;
+					break;
+				} 
+				printerr(2, "WARNING: Failed to create machine "
+					"krb5 context with credentials cache "
+					"%s for server %s\n",
+					*ccname, clp->servername);
+			}
+			gssd_free_krb5_machine_cred_list(credlist);			
+			if (!success) {
+				if(nocache == 0) {
+					nocache++;
+					printerr(2, "WARNING: Machine cache is "
+						"prematurely expired or "
+						"corrupted trying to recreate "
+						"cache for server %s\n",
+						clp->servername);
+				} else {
+					printerr(1, "WARNING: Failed to create "
+						"machine krb5 context "
+						"with any credentials cache "
+						"for server %s\n",
+						clp->servername);
+					goto out_return_error;
 				}
-			} while(!success);
-		} else {
-			printerr(1, "WARNING: Failed to create krb5 context "
-				 "for user with uid %d for server %s\n",
-				 uid, clp->servername);
-			goto out_return_error;
-		}
+			}
+		} while(!success);
+	} else {
+		printerr(1, "WARNING: Failed to create krb5 context "
+			"for user with uid %d for server %s\n",
+			uid, clp->servername);
+		goto out_return_error;
 	}
 
 	if (!authgss_get_private_data(auth, &pd)) {
-- 
1.7.7.6


                 reply	other threads:[~2012-11-30 18:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354300204-2509-1-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).