#include <security/mac_internal.h>
#include <security/mac_mach_internal.h>
#include <mach/message.h>
#include <kern/task.h>
void
mac_port_label_init(struct label *l)
{
mac_label_init(l);
if (mac_late == 0) {
mac_label_journal_add(l, MLJ_TYPE_PORT);
mac_label_journal(l, MLJ_PORT_OP_INIT);
}
MAC_PERFORM (port_label_init, l);
}
void
mac_port_label_destroy(struct label *l)
{
MAC_PERFORM (port_label_destroy, l);
if (mac_late == 0)
mac_label_journal_remove(l);
mac_label_destroy(l);
}
void
mac_port_label_copy(struct label *src, struct label *dest)
{
MAC_PERFORM(port_label_copy, src, dest);
}
void
mac_port_label_update_cred(struct label *src, struct label *dest)
{
MAC_PERFORM(port_label_update_cred, src, dest);
}
void
mac_port_label_associate(struct label *it, struct label *st, struct label *port)
{
if (mac_late == 0)
mac_label_journal(port, MLJ_PORT_OP_CREATE);
MAC_PERFORM(port_label_associate, it, st, port);
}
void
mac_port_label_associate_kernel(struct label *port, int isreply)
{
if (mac_late == 0)
mac_label_journal(port, MLJ_PORT_OP_CREATE_K);
MAC_PERFORM(port_label_associate_kernel, port, isreply);
}
void
mac_port_label_update_kobject(struct label *port, int kotype)
{
if (mac_late == 0)
mac_label_journal(port, MLJ_PORT_OP_UPDATE, kotype);
MAC_PERFORM(port_label_update_kobject, port, kotype);
}
int
mac_port_label_internalize(struct label *label, char *string)
{
int error;
error = MAC_INTERNALIZE(cred, label, string);
return (error);
}
int
mac_port_label_externalize(struct label *label, char *elements,
char *outbuf, size_t outbuflen, int flags __unused)
{
int error;
error = MAC_EXTERNALIZE(cred, label, elements, outbuf, outbuflen);
return (error);
}
int
mac_port_check_label_update(struct label *task, struct label *old,
struct label *newlabel)
{
int error;
MAC_CHECK(port_check_label_update, task, old, newlabel);
return (error);
}
int
mac_port_check_send(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_send, task, port);
return (error);
}
int
mac_port_check_receive(struct label *task, struct label *sender)
{
int error;
MAC_CHECK(port_check_receive, task, sender);
return (error);
}
int
mac_port_check_make_send(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_make_send, task, port);
return (error);
}
int
mac_port_check_make_send_once(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_make_send_once, task, port);
return (error);
}
int
mac_port_check_copy_send(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_copy_send, task, port);
return (error);
}
int
mac_port_check_move_send(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_move_send, task, port);
return (error);
}
int
mac_port_check_move_send_once(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_move_send_once, task, port);
return (error);
}
int
mac_port_check_move_receive(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_move_receive, task, port);
return (error);
}
int
mac_port_check_hold_send(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_hold_send, task, port);
return (error);
}
int
mac_port_check_hold_send_once(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_hold_send_once, task, port);
return (error);
}
int
mac_port_check_hold_receive(struct label *task, struct label *port)
{
int error;
MAC_CHECK(port_check_hold_receive, task, port);
return (error);
}
int
mac_port_check_method(task_t task, struct label *sub, struct label *obj, int msgid)
{
int error;
MAC_CHECK(port_check_method, get_bsdtask_info(task), sub, obj, msgid);
return (error);
}