Commit c26d45f3 authored by Niels Möller's avatar Niels Möller

(spawn_helper): Use SOCK_DGRAM for Solaris

style ucred passing, otherwise SOCK_STREAM.

Rev: src/lshd-userauth.c:1.7
parent ce4b3d36
......@@ -38,6 +38,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include "nettle/base16.h"
#include "nettle/macros.h"
......@@ -465,8 +466,17 @@ spawn_helper(const char *program, uid_t uid, gid_t gid)
pid_t child;
/* pipe[0] for the child, pipe[1] for the parent */
int pipe[2];
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, pipe) < 0)
int type;
#ifdef SO_RECVUCRED
/* Solaris' ucred passing works with SOCK_DGRAM sockets only */
type = SOCK_DGRAM;
#else
type = SOCK_STREAM;
#endif
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe) < 0)
{
werror("socketpair failed: %e.\n", errno);
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment