| 1 | /* |
| 2 | Authors: |
| 3 | Pavel Březina <[email protected]> |
| 4 | |
| 5 | Copyright (C) 2019 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 <time.h> |
| 22 | #include <errno.h> |
| 23 | #include <string.h> |
| 24 | #include <stdlib.h> |
| 25 | |
| 26 | #include "authselect.h"cxx . . $ `<file>/include/authselect.h`/ |
| 27 | #include "common/common.h"cxx . . $ `<file>/src/common/common.h`/ |
| 28 | #include "lib/constants.h"cxx . . $ `<file>/src/lib/constants.h`/ |
| 29 | #include "lib/util/util.h"cxx . . $ `<file>/src/lib/util/util.h`/ |
| 30 | #include "lib/files/files.h"cxx . . $ `<file>/src/lib/files/files.h`/ |
| 31 | #include "lib/profiles/profiles.h"cxx . . $ `<file>/src/lib/profiles/profiles.h`/ |
| 32 | |
| 33 | static errno_tcxx . . $ errno_t# |
| 34 | authselect_backup_create_namedcxx . . $ authselect_backup_create_named(c4dada3283861623).(const char *name, |
| 35 | char **_path) |
| 36 | { |
| 37 | char *path; |
| 38 | errno_tcxx . . $ errno_t# ret; |
| 39 | |
| 40 | path = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, name); |
| 41 | if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 42 | return ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 43 | } |
| 44 | |
| 45 | ret = file_make_pathcxx . . $ file_make_path(1df18506ef0a631b).(path, AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!); |
| 46 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 47 | freecxx . . $ free(5d22bdacc48458e8).(path); |
| 48 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to create backup directory [%s/%s] [%d]: %s", |
| 49 | AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, name, ret, strerror(ret)); |
| 50 | return ret; |
| 51 | } |
| 52 | |
| 53 | *_path = path; |
| 54 | |
| 55 | return EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 56 | } |
| 57 | |
| 58 | static errno_tcxx . . $ errno_t# |
| 59 | authselect_backup_create_anonymouscxx . . $ authselect_backup_create_anonymous(b90f8021b121110e).(char **_path) |
| 60 | { |
| 61 | struct tmcxx . . $ tm# *gmtime_ret; |
| 62 | struct tmcxx . . $ tm# tm; |
| 63 | char date[255]; |
| 64 | char *path; |
| 65 | time_tcxx . . $ time_t# now; |
| 66 | size_t n; |
| 67 | errno_tcxx . . $ errno_t# ret; |
| 68 | |
| 69 | ret = file_make_pathcxx . . $ file_make_path(1df18506ef0a631b).(AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!); |
| 70 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 71 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to create backup directory [%s] [%d]: %s", |
| 72 | AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, ret, strerror(ret)); |
| 73 | return ret; |
| 74 | } |
| 75 | |
| 76 | now = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 77 | gmtime_ret = gmtime_rcxx . . $ gmtime_r(92e3d173686db852).(&now, &tm); |
| 78 | if (gmtime_ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 79 | return EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 80 | } |
| 81 | |
| 82 | n = strftimecxx . . $ strftime(98e75925167c4f1b).(date, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); |
| 83 | if (n == 0) { |
| 84 | return EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 85 | } |
| 86 | |
| 87 | path = formatcxx . . $ format(a849077ff1b8d812).("%s/%s.XXXXXX", AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, date); |
| 88 | if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 89 | return ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 90 | } |
| 91 | |
| 92 | INFOcxx . . $ `src/common/common.h:63:9`!("Creating temporary directory at [%s]", path); |
| 93 | if (mkdtempcxx . . $ mkdtemp(7a9722d75b371431).(path) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 94 | ret = errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!; |
| 95 | freecxx . . $ free(5d22bdacc48458e8).(path); |
| 96 | return ret; |
| 97 | } |
| 98 | |
| 99 | *_path = path; |
| 100 | |
| 101 | return EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 102 | } |
| 103 | |
| 104 | static errno_tcxx . . $ errno_t# |
| 105 | authselect_backup_createcxx . . $ authselect_backup_create(c4dada3283861623).(const char *name, char **_path) |
| 106 | { |
| 107 | if (name != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && name[0] != '\0') { |
| 108 | return authselect_backup_create_namedcxx . . $ authselect_backup_create_named(c4dada3283861623).(name, _path); |
| 109 | } |
| 110 | |
| 111 | return authselect_backup_create_anonymouscxx . . $ authselect_backup_create_anonymous(b90f8021b121110e).(_path); |
| 112 | } |
| 113 | |
| 114 | static errno_tcxx . . $ errno_t# |
| 115 | authselect_backup_system_configurationcxx . . $ authselect_backup_system_configuration(5c4306d8553b3696).(const char *path) |
| 116 | { |
| 117 | struct authselect_symlinkcxx . . $ authselect_symlink# files[] = {SYMLINK_FILEScxx . . $ `src/lib/paths.h:140:9`!}; |
| 118 | const char *filename; |
| 119 | errno_tcxx . . $ errno_t# ret; |
| 120 | int i; |
| 121 | |
| 122 | for (i = 0; files[i].namecxx . . $ authselect_symlink#name. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; i++) { |
| 123 | filename = file_get_basenamecxx . . $ file_get_basename(fb58d2e09a2a1ce6).(files[i].destcxx . . $ authselect_symlink#dest.); |
| 124 | if (filename == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 125 | ERRORcxx . . $ `src/common/common.h:71:9`!("There is no filename in [%s]", files[i].dest); |
| 126 | return EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 127 | } |
| 128 | |
| 129 | INFOcxx . . $ `src/common/common.h:63:9`!("Copying [%s] to [%s/%s]", files[i].name, path, filename); |
| 130 | ret = selinux_file_copycxx . . $ selinux_file_copy(f8e1a36fd0133965).(files[i].namecxx . . $ authselect_symlink#name., path, filename, |
| 131 | AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!); |
| 132 | if (ret == ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!) { |
| 133 | WARNcxx . . $ `src/common/common.h:67:9`!("File [%s] does not exist", files[i].name); |
| 134 | } else if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 135 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to copy [%s] to [%s/%s] [%d]: %s", files[i].name, |
| 136 | path, filename, ret, strerror(ret)); |
| 137 | return ret; |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | return EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 142 | } |
| 143 | |
| 144 | static errno_tcxx . . $ errno_t# |
| 145 | authselect_backup_authselect_configurationcxx . . $ authselect_backup_authselect_configuration(5c4306d8553b3696).(const char *path) |
| 146 | { |
| 147 | errno_tcxx . . $ errno_t# ret; |
| 148 | |
| 149 | ret = selinux_file_copycxx . . $ selinux_file_copy(f8e1a36fd0133965).(PATH_CONFIG_FILEcxx . . $ `src/lib/paths.h:28:9`!, path, FILE_CONFIGcxx . . $ `src/lib/paths.h:27:9`!, |
| 150 | AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!); |
| 151 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 152 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to copy [%s] to [%s/%s] [%d]: %s", PATH_CONFIG_FILEcxx . . $ `src/lib/paths.h:28:9`!, |
| 153 | path, FILE_CONFIGcxx . . $ `src/lib/paths.h:27:9`!, ret, strerror(ret)); |
| 154 | return ret; |
| 155 | } |
| 156 | |
| 157 | return authselect_backup_system_configurationcxx . . $ authselect_backup_system_configuration(5c4306d8553b3696).(path); |
| 158 | } |
| 159 | |
| 160 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! int |
| 161 | authselect_backupcxx . . $ authselect_backup(c4dada3283861623).(const char *name, char **_path) |
| 162 | { |
| 163 | char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 164 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_valid; |
| 165 | errno_tcxx . . $ errno_t# ret; |
| 166 | |
| 167 | ret = authselect_backup_createcxx . . $ authselect_backup_create(c4dada3283861623).(name, &path); |
| 168 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 169 | goto done; |
| 170 | } |
| 171 | |
| 172 | ret = authselect_validate_configurationcxx . . $ authselect_validate_configuration(4de84dfa0cae09e5).(&is_valid); |
| 173 | if (ret == EOKcxx . . $ `src/common/errno_t.h:34:9`! && is_valid) { |
| 174 | /* Valid authselect configuration. */ |
| 175 | INFOcxx . . $ `src/common/common.h:63:9`!("Trying to backup authselect configuration to [%s]", path); |
| 176 | ret = authselect_backup_authselect_configurationcxx . . $ authselect_backup_authselect_configuration(5c4306d8553b3696).(path); |
| 177 | goto done; |
| 178 | } |
| 179 | |
| 180 | INFOcxx . . $ `src/common/common.h:63:9`!("Trying to backup system configuration to [%s]", path); |
| 181 | ret = authselect_backup_system_configurationcxx . . $ authselect_backup_system_configuration(5c4306d8553b3696).(path); |
| 182 | |
| 183 | done: |
| 184 | if (ret == EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 185 | INFOcxx . . $ `src/common/common.h:63:9`!("Backup was successfully created at [%s]", path); |
| 186 | *_path = path; |
| 187 | ret = EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 188 | } else if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 189 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to create backup [%d]: %s", ret, strerror(ret)); |
| 190 | freecxx . . $ free(5d22bdacc48458e8).(path); |
| 191 | } |
| 192 | |
| 193 | return ret; |
| 194 | } |
| 195 | |
| 196 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! char ** |
| 197 | authselect_backup_listcxx . . $ authselect_backup_list(de5739791ae7584).(void) |
| 198 | { |
| 199 | char **names; |
| 200 | errno_tcxx . . $ errno_t# ret; |
| 201 | |
| 202 | ret = dir_listcxx . . $ dir_list(3003b1af897cb540).(AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, |
| 203 | DIR_LIST_DIRScxx . . $ `src/lib/util/dir.h:30:9`! | DIR_LIST_SORT_BY_CTIMEcxx . . $ `src/lib/util/dir.h:36:9`!, |
| 204 | &names, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 205 | if (ret == ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!) { |
| 206 | INFOcxx . . $ `src/common/common.h:63:9`!(AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`! " does not exist."); |
| 207 | return string_array_createcxx . . $ string_array_create(4d3fbc76ec7ad0ba).(0); |
| 208 | } else if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 209 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to list directory [%s] [%d]: %s", |
| 210 | AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, ret, strerror(ret)); |
| 211 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 212 | } |
| 213 | |
| 214 | return names; |
| 215 | } |
| 216 | |
| 217 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! int |
| 218 | authselect_backup_removecxx . . $ authselect_backup_remove(5c4306d8553b3696).(const char *name) |
| 219 | { |
| 220 | char *path; |
| 221 | errno_tcxx . . $ errno_t# ret; |
| 222 | |
| 223 | INFOcxx . . $ `src/common/common.h:63:9`!("Removing backup [%s]", name); |
| 224 | |
| 225 | path = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, name); |
| 226 | if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 227 | return ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 228 | } |
| 229 | |
| 230 | ret = dir_removecxx . . $ dir_remove(5c4306d8553b3696).(path); |
| 231 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 232 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to delete directory [%s] [%d]: %s", |
| 233 | path, ret, strerror(ret)); |
| 234 | } |
| 235 | |
| 236 | return ret; |
| 237 | } |
| 238 | |
| 239 | static errno_tcxx . . $ errno_t# |
| 240 | authselect_restore_system_configurationcxx . . $ authselect_restore_system_configuration(5c4306d8553b3696).(const char *path) |
| 241 | { |
| 242 | struct selinux_safe_copycxx . . $ selinux_safe_copy# table[] = { |
| 243 | {FILE_CONFIGcxx . . $ `src/lib/paths.h:27:9`!, PATH_CONFIG_FILEcxx . . $ `src/lib/paths.h:28:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 244 | {FILE_SYSTEMcxx . . $ `src/lib/paths.h:37:9`!, PATH_SYMLINK_SYSTEMcxx . . $ `src/lib/paths.h:59:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 245 | {FILE_PASSWORDcxx . . $ `src/lib/paths.h:38:9`!, PATH_SYMLINK_PASSWORDcxx . . $ `src/lib/paths.h:60:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 246 | {FILE_FINGERPRINTcxx . . $ `src/lib/paths.h:39:9`!, PATH_SYMLINK_FINGERPRINTcxx . . $ `src/lib/paths.h:61:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 247 | {FILE_SMARTCARDcxx . . $ `src/lib/paths.h:40:9`!, PATH_SYMLINK_SMARTCARDcxx . . $ `src/lib/paths.h:62:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 248 | {FILE_SWITCHABLEcxx . . $ `src/lib/paths.h:41:9`!, PATH_SYMLINK_SWITCHABLEcxx . . $ `src/lib/paths.h:63:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 249 | {FILE_POSTLOGINcxx . . $ `src/lib/paths.h:42:9`!, PATH_SYMLINK_POSTLOGINcxx . . $ `src/lib/paths.h:64:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 250 | {FILE_NSSWITCHcxx . . $ `src/lib/paths.h:43:9`!, PATH_SYMLINK_NSSWITCHcxx . . $ `src/lib/paths.h:65:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 251 | {FILE_DCONF_DBcxx . . $ `src/lib/paths.h:44:9`!, PATH_SYMLINK_DCONF_DBcxx . . $ `src/lib/paths.h:66:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 252 | {FILE_DCONF_LOCKcxx . . $ `src/lib/paths.h:45:9`!, PATH_SYMLINK_DCONF_LOCKcxx . . $ `src/lib/paths.h:67:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 253 | {NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 254 | }; |
| 255 | errno_tcxx . . $ errno_t# ret; |
| 256 | int i; |
| 257 | |
| 258 | for (i = 0; table[i].sourcecxx . . $ selinux_safe_copy#source. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; i++) { |
| 259 | table[i].sourcecxx . . $ selinux_safe_copy#source. = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", path, table[i].sourcecxx . . $ selinux_safe_copy#source.); |
| 260 | if (table[i].sourcecxx . . $ selinux_safe_copy#source. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 261 | ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 262 | goto done; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | ret = selinux_copy_files_safelycxx . . $ selinux_copy_files_safely(58cfd31e237da923).(table, AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 267 | |
| 268 | done: |
| 269 | /* In case of an error in formatting the source file, it will be NULL |
| 270 | * and the iteration will stop before we free the static data. */ |
| 271 | for (i = 0; table[i].sourcecxx . . $ selinux_safe_copy#source. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; i++) { |
| 272 | freecxx . . $ free(5d22bdacc48458e8).((char*)table[i].sourcecxx . . $ selinux_safe_copy#source.); |
| 273 | } |
| 274 | |
| 275 | return ret; |
| 276 | } |
| 277 | |
| 278 | static errno_tcxx . . $ errno_t# |
| 279 | authselect_restore_authselect_configurationcxx . . $ authselect_restore_authselect_configuration(5c4306d8553b3696).(const char *path) |
| 280 | { |
| 281 | struct selinux_safe_copycxx . . $ selinux_safe_copy# table[] = { |
| 282 | {FILE_CONFIGcxx . . $ `src/lib/paths.h:27:9`!, PATH_CONFIG_FILEcxx . . $ `src/lib/paths.h:28:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 283 | {FILE_SYSTEMcxx . . $ `src/lib/paths.h:37:9`!, PATH_SYSTEMcxx . . $ `src/lib/paths.h:48:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 284 | {FILE_PASSWORDcxx . . $ `src/lib/paths.h:38:9`!, PATH_PASSWORDcxx . . $ `src/lib/paths.h:49:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 285 | {FILE_FINGERPRINTcxx . . $ `src/lib/paths.h:39:9`!, PATH_FINGERPRINTcxx . . $ `src/lib/paths.h:50:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 286 | {FILE_SMARTCARDcxx . . $ `src/lib/paths.h:40:9`!, PATH_SMARTCARDcxx . . $ `src/lib/paths.h:51:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 287 | {FILE_SWITCHABLEcxx . . $ `src/lib/paths.h:41:9`!, PATH_SWITCHABLEcxx . . $ `src/lib/paths.h:52:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!}, |
| 288 | {FILE_POSTLOGINcxx . . $ `src/lib/paths.h:42:9`!, PATH_POSTLOGINcxx . . $ `src/lib/paths.h:53:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 289 | {FILE_NSSWITCHcxx . . $ `src/lib/paths.h:43:9`!, PATH_NSSWITCHcxx . . $ `src/lib/paths.h:54:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 290 | {FILE_DCONF_DBcxx . . $ `src/lib/paths.h:44:9`!, PATH_DCONF_DBcxx . . $ `src/lib/paths.h:55:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 291 | {FILE_DCONF_LOCKcxx . . $ `src/lib/paths.h:45:9`!, PATH_DCONF_LOCKcxx . . $ `src/lib/paths.h:56:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 292 | {NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!}, |
| 293 | }; |
| 294 | errno_tcxx . . $ errno_t# ret; |
| 295 | int i; |
| 296 | |
| 297 | for (i = 0; table[i].sourcecxx . . $ selinux_safe_copy#source. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; i++) { |
| 298 | table[i].sourcecxx . . $ selinux_safe_copy#source. = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", path, table[i].sourcecxx . . $ selinux_safe_copy#source.); |
| 299 | if (table[i].sourcecxx . . $ selinux_safe_copy#source. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 300 | ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 301 | goto done; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | ret = selinux_copy_files_safelycxx . . $ selinux_copy_files_safely(58cfd31e237da923).(table, AUTHSELECT_DIR_MODEcxx . . $ `src/lib/constants.h:29:9`!, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 306 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 307 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to copy files [%d]: %s", ret, strerror(ret)); |
| 308 | goto done; |
| 309 | } |
| 310 | |
| 311 | ret = authselect_symlinks_writecxx . . $ authselect_symlinks_write(b126dc7c1de90089).(); |
| 312 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 313 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to create symbolic links [%d]: %s", ret, strerror(ret)); |
| 314 | goto done; |
| 315 | } |
| 316 | |
| 317 | ret = authselect_profile_dconf_updatecxx . . $ authselect_profile_dconf_update(b126dc7c1de90089).(); |
| 318 | if (ret == ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!) { |
| 319 | INFOcxx . . $ `src/common/common.h:63:9`!("Dconf is not installed on your system"); |
| 320 | } else if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 321 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to update dconf database [%d]: %s", ret, strerror(ret)); |
| 322 | goto done; |
| 323 | } |
| 324 | |
| 325 | ret = EOKcxx . . $ `src/common/errno_t.h:34:9`!; |
| 326 | |
| 327 | done: |
| 328 | /* In case of an error in formatting the source file, it will be NULL |
| 329 | * and the iteration will stop before we free the static data. */ |
| 330 | for (i = 0; table[i].sourcecxx . . $ selinux_safe_copy#source. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; i++) { |
| 331 | freecxx . . $ free(5d22bdacc48458e8).((char*)table[i].sourcecxx . . $ selinux_safe_copy#source.); |
| 332 | } |
| 333 | |
| 334 | return ret; |
| 335 | } |
| 336 | |
| 337 | _PUBLIC_cxx . . $ `src/lib/constants.h:27:9`! int |
| 338 | authselect_backup_restorecxx . . $ authselect_backup_restore(5c4306d8553b3696).(const char *name) |
| 339 | { |
| 340 | char *confpath = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 341 | char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 342 | errno_tcxx . . $ errno_t# ret; |
| 343 | |
| 344 | INFOcxx . . $ `src/common/common.h:63:9`!("Restoring configuration from backup [%s]", name); |
| 345 | |
| 346 | path = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", AUTHSELECT_BACKUP_DIRcxx . . $ `<built-in>:420:9`!, name); |
| 347 | if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 348 | ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 349 | goto done; |
| 350 | } |
| 351 | |
| 352 | confpath = formatcxx . . $ format(a849077ff1b8d812).("%s/%s", path, FILE_CONFIGcxx . . $ `src/lib/paths.h:27:9`!); |
| 353 | if (confpath == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 354 | ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 355 | goto done; |
| 356 | } |
| 357 | |
| 358 | ret = file_existscxx . . $ file_exists(5c4306d8553b3696).(confpath); |
| 359 | if (ret == EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 360 | INFOcxx . . $ `src/common/common.h:63:9`!("Backup [%s] contains authselect configuration", name); |
| 361 | ret = authselect_restore_authselect_configurationcxx . . $ authselect_restore_authselect_configuration(5c4306d8553b3696).(path); |
| 362 | } else if (ret == ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!) { |
| 363 | INFOcxx . . $ `src/common/common.h:63:9`!("Backup [%s] contains non-authselect configuration", name); |
| 364 | ret = authselect_restore_system_configurationcxx . . $ authselect_restore_system_configuration(5c4306d8553b3696).(path); |
| 365 | } |
| 366 | |
| 367 | done: |
| 368 | if (ret != EOKcxx . . $ `src/common/errno_t.h:34:9`!) { |
| 369 | ERRORcxx . . $ `src/common/common.h:71:9`!("Unable to restore [%s] [%d]: %s", name, ret, strerror(ret)); |
| 370 | } |
| 371 | |
| 372 | freecxx . . $ free(5d22bdacc48458e8).(confpath); |
| 373 | freecxx . . $ free(5d22bdacc48458e8).(path); |
| 374 | |
| 375 | return ret; |
| 376 | } |