2012-01-20 17:49:32 +00:00
|
|
|
/*
|
|
|
|
* viridentity.h: helper APIs for managing user identities
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012-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
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 Public
|
|
|
|
* License along with this library; If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-06-18 11:13:08 -05:00
|
|
|
#pragma once
|
2012-01-20 17:49:32 +00:00
|
|
|
|
2019-09-19 15:38:03 +01:00
|
|
|
#include "internal.h"
|
|
|
|
#include <glib-object.h>
|
2022-05-18 11:12:30 +02:00
|
|
|
#include "virtypedparam.h"
|
2012-01-20 17:49:32 +00:00
|
|
|
|
2019-09-19 15:38:03 +01:00
|
|
|
#define VIR_TYPE_IDENTITY vir_identity_get_type()
|
|
|
|
G_DECLARE_FINAL_TYPE(virIdentity, vir_identity, VIR, IDENTITY, GObject);
|
2012-01-20 17:49:32 +00:00
|
|
|
|
2021-04-30 16:52:30 +01:00
|
|
|
#define VIR_IDENTITY_AUTORESTORE __attribute__((cleanup(virIdentityRestoreHelper)))
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virIdentity *virIdentityGetCurrent(void);
|
|
|
|
int virIdentitySetCurrent(virIdentity *ident);
|
2021-04-30 16:52:30 +01:00
|
|
|
virIdentity *virIdentityElevateCurrent(void);
|
|
|
|
|
|
|
|
void virIdentityRestoreHelper(virIdentity **identptr);
|
2019-10-04 17:14:10 +01:00
|
|
|
|
2021-04-29 15:52:20 +01:00
|
|
|
int virIdentityIsCurrentElevated(void);
|
2021-03-11 08:16:13 +01:00
|
|
|
virIdentity *virIdentityGetSystem(void);
|
2013-03-06 10:53:47 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virIdentity *virIdentityNew(void);
|
2021-04-30 16:46:15 +01:00
|
|
|
virIdentity *virIdentityNewCopy(virIdentity *src);
|
2013-03-06 11:00:16 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetUserName(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
const char **username);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetUNIXUserID(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
uid_t *uid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetGroupName(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
const char **groupname);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetUNIXGroupID(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
gid_t *gid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetProcessID(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
pid_t *pid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetProcessTime(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
unsigned long long *timestamp);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetSASLUserName(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char **username);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetX509DName(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char **dname);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentityGetSELinuxContext(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char **context);
|
2020-11-19 12:26:17 +00:00
|
|
|
int virIdentityGetSystemToken(virIdentity *ident,
|
|
|
|
const char **token);
|
2013-08-22 16:43:35 +01:00
|
|
|
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetUserName(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
const char *username);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetUNIXUserID(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
uid_t uid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetGroupName(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
const char *groupname);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetUNIXGroupID(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
gid_t gid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetProcessID(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
pid_t pid);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetProcessTime(virIdentity *ident,
|
2019-07-26 11:59:15 +01:00
|
|
|
unsigned long long timestamp);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetSASLUserName(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char *username);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetX509DName(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char *dname);
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetSELinuxContext(virIdentity *ident,
|
2013-08-22 16:43:35 +01:00
|
|
|
const char *context);
|
2020-11-19 12:26:17 +00:00
|
|
|
int virIdentitySetSystemToken(virIdentity *ident,
|
|
|
|
const char *token);
|
2019-07-26 16:36:29 +01:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virIdentitySetParameters(virIdentity *ident,
|
2019-07-26 16:36:29 +01:00
|
|
|
virTypedParameterPtr params,
|
|
|
|
int nparams);
|
|
|
|
|
2022-05-18 11:12:30 +02:00
|
|
|
virTypedParamList *virIdentityGetParameters(virIdentity *ident);
|