getauth.c int main (int argc, char *argv []) { error_t err; mach_port_t password_serv, msgport; auth_t auth; process_t proc_server; password_serv = file_name_lookup (_SERVERS_PASSWORD, 0, 0); if (password_serv == MACH_PORT_NULL) error (1, 0, "Failed to obtain a port to the password server"); err = password_check_user (password_serv, atoi (argv[1]), argv[2], &auth); if (err == EACCES) error (1, err, "Invalid password"); if (err) error (1, err, "Authentication failure"); proc_server = getproc (); err = proc_getmsgport (proc_serv, getppid (), &msgport); if (err) error (1, err, "Cannot get parent's message port"); err = msg_add_auth (msgport, auth); if (err) error (1, err, "Failed to add authorization to parent"); return 0; }