From patchwork Thu Dec 20 12:50:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1899611 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BDB03DF23A for ; Thu, 20 Dec 2012 12:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751995Ab2LTMun (ORCPT ); Thu, 20 Dec 2012 07:50:43 -0500 Received: from mail-gg0-f179.google.com ([209.85.161.179]:46889 "EHLO mail-gg0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592Ab2LTMum (ORCPT ); Thu, 20 Dec 2012 07:50:42 -0500 Received: by mail-gg0-f179.google.com with SMTP id q1so688756gge.10 for ; Thu, 20 Dec 2012 04:50:42 -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=XpSCTwklLGScXRXz0sxzMl2gvZHyprCsxXNSJmQUQMiFyKQp9FAz3E6F2XBqUSMc8K BXa6N5IxAEONIR5b0D/NzcyZbbQ6r4C0XpOkWfrZcWf9OpMaNl/SNH0N9UJtUlalGvdT ILrZFmHRlkv2dq+B6X0lH75lpf8K3ZBAhMi923G48JLQepQiXg97oo8M5elCQFBJ6IMP VjTr1/ilwaQhqMIzi22zVIV+cMiIJh2XEnZ19klTdAAGaYkYsqrMXoaSWTCMZUy84E62 ECMb185T0mbt20tOjaaC1eJvKaKmDWhHAwDyqTlQrm6Gy2gcf/TKjMuDgXEvjNVes9tW pG9g== X-Received: by 10.236.116.201 with SMTP id g49mr9146499yhh.73.1356007842080; Thu, 20 Dec 2012 04:50:42 -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 n40sm6835481ani.16.2012.12.20.04.50.40 (version=SSLv3 cipher=OTHER); Thu, 20 Dec 2012 04:50:41 -0800 (PST) From: Jeff Layton To: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Subject: [PATCH v3 1/6] cifs-utils: struct cifs_sid definition to new cifsidmap.h header Date: Thu, 20 Dec 2012 07:50:28 -0500 Message-Id: <1356007833-10893-2-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1356007833-10893-1-git-send-email-jlayton@samba.org> References: <1356007833-10893-1-git-send-email-jlayton@samba.org> X-Gm-Message-State: ALoCoQmCxfFNcSL+BDZQKfHQJ2Sxsn41+bugszAYLa0nU0MxEpu4Lgn4rqi8iOWfOOZlDm+rbxvZ 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 */