diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-06-27 18:06:41 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-06-27 18:06:41 +0000 |
commit | 02d6c5b525eb33f2cb80e79944dc5182be119e2c (patch) | |
tree | e75771e43b8b10a3afb7a3dbbe6f2bc79e8214a1 /contrib/openbsm/libbsm | |
parent | f7669e641742373606ef85a4855b7028f5b564a5 (diff) | |
download | FreeBSD-src-02d6c5b525eb33f2cb80e79944dc5182be119e2c.zip FreeBSD-src-02d6c5b525eb33f2cb80e79944dc5182be119e2c.tar.gz |
Vendor import of OpenBSM 1.0 alpha 7, with the following change history
notes:
- Adopted Solaris-compatible format for subject32_ex and subject64_ex
tokens, which previously did not correctly implement variable length
address storage.
- Prefer inttypes.h to stdint.h; enhance queue.h detection to test for
TAILQ_FOREACH_SAFE(), which is present in recent BSD queue.h's, but not
older ones. OpenBSM now builds on some FreeBSD 4.x version.
- New event types for extended attributes, ACLs, and scheduling.
Obtained from: TrustedBSD Project
Diffstat (limited to 'contrib/openbsm/libbsm')
-rw-r--r-- | contrib/openbsm/libbsm/bsm_notify.c | 4 | ||||
-rw-r--r-- | contrib/openbsm/libbsm/bsm_token.c | 40 |
2 files changed, 33 insertions, 11 deletions
diff --git a/contrib/openbsm/libbsm/bsm_notify.c b/contrib/openbsm/libbsm/bsm_notify.c index d5a7601..3ebfb25 100644 --- a/contrib/openbsm/libbsm/bsm_notify.c +++ b/contrib/openbsm/libbsm/bsm_notify.c @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#11 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#12 $ */ /* @@ -45,7 +45,7 @@ #include <bsm/libbsm.h> #include <errno.h> -#include <stdint.h> +#include <inttypes.h> #include <stdarg.h> #include <string.h> #include <syslog.h> diff --git a/contrib/openbsm/libbsm/bsm_token.c b/contrib/openbsm/libbsm/bsm_token.c index 98991ad..7512c42 100644 --- a/contrib/openbsm/libbsm/bsm_token.c +++ b/contrib/openbsm/libbsm/bsm_token.c @@ -30,7 +30,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#47 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#48 $ */ #include <sys/types.h> @@ -691,7 +691,16 @@ au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, token_t *t; u_char *dptr = NULL; - GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t)); + if (tid->at_type == AU_IPv4) + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + + 10 * sizeof(u_int32_t)); + else if (tid->at_type == AU_IPv6) + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + + 13 * sizeof(u_int32_t)); + else { + errno = EINVAL; + return (NULL); + } if (t == NULL) return (NULL); @@ -706,9 +715,11 @@ au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, ADD_U_INT32(dptr, tid->at_port); ADD_U_INT32(dptr, tid->at_type); ADD_U_INT32(dptr, tid->at_addr[0]); - ADD_U_INT32(dptr, tid->at_addr[1]); - ADD_U_INT32(dptr, tid->at_addr[2]); - ADD_U_INT32(dptr, tid->at_addr[3]); + if (tid->at_type == AU_IPv6) { + ADD_U_INT32(dptr, tid->at_addr[1]); + ADD_U_INT32(dptr, tid->at_addr[2]); + ADD_U_INT32(dptr, tid->at_addr[3]); + } return (t); } @@ -969,7 +980,16 @@ au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, token_t *t; u_char *dptr = NULL; - GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t)); + if (tid->at_type == AU_IPv4) + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 10 * + sizeof(u_int32_t)); + else if (tid->at_type == AU_IPv6) + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * + sizeof(u_int32_t)); + else { + errno = EINVAL; + return (NULL); + } if (t == NULL) return (NULL); @@ -984,9 +1004,11 @@ au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, ADD_U_INT32(dptr, tid->at_port); ADD_U_INT32(dptr, tid->at_type); ADD_U_INT32(dptr, tid->at_addr[0]); - ADD_U_INT32(dptr, tid->at_addr[1]); - ADD_U_INT32(dptr, tid->at_addr[2]); - ADD_U_INT32(dptr, tid->at_addr[3]); + if (tid->at_type == AU_IPv6) { + ADD_U_INT32(dptr, tid->at_addr[1]); + ADD_U_INT32(dptr, tid->at_addr[2]); + ADD_U_INT32(dptr, tid->at_addr[3]); + } return (t); } |