2 Unix SMB/CIFS implementation.
4 Unix socket communication for the Himmelblau daemon
6 Copyright (C) David Mulder 2024
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 use libnss::group::Group as NssGroup;
23 use libnss::passwd::Passwd as NssPasswd;
24 use serde::{Deserialize, Serialize};
26 #[derive(Debug, Serialize, Deserialize)]
37 impl From<Passwd> for NssPasswd {
38 fn from(val: Passwd) -> Self {
51 #[derive(Debug, Serialize, Deserialize)]
56 pub members: Vec<String>,
59 impl From<Group> for NssGroup {
60 fn from(val: Group) -> Self {
70 #[derive(Serialize, Deserialize)]
71 pub enum PamAuthRequest {
72 Password { cred: String },
73 MFACode { cred: String },
74 MFAPoll { poll_attempt: u32 },
75 SetupPin { pin: String },
79 #[derive(Serialize, Deserialize)]
82 NssAccountByUid(uid_t),
83 NssAccountByName(String),
86 NssGroupByName(String),
87 PamAuthenticateInit(String),
88 PamAuthenticateStep(PamAuthRequest),
89 PamAccountAllowed(String),
90 PamAccountBeginSession(String),
93 #[derive(Debug, Serialize, Deserialize)]
94 pub enum PamAuthResponse {
99 MFACode { msg: String },
100 MFAPoll { msg: String, polling_interval: u32 },
102 SetupPin { msg: String },
106 #[derive(Debug, Serialize, Deserialize)]
108 NssAccounts(Vec<Passwd>),
109 NssAccount(Option<Passwd>),
110 NssGroups(Vec<Group>),
111 NssGroup(Option<Group>),
112 PamStatus(Option<bool>),
113 PamAuthStepResponse(PamAuthResponse),