From patchwork Thu Jul 30 21:15:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 6906821 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D17309F380 for ; Thu, 30 Jul 2015 21:15:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 138AF20532 for ; Thu, 30 Jul 2015 21:15:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1450D2052D for ; Thu, 30 Jul 2015 21:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751142AbbG3VPT (ORCPT ); Thu, 30 Jul 2015 17:15:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40333 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbbG3VPT (ORCPT ); Thu, 30 Jul 2015 17:15:19 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 95CBCA2C0A for ; Thu, 30 Jul 2015 21:15:18 +0000 (UTC) Received: from smallhat.boston.devel.redhat.com (vpn-48-41.rdu2.redhat.com [10.10.48.41]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6ULFHr8026405 for ; Thu, 30 Jul 2015 17:15:18 -0400 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] rpc.gssd: Only clear the retval if it has not been set Date: Thu, 30 Jul 2015 17:15:16 -0400 Message-Id: <1438290916-12071-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.3 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 In gssd_search_krb5_keytab() an error code can be cleared by blindly setting retval to zero. Reported-by: Jianhong Yin Signed-off-by: Steve Dickson --- utils/gssd/krb5_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c index f1ebc0d..ecf17a2 100644 --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -772,7 +772,9 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt, "keytab '%s'\n", k5err, kt_name); } - retval = 0; + /* Only clear the retval if has not been set */ + if (retval < 0) + retval = 0; out: free(k5err); return retval;