| 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 | #include <string.h> |
| 22 | #include <stdlib.h> |
| 23 | |
| 24 | #include "authselect.h"cxx . . $ `<file>/include/authselect.h`/ |
| 25 | #include "lib/constants.h"cxx . . $ `<file>/src/lib/constants.h`/ |
| 26 | #include "lib/files/files.h"cxx . . $ `<file>/src/lib/files/files.h`/ |
| 27 | #include "lib/profiles/profiles.h"cxx . . $ `<file>/src/lib/profiles/profiles.h`/ |
| 28 | |
| 29 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! int |
| 30 | authselect_filescxx . . $ authselect_files(879a8b3bb2b9eac1).(const char *profile_id, |
| 31 | const char **features, |
| 32 | struct authselect_filescxx . . $ authselect_files# **_files) |
| 33 | { |
| 34 | struct authselect_profilecxx . . $ authselect_profile# *profile; |
| 35 | struct authselect_filescxx . . $ authselect_files# *files; |
| 36 | errno_tcxx . . $ errno_t# ret; |
| 37 | |
| 38 | ret = authselect_profilecxx . . $ authselect_profile(9cd096d22a496993).(profile_id, &profile); |
| 39 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 40 | return ret; |
| 41 | } |
| 42 | |
| 43 | ret = authselect_system_generatecxx . . $ authselect_system_generate(5b14afb014176dea).(features, profile->filescxx . . $ authselect_profile#files., &files); |
| 44 | authselect_profile_freecxx . . $ authselect_profile_free(56572ca77072da15).(profile); |
| 45 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 46 | return ret; |
| 47 | } |
| 48 | |
| 49 | *_files = files; |
| 50 | |
| 51 | return EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 52 | } |
| 53 | |
| 54 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 55 | authselect_files_nsswitchcxx . . $ authselect_files_nsswitch(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 56 | { |
| 57 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 58 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 59 | } |
| 60 | |
| 61 | return files->nsswitchcxx . . $ authselect_files#nsswitch.; |
| 62 | } |
| 63 | |
| 64 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 65 | authselect_files_systemauthcxx . . $ authselect_files_systemauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 66 | { |
| 67 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 68 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 69 | } |
| 70 | |
| 71 | return files->systemauthcxx . . $ authselect_files#systemauth.; |
| 72 | } |
| 73 | |
| 74 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 75 | authselect_files_passwordauthcxx . . $ authselect_files_passwordauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 76 | { |
| 77 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 78 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 79 | } |
| 80 | |
| 81 | return files->passwordauthcxx . . $ authselect_files#passwordauth.; |
| 82 | } |
| 83 | |
| 84 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 85 | authselect_files_smartcardauthcxx . . $ authselect_files_smartcardauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 86 | { |
| 87 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 88 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 89 | } |
| 90 | |
| 91 | return files->smartcardauthcxx . . $ authselect_files#smartcardauth.; |
| 92 | } |
| 93 | |
| 94 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 95 | authselect_files_fingerprintauthcxx . . $ authselect_files_fingerprintauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 96 | { |
| 97 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 98 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 99 | } |
| 100 | |
| 101 | return files->fingerprintauthcxx . . $ authselect_files#fingerprintauth.; |
| 102 | } |
| 103 | |
| 104 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 105 | authselect_files_switchableauthcxx . . $ authselect_files_switchableauth(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 106 | { |
| 107 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 108 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 109 | } |
| 110 | |
| 111 | return files->switchableauthcxx . . $ authselect_files#switchableauth.; |
| 112 | } |
| 113 | |
| 114 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 115 | authselect_files_postlogincxx . . $ authselect_files_postlogin(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 116 | { |
| 117 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 118 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 119 | } |
| 120 | |
| 121 | return files->postlogincxx . . $ authselect_files#postlogin.; |
| 122 | } |
| 123 | |
| 124 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 125 | authselect_files_dconf_dbcxx . . $ authselect_files_dconf_db(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 126 | { |
| 127 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 128 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 129 | } |
| 130 | |
| 131 | return files->dconfdbcxx . . $ authselect_files#dconfdb.; |
| 132 | } |
| 133 | |
| 134 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! const char * |
| 135 | authselect_files_dconf_lockcxx . . $ authselect_files_dconf_lock(5d1c3e03439491a3).(const struct authselect_filescxx . . $ authselect_files# *files) |
| 136 | { |
| 137 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 138 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 139 | } |
| 140 | |
| 141 | return files->dconflockcxx . . $ authselect_files#dconflock.; |
| 142 | } |
| 143 | |
| 144 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! void |
| 145 | authselect_files_freecxx . . $ authselect_files_free(e1e1e20e9d8c2ec3).(struct authselect_filescxx . . $ authselect_files# *files) |
| 146 | { |
| 147 | if (files == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 148 | return; |
| 149 | } |
| 150 | |
| 151 | if (files->systemauthcxx . . $ authselect_files#systemauth. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 152 | freecxx . . $ free(5d22bdacc48458e8).(files->systemauthcxx . . $ authselect_files#systemauth.); |
| 153 | } |
| 154 | |
| 155 | if (files->passwordauthcxx . . $ authselect_files#passwordauth. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 156 | freecxx . . $ free(5d22bdacc48458e8).(files->passwordauthcxx . . $ authselect_files#passwordauth.); |
| 157 | } |
| 158 | |
| 159 | if (files->smartcardauthcxx . . $ authselect_files#smartcardauth. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 160 | freecxx . . $ free(5d22bdacc48458e8).(files->smartcardauthcxx . . $ authselect_files#smartcardauth.); |
| 161 | } |
| 162 | |
| 163 | if (files->switchableauthcxx . . $ authselect_files#switchableauth. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 164 | freecxx . . $ free(5d22bdacc48458e8).(files->switchableauthcxx . . $ authselect_files#switchableauth.); |
| 165 | } |
| 166 | |
| 167 | if (files->fingerprintauthcxx . . $ authselect_files#fingerprintauth. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 168 | freecxx . . $ free(5d22bdacc48458e8).(files->fingerprintauthcxx . . $ authselect_files#fingerprintauth.); |
| 169 | } |
| 170 | |
| 171 | if (files->postlogincxx . . $ authselect_files#postlogin. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 172 | freecxx . . $ free(5d22bdacc48458e8).(files->postlogincxx . . $ authselect_files#postlogin.); |
| 173 | } |
| 174 | |
| 175 | if (files->nsswitchcxx . . $ authselect_files#nsswitch. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 176 | freecxx . . $ free(5d22bdacc48458e8).(files->nsswitchcxx . . $ authselect_files#nsswitch.); |
| 177 | } |
| 178 | |
| 179 | if (files->dconfdbcxx . . $ authselect_files#dconfdb. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 180 | freecxx . . $ free(5d22bdacc48458e8).(files->dconfdbcxx . . $ authselect_files#dconfdb.); |
| 181 | } |
| 182 | |
| 183 | if (files->dconflockcxx . . $ authselect_files#dconflock. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 184 | freecxx . . $ free(5d22bdacc48458e8).(files->dconflockcxx . . $ authselect_files#dconflock.); |
| 185 | } |
| 186 | |
| 187 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(files, 0, sizeof(struct authselect_filescxx . . $ authselect_files#)); |
| 188 | |
| 189 | freecxx . . $ free(5d22bdacc48458e8).(files); |
| 190 | } |