#include <time.h>
#include <unistd.h>
+#if defined(__sun)
+#include <ucred.h>
+#endif
+
#include "common.h"
#include "config.h"
#include "control.h"
(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
#endif
-#define SUN_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
+#define SUN_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
#define LISTEN_BACKLOG 5
*gid = creds.gid;
return 0;
}
+#elif defined(__sun)
+static int
+getpeereid(int fd, uid_t *uid, gid_t *gid)
+{
+ ucred_t *ucred = NULL;
+
+ if (getpeerucred(fd, &ucred) == -1)
+ return -1;
+
+ *uid = ucred_geteuid(ucred);
+ *gid_t gid = ucred_getegid(ucred);
+ ucred_free(ucred);
+ return 0;
+}
#endif
static int
#include "logerr.h"
#include "privsep.h"
-#define PS_CTL_FD(ctx) (ctx)->ps_ctl->psp_fd
+#define PS_CTL_FD(ctx) (ctx)->ps_ctl->psp_fd
/* We expect to have open 2 privsep STREAM, 2 STREAM and 2 file STREAM fds */