goto bad;
where = US"SO_PASSCRED";
-if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0)
+if (setsockopt(fd, SOL_SOCKET,
+#ifdef SO_PASSCRED /* Linux */
+ SO_PASSCRED,
+#elif defined(LOCAL_CREDS) /* BSD-ish */
+ LOCAL_CREDS,
+#else
+# error no SO_PASSCRED
+#endif
+ &on, sizeof(on)) < 0)
goto bad;
/* debug_printf("%s: fd %d\n", __FUNCTION__, fd); */
/* Refuse to handle the item unless the peer has good credentials */
#ifdef SCM_CREDENTIALS
# define EXIM_SCM_CR_TYPE SCM_CREDENTIALS
-#elif defined(SCM_CREDS)
+#elif defined(LOCAL_CREDS) && defined(SCM_CREDS)
# define EXIM_SCM_CR_TYPE SCM_CREDS
#else
# error no SCM creds knowlege
cp = CMSG_NXTHDR(&msg, cp))
if (cp->cmsg_level == SOL_SOCKET && cp->cmsg_type == EXIM_SCM_CR_TYPE)
{
-#ifdef SCM_CREDENTIALS
+#ifdef SCM_CREDENTIALS /* Linux */
struct ucred * cr = (struct ucred *) CMSG_DATA(cp);
if (cr->uid && cr->uid != exim_uid)
{
DEBUG(D_queue_run) debug_printf("%s: sender creds pid %d uid %d gid %d\n",
__FUNCTION__, (int)cr->pid, (int)cr->uid, (int)cr->gid);
return FALSE;
-#elif defined(SCM_CREDS)
- struct cmsgcred * cr = (struct cmsgcred *) CMSG_DATA(cp);
- if (cr->cmcred_uid && cr->cmcred_uid != exim_uid)
+#elif defined(LOCAL_CREDS) /* BSD-ish */
+ struct sockcred * cr = (struct sockcred *) CMSG_DATA(cp);
+ if (cr->sc_uid && cr->sc_uid != exim_uid)
{
- DEBUG(D_queue_run) debug_printf("%s: sender creds pid %d uid %d gid %d\n",
- __FUNCTION__, (int)cr->cmcred_pid, (int)cr->cmcred_uid, (int)cr->cmcred_gid);
+ DEBUG(D_queue_run) debug_printf("%s: sender creds pid ??? uid %d gid %d\n",
+ __FUNCTION__, (int)cr->sc_uid, (int)cr->sc_gid);
return FALSE;
#endif
}
spool_directory, getpid());
#endif
-if (bind(fd, &sun, len) < 0) { where = US"bind"; goto bad; }
+if (bind(fd, (const struct sockaddr *)&sun, len) < 0)
+ { where = US"bind"; goto bad; }
#ifdef notdef
debug_printf("local%s '%s'\n", *sun.sun_path ? "" : " abstract",
len = offsetof(struct sockaddr_un, sun_path) + 1
+ snprintf(sun.sun_path+1, sizeof(sun.sun_path)-1, "%s", NOTIFIER_SOCKET_NAME);
-if (connect(fd, &sun, len) < 0) { where = US"connect"; goto bad; }
+if (connect(fd, (const struct sockaddr *)&sun, len) < 0)
+ { where = US"connect"; goto bad; }
buf[0] = NOTIFY_QUEUE_SIZE_REQ;
if (send(fd, buf, 1, 0) < 0) { where = US"send"; goto bad; }