From patchwork Mon Sep 21 20:50:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 7233761 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 36608BF036 for ; Mon, 21 Sep 2015 20:50:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 638F720636 for ; Mon, 21 Sep 2015 20:50:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B78220617 for ; Mon, 21 Sep 2015 20:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbbIUUur (ORCPT ); Mon, 21 Sep 2015 16:50:47 -0400 Received: from mx143.netapp.com ([216.240.21.24]:62996 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753540AbbIUUup (ORCPT ); Mon, 21 Sep 2015 16:50:45 -0400 X-IronPort-AV: E=Sophos;i="5.17,569,1437462000"; d="scan'208";a="67884550" Received: from vmwexchts01-prd.hq.netapp.com ([10.122.105.12]) by mx143-out.netapp.com with ESMTP; 21 Sep 2015 13:50:46 -0700 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS01-PRD.hq.netapp.com (10.122.105.12) with Microsoft SMTP Server id 15.0.1104.5; Mon, 21 Sep 2015 13:50:45 -0700 Received: from andros-new.vpn.netapp.com (andros-new.vpn.netapp.com [10.55.79.9]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id t8LKofBu003117; Mon, 21 Sep 2015 13:50:44 -0700 (PDT) From: To: CC: , , Andy Adamson Subject: [PATCH 4/4] GSSD: clean up machine credentials Date: Mon, 21 Sep 2015 16:50:09 -0400 Message-ID: <1442868609-1812-5-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.9.3 (Apple Git-50) In-Reply-To: <1442868609-1812-1-git-send-email-andros@netapp.com> References: <1442868609-1812-1-git-send-email-andros@netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andy Adamson 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 destroyes machine credentials. Signed-off-by: Andy Adamson --- 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);