From patchwork Fri Aug 7 19:43:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 39999 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n77Jhe0t002842 for ; Fri, 7 Aug 2009 19:43:40 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 0A240AD0BB; Fri, 7 Aug 2009 13:39:19 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.8 tests=AWL, BAYES_00, NO_MORE_FUNN, SPF_PASS autolearn=no version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by lists.samba.org (Postfix) with ESMTP id 0E4A7AD05B; Fri, 7 Aug 2009 13:39:02 -0600 (MDT) Received: from mail.poochiereds.net ([71.70.153.3]) by cdptpa-omta02.mail.rr.com with ESMTP id <20090807194320029.MERL22035@cdptpa-omta02.mail.rr.com>; Fri, 7 Aug 2009 19:43:20 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id D31E258143; Fri, 7 Aug 2009 15:43:17 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org, samba-technical@lists.samba.org Date: Fri, 7 Aug 2009 15:43:15 -0400 Message-Id: <1249674197-1065-6-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1249674197-1065-1-git-send-email-jlayton@redhat.com> References: <1249674197-1065-1-git-send-email-jlayton@redhat.com> Subject: [linux-cifs-client] [PATCH 5/7] cifs.upcall: clean up flag handling X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Add a new stack var to hold the flags returned by the decoder routine so that we don't need to worry so much about preserving "rc". Signed-off-by: Jeff Layton --- client/cifs.upcall.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c index e60fb50..38be876 100644 --- a/client/cifs.upcall.c +++ b/client/cifs.upcall.c @@ -164,7 +164,7 @@ static struct decoded_args { sectype_t sec; }; -static int +static unsigned int decode_key_description(const char *desc, struct decoded_args *arg) { int retval = 0; @@ -302,6 +302,7 @@ int main(const int argc, char *const argv[]) DATA_BLOB sess_key = data_blob_null; key_serial_t key = 0; size_t datalen; + unsigned int have; long rc = 1; int c; char *buf, *princ, *ccname = NULL; @@ -355,15 +356,14 @@ int main(const int argc, char *const argv[]) goto out; } - rc = decode_key_description(buf, &arg); - if ((rc & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) { + have = decode_key_description(buf, &arg); + SAFE_FREE(buf); + if ((have & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) { syslog(LOG_ERR, "unable to get necessary params from key " - "description (0x%x)", rc); + "description (0x%x)", have); rc = 1; - SAFE_FREE(buf); goto out; } - SAFE_FREE(buf); if (arg.ver > CIFS_SPNEGO_UPCALL_VERSION) { syslog(LOG_ERR, "incompatible kernel upcall version: 0x%x", @@ -372,10 +372,10 @@ int main(const int argc, char *const argv[]) goto out; } - if (rc & DKD_HAVE_PID) + if (have & DKD_HAVE_PID) ccname = get_krb5_ccname(arg.pid); - if (rc & DKD_HAVE_UID) { + if (have & DKD_HAVE_UID) { rc = setuid(arg.uid); if (rc == -1) { syslog(LOG_ERR, "setuid: %s", strerror(errno));