From patchwork Fri Feb 24 14:27:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9590455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC84C601AE for ; Fri, 24 Feb 2017 14:28:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD01028701 for ; Fri, 24 Feb 2017 14:28:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1B072876C; Fri, 24 Feb 2017 14:28:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C0BD28701 for ; Fri, 24 Feb 2017 14:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751290AbdBXO2S (ORCPT ); Fri, 24 Feb 2017 09:28:18 -0500 Received: from hr2.samba.org ([144.76.82.148]:47290 "EHLO hr2.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbdBXO2R (ORCPT ); Fri, 24 Feb 2017 09:28:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42627210; h=Message-Id:Date:Cc:To:From; bh=FqYXeeKbEltPifiylX9mrBwGw79264eat0YW9MA16ZU=; b=ibObgT2S1LD/NDsjWL5VDwBx0j 9eqXfbe3IdWxSGkX7x3w1ViPaeOv2IzpZvjiNkObvUIrILnPSSijyMG88IdmLR24FeS8/f5OipukY VKWBBPooZtKSL3OsE0F0Vjakv9SoYSqU1Yhu2u//0RBJZWaHgNy4Vrif9QbdLL7D64Fc=; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim) id 1chGr1-0000FM-39; Fri, 24 Feb 2017 14:28:15 +0000 From: Jeff Layton To: linux-cifs@vger.kernel.org Cc: cwseys@physics.wisc.edu, ssorce@redhat.com, samba-technical@lists.samba.org Subject: [cifs-utils PATCH 3/8] cifs.upcall: remove need for replace.h Date: Fri, 24 Feb 2017 09:27:45 -0500 Message-Id: <20170224142750.4151-4-jlayton@samba.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170224142750.4151-1-jlayton@samba.org> References: <20170224142750.4151-1-jlayton@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Take just what we need from replace.h and move it to cifs.upcall.c. Signed-off-by: Jeff Layton --- cifs.upcall.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cifs.upcall.c b/cifs.upcall.c index f766a8b5799e..cfc926cd9d09 100644 --- a/cifs.upcall.c +++ b/cifs.upcall.c @@ -49,8 +49,9 @@ #include #include #include +#include +#include -#include "replace.h" #include "data_blob.h" #include "spnego.h" #include "cifs_spnego.h" @@ -68,6 +69,21 @@ typedef enum _sectype { MS_KRB5 } sectype_t; +/* These macros unify the keyblock handling of Heimdal and MIT somewhat */ +#ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */ +#define KRB5_KEY_TYPE(k) ((k)->keytype) +#define KRB5_KEY_LENGTH(k) ((k)->keyvalue.length) +#define KRB5_KEY_DATA(k) ((k)->keyvalue.data) +#define KRB5_KEY_DATA_CAST void +#else /* MIT */ +#define KRB5_KEY_TYPE(k) ((k)->enctype) +#define KRB5_KEY_LENGTH(k) ((k)->length) +#define KRB5_KEY_DATA(k) ((k)->contents) +#define KRB5_KEY_DATA_CAST krb5_octet +#endif + +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x = NULL; } } while (0) + #ifdef HAVE_LIBCAP_NG static int trim_capabilities(bool need_environ) @@ -434,7 +450,7 @@ cifs_krb5_get_req(const char *host, krb5_ccache ccache, krb5_data apreq_pkt, in_data; krb5_auth_context auth_context = NULL; #if defined(HAVE_KRB5_AUTH_CON_SETADDRS) && defined(HAVE_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE) - static const uint8_t gss_cksum[24] = { 0x10, 0x00, /* ... */}; + static char gss_cksum[24] = { 0x10, 0x00, /* ... */}; #endif memset(&in_creds, 0, sizeof(in_creds)); @@ -498,7 +514,7 @@ cifs_krb5_get_req(const char *host, krb5_ccache ccache, * * See https://bugzilla.samba.org/show_bug.cgi?id=7890 */ - in_data.data = discard_const_p(char, gss_cksum); + in_data.data = gss_cksum; in_data.length = 24; /* MIT krb5 < 1.7 is missing the prototype, but still has the symbol */