| 1 | /* |
| 2 | Authors: |
| 3 | Pavel Březina <[email protected]> |
| 4 | |
| 5 | Copyright (C) 2017 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 _AUTHSELECT_H_ |
| 22 | #define _AUTHSELECT_H_cxx . . $ `include/authselect.h:22:9`! |
| 23 | |
| 24 | #include <errno.h> |
| 25 | #include <stdint.h> |
| 26 | #include <stdbool.h> |
| 27 | |
| 28 | /** |
| 29 | * Holds information about profile. See authselect_profile_* functions to |
| 30 | * manipulate this structure. |
| 31 | */ |
| 32 | struct authselect_profilecxx . . $ authselect_profile#; |
| 33 | |
| 34 | /** |
| 35 | * Holds information about managed files. See authselect_files_* functions to |
| 36 | * manipulate this structure. |
| 37 | */ |
| 38 | struct authselect_filescxx . . $ authselect_files#; |
| 39 | |
| 40 | /** |
| 41 | * Authselect profile types. |
| 42 | */ |
| 43 | enum authselect_profile_typecxx . . $ authselect_profile_type# { |
| 44 | AUTHSELECT_PROFILE_DEFAULTcxx . . $ AUTHSELECT_PROFILE_DEFAULT., |
| 45 | AUTHSELECT_PROFILE_VENDORcxx . . $ AUTHSELECT_PROFILE_VENDOR., |
| 46 | AUTHSELECT_PROFILE_CUSTOMcxx . . $ AUTHSELECT_PROFILE_CUSTOM., |
| 47 | AUTHSELECT_PROFILE_ANYcxx . . $ AUTHSELECT_PROFILE_ANY. |
| 48 | }; |
| 49 | |
| 50 | /** |
| 51 | * Activate a profile. |
| 52 | * |
| 53 | * Activate profile file @profile_id. If a change to the system configuration |
| 54 | * not performed by authselect was detected, this operation will fail unless |
| 55 | * @force_override option is provided. |
| 56 | * |
| 57 | * If @force_override option is set to true, authselect will override the |
| 58 | * changes with its own content. |
| 59 | * |
| 60 | * If the selected profile supports optional features, these features |
| 61 | * may be enabled by putting them into @features array. |
| 62 | * |
| 63 | * @param profile_id Profile identifier. |
| 64 | * @param features NULL-terminated array of optional features to enable. |
| 65 | * @param force_override If true, authselect will override local changes. |
| 66 | * |
| 67 | * @return |
| 68 | * - 0 if the profile is successfully activated. |
| 69 | * - EEXIST if the system is already configured by other means than |
| 70 | * authselect and @force_overwrite must be set to true to force |
| 71 | * overwrite the existing files. |
| 72 | * - ENOENT if the profile was not found. |
| 73 | * - EINVAL if unsupported feature was provided. |
| 74 | * - Other errno code on generic error. |
| 75 | */ |
| 76 | int |
| 77 | authselect_activatecxx . . $ authselect_activate(ee6f66a11326c070).(const char *profile_id, |
| 78 | const char **features, |
| 79 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! force_overwrite); |
| 80 | |
| 81 | /** |
| 82 | * Uninstall authselect configuration. |
| 83 | * |
| 84 | * This will copy the files from /etc/authselect to their standard configuration |
| 85 | * and break the symlinks. |
| 86 | * |
| 87 | * @return |
| 88 | * - 0 if the operation was successful |
| 89 | * - Other errno code on generic error. |
| 90 | */ |
| 91 | int |
| 92 | authselect_uninstallcxx . . $ authselect_uninstall(b126dc7c1de90089).(void); |
| 93 | |
| 94 | /** |
| 95 | * Apply any changes to currently selected profile. |
| 96 | * |
| 97 | * Read currently selected profile together with its enabled features |
| 98 | * and regenerate existing configuration. This can be used to apply |
| 99 | * any changes to the profile templates. |
| 100 | * |
| 101 | * @param upgrade Only apply changes if installed profiles have changed. |
| 102 | * |
| 103 | * @return |
| 104 | * - 0 if the profile is successfully updated. |
| 105 | * - EEXIST if the system is already configured by other means than |
| 106 | * authselect. |
| 107 | * - ENOENT if there is no existing authselect configuration. |
| 108 | * - EAGAIN if upgrade is true and no changes are needed. |
| 109 | * - Other errno code on generic error. |
| 110 | */ |
| 111 | int |
| 112 | authselect_apply_changescxx . . $ authselect_apply_changes(73da94e76e6bd037).(boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! upgrade); |
| 113 | |
| 114 | /** |
| 115 | * Backup all system configuration files. |
| 116 | * |
| 117 | * @param name Backup name. If not specified, current time with random |
| 118 | * suffix will be used. |
| 119 | * @param _path Path to the backup directory. |
| 120 | * |
| 121 | * @return EOK on success, other errno code on failure. |
| 122 | */ |
| 123 | int |
| 124 | authselect_backupcxx . . $ authselect_backup(c4dada3283861623).(const char *name, char **_path); |
| 125 | |
| 126 | /** |
| 127 | * List available backups. |
| 128 | * |
| 129 | * @param _names NULL-terminated string array that holds the backup names. |
| 130 | * |
| 131 | * @return EOK on success, other errno code on failure. |
| 132 | */ |
| 133 | char ** |
| 134 | authselect_backup_listcxx . . $ authselect_backup_list(de5739791ae7584).(void); |
| 135 | |
| 136 | /** |
| 137 | * Remove backup. |
| 138 | * |
| 139 | * This will delete the backup configuration files from disk. |
| 140 | * |
| 141 | * @param name Backup name. |
| 142 | * |
| 143 | * @return EOK on success, other errno code on failure. |
| 144 | */ |
| 145 | int |
| 146 | authselect_backup_removecxx . . $ authselect_backup_remove(5c4306d8553b3696).(const char *name); |
| 147 | |
| 148 | /** |
| 149 | * Restore configuration from backup. |
| 150 | * |
| 151 | * This will overwrite current configuration with the old one that is stored |
| 152 | * in the backup directory. |
| 153 | * |
| 154 | * @param name Backup name. |
| 155 | * |
| 156 | * @return EOK on success, other errno code on failure. |
| 157 | */ |
| 158 | int |
| 159 | authselect_backup_restorecxx . . $ authselect_backup_restore(5c4306d8553b3696).(const char *name); |
| 160 | |
| 161 | /** |
| 162 | * Enable a feature with currently activated profile. |
| 163 | * |
| 164 | * @param feature Feature name to activate. |
| 165 | * |
| 166 | * @return |
| 167 | * - 0 if the feature is successfully enabled. |
| 168 | * - ENOENT if there is no existing authselect configuration. |
| 169 | * - Other errno code on generic error. |
| 170 | */ |
| 171 | int |
| 172 | authselect_feature_enablecxx . . $ authselect_feature_enable(5c4306d8553b3696).(const char *feature); |
| 173 | |
| 174 | /** |
| 175 | * Disable a feature with currently activated profile. |
| 176 | * |
| 177 | * @param feature Feature name to activate. |
| 178 | * |
| 179 | * @return |
| 180 | * - 0 if the feature is successfully disabled. |
| 181 | * - ENOENT if there is no existing authselect configuration. |
| 182 | * - Other errno code on generic error. |
| 183 | */ |
| 184 | int |
| 185 | authselect_feature_disablecxx . . $ authselect_feature_disable(5c4306d8553b3696).(const char *feature); |
| 186 | |
| 187 | /** |
| 188 | * Check if a feature is enabled in currently activated profile. |
| 189 | * |
| 190 | * @param feature Feature name to check. |
| 191 | * |
| 192 | * @return |
| 193 | * - 0 if the feature is enabled. |
| 194 | * - ENOENT if it is disabled or there is no existing authselect configuration. |
| 195 | * - Other errno code on generic error. |
| 196 | */ |
| 197 | int |
| 198 | authselect_feature_enabledcxx . . $ authselect_feature_enabled(5c4306d8553b3696).(const char *feature); |
| 199 | |
| 200 | /** |
| 201 | * Check if current configuration is valid. |
| 202 | * |
| 203 | * This will detect any manual changes to current authselect |
| 204 | * configuration and return its result in @_is_valid. |
| 205 | * |
| 206 | * @param _is_valid True if no manual changes were detected, false otherwise. |
| 207 | * |
| 208 | * @return |
| 209 | * - 0 if there is an existing authselect configuration, the result of |
| 210 | * validation is returned in @_is_valid output variable. |
| 211 | * - ENOENT if there is no existing configuration |
| 212 | * - EEXIST if there is existing configuration, not created by authselect, |
| 213 | * the result of validation is returned in @_is_valid output variable. |
| 214 | * - Other errno code on generic error. |
| 215 | */ |
| 216 | int |
| 217 | authselect_validate_configurationcxx . . $ authselect_validate_configuration(4de84dfa0cae09e5).(boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! *_is_valid); |
| 218 | |
| 219 | /** |
| 220 | * Return profile identifier and parameters of currently selected profile. |
| 221 | * |
| 222 | * Free the returned @_features array with authselect_array_free() |
| 223 | * |
| 224 | * @param[out] _profile_id Profile identifier. |
| 225 | * @param[out] _features NULL-terminated array of enabled |
| 226 | * optional features. If NULL, this output parameter |
| 227 | * is ignored. |
| 228 | * |
| 229 | * @return |
| 230 | * - 0 if an configuration was read, current configuration is returned |
| 231 | * in @_profile_id and @_features output variables. |
| 232 | * - ENOENT if there is no existing configuration. |
| 233 | * - Other errno code on generic error. |
| 234 | */ |
| 235 | int |
| 236 | authselect_current_configurationcxx . . $ authselect_current_configuration(2bdaab245118da41).(char **_profile_id, |
| 237 | char ***_features); |
| 238 | |
| 239 | /** |
| 240 | * Return NULL-terminated array of all available profile identifiers. |
| 241 | * |
| 242 | * The array is sorted alphabetically having custom profiles pushed after |
| 243 | * default and vendor specific profiles. |
| 244 | * |
| 245 | * Free the returned array with authselect_array_free() |
| 246 | * |
| 247 | * @return NULL-terminated array containing all available profiles or NULL |
| 248 | * on error. |
| 249 | */ |
| 250 | char ** |
| 251 | authselect_listcxx . . $ authselect_list(6aacb5881005f5e4).(); |
| 252 | |
| 253 | /** |
| 254 | * Return information about a profile. |
| 255 | * |
| 256 | * Free the structure with @authselect_profile_free(). |
| 257 | * |
| 258 | * @param profile_id Profile identifier. |
| 259 | * @param _profile Authselect profile information. |
| 260 | * |
| 261 | * @return |
| 262 | * - 0 if the profile was found and read, profile information |
| 263 | * is returned in @_profile output variable. |
| 264 | * - ENOENT if the profile was not found. |
| 265 | * - Other errno code on generic error. |
| 266 | */ |
| 267 | int |
| 268 | authselect_profilecxx . . $ authselect_profile(9cd096d22a496993).(const char *profile_id, |
| 269 | struct authselect_profilecxx . . $ authselect_profile# **_profile); |
| 270 | |
| 271 | /** |
| 272 | * Get profile identifier. |
| 273 | * |
| 274 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 275 | * |
| 276 | * @return Profile identifier. |
| 277 | */ |
| 278 | const char * |
| 279 | authselect_profile_idcxx . . $ authselect_profile_id(96f23b929ece55c2).(const struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 280 | |
| 281 | /** |
| 282 | * Get profile name. |
| 283 | * |
| 284 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 285 | * |
| 286 | * @return Profile name. |
| 287 | */ |
| 288 | const char * |
| 289 | authselect_profile_namecxx . . $ authselect_profile_name(96f23b929ece55c2).(const struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 290 | |
| 291 | /** |
| 292 | * Full path to the profile file. |
| 293 | * |
| 294 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 295 | * |
| 296 | * @return Profile file path. |
| 297 | */ |
| 298 | const char * |
| 299 | authselect_profile_pathcxx . . $ authselect_profile_path(96f23b929ece55c2).(const struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 300 | |
| 301 | /** |
| 302 | * Get profile description. |
| 303 | * |
| 304 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 305 | * |
| 306 | * @return Profile description or NULL if none is available. |
| 307 | */ |
| 308 | const char * |
| 309 | authselect_profile_descriptioncxx . . $ authselect_profile_description(96f23b929ece55c2).(const struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 310 | |
| 311 | /** |
| 312 | * Get profile requirements for selected features. |
| 313 | * |
| 314 | * It is necessary to free the returned pointer manually. |
| 315 | * |
| 316 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 317 | * @param features NULL-terminated array of optional features to enable. |
| 318 | * |
| 319 | * @return Profile requirements, empty string if there are none requirements |
| 320 | * or NULL in case of an error. |
| 321 | */ |
| 322 | char * |
| 323 | authselect_profile_requirementscxx . . $ authselect_profile_requirements(e64a63f0b99072ff).(const struct authselect_profilecxx . . $ authselect_profile# *profile, |
| 324 | const char **features); |
| 325 | |
| 326 | /** |
| 327 | * Return nsswitch maps set by the profile. |
| 328 | * |
| 329 | * It is necessary to free the returned pointer with @authselect_array_free. |
| 330 | * |
| 331 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 332 | * @param features NULL-terminated array of optional features to enable. |
| 333 | * |
| 334 | * @return Map names, NULL on error. |
| 335 | */ |
| 336 | char ** |
| 337 | authselect_profile_nsswitch_mapscxx . . $ authselect_profile_nsswitch_maps(ba3de4acb81939e8).(const struct authselect_profilecxx . . $ authselect_profile# *profile, |
| 338 | const char **features); |
| 339 | |
| 340 | /** |
| 341 | * List features supported by the profile. |
| 342 | * |
| 343 | * It is necessary to free the returned pointer with @authselect_array_free. |
| 344 | * |
| 345 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 346 | * |
| 347 | * @return NULL-terminated array of supported features, NULL on error. |
| 348 | */ |
| 349 | char ** |
| 350 | authselect_profile_featurescxx . . $ authselect_profile_features(99e33f263369bfd1).(const struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 351 | |
| 352 | /** |
| 353 | * Free authconfig_profile structure obtained by @authselect_profile. |
| 354 | * |
| 355 | * @param profile Pointer to structure obtained by @authselect_profile. |
| 356 | */ |
| 357 | void |
| 358 | authselect_profile_freecxx . . $ authselect_profile_free(56572ca77072da15).(struct authselect_profilecxx . . $ authselect_profile# *profile); |
| 359 | |
| 360 | /** |
| 361 | * Get nsswitch and PAM configuration that would be used if this profile |
| 362 | * would be enabled by @authselect_activate() without performing any |
| 363 | * changes to the system configuration. |
| 364 | * |
| 365 | * Free the files structure with @authselect_files_free(). |
| 366 | * |
| 367 | * @param profile_id Profile identifier. |
| 368 | * @param features NULL-terminated array of optional features to enable. |
| 369 | * @param _files Generated files content. |
| 370 | * |
| 371 | * @return |
| 372 | * - 0 on success, the generated content is returned in @_files output variable. |
| 373 | * - ENOENT if the profile was not found. |
| 374 | * - Other errno code on generic error. |
| 375 | */ |
| 376 | int |
| 377 | authselect_filescxx . . $ authselect_files(879a8b3bb2b9eac1).(const char *profile_id, |
| 378 | const char **features, |
| 379 | struct authselect_filescxx . . $ authselect_files# **_files); |
| 380 | |
| 381 | /** |
| 382 | * Get nsswitch.conf content. |
| 383 | * |
| 384 | * @param files Pointer to structure obtained by @authselect_cat. |
| 385 | * |
| 386 | * @return Generated nsswitch.conf content or NULL if the profile does |
| 387 | * not touch nsswitch.conf. |
| 388 | */ |
| 389 | const char * |
| 390 | authselect_files_nsswitchcxx . . $ authselect_files_nsswitch(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 391 | |
| 392 | /** |
| 393 | * Get system-auth pam stack content. |
| 394 | * |
| 395 | * @param files Pointer to structure obtained by @authselect_cat. |
| 396 | * |
| 397 | * @return Generated system-auth pam stack content or NULL if the profile does |
| 398 | * not touch this stack. |
| 399 | */ |
| 400 | const char * |
| 401 | authselect_files_systemauthcxx . . $ authselect_files_systemauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 402 | |
| 403 | /** |
| 404 | * Get password-auth pam stack content. |
| 405 | * |
| 406 | * @param files Pointer to structure obtained by @authselect_cat. |
| 407 | * |
| 408 | * @return Generated password-auth pam stack content or NULL if the profile does |
| 409 | * not touch this stack. |
| 410 | */ |
| 411 | const char * |
| 412 | authselect_files_passwordauthcxx . . $ authselect_files_passwordauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 413 | |
| 414 | /** |
| 415 | * Get smartcard-auth pam stack content. |
| 416 | * |
| 417 | * @param files Pointer to structure obtained by @authselect_cat. |
| 418 | * |
| 419 | * @return Generated smartcard-auth pam stack content or NULL if the profile |
| 420 | * does not touch this stack. |
| 421 | */ |
| 422 | const char * |
| 423 | authselect_files_smartcardauthcxx . . $ authselect_files_smartcardauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 424 | |
| 425 | /** |
| 426 | * Get fingerprint-auth pam stack content. |
| 427 | * |
| 428 | * @param files Pointer to structure obtained by @authselect_cat. |
| 429 | * |
| 430 | * @return Generated fingerprint-auth pam stack content or NULL if the profile |
| 431 | * does not touch this stack. |
| 432 | */ |
| 433 | const char * |
| 434 | authselect_files_fingerprintauthcxx . . $ authselect_files_fingerprintauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 435 | |
| 436 | /** |
| 437 | * Get switchable-auth pam stack content. |
| 438 | * |
| 439 | * @param files Pointer to structure obtained by @authselect_cat. |
| 440 | * |
| 441 | * @return Generated switchable-auth pam stack content or NULL if the profile does |
| 442 | * not touch this stack. |
| 443 | */ |
| 444 | const char * |
| 445 | authselect_files_switchableauthcxx . . $ authselect_files_switchableauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 446 | |
| 447 | /** |
| 448 | * Get postlogin pam stack content. |
| 449 | * |
| 450 | * @param files Pointer to structure obtained by @authselect_cat. |
| 451 | * |
| 452 | * @return Generated postlogin pam stack content or NULL if the profile |
| 453 | * does not touch this stack. |
| 454 | */ |
| 455 | const char * |
| 456 | authselect_files_postlogincxx . . $ authselect_files_postlogin(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 457 | |
| 458 | /** |
| 459 | * Get dconf database content. |
| 460 | * |
| 461 | * @param files Pointer to structure obtained by @authselect_cat. |
| 462 | * |
| 463 | * @return Generated dconf database content. |
| 464 | */ |
| 465 | const char * |
| 466 | authselect_files_dconf_dbcxx . . $ authselect_files_dconf_db(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 467 | |
| 468 | /** |
| 469 | * Get dconf lock content. |
| 470 | * |
| 471 | * @param files Pointer to structure obtained by @authselect_cat. |
| 472 | * |
| 473 | * @return Generated dconf lockcontent. |
| 474 | */ |
| 475 | const char * |
| 476 | authselect_files_dconf_lockcxx . . $ authselect_files_dconf_lock(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files); |
| 477 | |
| 478 | /** |
| 479 | * Free authconfig_files structure obtained by @authselect_cat. |
| 480 | * |
| 481 | * @param files Pointer to structure obtained by @authselect_cat. |
| 482 | */ |
| 483 | void |
| 484 | authselect_files_freecxx . . $ authselect_files_free(e1e1e20e9d8c2ec3).(struct authselect_filescxx . . $ authselect_files# *files); |
| 485 | |
| 486 | /** |
| 487 | * @return Path to system nsswitch.conf file. |
| 488 | */ |
| 489 | const char * |
| 490 | authselect_path_nsswitchcxx . . $ authselect_path_nsswitch(87c6ae427bbae0f6).(); |
| 491 | |
| 492 | /** |
| 493 | * @return Path to system system-auth pam stack. |
| 494 | */ |
| 495 | const char * |
| 496 | authselect_path_systemauthcxx . . $ authselect_path_systemauth(87c6ae427bbae0f6).(); |
| 497 | |
| 498 | /** |
| 499 | * @return Path to system password-auth pam stack. |
| 500 | */ |
| 501 | const char * |
| 502 | authselect_path_passwordauthcxx . . $ authselect_path_passwordauth(87c6ae427bbae0f6).(); |
| 503 | |
| 504 | /** |
| 505 | * @return Path to system smartcard-auth pam stack. |
| 506 | */ |
| 507 | const char * |
| 508 | authselect_path_smartcardauthcxx . . $ authselect_path_smartcardauth(87c6ae427bbae0f6).(); |
| 509 | |
| 510 | /** |
| 511 | * @return Path to system fingerprint-auth pam stack. |
| 512 | */ |
| 513 | const char * |
| 514 | authselect_path_fingerprintauthcxx . . $ authselect_path_fingerprintauth(87c6ae427bbae0f6).(); |
| 515 | |
| 516 | /** |
| 517 | * @return Path to system switchable-auth pam stack. |
| 518 | */ |
| 519 | const char * |
| 520 | authselect_path_switchableauthcxx . . $ authselect_path_switchableauth(87c6ae427bbae0f6).(); |
| 521 | |
| 522 | /** |
| 523 | * @return Path to system postlogin pam stack. |
| 524 | */ |
| 525 | const char * |
| 526 | authselect_path_postlogincxx . . $ authselect_path_postlogin(87c6ae427bbae0f6).(); |
| 527 | |
| 528 | /** |
| 529 | * @return Path to system dconf database directory. |
| 530 | */ |
| 531 | const char * |
| 532 | authselect_path_dconf_dbcxx . . $ authselect_path_dconf_db(87c6ae427bbae0f6).(); |
| 533 | |
| 534 | /** |
| 535 | * @return Path to system dconf locks directory. |
| 536 | */ |
| 537 | const char * |
| 538 | authselect_path_dconf_lockcxx . . $ authselect_path_dconf_lock(87c6ae427bbae0f6).(); |
| 539 | |
| 540 | /** |
| 541 | * Empty value for initialization. |
| 542 | */ |
| 543 | #define AUTHSELECT_SYMLINK_NONEcxx . . $ `include/authselect.h:543:9`! 0x0000 |
| 544 | |
| 545 | /** |
| 546 | * Create symbolic links for meta files. |
| 547 | */ |
| 548 | #define AUTHSELECT_SYMLINK_METAcxx . . $ `include/authselect.h:548:9`! 0x0001 |
| 549 | |
| 550 | /** |
| 551 | * Create symbolic links for nsswitch.conf. |
| 552 | */ |
| 553 | #define AUTHSELECT_SYMLINK_NSSWITCHcxx . . $ `include/authselect.h:553:9`! 0x0002 |
| 554 | |
| 555 | /** |
| 556 | * Create symbolic links for PAM files. |
| 557 | */ |
| 558 | #define AUTHSELECT_SYMLINK_PAMcxx . . $ `include/authselect.h:558:9`! 0x0004 |
| 559 | |
| 560 | /** |
| 561 | * Create symbolic links for dconf files. |
| 562 | */ |
| 563 | #define AUTHSELECT_SYMLINK_DCONFcxx . . $ `include/authselect.h:563:9`! 0x0008 |
| 564 | |
| 565 | /** |
| 566 | * Create new profile. |
| 567 | * |
| 568 | * Create new profile named @name. Argument @type determines the type of |
| 569 | * newly created profile and can be either AUTHSELECT_PROFILE_VENDOR or |
| 570 | * AUTHSELECT_PROFILE_CUSTOM. Default profiles cannot be created as they |
| 571 | * are only shipped with installation. |
| 572 | * |
| 573 | * New profile can be based on an existing profile @base_id. Argument |
| 574 | * @base_type determines where the base profile is located. If it is |
| 575 | * AUTHSELECT_PROFILE_ANY, standard algorithm is used, that means if |
| 576 | * custom/ prefix is is @base_id it is a custom profile, otherwise |
| 577 | * it is search in vendor and then in default profiles. |
| 578 | * |
| 579 | * When the profile is based on @base_id, files from @base_id are copied |
| 580 | * in the new profile location. Symbolic links can be created instead of |
| 581 | * creating a copy of a file by providing a bit mask consisting of: |
| 582 | * - AUTHSELECT_SYMLINK_META |
| 583 | * - AUTHSELECT_SYMLINK_NSSWITCH |
| 584 | * - AUTHSELECT_SYMLINK_PAM |
| 585 | * - AUTHSELECT_SYMLINK_DCONF |
| 586 | * |
| 587 | * Alternatively, specific files that should be symlinked can be specified |
| 588 | * with @symlinks array. |
| 589 | * |
| 590 | * @param name New profile name. |
| 591 | * @param type New profile type. |
| 592 | * @param base_id Base profile ID. |
| 593 | * @param base_type Base profile type. |
| 594 | * @param symlink_flags Symbolic links bit mask. |
| 595 | * @param symlinks Array of files that should be symlinked. |
| 596 | * @param _path Path to the new profile directory. |
| 597 | * |
| 598 | * @return |
| 599 | * - 0 if the profile is successfully created. |
| 600 | * - EEXIST if the profile already exists. |
| 601 | * - ENOENT if the base profile is not found. |
| 602 | * - Other errno code on generic error. |
| 603 | */ |
| 604 | int |
| 605 | authselect_profile_createcxx . . $ authselect_profile_create(4f52199d544410a4).(const char *name, |
| 606 | enum authselect_profile_typecxx . . $ authselect_profile_type# type, |
| 607 | const char *base_id, |
| 608 | enum authselect_profile_typecxx . . $ authselect_profile_type# base_type, |
| 609 | uint32_tcxx . . $ uint32_t# symlink_flags, |
| 610 | const char **symlinks, |
| 611 | char **_path); |
| 612 | |
| 613 | /** |
| 614 | * Free NULL-terminated string array. |
| 615 | */ |
| 616 | void |
| 617 | authselect_array_freecxx . . $ authselect_array_free(3ed91490e421178f).(char **array); |
| 618 | |
| 619 | enum authselect_debugcxx . . $ authselect_debug# { |
| 620 | AUTHSELECT_INFOcxx . . $ AUTHSELECT_INFO., |
| 621 | AUTHSELECT_WARNINGcxx . . $ AUTHSELECT_WARNING., |
| 622 | AUTHSELECT_ERRORcxx . . $ AUTHSELECT_ERROR. |
| 623 | }; |
| 624 | |
| 625 | /* Function to log authselect events. |
| 626 | * |
| 627 | * @param pvt Private data passed to the function. |
| 628 | * @param level Debug level. |
| 629 | * @param function Internal library function name. |
| 630 | * @param msg Debug message |
| 631 | * |
| 632 | * @see authselect_set_debug_fn |
| 633 | */ |
| 634 | typedef void (*authselect_debug_fncxx . . $ authselect_debug_fn#)(void *pvt, |
| 635 | enum authselect_debugcxx . . $ authselect_debug# level, |
| 636 | const char *file, |
| 637 | unsigned long line, |
| 638 | const char *function, |
| 639 | const char *msg); |
| 640 | |
| 641 | /* Set authselect debug function. |
| 642 | * |
| 643 | * Only one function can be set at a time. Use NULL to disable debug messages. |
| 644 | * |
| 645 | * @param fn Function to be called on internal events. |
| 646 | * @param pvt Caller private data passed to the function. |
| 647 | */ |
| 648 | void authselect_set_debug_fncxx . . $ authselect_set_debug_fn(10083e02f417e2d6).(authselect_debug_fncxx . . $ authselect_debug_fn# fn, void *pvt); |
| 649 | |
| 650 | #endif /* _AUTHSELECT_H_ */ |