From patchwork Sat Nov 3 12:50:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1692381 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 5F339DFB7B for ; Sat, 3 Nov 2012 12:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932416Ab2KCMvF (ORCPT ); Sat, 3 Nov 2012 08:51:05 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:50361 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932075Ab2KCMvF (ORCPT ); Sat, 3 Nov 2012 08:51:05 -0400 Received: by mail-gh0-f174.google.com with SMTP id g15so789442ghb.19 for ; Sat, 03 Nov 2012 05:51:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=cMhs8U8/pb0++DwZvxs4egxOoawErQj3GjKT0APOAdQ=; b=hJujgEoCIYgVI8yN1Vfbw5yOzZ2g3wGYU/by4vkirsreOC10AKV7mmU/e6v5hCr/KE RHB1Y3Pjq6RMMQ4HnM97PzpMV9os90MRk8ItuZ5eoycB8JWAEevx3c0nVaGo2jt2eWW8 2P7sPZDODUDFz9hYosvFMttuySszXJS/O/lRZqCcJhnETsmvLGMwWRIMRRUVrMKUu/dt ckY5L6yTkZqUgGbvAwUtFu67IupdrBMcSRolckYh5kuOIHLygF//Vcau83CifFx38u/c z0lJWJ9t6rzDMbXGsB2iFlIS9kF+O/OnSZVvG49lSskk0E3/ND5E+Jxjy2pvafU7vx4P SpZQ== Received: by 10.236.85.78 with SMTP id t54mr4307370yhe.48.1351947064942; Sat, 03 Nov 2012 05:51:04 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id n13sm11145727ano.20.2012.11.03.05.51.03 (version=SSLv3 cipher=OTHER); Sat, 03 Nov 2012 05:51:04 -0700 (PDT) From: Jeff Layton To: linux-cifs@vger.kernel.org Cc: shirishpargaonkar@gmail.com Subject: [PATCH 16/17] getcifsacl: don't use wbcDomainSid internally Date: Sat, 3 Nov 2012 08:50:33 -0400 Message-Id: <1351947034-18876-17-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351947034-18876-1-git-send-email-jlayton@samba.org> References: <1351947034-18876-1-git-send-email-jlayton@samba.org> X-Gm-Message-State: ALoCoQmrAJWAgAsutYrP0KtQxIErUksUErWCCXahRB6SfUWNf4m/MdbO1/qRK44WNp6tFlwAgSOv Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Use our own cifs_sid instead and cast it to a wbcDomainSid before handing it off to winbind. Signed-off-by: Jeff Layton --- getcifsacl.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/getcifsacl.c b/getcifsacl.c index f7e6d4f..1bcbd58 100644 --- a/getcifsacl.c +++ b/getcifsacl.c @@ -176,16 +176,16 @@ print_ace_type(uint8_t acetype, int raw) * little endian here so that winbind will understand correctly. */ static void -convert_sid_endianness(struct wbcDomainSid *sid) +convert_sid_endianness(struct cifs_sid *sid) { int i; for (i = 0; i < sid->num_subauth; i++) - sid->sub_auth[i] = le32toh(sid->sub_auths[i]); + sid->sub_auth[i] = le32toh(sid->sub_auth[i]); } static void -print_sid(struct wbcDomainSid *sidptr, int raw) +print_sid(struct cifs_sid *sidptr, int raw) { int i; int num_auths; @@ -200,7 +200,8 @@ print_sid(struct wbcDomainSid *sidptr, int raw) if (raw) goto print_sid_raw; - rc = wbcLookupSid(sidptr, &domain_name, &sidname, &sntype); + rc = wbcLookupSid((struct wbcDomainSid *)sidptr, &domain_name, + &sidname, &sntype); if (WBC_ERROR_IS_OK(rc)) { printf("%s", domain_name); if (strlen(domain_name)) @@ -210,14 +211,14 @@ print_sid(struct wbcDomainSid *sidptr, int raw) } print_sid_raw: - num_auths = sidptr->num_auths; + num_auths = sidptr->num_subauth; printf("S"); - printf("-%d", sidptr->sid_rev_num); + printf("-%d", sidptr->revision); for (i = 0; i < num_auth; ++i) - if (sidptr->id_auth[i]) - printf("-%d", sidptr->id_auth[i]); + if (sidptr->authority[i]) + printf("-%d", sidptr->authority[i]); for (i = 0; i < num_auths; i++) - printf("-%u", sidptr->sub_auths[i]); + printf("-%u", sidptr->sub_auth[i]); } static void @@ -232,7 +233,7 @@ print_ace(struct cifs_ace *pace, char *end_of_acl, int raw) return; printf("ACL:"); - print_sid((struct wbcDomainSid *)&pace->sid, raw); + print_sid((struct cifs_sid *)&pace->sid, raw); printf(":"); print_ace_type(pace->type, raw); printf("/"); @@ -276,14 +277,14 @@ parse_dacl(struct cifs_ctrl_acl *pdacl, char *end_of_acl, int raw) } static int -parse_sid(struct wbcDomainSid *psid, char *end_of_acl, char *title, int raw) +parse_sid(struct cifs_sid *psid, char *end_of_acl, char *title, int raw) { if (end_of_acl < (char *)psid + 8) return -EINVAL; if (title) printf("%s:", title); - print_sid((struct wbcDomainSid *)psid, raw); + print_sid((struct cifs_sid *)psid, raw); printf("\n"); return 0; @@ -295,15 +296,15 @@ parse_sec_desc(struct cifs_ntsd *pntsd, ssize_t acl_len, int raw) int rc; uint32_t dacloffset; char *end_of_acl = ((char *)pntsd) + acl_len; - struct wbcDomainSid *owner_sid_ptr, *group_sid_ptr; + struct cifs_sid *owner_sid_ptr, *group_sid_ptr; struct cifs_ctrl_acl *dacl_ptr; /* no need for SACL ptr */ if (pntsd == NULL) return -EIO; - owner_sid_ptr = (struct wbcDomainSid *)((char *)pntsd + + owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + le32toh(pntsd->osidoffset)); - group_sid_ptr = (struct wbcDomainSid *)((char *)pntsd + + group_sid_ptr = (struct cifs_sid *)((char *)pntsd + le32toh(pntsd->gsidoffset)); dacloffset = le32toh(pntsd->dacloffset); dacl_ptr = (struct cifs_ctrl_acl *)((char *)pntsd + dacloffset);