syslog-ng source
compat-unix-creds.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Balabit
3  * Copyright (c) 2014 Gergely Nagy
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef _SYSLOG_NG_UNIX_CREDENTIALS_H
25 #define _SYSLOG_NG_UNIX_CREDENTIALS_H
26 
27 #include <sys/types.h>
28 #include <sys/socket.h>
29 
30 #include "syslog-ng.h"
31 
32 #if defined(__linux__)
33 # if SYSLOG_NG_HAVE_STRUCT_UCRED && SYSLOG_NG_HAVE_CTRLBUF_IN_MSGHDR
34 # define CRED_PASS_SUPPORTED
35 # define cred_t struct ucred
36 # define cred_get(c,x) ((c)->x)
37 # endif
38 #elif defined(__FreeBSD__)
39 # if SYSLOG_NG_HAVE_STRUCT_CMSGCRED && SYSLOG_NG_HAVE_CTRLBUF_IN_MSGHDR
40 # define CRED_PASS_SUPPORTED
41 # define SCM_CREDENTIALS SCM_CREDS
42 # define cred_t struct cmsgcred
43 # define cred_get(c,x) ((c)->cmcred_##x)
44 # endif
45 #endif
46 
47 void setsockopt_so_passcred(gint fd, gint enable);
48 
49 #endif
void setsockopt_so_passcred(gint fd, gint enable)
Definition: compat-unix-creds.c:27