Debian Codegraph @

src/lib/files/files.h

raw symbols SCIP
1 /*
2 Authors:
3 Pavel Březina <[email protected]>
4
5 Copyright (C) 2018 Red Hat
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _FILES_H_
22 #define _FILES_H_cxx . . $ `src/lib/files/files.h:22:9`!
23
24 #include <stdbool.h>
25
26 #include "common/errno_t.h"cxx . . $ `<file>/src/common/errno_t.h`/
27
28 struct authselect_filescxx . . $ authselect_files# {
29 char *systemauthcxx . . $ authselect_files#systemauth.;
30 char *passwordauthcxx . . $ authselect_files#passwordauth.;
31 char *smartcardauthcxx . . $ authselect_files#smartcardauth.;
32 char *switchableauthcxx . . $ authselect_files#switchableauth.;
33 char *fingerprintauthcxx . . $ authselect_files#fingerprintauth.;
34 char *postlogincxx . . $ authselect_files#postlogin.;
35 char *nsswitchcxx . . $ authselect_files#nsswitch.;
36 char *dconfdbcxx . . $ authselect_files#dconfdb.;
37 char *dconflockcxx . . $ authselect_files#dconflock.;
38 };
39
40 /**
41 * Read information from configuration file.
42 *
43 * @param _profile_id Profile ID.
44 * @param _features NULL-terminated string array of enabled features.
45 *
46 * @return EOK on success, ENOENT if the configuration file is missing,
47 * other errno code on error.
48 */
49 errno_tcxx . . $ errno_t#
50 authselect_config_readcxx . . $ authselect_config_read(2bdaab245118da41).(char **_profile_id,
51 char ***_features);
52
53
54 /**
55 * Write information into configuration file.
56 *
57 * @param profile_id Profile ID.
58 * @param features NULL-terminated string array of enabled features.
59 *
60 * @return EOK on success, other errno code on error.
61 */
62 errno_tcxx . . $ errno_t#
63 authselect_config_writecxx . . $ authselect_config_write(2ef3bc9ee8f8b3e9).(const char *profile_id,
64 const char **features);
65
66 /**
67 * Test if all locations that we work with are writable.
68 *
69 * @return True if all locations are writable, false otherwise.
70 */
71 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
72 authselect_config_locations_writablecxx . . $ authselect_config_locations_writable(c9857a73d68e59ba).(void);
73
74 /**
75 * Validate existing authselect configuration.
76 *
77 * Check that all files are created, readable and with correct content
78 * and that all symbolic links exist.
79 *
80 * @return True if the configuration is valid, false otherwise.
81 */
82 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
83 authselect_config_validate_authselectcxx . . $ authselect_config_validate_authselect(555288a511009159).(const char *profile_id,
84 const char **features);
85
86 /**
87 * Validate existing non-authselect configuration.
88 *
89 * Check that there are no left overs from previous authselect configuration.
90 * All generated files must be removed and all symbolic links must either not
91 * exists, point to different location or must be other file or directory.
92 *
93 * @return True if the are no left overs, false otherwise.
94 */
95 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
96 authselect_config_validate_usercxx . . $ authselect_config_validate_user(c9857a73d68e59ba).(void);
97
98 /**
99 * Validate missing configuration.
100 *
101 * Check that there is no configuration at all (there are no authselect and
102 * no system files present).
103 *
104 * @return True if there is no configuration, false otherwise.
105 */
106 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
107 authselect_config_validate_missingcxx . . $ authselect_config_validate_missing(c9857a73d68e59ba).(void);
108
109 /**
110 * Generate contents of nsswitch.conf.
111 *
112 * @param template The file template.
113 * @param features List of enabled features.
114 * @param _content Generated content.
115 *
116 * @return EOK on success, other errno code on failure.
117 */
118 errno_tcxx . . $ errno_t#
119 authselect_nsswitch_generatecxx . . $ authselect_nsswitch_generate(bd92be699d7b007a).(const char *template,
120 const char **features,
121 char **_content);
122
123 /**
124 * Find nsswitch maps in generated content.
125 *
126 * @param content Generated content.
127 * @param _maps Maps found in @content.
128 *
129 * @return EOK on success, other errno code on error.
130 */
131 errno_tcxx . . $ errno_t#
132 authselect_nsswitch_find_mapscxx . . $ authselect_nsswitch_find_maps(bd420b23a2195fdd).(char *content,
133 char ***_maps);
134
135 /**
136 * Read system files templates and return them in files structure.
137 *
138 * @param dirname Name of the directory that contains the files.
139 * @param dirfd File descriptor of the opened directory.
140 * @param _templates Output templates.
141 *
142 * @return EOK on success, other errno code on error.
143 */
144 errno_tcxx . . $ errno_t#
145 authselect_system_read_templatescxx . . $ authselect_system_read_templates(427a9196ceaf3f94).(const char *dirname,
146 int dirfd,
147 struct authselect_filescxx . . $ authselect_files# **_templates);
148
149 /**
150 * Generate content of system files based on provided templates.
151 *
152 * @param features Optional features that should be enabled.
153 * @param templates System file templates.
154 * @param _files Generated system files content.
155 *
156 * @return EOK on success, other errno code on failure.
157 */
158 errno_tcxx . . $ errno_t#
159 authselect_system_generatecxx . . $ authselect_system_generate(5b14afb014176dea).(const char **features,
160 struct authselect_filescxx . . $ authselect_files# *templates,
161 struct authselect_filescxx . . $ authselect_files# **_files);
162
163 /**
164 * Write system files.
165 *
166 * @param features Optional features that should be enabled.
167 * @param templates System file templates.
168 * @param _files Generated system files content.
169 *
170 * @return EOK on success, other errno code on failure.
171 */
172 errno_tcxx . . $ errno_t#
173 authselect_system_writecxx . . $ authselect_system_write(36f2feb53451c8f1).(const char **features,
174 struct authselect_filescxx . . $ authselect_files# *templates);
175
176 /**
177 * Validate content of system files that we generate.
178 *
179 * @return True if the files are readable and have expected content, return
180 * false otherwise.
181 */
182 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
183 authselect_system_validatecxx . . $ authselect_system_validate(a73b0e1def25ad2a).(struct authselect_filescxx . . $ authselect_files# *files);
184
185 /**
186 * Validate generated files for non-existing configuration.
187 *
188 * It checks that there are not left overs from previous authselect
189 * configuration, i.e. that all generated files do not exist.
190 *
191 * @return True if all generated files do not exist, false otherwise.
192 */
193 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
194 authselect_system_validate_missingcxx . . $ authselect_system_validate_missing(c9857a73d68e59ba).(void);
195
196 /**
197 * Write symbolic links to system configuration files.
198 *
199 * @return EOK on success, other errno code on failure.
200 */
201 errno_tcxx . . $ errno_t#
202 authselect_symlinks_writecxx . . $ authselect_symlinks_write(b126dc7c1de90089).(void);
203
204 /**
205 * Validate symbolic links that we create.
206 *
207 * @return True if all symbolic links points to their expected destination,
208 * false otherwise.
209 */
210 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
211 authselect_symlinks_validatecxx . . $ authselect_symlinks_validate(c9857a73d68e59ba).(void);
212
213 /**
214 * Validate symbolic links for non-existing configuration.
215 *
216 * It checks that all symbolic links are either regular files or they point
217 * to different destination that we create for authselect or they do not
218 * exist at all.
219 *
220 * @return True if there are not left over symbolic links, false otherwise.
221 */
222 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
223 authselect_symlinks_validate_missingcxx . . $ authselect_symlinks_validate_missing(c9857a73d68e59ba).(void);
224
225 /**
226 * Check if all locations where our symbolic links will be stored
227 * are available. Returns false if any file already exist on these
228 * locations.
229 *
230 * @return True if all locations are empty, false otherwise.
231 */
232 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
233 authselect_symlinks_location_availablecxx . . $ authselect_symlinks_location_available(c9857a73d68e59ba).(void);
234
235 /**
236 * Remove symbolic links generated by authselect by copying authselect files
237 * to their system destination.
238 *
239 * @return EOK on success, other errno code on failure.
240 */
241 errno_tcxx . . $ errno_t#
242 authselect_symlinks_uninstallcxx . . $ authselect_symlinks_uninstall(d1b40a211a1a4e4c).();
243
244 /**
245 * Remove files from authselect directory.
246 */
247 errno_tcxx . . $ errno_t#
248 authselect_files_uninstallcxx . . $ authselect_files_uninstall(b126dc7c1de90089).(void);
249
250
251 /**
252 * List all profile directories in a sorted NULL-terminated string array.
253 *
254 * This will find all profiles within default, vendor and custom profile
255 * directories.
256 *
257 * @param _profiles NULL-terminated sorted string array.
258 *
259 * @return EOK on success, other errno code on failure.
260 */
261 errno_tcxx . . $ errno_t#
262 authselect_profile_listcxx . . $ authselect_profile_list(c293f0ab5a5bee95).(char ***_profiles);
263
264 #endif /* _FILES_H_ */