/*1* Copyright (c) 2009 Kungliga Tekniska H�gskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Portions Copyright (c) 2009 Apple Inc. All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10*11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13*14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* 3. Neither the name of the Institute nor the names of its contributors19* may be used to endorse or promote products derived from this software20* without specific prior written permission.21*22* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND23* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE26* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32* SUCH DAMAGE.33*/3435#include "config.h"3637#include <sys/types.h>38#include <sys/socket.h>39#ifdef HAVE_SYS_UN_H40#include <sys/un.h>41#endif4243#include <sys/poll.h>4445#include <ctype.h>46#include <stdio.h>47#include <stdlib.h>48#include <string.h>49#include <errno.h>5051#ifdef HAVE_GETPEERUCRED52#include <ucred.h>53#endif5455#include <krb5-types.h>56#include <asn1-common.h>5758#include <heimbase.h>59#include <base64.h>6061#include <heim-ipc.h>6263#if defined(__APPLE__) && defined(HAVE_GCD)64#include <mach/mach.h>65#include <servers/bootstrap.h>66#include <dispatch/dispatch.h>67#include <bsm/libbsm.h>6869#ifndef __APPLE_PRIVATE__ /* awe, using private interface */70typedef boolean_t (*dispatch_mig_callback_t)(mach_msg_header_t *message, mach_msg_header_t *reply);7172mach_msg_return_t73dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz, dispatch_mig_callback_t callback);74#endif7576#endif777879#include <roken.h>8081int82_heim_ipc_create_cred(uid_t, gid_t, pid_t, pid_t, heim_icred *);838485