From owner-p4-projects@FreeBSD.ORG Wed Feb 9 19:59:39 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 34FBE16A4D1; Wed, 9 Feb 2005 19:59:39 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C29CD16A4CE for ; Wed, 9 Feb 2005 19:59:38 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9664C43D31 for ; Wed, 9 Feb 2005 19:59:38 +0000 (GMT) (envelope-from areisse@nailabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j19Jxceo008397 for ; Wed, 9 Feb 2005 19:59:38 GMT (envelope-from areisse@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j19JxcsR008394 for perforce@freebsd.org; Wed, 9 Feb 2005 19:59:38 GMT (envelope-from areisse@nailabs.com) Date: Wed, 9 Feb 2005 19:59:38 GMT Message-Id: <200502091959.j19JxcsR008394@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to areisse@nailabs.com using -f From: Andrew Reisse To: Perforce Change Reviews Subject: PERFORCE change 70717 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2005 19:59:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=70717 Change 70717 by areisse@areisse_tislabs on 2005/02/09 19:58:40 Use a 32-bit access_vector_t (like selinux). With this change, libsepol becomes practically identical to the selinux version. Affected files ... .. //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/include/sepol/avtab.h#3 edit .. //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/include/sepol/flask_types.h#3 edit .. //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/src/avtab.c#3 edit .. //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/src/write.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/include/sepol/avtab.h#3 (text+ko) ==== @@ -26,7 +26,6 @@ #include #include -#include typedef struct avtab_key { uint32_t source_type; /* source type */ @@ -45,7 +44,7 @@ #define AVTAB_TYPE (AVTAB_TRANSITION | AVTAB_MEMBER | AVTAB_CHANGE) #define AVTAB_ENABLED 0x80000000 /* reserved for used in cond_avtab */ uint32_t specified; /* what fields are specified */ - access_vector_t data[3]; /* access vectors or types */ + uint32_t data[3]; /* access vectors or types */ #define avtab_allowed(x) (x)->data[0] #define avtab_auditdeny(x) (x)->data[1] #define avtab_auditallow(x) (x)->data[2] ==== //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/include/sepol/flask_types.h#3 (text+ko) ==== @@ -34,7 +34,7 @@ * for permissions are defined in the automatically generated * header file av_permissions.h. */ -typedef uint64_t access_vector_t; +typedef uint32_t access_vector_t; /* * Each object class is identified by a fixed-size value. ==== //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/src/avtab.c#3 (text+ko) ==== @@ -362,21 +362,12 @@ return -1; } if (avdatum->specified & AVTAB_AV) { - if (avdatum->specified & AVTAB_ALLOWED) { - uint32_t b1 = le32_to_cpu (buf[items++]); - uint32_t b2 = le32_to_cpu (buf[items++]); - avtab_allowed(avdatum) = (((uint64_t) b1) << 32) | b2; - } - if (avdatum->specified & AVTAB_AUDITDENY) { - uint32_t b1 = le32_to_cpu (buf[items++]); - uint32_t b2 = le32_to_cpu (buf[items++]); - avtab_auditdeny(avdatum) = (((uint64_t) b1) << 32) | b2; - } - if (avdatum->specified & AVTAB_AUDITALLOW) { - uint32_t b1 = le32_to_cpu (buf[items++]); - uint32_t b2 = le32_to_cpu (buf[items++]); - avtab_auditallow(avdatum) = (((uint64_t) b1) << 32) | b2; - } + if (avdatum->specified & AVTAB_ALLOWED) + avtab_allowed(avdatum) = le32_to_cpu(buf[items++]); + if (avdatum->specified & AVTAB_AUDITDENY) + avtab_auditdeny(avdatum) = le32_to_cpu(buf[items++]); + if (avdatum->specified & AVTAB_AUDITALLOW) + avtab_auditallow(avdatum) = le32_to_cpu(buf[items++]); } else { if (avdatum->specified & AVTAB_TRANSITION) avtab_transition(avdatum) = le32_to_cpu(buf[items++]); ==== //depot/projects/trustedbsd/sebsd/contrib/sebsd/libsepol/src/write.c#3 (text+ko) ==== @@ -107,18 +107,12 @@ return -1; } if (cur->datum.specified & AVTAB_AV) { - if (cur->datum.specified & AVTAB_ALLOWED) { - buf[items++] = cpu_to_le32(avtab_allowed(&cur->datum) >> 32); - buf[items++] = cpu_to_le32(avtab_allowed(&cur->datum) & 0xffffffff); - } - if (cur->datum.specified & AVTAB_AUDITDENY) { - buf[items++] = cpu_to_le32(avtab_auditdeny(&cur->datum) >> 32); - buf[items++] = cpu_to_le32(avtab_auditdeny(&cur->datum) & 0xffffffff); - } - if (cur->datum.specified & AVTAB_AUDITALLOW) { - buf[items++] = cpu_to_le32(avtab_auditallow(&cur->datum) >> 32); - buf[items++] = cpu_to_le32(avtab_auditallow(&cur->datum) & 0xffffffff); - } + if (cur->datum.specified & AVTAB_ALLOWED) + buf[items++] = cpu_to_le32(avtab_allowed(&cur->datum)); + if (cur->datum.specified & AVTAB_AUDITDENY) + buf[items++] = cpu_to_le32(avtab_auditdeny(&cur->datum)); + if (cur->datum.specified & AVTAB_AUDITALLOW) + buf[items++] = cpu_to_le32(avtab_auditallow(&cur->datum)); } else { if (cur->datum.specified & AVTAB_TRANSITION) buf[items++] = cpu_to_le32(avtab_transition(&cur->datum));