linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <andros@netapp.com>
To: <steved@redhat.com>
Cc: <jlayton@poochiereds.net>, <linux-nfs@vger.kernel.org>,
	Andy Adamson <andros@netapp.com>
Subject: [PATCH 4/4] GSSD: clean up machine credentials
Date: Mon, 21 Sep 2015 16:50:09 -0400	[thread overview]
Message-ID: <1442868609-1812-5-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1442868609-1812-1-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Since we no longer fork for uid 0, gssd_atexit() is only called when uid != 0,
and fails as permissions on the /tmp/krb5ccmachine_REALM file prohibit
the clean up of machine credentials (as it should).

Move the reaping of machine credentials back into a SIGINT sighandler so that
<Ctrl C> destroyes machine credentials.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 utils/gssd/gssd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 2a768ea..ebff860 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -729,10 +729,12 @@ found:
 }
 
 static void
-gssd_atexit(void)
+sig_die(int signal)
 {
 	if (root_uses_machine_creds)
 		gssd_destroy_krb5_machine_creds();
+	printerr(1, "exiting on signal %d\n", signal);
+	exit(0);
 }
 
 static void
@@ -892,17 +894,13 @@ main(int argc, char *argv[])
 		exit(EXIT_FAILURE);
 	}
 
-	if (atexit(gssd_atexit)) {
-		printerr(1, "ERROR: atexit failed: %s\n", strerror(errno));
-		exit(EXIT_FAILURE);
-	}
-
 	inotify_fd = inotify_init1(IN_NONBLOCK);
 	if (inotify_fd == -1) {
 		printerr(1, "ERROR: inotify_init1 failed: %s\n", strerror(errno));
 		exit(EXIT_FAILURE);
 	}
 
+	signal(SIGINT, sig_die);
 	signal_set(&sighup_ev, SIGHUP, gssd_scan_cb, NULL);
 	signal_add(&sighup_ev, NULL);
 	event_set(&inotify_ev, inotify_fd, EV_READ | EV_PERSIST, gssd_inotify_cb, NULL);
-- 
1.9.3 (Apple Git-50)


  parent reply	other threads:[~2015-09-21 20:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21 20:50 [PATCH 0/4] GSSD: Do not fork when UID = 0 andros
2015-09-21 20:50 ` [PATCH 1/4] GSSD: move process_krb5_upcall machine cred case to helper function andros
2015-09-21 20:50 ` [PATCH 2/4] GSSD: move process_krb5_updcall non " andros
2015-09-21 20:50 ` [PATCH 3/4] GSSD only fork when uid is not zeo andros
2015-09-21 20:50 ` andros [this message]
2015-09-22 11:24   ` [PATCH 4/4] GSSD: clean up machine credentials Jeff Layton
2015-09-22 16:38     ` Adamson, Andy
2015-09-22 17:09       ` Jeff Layton

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=1442868609-1812-5-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=jlayton@poochiereds.net \
    --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).