From patchwork Tue Dec 18 14:10:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1892071 Return-Path: X-Original-To: patchwork-cifs-client@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 DE7743FCD4 for ; Tue, 18 Dec 2012 14:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755086Ab2LROK6 (ORCPT ); Tue, 18 Dec 2012 09:10:58 -0500 Received: from mail-ye0-f181.google.com ([209.85.213.181]:63027 "EHLO mail-ye0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755054Ab2LROK5 (ORCPT ); Tue, 18 Dec 2012 09:10:57 -0500 Received: by mail-ye0-f181.google.com with SMTP id m11so130335yen.40 for ; Tue, 18 Dec 2012 06:10:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=A9W4xJ3pasZidwv1HhvBjbAZ8A+JdxfjczWJkNnKtBg=; b=cmQDyH7wma/3tDVqNx+cX5PQ6wK2Cc3Z+CxBK2dW5Lq1xdCpnyTwrM9Njkdrz19qr4 tPu+gSK1hZRSsbdFGEyQbx2cnOZOWmYfj0KOGhdPYTRhoDhEiJ3Anaivt6xVDBW6vY1j 5Kl03b7G6IJgxIP2NIKQsQ5fTIX99o82Xtsnqp9Y9DSeSPtfornxSIAGwDHKi2FjLFal oOwpl6Yc12kJuxaxBbBWpnZRBE0cJYNP26IcINu2XlyxSBg2pSt6RElnHXPeyi/fX7v8 vISX7sJyu+TUWTqcN6BpdGkCOyfC3qN1Z3T4dDJMIJl2bq0qq4scVFuYv3jwNxasi7b0 TC3g== X-Received: by 10.101.175.12 with SMTP id c12mr533740anp.48.1355839857143; Tue, 18 Dec 2012 06:10:57 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-113-143.nc.res.rr.com. [107.15.113.143]) by mx.google.com with ESMTPS id y9sm1387971anh.20.2012.12.18.06.10.55 (version=SSLv3 cipher=OTHER); Tue, 18 Dec 2012 06:10:55 -0800 (PST) From: Jeff Layton To: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Subject: [PATCH v2 1/5] cifs-utils: struct cifs_sid definition to new cifsidmap.h header Date: Tue, 18 Dec 2012 09:10:44 -0500 Message-Id: <1355839848-24118-2-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1355839848-24118-1-git-send-email-jlayton@samba.org> References: <1355839848-24118-1-git-send-email-jlayton@samba.org> X-Gm-Message-State: ALoCoQnwD0+x5j8oiqXh3JK4bR3R9uvziO+ptGHh+HuRAv5PsKmg2BqPKrybzBBjX7q4bllpe69k Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org People who want to build a plugin for the idmapping routines will need a header to describe the data types that they need. Add a cifsidmap.h file and move the struct cifs_sid definition into it, along with the constants needed to describe it. Signed-off-by: Jeff Layton --- Makefile.am | 1 + cifsacl.h | 12 ++---------- cifsidmap.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 cifsidmap.h diff --git a/Makefile.am b/Makefile.am index ff7a726..8964b37 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,7 @@ mount_cifs_SOURCES = mount.cifs.c mtab.c resolve_host.c util.c mount_cifs_LDADD = $(LIBCAP) $(CAPNG_LDADD) $(RT_LDADD) man_MANS = mount.cifs.8 +include_HEADERS = cifsidmap.h bin_PROGRAMS = sbin_PROGRAMS = diff --git a/cifsacl.h b/cifsacl.h index 68fe0fd..ca72dd4 100644 --- a/cifsacl.h +++ b/cifsacl.h @@ -20,6 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "cifsidmap.h" + #ifndef _CIFSACL_H #define _CIFSACL_H @@ -96,9 +98,6 @@ #define COMPMASK 0x8 #define COMPALL (COMPSID|COMPTYPE|COMPFLAG|COMPMASK) -#define NUM_AUTHS (6) /* number of authority fields */ -#define SID_MAX_SUB_AUTHORITIES (15) /* max number of sub authority fields */ - /* * While not indicated here, the structs below represent on-the-wire data * structures. Any multi-byte values are expected to be little-endian! @@ -114,13 +113,6 @@ struct cifs_ntsd { uint32_t dacloffset; } __attribute__((packed)); -struct cifs_sid { - uint8_t revision; /* revision level */ - uint8_t num_subauth; - uint8_t authority[NUM_AUTHS]; - uint32_t sub_auth[SID_MAX_SUB_AUTHORITIES]; -} __attribute__((packed)); - struct cifs_ctrl_acl { uint16_t revision; /* revision level */ uint16_t size; diff --git a/cifsidmap.h b/cifsidmap.h new file mode 100644 index 0000000..9907618 --- /dev/null +++ b/cifsidmap.h @@ -0,0 +1,37 @@ +/* + * ID Mapping Plugin interface for cifs-utils + * Copyright (C) 2012 Jeff Layton (jlayton@samba.org) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +#ifndef _CIFSIDMAP_H +#define _CIFSIDMAP_H + +#define NUM_AUTHS (6) /* number of authority fields */ +#define SID_MAX_SUB_AUTHORITIES (15) /* max number of sub authority fields */ + +/* + * Binary representation of a SID as presented to/from the kernel. Note that + * the sub_auth field is always stored in little-endian here. + */ +struct cifs_sid { + uint8_t revision; /* revision level */ + uint8_t num_subauth; + uint8_t authority[NUM_AUTHS]; + uint32_t sub_auth[SID_MAX_SUB_AUTHORITIES]; +} __attribute__((packed)); + +#endif /* _CIFSIDMAP_H */