diff options
author | tz204579 <none@none> | 2007-10-26 13:06:58 -0700 |
---|---|---|
committer | tz204579 <none@none> | 2007-10-26 13:06:58 -0700 |
commit | a7746f662862b6ac0a85751d8adbc897743a83e1 (patch) | |
tree | 04185d177485f7fc40c00d4c136037d038c47a38 /usr/src/cmd/auditreduce | |
parent | 4d139e710100affa83409f3f4b39670b0694e28e (diff) | |
download | illumos-gate-a7746f662862b6ac0a85751d8adbc897743a83e1.tar.gz |
6431736 c2audit needs to add support for auditing ZFS/NFS ACLs
Diffstat (limited to 'usr/src/cmd/auditreduce')
-rw-r--r-- | usr/src/cmd/auditreduce/token.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/usr/src/cmd/auditreduce/token.c b/usr/src/cmd/auditreduce/token.c index ff11f2cd2d..1e3c37fbd2 100644 --- a/usr/src/cmd/auditreduce/token.c +++ b/usr/src/cmd/auditreduce/token.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,7 +177,7 @@ trailer_token(adr_t *adr) adrm_u_short(adr, (ushort_t *)&magic_number, 1); if (magic_number != AUT_TRAILER_MAGIC) { (void) fprintf(stderr, "%s\n", - gettext("auditreduce: Bad trailer token")); + gettext("auditreduce: Bad trailer token")); return (-2); } adrm_u_int32(adr, &bytes, 1); @@ -265,9 +265,9 @@ return_value32_token(adr_t *adr) adrm_char(adr, &errnum, 1); adrm_u_int32(adr, &value, 1); if ((flags & M_SORF) && - ((global_class & mask.am_success) && (errnum == 0)) || - ((global_class & mask.am_failure) && (errnum != 0))) { - checkflags |= M_SORF; + ((global_class & mask.am_success) && (errnum == 0)) || + ((global_class & mask.am_failure) && (errnum != 0))) { + checkflags |= M_SORF; } return (-1); } @@ -288,9 +288,9 @@ return_value64_token(adr_t *adr) adrm_char(adr, &errnum, 1); adrm_u_int64(adr, &value, 1); if ((flags & M_SORF) && - ((global_class & mask.am_success) && (errnum == 0)) || - ((global_class & mask.am_failure) && (errnum != 0))) { - checkflags |= M_SORF; + ((global_class & mask.am_success) && (errnum == 0)) || + ((global_class & mask.am_failure) && (errnum != 0))) { + checkflags |= M_SORF; } return (-1); } @@ -515,6 +515,13 @@ argument64_token(adr_t *adr) return (-1); } +/* + * Format of acl token: + * acl token id adr_char + * acl type adr_u_int32 + * acl value adr_u_int32 (depends on type) + * file mode adr_u_int (in octal) + */ int acl_token(adr_t *adr) { @@ -531,6 +538,29 @@ acl_token(adr_t *adr) } /* + * Format of ace token: + * ace token id adr_char + * ace who adr_u_int32 (uid/gid) + * access mask adr_u_int32 + * ace flags adr_u_int16 + * ace type adr_u_int16 + */ +int +ace_token(adr_t *adr) +{ + uid_t who; + uint32_t access_mask; + uint16_t flags, type; + + adrm_uid(adr, &who, 1); + adrm_u_int32(adr, &access_mask, 1); + adrm_u_short(adr, &flags, 1); + adrm_u_short(adr, &type, 1); + + return (-1); +} + +/* * Format of attribute token: (old pre SunOS 5.7 format) * attribute token id adr_char * mode adr_int32 (printed in octal) @@ -1704,7 +1734,8 @@ collapse_path(char *s) is += 1; if (id > 0) id--; - while (id > 0 && s[--id] != '/'); + while (id > 0 && s[--id] != '/') + ; id++; continue; } @@ -1713,11 +1744,13 @@ collapse_path(char *s) is += 2; if (id > 0) id--; - while (id > 0 && s[--id] != '/'); + while (id > 0 && s[--id] != '/') + ; id++; continue; } - while (is < ls && (s[id++] = s[is++]) != '/'); + while (is < ls && (s[id++] = s[is++]) != '/') + ; is--; } return (s); |