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

Include sys/socket.h

(main): Use setsockopt SO_RECVUCRED, if available.

Rev: src/lshd-pty-helper.c:1.5
parent 199b4caf
......@@ -39,6 +39,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <grp.h>
......@@ -571,8 +572,8 @@ main (int argc UNUSED, char **argv UNUSED)
werror("wtmp_file: %s\n", wtmp_file);
/* Needed on Linux */
#ifdef SO_PASSCRED
#if defined (SO_PASSCRED)
/* For Linux */
{
int yes = 1;
......@@ -583,6 +584,17 @@ main (int argc UNUSED, char **argv UNUSED)
return EXIT_FAILURE;
}
}
#elif defined (SO_RECVUCRED)
{
int yes = 1;
if (setsockopt(STDIN_FILENO, SOL_SOCKET, SO_RECVUCRED,
&yes, sizeof(yes)) < 0)
{
die("setsockopt SO_PASSCRED failed: %s.\n", strerror(errno));
return EXIT_FAILURE;
}
}
#endif
init_pty_state(&state, getuid());
......
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