| 1 | /* |
| 2 | * Copyright © 2016 Red Hat, Inc |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * Authors: |
| 20 | * Alexander Larsson <[email protected]> |
| 21 | * Matthias Clasen <[email protected]> |
| 22 | */ |
| 23 | |
| 24 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 25 | |
| 26 | #include "xdp-documents.h"cxx . . $ `<file>/src/xdp-documents.h`/ |
| 27 | |
| 28 | #include <errno.h> |
| 29 | #include <fcntl.h> |
| 30 | #include <sys/stat.h> |
| 31 | #include <sys/types.h> |
| 32 | |
| 33 | #include <gio/gio.h> |
| 34 | #include <gio/gunixfdlist.h> |
| 35 | |
| 36 | #include "document-enums.h"cxx . . $ `<file>/document-portal/document-enums.h`/ |
| 37 | #include "xdp-app-info.h"cxx . . $ `<file>/src/xdp-app-info.h`/ |
| 38 | #include "xdp-dbus.h"cxx . . $ `<file>/build/src/xdp-dbus.h`/ |
| 39 | #include "xdp-utils.h"cxx . . $ `<file>/src/xdp-utils.h`/ |
| 40 | |
| 41 | #define DOCUMENT_PORTAL_DBUS_NAMEcxx . . $ `src/xdp-documents.c:41:9`! "org.freedesktop.portal.Documents" |
| 42 | #define DOCUMENT_PORTAL_DBUS_PATHcxx . . $ `src/xdp-documents.c:42:9`! "/org/freedesktop/portal/documents" |
| 43 | |
| 44 | static XdpDbusDocumentscxx . . $ XdpDbusDocuments# *documentscxx . . $ documents. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 45 | static char *documents_mountpointcxx . . $ documents_mountpoint. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 46 | |
| 47 | gbooleancxx . . $ gboolean# |
| 48 | xdp_init_document_proxycxx . . $ xdp_init_document_proxy(3bd67427cbb778d0). (GDBusConnectioncxx . . $ GDBusConnection# *connection, |
| 49 | GErrorcxx . . $ GError# **error) |
| 50 | { |
| 51 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) local_error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 52 | |
| 53 | documentscxx . . $ documents. = xdp_dbus_documents_proxy_new_synccxx . . $ xdp_dbus_documents_proxy_new_sync(7b6d35bd44bd25b8). (connection, 0, |
| 54 | DOCUMENT_PORTAL_DBUS_NAMEcxx . . $ `src/xdp-documents.c:41:9`!, |
| 55 | DOCUMENT_PORTAL_DBUS_PATHcxx . . $ `src/xdp-documents.c:42:9`!, |
| 56 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error); |
| 57 | if (!documentscxx . . $ documents.) |
| 58 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 59 | |
| 60 | if (!xdp_dbus_documents_call_get_mount_point_synccxx . . $ xdp_dbus_documents_call_get_mount_point_sync(f924b110f5021ce2). (documentscxx . . $ documents., |
| 61 | &documents_mountpointcxx . . $ documents_mountpoint., |
| 62 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &local_error)) |
| 63 | { |
| 64 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Document portal fuse mount point unknown: %s", |
| 65 | local_error->message); |
| 66 | } |
| 67 | |
| 68 | xdp_set_documents_mountpointcxx . . $ xdp_set_documents_mountpoint(85c52e162fed56f9). (documents_mountpointcxx . . $ documents_mountpoint.); |
| 69 | |
| 70 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 71 | } |
| 72 | |
| 73 | char * |
| 74 | xdp_register_documentcxx . . $ xdp_register_document(e16c043bff209580). (const char *uri, |
| 75 | const char *app_id, |
| 76 | XdpDocumentFlagscxx . . $ XdpDocumentFlags# flags, |
| 77 | GErrorcxx . . $ GError# **error) |
| 78 | { |
| 79 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *doc_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 80 | g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GStrv) doc_ids = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 81 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 82 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *basename = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 83 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *dirname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 84 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GUnixFDList) fd_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 85 | int fd, fd_in; |
| 86 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GFile) file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 87 | gbooleancxx . . $ gboolean# ret = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 88 | const char *permissions[5]; |
| 89 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *doc_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 90 | int i; |
| 91 | int version; |
| 92 | gbooleancxx . . $ gboolean# handled_permissions = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 93 | DocumentAddFullFlagscxx . . $ DocumentAddFullFlags# full_flags; |
| 94 | |
| 95 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (app_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && *app_id != '\0', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 96 | |
| 97 | file = g_file_new_for_uricxx . . $ g_file_new_for_uri(ba1fd5950b7d7bd5). (uri); |
| 98 | path = g_file_get_pathcxx . . $ g_file_get_path(bd69fa69840f32a9). (file); |
| 99 | if (path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 100 | { |
| 101 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, G_IO_ERROR_NOT_SUPPORTEDcxx . . $ G_IO_ERROR_NOT_SUPPORTED., |
| 102 | "URI %s not supported by the document portal", uri); |
| 103 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 104 | } |
| 105 | basename = g_path_get_basenamecxx . . $ g_path_get_basename(a8b8e32347182212). (path); |
| 106 | dirname = g_path_get_dirnamecxx . . $ g_path_get_dirname(a8b8e32347182212). (path); |
| 107 | |
| 108 | if (flags & XDP_DOCUMENT_FLAG_FOR_SAVEcxx . . $ XDP_DOCUMENT_FLAG_FOR_SAVE.) |
| 109 | fd = opencxx . . $ open(e156e3aa1e5c4ad1). (dirname, O_CLOEXECcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:142:10`!); |
| 110 | else |
| 111 | fd = opencxx . . $ open(e156e3aa1e5c4ad1). (path, O_CLOEXECcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:142:10`!); |
| 112 | |
| 113 | if (fd == -1) |
| 114 | { |
| 115 | g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, g_io_error_from_errnocxx . . $ g_io_error_from_errno(b47e8a466716fd56). (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!), |
| 116 | "Failed to open %s", uri); |
| 117 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 118 | } |
| 119 | fd_list = g_unix_fd_list_newcxx . . $ g_unix_fd_list_new(2f03ba904a9d4e55). (); |
| 120 | fd_in = g_unix_fd_list_appendcxx . . $ g_unix_fd_list_append(57b895fb290201ec). (fd_list, fd, error); |
| 121 | closecxx . . $ close(7864480464b09eea). (fd); |
| 122 | |
| 123 | if (fd_in == -1) |
| 124 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 125 | |
| 126 | i = 0; |
| 127 | permissions[i++] = "read"; |
| 128 | if ((flags & XDP_DOCUMENT_FLAG_WRITABLEcxx . . $ XDP_DOCUMENT_FLAG_WRITABLE.) || (flags & XDP_DOCUMENT_FLAG_FOR_SAVEcxx . . $ XDP_DOCUMENT_FLAG_FOR_SAVE.)) |
| 129 | permissions[i++] = "write"; |
| 130 | permissions[i++] = "grant-permissions"; |
| 131 | if (flags & XDP_DOCUMENT_FLAG_DELETABLEcxx . . $ XDP_DOCUMENT_FLAG_DELETABLE.) |
| 132 | permissions[i++] = "delete"; |
| 133 | permissions[i++] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 134 | |
| 135 | version = xdp_dbus_documents_get_versioncxx . . $ xdp_dbus_documents_get_version(b3c34875a46a66a4). (documentscxx . . $ documents.); |
| 136 | full_flags = DOCUMENT_ADD_FLAGS_REUSE_EXISTINGcxx . . $ DOCUMENT_ADD_FLAGS_REUSE_EXISTING. | DOCUMENT_ADD_FLAGS_PERSISTENTcxx . . $ DOCUMENT_ADD_FLAGS_PERSISTENT. | DOCUMENT_ADD_FLAGS_AS_NEEDED_BY_APPcxx . . $ DOCUMENT_ADD_FLAGS_AS_NEEDED_BY_APP.; |
| 137 | if (flags & XDP_DOCUMENT_FLAG_DIRECTORYcxx . . $ XDP_DOCUMENT_FLAG_DIRECTORY.) |
| 138 | full_flags |= DOCUMENT_ADD_FLAGS_DIRECTORYcxx . . $ DOCUMENT_ADD_FLAGS_DIRECTORY.; |
| 139 | |
| 140 | if (flags & XDP_DOCUMENT_FLAG_FOR_SAVEcxx . . $ XDP_DOCUMENT_FLAG_FOR_SAVE.) |
| 141 | { |
| 142 | if (version >= 3) |
| 143 | { |
| 144 | ret = xdp_dbus_documents_call_add_named_full_synccxx . . $ xdp_dbus_documents_call_add_named_full_sync(be8984d86830bf56). (documentscxx . . $ documents., |
| 145 | g_variant_new_handlecxx . . $ g_variant_new_handle(d662e1c280be90d3). (fd_in), |
| 146 | basename, |
| 147 | full_flags, |
| 148 | app_id, |
| 149 | permissions, |
| 150 | fd_list, |
| 151 | &doc_id, |
| 152 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 153 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 154 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 155 | error); |
| 156 | handled_permissions = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 157 | } |
| 158 | else |
| 159 | ret = xdp_dbus_documents_call_add_named_synccxx . . $ xdp_dbus_documents_call_add_named_sync(9285050a3cebf544). (documentscxx . . $ documents., |
| 160 | g_variant_new_handlecxx . . $ g_variant_new_handle(d662e1c280be90d3). (fd_in), |
| 161 | basename, |
| 162 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 163 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 164 | fd_list, |
| 165 | &doc_id, |
| 166 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 167 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 168 | error); |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | if (version >= 2) |
| 173 | { |
| 174 | ret = xdp_dbus_documents_call_add_full_synccxx . . $ xdp_dbus_documents_call_add_full_sync(3565c662c2ec8664). (documentscxx . . $ documents., |
| 175 | g_variant_new_fixed_arraycxx . . $ g_variant_new_fixed_array(68571e015fb2a4d7). (G_VARIANT_TYPE_HANDLEcxx . . $ `<external>/14064154155447831270/gvarianttype.h:172:9`!, &fd_in, 1, sizeof (gint32cxx . . $ gint32#)), |
| 176 | full_flags, |
| 177 | app_id, |
| 178 | permissions, |
| 179 | fd_list, |
| 180 | &doc_ids, |
| 181 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 182 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 183 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 184 | error); |
| 185 | handled_permissions = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 186 | } |
| 187 | else |
| 188 | ret = xdp_dbus_documents_call_add_synccxx . . $ xdp_dbus_documents_call_add_sync(d7d56fb74cd0e6f). (documentscxx . . $ documents., |
| 189 | g_variant_new_handlecxx . . $ g_variant_new_handle(d662e1c280be90d3). (fd_in), |
| 190 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 191 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 192 | fd_list, |
| 193 | &doc_id, |
| 194 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 195 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 196 | error); |
| 197 | } |
| 198 | |
| 199 | if (!ret) |
| 200 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 201 | |
| 202 | if (doc_ids && doc_ids[0]) { |
| 203 | doc_id = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (doc_ids[0]); |
| 204 | } |
| 205 | |
| 206 | if (!handled_permissions) |
| 207 | { |
| 208 | if (!xdp_dbus_documents_call_grant_permissions_synccxx . . $ xdp_dbus_documents_call_grant_permissions_sync(c3c81aa7d040b381). (documentscxx . . $ documents., |
| 209 | doc_id, |
| 210 | app_id, |
| 211 | permissions, |
| 212 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 213 | error)) |
| 214 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 215 | } |
| 216 | |
| 217 | if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (doc_id, "") == 0) |
| 218 | { |
| 219 | doc_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 220 | return g_filename_to_uricxx . . $ g_filename_to_uri(aa426d2e062653f5). (doc_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error); |
| 221 | } |
| 222 | |
| 223 | doc_path = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (documents_mountpointcxx . . $ documents_mountpoint., doc_id, basename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 224 | return g_filename_to_uricxx . . $ g_filename_to_uri(aa426d2e062653f5). (doc_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error); |
| 225 | } |
| 226 | |
| 227 | char * |
| 228 | xdp_get_real_path_for_doc_idcxx . . $ xdp_get_real_path_for_doc_id(a8b8e32347182212). (const char *doc_id) |
| 229 | { |
| 230 | gbooleancxx . . $ gboolean# ret = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 231 | char *real_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 232 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`! (GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 233 | |
| 234 | ret = xdp_dbus_documents_call_info_synccxx . . $ xdp_dbus_documents_call_info_sync(e586a82f185a310d). (documentscxx . . $ documents., doc_id, &real_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error); |
| 235 | if (!ret) |
| 236 | { |
| 237 | g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:371:9`! ("document portal error for doc id '%s': %s", doc_id, error->message); |
| 238 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 239 | } |
| 240 | |
| 241 | return real_path; |
| 242 | } |
| 243 | |
| 244 | /* Get the document id from the path, if there's any. |
| 245 | * Returns TRUE when path seems to point to the documents |
| 246 | * storage. Also returns the guessed doc id and suffix path |
| 247 | * without the dir name immediately following the doc id. |
| 248 | */ |
| 249 | static gbooleancxx . . $ gboolean# |
| 250 | xdp_looks_like_document_portal_pathcxx . . $ xdp_looks_like_document_portal_path(c0a3d66f6ffdbd4c). (const char *path, |
| 251 | char **docid_out, |
| 252 | char **suffix_path_out) |
| 253 | { |
| 254 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *docid = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 255 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *suffix_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 256 | const char *p, *q; |
| 257 | |
| 258 | if (!g_str_has_prefixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:159:9`! (path, g_get_user_runtime_dir ())) |
| 259 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 260 | |
| 261 | p = strstrcxx . . $ strstr(a713fe7b9a57cf96). (path, "/doc/"); |
| 262 | if (!p) |
| 263 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 264 | |
| 265 | p += strlencxx . . $ strlen(751346f8406fd082). ("/doc/"); |
| 266 | q = strchrcxx . . $ strchr(2050848944e00d54). (p, '/'); |
| 267 | |
| 268 | if (q) |
| 269 | { |
| 270 | docid = g_strndupcxx . . $ g_strndup(eabdfdef77619b3d). (p, q - p); |
| 271 | |
| 272 | /* The mapping from doc path to the host path already provides the dir name, |
| 273 | * so we can omit it from the subpath. |
| 274 | */ |
| 275 | q = strchrcxx . . $ strchr(2050848944e00d54). (++q, '/'); |
| 276 | if (q) |
| 277 | suffix_path = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (q); |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | docid = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (p); |
| 282 | } |
| 283 | |
| 284 | if (docid[0] == '\0') |
| 285 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 286 | |
| 287 | if (docid_out) |
| 288 | *docid_out = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&docid); |
| 289 | if (suffix_path_out) |
| 290 | *suffix_path_out = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&suffix_path); |
| 291 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 292 | } |
| 293 | |
| 294 | char * |
| 295 | xdp_resolve_document_portal_pathcxx . . $ xdp_resolve_document_portal_path(7ec23921cb940e71). (const char *path, |
| 296 | XdpResolveDocumentStrategycxx . . $ XdpResolveDocumentStrategy# strategy) |
| 297 | { |
| 298 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *docid = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 299 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *suffix_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 300 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *host_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 301 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *resolved_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 302 | |
| 303 | if (!xdp_looks_like_document_portal_pathcxx . . $ xdp_looks_like_document_portal_path(c0a3d66f6ffdbd4c). (path, &docid, &suffix_path)) |
| 304 | return g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (path); |
| 305 | |
| 306 | host_path = xdp_get_real_path_for_doc_idcxx . . $ xdp_get_real_path_for_doc_id(a8b8e32347182212). (docid); |
| 307 | if (!host_path) |
| 308 | return g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (path); |
| 309 | |
| 310 | resolved_path = g_strconcatcxx . . $ g_strconcat(a849077ff1b8d812). (host_path, suffix_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 311 | |
| 312 | if (strategy == XDP_RESOLVE_DOCUMENT_TO_DIRECTORYcxx . . $ XDP_RESOLVE_DOCUMENT_TO_DIRECTORY.) |
| 313 | { |
| 314 | char *last_dir_separator = strrchrcxx . . $ strrchr(2050848944e00d54). (resolved_path, G_DIR_SEPARATORcxx . . $ `<external>/10505296616216143549/glibconfig.h:212:9`!); |
| 315 | if (last_dir_separator) |
| 316 | *last_dir_separator = '\0'; |
| 317 | } |
| 318 | |
| 319 | return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&resolved_path); |
| 320 | } |