diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-11-15 03:34:58 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-11-15 03:34:58 +0000 |
commit | 854a76a79b0379744455eaa7675624464cbb804f (patch) | |
tree | b934fb881281e4f08365f1f7472375631174c86e /lib/libc | |
parent | 39b36ed8f779155c56daa7907fe7f1f7908f1fc8 (diff) | |
download | FreeBSD-src-854a76a79b0379744455eaa7675624464cbb804f.zip FreeBSD-src-854a76a79b0379744455eaa7675624464cbb804f.tar.gz |
/etc/mac.conf is implicitly read and parsed when the MAC configuration
is accessed for the first time as a result of an application looking
up label configuration information. Previously, the check and read
were kicked off by mac_prepare_(typename)() functions; since
mac_prepare_type() may now be directly employed by a user process,
push the check and initialization into that function.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/posix1e/mac.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/libc/posix1e/mac.c b/lib/libc/posix1e/mac.c index d8a1b2d..07755e6 100644 --- a/lib/libc/posix1e/mac.c +++ b/lib/libc/posix1e/mac.c @@ -358,9 +358,15 @@ int mac_prepare_type(struct mac **mac, const char *name) { struct label_default *ld; + int error; + + error = mac_maybe_init_internal(); + if (error != 0) + return (error); for (ld = LIST_FIRST(&label_default_head); ld != NULL; ld = LIST_NEXT(ld, ld_entries)) { + printf("%s\n", ld->ld_name); if (strcmp(name, ld->ld_name) == 0) return (mac_prepare(mac, ld->ld_labels)); } @@ -372,11 +378,6 @@ mac_prepare_type(struct mac **mac, const char *name) int mac_prepare_ifnet_label(struct mac **mac) { - int error; - - error = mac_maybe_init_internal(); - if (error != 0) - return (error); return (mac_prepare_type(mac, "ifnet")); } @@ -384,11 +385,6 @@ mac_prepare_ifnet_label(struct mac **mac) int mac_prepare_file_label(struct mac **mac) { - int error; - - error = mac_maybe_init_internal(); - if (error != 0) - return (error); return (mac_prepare_type(mac, "file")); } @@ -396,11 +392,6 @@ mac_prepare_file_label(struct mac **mac) int mac_prepare_packet_label(struct mac **mac) { - int error; - - error = mac_maybe_init_internal(); - if (error != 0) - return (error); return (mac_prepare_type(mac, "packet")); } @@ -408,11 +399,6 @@ mac_prepare_packet_label(struct mac **mac) int mac_prepare_process_label(struct mac **mac) { - int error; - - error = mac_maybe_init_internal(); - if (error != 0) - return (error); return (mac_prepare_type(mac, "process")); } |