From patchwork Mon Oct 22 18:35:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Sanislo X-Patchwork-Id: 1627521 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id EA0B1400E8 for ; Mon, 22 Oct 2012 18:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755563Ab2JVSli (ORCPT ); Mon, 22 Oct 2012 14:41:38 -0400 Received: from maui.cs.washington.edu ([128.208.5.86]:57799 "EHLO maui.cs.washington.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754545Ab2JVSli (ORCPT ); Mon, 22 Oct 2012 14:41:38 -0400 Received: from maui.cs.washington.edu (localhost [127.0.0.1]) by maui.cs.washington.edu (8.14.1/8.14.1/1.10) with ESMTP id q9MIfanm021399; Mon, 22 Oct 2012 11:41:36 -0700 (envelope-from oystr@maui.cs.washington.edu) Received: (from oystr@localhost) by maui.cs.washington.edu (8.14.1/8.14.1/Submit/1.2) id q9MIfad4021398; Mon, 22 Oct 2012 11:41:36 -0700 (envelope-from oystr) Date: 22 Oct 2012 11:35 PDT From: Jan Sanislo Subject: [PATCH 01/01] Allow nfsidmap to set key timeout To: linux-nfs@vger.kernel.org Cc: jlayton@redhat.com, SteveD@redhat.com Message-Id: <1350930905/oystr@maui.cs.washington.edu> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org nfsidmap calls keyctl_set_timeout after the key has been instantiated, by which time our key modification privileges have been removed. Move the timeout setting prior to key instantiation. Reviewed-by: Jeff Layton jlayton@redhat.com Signed-off-by: Jan Sanislo oystr@cs.washington.edu --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/nfs-utils-1.2.6/utils/nfsidmap/nfsidmap.c +++ b/nfs-utils-1.2.6/utils/nfsidmap/nfsidmap.c @@ -320,6 +320,16 @@ key, type, value, timeout); } + /* + * Set timeout before instantiation revokes our rights + * over the key. + */ + if ( timeout > 0 ) { + rc = keyctl_set_timeout(key, timeout); + if ( rc != 0 ) + xlog_warn("keyctl_set_timeout key 0x%x failed: %m",key); + } + if (strcmp(type, "uid") == 0) rc = id_lookup(value, key, USER); else if (strcmp(type, "gid") == 0) @@ -329,10 +339,6 @@ else if (strcmp(type, "group") == 0) rc = name_lookup(value, key, GROUP); - /* Set timeout to 10 (600 seconds) minutes */ - if (rc == 0) - keyctl_set_timeout(key, timeout); - free(arg); return rc; }