Date: Wed, 9 Feb 2005 19:59:38 GMT From: Andrew Reisse <areisse@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 70717 for review Message-ID: <200502091959.j19JxcsR008394@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/types.h> #include <stdint.h> -#include <sepol/flask_types.h> 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502091959.j19JxcsR008394>