2013-09-18 13:40:09 -04:00
|
|
|
/* GIO - GLib Input, Output and Streaming Library
|
|
|
|
*
|
|
|
|
* Copyright 2013 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-05-27 18:21:30 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2013-09-18 13:40:09 -04:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
2014-01-23 12:58:29 +01:00
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2013-09-18 13:40:09 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __G_CREDENTIALS_PRIVATE_H__
|
|
|
|
#define __G_CREDENTIALS_PRIVATE_H__
|
|
|
|
|
|
|
|
#include "gio/gcredentials.h"
|
|
|
|
#include "gio/gnetworking.h"
|
|
|
|
|
2019-10-14 08:22:24 +01:00
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_SUPPORTED:
|
|
|
|
*
|
|
|
|
* Defined to 1 if GCredentials works.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_SUPPORTED
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_USE_LINUX_UCRED, etc.:
|
|
|
|
*
|
|
|
|
* Defined to 1 if GCredentials uses Linux `struct ucred`, etc.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_USE_LINUX_UCRED
|
|
|
|
#undef G_CREDENTIALS_USE_FREEBSD_CMSGCRED
|
|
|
|
#undef G_CREDENTIALS_USE_NETBSD_UNPCBID
|
|
|
|
#undef G_CREDENTIALS_USE_OPENBSD_SOCKPEERCRED
|
|
|
|
#undef G_CREDENTIALS_USE_SOLARIS_UCRED
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_NATIVE_TYPE:
|
|
|
|
*
|
|
|
|
* Defined to one of G_CREDENTIALS_TYPE_LINUX_UCRED, etc.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_NATIVE_TYPE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_NATIVE_SIZE:
|
|
|
|
*
|
|
|
|
* Defined to the size of the %G_CREDENTIALS_NATIVE_TYPE
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_NATIVE_SIZE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED:
|
|
|
|
*
|
|
|
|
* Defined to 1 if we have a message-passing API in which credentials
|
|
|
|
* are attached to a particular message, such as `SCM_CREDENTIALS` on Linux
|
|
|
|
* or `SCM_CREDS` on FreeBSD.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED:
|
|
|
|
*
|
|
|
|
* Defined to 1 if we have a `getsockopt()`-style API in which one end of
|
|
|
|
* a socket connection can directly query the credentials of the process
|
|
|
|
* that initiated the other end, such as `getsockopt SO_PEERCRED` on Linux
|
|
|
|
* or `getpeereid()` on multiple operating systems.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED
|
|
|
|
|
|
|
|
/*
|
|
|
|
* G_CREDENTIALS_SPOOFING_SUPPORTED:
|
|
|
|
*
|
|
|
|
* Defined to 1 if privileged processes can spoof their credentials when
|
|
|
|
* using the message-passing API.
|
|
|
|
*/
|
|
|
|
#undef G_CREDENTIALS_SPOOFING_SUPPORTED
|
|
|
|
|
2013-09-18 13:40:09 -04:00
|
|
|
#ifdef __linux__
|
|
|
|
#define G_CREDENTIALS_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_USE_LINUX_UCRED 1
|
|
|
|
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_LINUX_UCRED
|
|
|
|
#define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct ucred))
|
|
|
|
#define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
|
2013-09-19 16:09:38 -04:00
|
|
|
#define G_CREDENTIALS_SPOOFING_SUPPORTED 1
|
2013-09-18 13:40:09 -04:00
|
|
|
|
2015-01-27 07:38:31 -05:00
|
|
|
#elif defined(__FreeBSD__) || \
|
|
|
|
defined(__FreeBSD_kernel__) /* Debian GNU/kFreeBSD */ || \
|
|
|
|
defined(__GNU__) /* GNU Hurd */ || \
|
|
|
|
defined(__DragonFly__) /* DragonFly BSD */
|
2013-09-18 13:40:09 -04:00
|
|
|
#define G_CREDENTIALS_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_USE_FREEBSD_CMSGCRED 1
|
|
|
|
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED
|
|
|
|
#define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct cmsgcred))
|
|
|
|
#define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
|
2013-09-19 16:09:38 -04:00
|
|
|
#define G_CREDENTIALS_SPOOFING_SUPPORTED 1
|
2013-09-18 13:40:09 -04:00
|
|
|
|
2014-04-15 15:09:22 +01:00
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
#define G_CREDENTIALS_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_USE_NETBSD_UNPCBID 1
|
|
|
|
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_NETBSD_UNPCBID
|
|
|
|
#define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct unpcbid))
|
2014-09-01 18:42:43 +02:00
|
|
|
/* #undef G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED */
|
2014-04-15 15:09:22 +01:00
|
|
|
#define G_CREDENTIALS_SPOOFING_SUPPORTED 1
|
|
|
|
|
2013-09-18 13:40:09 -04:00
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#define G_CREDENTIALS_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_USE_OPENBSD_SOCKPEERCRED 1
|
|
|
|
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED
|
|
|
|
#define G_CREDENTIALS_NATIVE_SIZE (sizeof (struct sockpeercred))
|
|
|
|
#define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
|
2013-09-19 16:09:38 -04:00
|
|
|
#define G_CREDENTIALS_SPOOFING_SUPPORTED 1
|
|
|
|
|
|
|
|
#elif defined(__sun__) || defined(__illumos__) || defined (__OpenSolaris_kernel__)
|
|
|
|
#include <ucred.h>
|
|
|
|
#define G_CREDENTIALS_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_USE_SOLARIS_UCRED 1
|
|
|
|
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_SOLARIS_UCRED
|
|
|
|
#define G_CREDENTIALS_NATIVE_SIZE (ucred_size ())
|
|
|
|
#define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1
|
|
|
|
#define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1
|
2013-09-18 13:40:09 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __G_CREDENTIALS_PRIVATE_H__ */
|