From patchwork Wed Apr 30 15:18:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 4094671 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6EA969F169 for ; Wed, 30 Apr 2014 15:18:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB0FC202DD for ; Wed, 30 Apr 2014 15:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE0772027D for ; Wed, 30 Apr 2014 15:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422690AbaD3PSc (ORCPT ); Wed, 30 Apr 2014 11:18:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20875 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422649AbaD3PSc (ORCPT ); Wed, 30 Apr 2014 11:18:32 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3UFIUPE016750 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 30 Apr 2014 11:18:31 -0400 Received: from smallhat.boston.devel.redhat.com (vpn-63-95.rdu2.redhat.com [10.10.63.95]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3UFIUYU028779 for ; Wed, 30 Apr 2014 11:18:30 -0400 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] libnfsidmap: id_as_chars() fails zero value ids. Date: Wed, 30 Apr 2014 11:18:28 -0400 Message-Id: <1398871108-18213-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 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 Root has a zero value id which is valid and should not be mapped to nfsnobody Signed-off-by: Steve Dickson --- libnfsidmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libnfsidmap.c b/libnfsidmap.c index 641d766..92bc493 100644 --- a/libnfsidmap.c +++ b/libnfsidmap.c @@ -99,8 +99,12 @@ static char * toupper_str(char *s) static int id_as_chars(char *name, int *id) { long int value = strtol(name, NULL, 10); - if (value == 0) - return 0; + + if (value == 0) { + /* zero value ids are valid */ + if (strcmp(name, "0") != 0) + return 0; + } *id = (int)value; return 1; }