| 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
| 2 | * Copyright 2019 MariaDB Corporation Ab. All rights reserved. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 17 | * MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include "config.h"cxx . . $ `<file>/build/include/config.h`/ |
| 21 | #include "common.h"cxx . . $ `<file>/storage/maria/libmarias3/src/common.h`/ |
| 22 | |
| 23 | #include <pthread.h> |
| 24 | #include <arpa/inet.h> |
| 25 | #include <netinet/in.h> |
| 26 | #include <stdint.h> |
| 27 | |
| 28 | ms3_malloc_callbackcxx . . $ ms3_malloc_callback# ms3_cmalloccxx . . $ ms3_cmalloc. = (ms3_malloc_callbackcxx . . $ ms3_malloc_callback#)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).; |
| 29 | ms3_free_callbackcxx . . $ ms3_free_callback# ms3_cfreecxx . . $ ms3_cfree. = (ms3_free_callbackcxx . . $ ms3_free_callback#)freecxx . . $ free(5d22bdacc48458e8).; |
| 30 | ms3_realloc_callbackcxx . . $ ms3_realloc_callback# ms3_crealloccxx . . $ ms3_crealloc. = (ms3_realloc_callbackcxx . . $ ms3_realloc_callback#)realloccxx . . $ realloc(417ab160f6baadc6).; |
| 31 | ms3_strdup_callbackcxx . . $ ms3_strdup_callback# ms3_cstrdupcxx . . $ ms3_cstrdup. = (ms3_strdup_callbackcxx . . $ ms3_strdup_callback#)strdupcxx . . $ strdup(a8b8e32347182212).; |
| 32 | ms3_calloc_callbackcxx . . $ ms3_calloc_callback# ms3_ccalloccxx . . $ ms3_ccalloc. = (ms3_calloc_callbackcxx . . $ ms3_calloc_callback#)calloccxx . . $ calloc(63a7bf2941bfcd7a).; |
| 33 | |
| 34 | |
| 35 | /* Thread locking code for OpenSSL < 1.1.0 */ |
| 36 | #include <dlfcn.h> |
| 37 | #ifndef RTLD_DEFAULTcxx . . $ `<external>/16223394379662886929/dlfcn.h:50:9`! |
| 38 | #define RTLD_DEFAULT ((void *)0) |
| 39 | #endif |
| 40 | static pthread_mutex_tcxx . . $ pthread_mutex_t# *mutex_bufcxx . . $ mutex_buf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 41 | #define CRYPTO_LOCKcxx . . $ `storage/maria/libmarias3/src/marias3.c:41:9`! 1 |
| 42 | static void (*openssl_set_id_callbackcxx . . $ openssl_set_id_callback.)(unsigned long (*func)(void)); |
| 43 | static void (*openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback.)(void (*func)(int mode,int type, const char *file,int line)); |
| 44 | static int (*openssl_num_lockscxx . . $ openssl_num_locks.)(void); |
| 45 | |
| 46 | static void locking_functioncxx . . $ locking_function(fb55fac72934dd32).(int mode, int n, const char *file, int line) |
| 47 | { |
| 48 | (void) file; |
| 49 | (void) line; |
| 50 | if(mode & CRYPTO_LOCKcxx . . $ `storage/maria/libmarias3/src/marias3.c:41:9`!) |
| 51 | pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&(mutex_bufcxx . . $ mutex_buf.[n])); |
| 52 | else |
| 53 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&(mutex_bufcxx . . $ mutex_buf.[n])); |
| 54 | } |
| 55 | |
| 56 | static int curl_needs_openssl_lockingcxx . . $ curl_needs_openssl_locking(b126dc7c1de90089).(void) |
| 57 | { |
| 58 | curl_version_info_datacxx . . $ curl_version_info_data# *data = curl_version_infocxx . . $ curl_version_info(892d5edb12c5374d).(CURLVERSION_NOWcxx . . $ `<external>/9362084101733100468/curl.h:3106:9`!); |
| 59 | |
| 60 | if (data->ssl_versioncxx . . $ curl_version_info_data#ssl_version. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 61 | { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(data->ssl_versioncxx . . $ curl_version_info_data#ssl_version., "OpenSSL", 7) != 0) |
| 66 | { |
| 67 | return 0; |
| 68 | } |
| 69 | if (data->ssl_versioncxx . . $ curl_version_info_data#ssl_version.[8] == '0') |
| 70 | { |
| 71 | return 1; |
| 72 | } |
| 73 | if ((data->ssl_versioncxx . . $ curl_version_info_data#ssl_version.[8] == '1') && (data->ssl_versioncxx . . $ curl_version_info_data#ssl_version.[10] == '0')) |
| 74 | { |
| 75 | openssl_set_id_callbackcxx . . $ openssl_set_id_callback. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(RTLD_DEFAULTcxx . . $ `<external>/16223394379662886929/dlfcn.h:50:9`!, "CRYPTO_set_id_callback"); |
| 76 | openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(RTLD_DEFAULTcxx . . $ `<external>/16223394379662886929/dlfcn.h:50:9`!, "CRYPTO_set_locking_callback"); |
| 77 | openssl_num_lockscxx . . $ openssl_num_locks. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(RTLD_DEFAULTcxx . . $ `<external>/16223394379662886929/dlfcn.h:50:9`!, "CRYPTO_num_locks"); |
| 78 | return openssl_set_id_callbackcxx . . $ openssl_set_id_callback. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && |
| 79 | openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && |
| 80 | openssl_num_lockscxx . . $ openssl_num_locks. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 81 | } |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | static unsigned long __attribute__((unused)) id_functioncxx . . $ id_function(f708dce9a8856c70).(void) |
| 86 | { |
| 87 | return ((unsigned long)pthread_selfcxx . . $ pthread_self(f708dce9a8856c70).()); |
| 88 | } |
| 89 | |
| 90 | uint8_tcxx . . $ uint8_t# ms3_library_init_malloccxx . . $ ms3_library_init_malloc(1a3402231343c570).(ms3_malloc_callbackcxx . . $ ms3_malloc_callback# m, |
| 91 | ms3_free_callbackcxx . . $ ms3_free_callback# f, ms3_realloc_callbackcxx . . $ ms3_realloc_callback# r, |
| 92 | ms3_strdup_callbackcxx . . $ ms3_strdup_callback# s, ms3_calloc_callbackcxx . . $ ms3_calloc_callback# c) |
| 93 | { |
| 94 | if (!m || !f || !r || !s || !c) |
| 95 | { |
| 96 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 97 | } |
| 98 | |
| 99 | ms3_cmalloccxx . . $ ms3_cmalloc. = m; |
| 100 | ms3_cfreecxx . . $ ms3_cfree. = f; |
| 101 | ms3_crealloccxx . . $ ms3_crealloc. = r; |
| 102 | ms3_cstrdupcxx . . $ ms3_cstrdup. = s; |
| 103 | ms3_ccalloccxx . . $ ms3_ccalloc. = c; |
| 104 | |
| 105 | if (curl_needs_openssl_lockingcxx . . $ curl_needs_openssl_locking(b126dc7c1de90089).()) |
| 106 | { |
| 107 | int i; |
| 108 | mutex_bufcxx . . $ mutex_buf. = ms3_cmalloccxx . . $ ms3_cmalloc.(openssl_num_lockscxx . . $ openssl_num_locks.() * sizeof(pthread_mutex_tcxx . . $ pthread_mutex_t#)); |
| 109 | if(mutex_bufcxx . . $ mutex_buf.) |
| 110 | { |
| 111 | for(i = 0; i < openssl_num_lockscxx . . $ openssl_num_locks.(); i++) |
| 112 | pthread_mutex_initcxx . . $ pthread_mutex_init(db9d29dab44ea1aa).(&(mutex_bufcxx . . $ mutex_buf.[i]), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 113 | openssl_set_id_callbackcxx . . $ openssl_set_id_callback.(id_functioncxx . . $ id_function(f708dce9a8856c70).); |
| 114 | openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback.(locking_functioncxx . . $ locking_function(fb55fac72934dd32).); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | if (curl_global_init_memcxx . . $ curl_global_init_mem(6441d25796c8cba5).(CURL_GLOBAL_DEFAULTcxx . . $ `<external>/9362084101733100468/curl.h:3018:9`!, m, f, r, s, c)) |
| 119 | { |
| 120 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 121 | } |
| 122 | |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | void ms3_library_initcxx . . $ ms3_library_init(49f6e7a06ebc5aa8).(void) |
| 127 | { |
| 128 | if (curl_needs_openssl_lockingcxx . . $ curl_needs_openssl_locking(b126dc7c1de90089).()) |
| 129 | { |
| 130 | int i; |
| 131 | mutex_bufcxx . . $ mutex_buf. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(openssl_num_lockscxx . . $ openssl_num_locks.() * sizeof(pthread_mutex_tcxx . . $ pthread_mutex_t#)); |
| 132 | if(mutex_bufcxx . . $ mutex_buf.) |
| 133 | { |
| 134 | for(i = 0; i < openssl_num_lockscxx . . $ openssl_num_locks.(); i++) |
| 135 | pthread_mutex_initcxx . . $ pthread_mutex_init(db9d29dab44ea1aa).(&(mutex_bufcxx . . $ mutex_buf.[i]), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 136 | openssl_set_id_callbackcxx . . $ openssl_set_id_callback.(id_functioncxx . . $ id_function(f708dce9a8856c70).); |
| 137 | openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback.(locking_functioncxx . . $ locking_function(fb55fac72934dd32).); |
| 138 | } |
| 139 | } |
| 140 | curl_global_initcxx . . $ curl_global_init(8ee5a1f0a6e4ee2a).(CURL_GLOBAL_DEFAULTcxx . . $ `<external>/9362084101733100468/curl.h:3018:9`!); |
| 141 | } |
| 142 | |
| 143 | void ms3_library_deinitcxx . . $ ms3_library_deinit(49f6e7a06ebc5aa8).(void) |
| 144 | { |
| 145 | int i; |
| 146 | if (mutex_bufcxx . . $ mutex_buf.) |
| 147 | { |
| 148 | openssl_set_id_callbackcxx . . $ openssl_set_id_callback.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 149 | openssl_set_locking_callbackcxx . . $ openssl_set_locking_callback.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 150 | for(i = 0; i < openssl_num_lockscxx . . $ openssl_num_locks.(); i++) |
| 151 | pthread_mutex_destroycxx . . $ pthread_mutex_destroy(d89ae235521888f9).(&(mutex_bufcxx . . $ mutex_buf.[i])); |
| 152 | ms3_cfreecxx . . $ ms3_cfree.(mutex_bufcxx . . $ mutex_buf.); |
| 153 | mutex_bufcxx . . $ mutex_buf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 154 | } |
| 155 | curl_global_cleanupcxx . . $ curl_global_cleanup(49f6e7a06ebc5aa8).(); |
| 156 | } |
| 157 | |
| 158 | ms3_stcxx . . $ ms3_st# *ms3_initcxx . . $ ms3_init(e57fc653a6ad2c54).(const char *s3key, const char *s3secret, |
| 159 | const char *region, |
| 160 | const char *base_domain) |
| 161 | { |
| 162 | ms3_stcxx . . $ ms3_st# *ms3; |
| 163 | |
| 164 | if ((s3key == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) || (s3secret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 165 | { |
| 166 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 167 | } |
| 168 | |
| 169 | ms3 = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(ms3_stcxx . . $ ms3_st#)); |
| 170 | |
| 171 | ms3->s3keycxx . . $ ms3_st#s3key. = ms3_cstrdupcxx . . $ ms3_cstrdup.(s3key); |
| 172 | ms3->s3secretcxx . . $ ms3_st#s3secret. = ms3_cstrdupcxx . . $ ms3_cstrdup.(s3secret); |
| 173 | ms3->regioncxx . . $ ms3_st#region. = ms3_cstrdupcxx . . $ ms3_cstrdup.(region); |
| 174 | ms3->portcxx . . $ ms3_st#port. = 0; /* The default value */ |
| 175 | |
| 176 | if (base_domain && strlencxx . . $ strlen(751346f8406fd082).(base_domain)) |
| 177 | { |
| 178 | struct sockaddr_incxx . . $ sockaddr_in# sa; |
| 179 | ms3->base_domaincxx . . $ ms3_st#base_domain. = ms3_cstrdupcxx . . $ ms3_cstrdup.(base_domain); |
| 180 | if (inet_ptoncxx . . $ inet_pton(8d303d671d73812).(AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!, base_domain, &(sa.sin_addrcxx . . $ sockaddr_in#sin_addr.))) |
| 181 | { |
| 182 | ms3->list_versioncxx . . $ ms3_st#list_version. = 1; |
| 183 | ms3->protocol_versioncxx . . $ ms3_st#protocol_version. = 1; |
| 184 | } |
| 185 | else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(base_domain, "s3.amazonaws.com") == 0) |
| 186 | { |
| 187 | ms3->list_versioncxx . . $ ms3_st#list_version. = 2; |
| 188 | ms3->protocol_versioncxx . . $ ms3_st#protocol_version. = 2; |
| 189 | } |
| 190 | else |
| 191 | { |
| 192 | // Assume that S3-compatible APIs can't support v2 list |
| 193 | ms3->list_versioncxx . . $ ms3_st#list_version. = 1; |
| 194 | ms3->protocol_versioncxx . . $ ms3_st#protocol_version. = 2; |
| 195 | } |
| 196 | } |
| 197 | else |
| 198 | { |
| 199 | ms3->base_domaincxx . . $ ms3_st#base_domain. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 200 | ms3->list_versioncxx . . $ ms3_st#list_version. = 2; |
| 201 | ms3->protocol_versioncxx . . $ ms3_st#protocol_version. = 2; |
| 202 | } |
| 203 | |
| 204 | ms3->buffer_chunk_sizecxx . . $ ms3_st#buffer_chunk_size. = READ_BUFFER_DEFAULT_SIZEcxx . . $ `storage/maria/libmarias3/src/request.h:32:9`!; |
| 205 | |
| 206 | ms3->curlcxx . . $ ms3_st#curl. = curl_easy_initcxx . . $ curl_easy_init(50c7df7de5344ebb).(); |
| 207 | ms3->last_errorcxx . . $ ms3_st#last_error. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 208 | ms3->use_httpcxx . . $ ms3_st#use_http. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 209 | ms3->no_content_typecxx . . $ ms3_st#no_content_type. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 210 | ms3->disable_verificationcxx . . $ ms3_st#disable_verification. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 211 | ms3->first_runcxx . . $ ms3_st#first_run. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 212 | ms3->path_buffercxx . . $ ms3_st#path_buffer. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 1024); |
| 213 | ms3->query_buffercxx . . $ ms3_st#query_buffer. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 3072); |
| 214 | ms3->list_containercxx . . $ ms3_st#list_container..poolcxx . . $ ms3_list_container_st#pool. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 215 | ms3->list_containercxx . . $ ms3_st#list_container..nextcxx . . $ ms3_list_container_st#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 216 | ms3->list_containercxx . . $ ms3_st#list_container..startcxx . . $ ms3_list_container_st#start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 217 | ms3->list_containercxx . . $ ms3_st#list_container..pool_listcxx . . $ ms3_list_container_st#pool_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 218 | ms3->list_containercxx . . $ ms3_st#list_container..pool_freecxx . . $ ms3_list_container_st#pool_free. = 0; |
| 219 | ms3->read_cbcxx . . $ ms3_st#read_cb.= 0; |
| 220 | ms3->user_datacxx . . $ ms3_st#user_data.= 0; |
| 221 | ms3->connect_timeout_mscxx . . $ ms3_st#connect_timeout_ms. = 0; |
| 222 | ms3->timeout_mscxx . . $ ms3_st#timeout_ms. = 0; |
| 223 | |
| 224 | ms3->iam_rolecxx . . $ ms3_st#iam_role. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 225 | ms3->role_keycxx . . $ ms3_st#role_key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 226 | ms3->role_secretcxx . . $ ms3_st#role_secret. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 227 | ms3->role_session_tokencxx . . $ ms3_st#role_session_token. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 228 | ms3->iam_endpointcxx . . $ ms3_st#iam_endpoint. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 229 | ms3->sts_endpointcxx . . $ ms3_st#sts_endpoint. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 230 | ms3->sts_regioncxx . . $ ms3_st#sts_region. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 231 | ms3->iam_role_arncxx . . $ ms3_st#iam_role_arn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 232 | |
| 233 | #ifdef HAVE_NEW_CURL_API |
| 234 | ms3->content_type_in = NULL; |
| 235 | #endif |
| 236 | ms3->content_type_outcxx . . $ ms3_st#content_type_out. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 237 | |
| 238 | return ms3; |
| 239 | } |
| 240 | |
| 241 | uint8_tcxx . . $ uint8_t# ms3_init_assume_rolecxx . . $ ms3_init_assume_role(11a3a38af5b85b38).(ms3_stcxx . . $ ms3_st# *ms3, const char *iam_role, const char *sts_endpoint, const char *sts_region) |
| 242 | { |
| 243 | uint8_tcxx . . $ uint8_t# ret=0; |
| 244 | |
| 245 | if (iam_role == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 246 | { |
| 247 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 248 | } |
| 249 | ms3->iam_rolecxx . . $ ms3_st#iam_role. = ms3_cstrdupcxx . . $ ms3_cstrdup.(iam_role); |
| 250 | |
| 251 | if (sts_endpoint && strlencxx . . $ strlen(751346f8406fd082).(sts_endpoint)) |
| 252 | { |
| 253 | ms3->sts_endpointcxx . . $ ms3_st#sts_endpoint. = ms3_cstrdupcxx . . $ ms3_cstrdup.(sts_endpoint); |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | ms3->sts_endpointcxx . . $ ms3_st#sts_endpoint. = ms3_cstrdupcxx . . $ ms3_cstrdup.("sts.amazonaws.com"); |
| 258 | } |
| 259 | |
| 260 | if (sts_region && strlencxx . . $ strlen(751346f8406fd082).(sts_region)) |
| 261 | { |
| 262 | ms3->sts_regioncxx . . $ ms3_st#sts_region. = ms3_cstrdupcxx . . $ ms3_cstrdup.(sts_region); |
| 263 | } |
| 264 | else |
| 265 | { |
| 266 | ms3->sts_regioncxx . . $ ms3_st#sts_region. = ms3_cstrdupcxx . . $ ms3_cstrdup.("us-east-1"); |
| 267 | } |
| 268 | |
| 269 | ms3->iam_endpointcxx . . $ ms3_st#iam_endpoint. = ms3_cstrdupcxx . . $ ms3_cstrdup.("iam.amazonaws.com"); |
| 270 | |
| 271 | ms3->iam_role_arncxx . . $ ms3_st#iam_role_arn. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 2048); |
| 272 | ms3->iam_role_arncxx . . $ ms3_st#iam_role_arn.[0] = '\0'; |
| 273 | ms3->role_keycxx . . $ ms3_st#role_key. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 128); |
| 274 | ms3->role_keycxx . . $ ms3_st#role_key.[0] = '\0'; |
| 275 | ms3->role_secretcxx . . $ ms3_st#role_secret. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 1024); |
| 276 | ms3->role_secretcxx . . $ ms3_st#role_secret.[0] = '\0'; |
| 277 | // aws says theres no maximum length here.. 2048 might be overkill |
| 278 | ms3->role_session_tokencxx . . $ ms3_st#role_session_token. = ms3_cmalloccxx . . $ ms3_cmalloc.(sizeof(char) * 2048); |
| 279 | ms3->role_session_tokencxx . . $ ms3_st#role_session_token.[0] = '\0'; |
| 280 | // 0 will uses the default and not set a value in the request |
| 281 | ms3->role_session_durationcxx . . $ ms3_st#role_session_duration. = 0; |
| 282 | |
| 283 | ret = ms3_assume_rolecxx . . $ ms3_assume_role(a44ea76fcb91cc1e).(ms3); |
| 284 | |
| 285 | return ret; |
| 286 | } |
| 287 | |
| 288 | uint8_tcxx . . $ uint8_t# ms3_ec2_set_credcxx . . $ ms3_ec2_set_cred(5b89988bcf9b7bd9).(ms3_stcxx . . $ ms3_st# *ms3, const char *iam_role, |
| 289 | const char *s3key, const char *s3secret, |
| 290 | const char *token) |
| 291 | { |
| 292 | uint8_tcxx . . $ uint8_t# ret=0; |
| 293 | |
| 294 | if (iam_role == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || token == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || s3key == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || s3secret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 295 | { |
| 296 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 297 | } |
| 298 | ms3->iam_rolecxx . . $ ms3_st#iam_role. = ms3_cstrdupcxx . . $ ms3_cstrdup.(iam_role); |
| 299 | ms3->role_keycxx . . $ ms3_st#role_key. = ms3_cstrdupcxx . . $ ms3_cstrdup.(s3key); |
| 300 | ms3->role_secretcxx . . $ ms3_st#role_secret. = ms3_cstrdupcxx . . $ ms3_cstrdup.(s3secret); |
| 301 | ms3->role_session_tokencxx . . $ ms3_st#role_session_token. = ms3_cstrdupcxx . . $ ms3_cstrdup.(token); |
| 302 | |
| 303 | return ret; |
| 304 | } |
| 305 | |
| 306 | static void list_freecxx . . $ list_free(88234e7c7f58ab5f).(ms3_stcxx . . $ ms3_st# *ms3) |
| 307 | { |
| 308 | ms3_list_stcxx . . $ ms3_list_st# *list = ms3->list_containercxx . . $ ms3_st#list_container..startcxx . . $ ms3_list_container_st#start.; |
| 309 | struct ms3_pool_alloc_list_stcxx . . $ ms3_pool_alloc_list_st# *plist = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *next = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 310 | while (list) |
| 311 | { |
| 312 | ms3_cfreecxx . . $ ms3_cfree.(list->keycxx . . $ ms3_list_st#key.); |
| 313 | list = list->nextcxx . . $ ms3_list_st#next.; |
| 314 | } |
| 315 | plist = ms3->list_containercxx . . $ ms3_st#list_container..pool_listcxx . . $ ms3_list_container_st#pool_list.; |
| 316 | while (plist) |
| 317 | { |
| 318 | next = plist->prevcxx . . $ ms3_pool_alloc_list_st#prev.; |
| 319 | ms3_cfreecxx . . $ ms3_cfree.(plist->poolcxx . . $ ms3_pool_alloc_list_st#pool.); |
| 320 | ms3_cfreecxx . . $ ms3_cfree.(plist); |
| 321 | plist = next; |
| 322 | } |
| 323 | ms3->list_containercxx . . $ ms3_st#list_container..poolcxx . . $ ms3_list_container_st#pool. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 324 | ms3->list_containercxx . . $ ms3_st#list_container..nextcxx . . $ ms3_list_container_st#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 325 | ms3->list_containercxx . . $ ms3_st#list_container..startcxx . . $ ms3_list_container_st#start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 326 | ms3->list_containercxx . . $ ms3_st#list_container..pool_listcxx . . $ ms3_list_container_st#pool_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 327 | ms3->list_containercxx . . $ ms3_st#list_container..pool_freecxx . . $ ms3_list_container_st#pool_free. = 0; |
| 328 | } |
| 329 | |
| 330 | void ms3_deinitcxx . . $ ms3_deinit(88234e7c7f58ab5f).(ms3_stcxx . . $ ms3_st# *ms3) |
| 331 | { |
| 332 | if (!ms3) |
| 333 | { |
| 334 | return; |
| 335 | } |
| 336 | |
| 337 | ms3debugcxx . . $ `storage/maria/libmarias3/src/debug.h:28:9`!("deinit: 0x%" PRIXPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:165:10`!, (uintptr_t)ms3); |
| 338 | ms3_cfreecxx . . $ ms3_cfree.(ms3->s3secretcxx . . $ ms3_st#s3secret.); |
| 339 | ms3_cfreecxx . . $ ms3_cfree.(ms3->s3keycxx . . $ ms3_st#s3key.); |
| 340 | ms3_cfreecxx . . $ ms3_cfree.(ms3->regioncxx . . $ ms3_st#region.); |
| 341 | ms3_cfreecxx . . $ ms3_cfree.(ms3->base_domaincxx . . $ ms3_st#base_domain.); |
| 342 | ms3_cfreecxx . . $ ms3_cfree.(ms3->iam_rolecxx . . $ ms3_st#iam_role.); |
| 343 | ms3_cfreecxx . . $ ms3_cfree.(ms3->role_keycxx . . $ ms3_st#role_key.); |
| 344 | ms3_cfreecxx . . $ ms3_cfree.(ms3->role_secretcxx . . $ ms3_st#role_secret.); |
| 345 | ms3_cfreecxx . . $ ms3_cfree.(ms3->role_session_tokencxx . . $ ms3_st#role_session_token.); |
| 346 | ms3_cfreecxx . . $ ms3_cfree.(ms3->iam_endpointcxx . . $ ms3_st#iam_endpoint.); |
| 347 | ms3_cfreecxx . . $ ms3_cfree.(ms3->sts_endpointcxx . . $ ms3_st#sts_endpoint.); |
| 348 | ms3_cfreecxx . . $ ms3_cfree.(ms3->sts_regioncxx . . $ ms3_st#sts_region.); |
| 349 | ms3_cfreecxx . . $ ms3_cfree.(ms3->iam_role_arncxx . . $ ms3_st#iam_role_arn.); |
| 350 | curl_easy_cleanupcxx . . $ curl_easy_cleanup(5d22bdacc48458e8).(ms3->curlcxx . . $ ms3_st#curl.); |
| 351 | ms3_cfreecxx . . $ ms3_cfree.(ms3->last_errorcxx . . $ ms3_st#last_error.); |
| 352 | ms3_cfreecxx . . $ ms3_cfree.(ms3->path_buffercxx . . $ ms3_st#path_buffer.); |
| 353 | ms3_cfreecxx . . $ ms3_cfree.(ms3->query_buffercxx . . $ ms3_st#query_buffer.); |
| 354 | list_freecxx . . $ list_free(88234e7c7f58ab5f).(ms3); |
| 355 | ms3_cfreecxx . . $ ms3_cfree.(ms3); |
| 356 | } |
| 357 | |
| 358 | const char *ms3_server_errorcxx . . $ ms3_server_error(e28dd5dd75044808).(ms3_stcxx . . $ ms3_st# *ms3) |
| 359 | { |
| 360 | if (!ms3) |
| 361 | { |
| 362 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 363 | } |
| 364 | |
| 365 | return ms3->last_errorcxx . . $ ms3_st#last_error.; |
| 366 | } |
| 367 | |
| 368 | void ms3_debugcxx . . $ ms3_debug(d4f767463ce0a6b3).(int debug_state) |
| 369 | { |
| 370 | long state = ms3debug_getcxx . . $ ms3debug_get(da6335ded91d79c2).(); |
| 371 | if (state != (long) debug_state) |
| 372 | { |
| 373 | ms3debug_setcxx . . $ ms3debug_set(b45ddcbc8423892c).((boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!) debug_state); |
| 374 | if (debug_state) |
| 375 | { |
| 376 | ms3debugcxx . . $ `storage/maria/libmarias3/src/debug.h:28:9`!("enabling debug"); |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | const char *ms3_errorcxx . . $ ms3_error(42624c5f3be67010).(uint8_tcxx . . $ uint8_t# errcode) |
| 382 | { |
| 383 | if (errcode >= MS3_ERR_MAXcxx . . $ MS3_ERR_MAX.) |
| 384 | { |
| 385 | return baderrorcxx . . $ `storage/maria/libmarias3/src/error.h:24:9`!; |
| 386 | } |
| 387 | |
| 388 | return errmsgscxx . . $ errmsgs.[errcode]; |
| 389 | } |
| 390 | |
| 391 | uint8_tcxx . . $ uint8_t# ms3_list_dircxx . . $ ms3_list_dir(375f1c1339f18b70).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *prefix, |
| 392 | ms3_list_stcxx . . $ ms3_list_st# **list) |
| 393 | { |
| 394 | uint8_tcxx . . $ uint8_t# res = 0; |
| 395 | |
| 396 | if (!ms3 || !bucket || !list) |
| 397 | { |
| 398 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 399 | } |
| 400 | |
| 401 | list_freecxx . . $ list_free(88234e7c7f58ab5f).(ms3); |
| 402 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_LISTcxx . . $ MS3_CMD_LIST., bucket, 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`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, prefix, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 403 | 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 404 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 405 | *list = ms3->list_containercxx . . $ ms3_st#list_container..startcxx . . $ ms3_list_container_st#start.; |
| 406 | return res; |
| 407 | } |
| 408 | |
| 409 | uint8_tcxx . . $ uint8_t# ms3_listcxx . . $ ms3_list(375f1c1339f18b70).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *prefix, |
| 410 | ms3_list_stcxx . . $ ms3_list_st# **list) |
| 411 | { |
| 412 | uint8_tcxx . . $ uint8_t# res = 0; |
| 413 | |
| 414 | if (!ms3 || !bucket || !list) |
| 415 | { |
| 416 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 417 | } |
| 418 | |
| 419 | list_freecxx . . $ list_free(88234e7c7f58ab5f).(ms3); |
| 420 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_LIST_RECURSIVEcxx . . $ MS3_CMD_LIST_RECURSIVE., bucket, 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`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 421 | prefix, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 422 | 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 423 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 424 | *list = ms3->list_containercxx . . $ ms3_st#list_container..startcxx . . $ ms3_list_container_st#start.; |
| 425 | return res; |
| 426 | } |
| 427 | |
| 428 | uint8_tcxx . . $ uint8_t# ms3_putcxx . . $ ms3_put(c1b3b3914826faea).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *key, |
| 429 | const uint8_tcxx . . $ uint8_t# *data, size_t length) |
| 430 | { |
| 431 | uint8_tcxx . . $ uint8_t# res; |
| 432 | |
| 433 | if (!ms3 || !bucket || !key || !data) |
| 434 | { |
| 435 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 436 | } |
| 437 | |
| 438 | if (length == 0) |
| 439 | { |
| 440 | return MS3_ERR_NO_DATAcxx . . $ MS3_ERR_NO_DATA.; |
| 441 | } |
| 442 | |
| 443 | // mhash can't hash more than 4GB it seems |
| 444 | if (length > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`!) |
| 445 | { |
| 446 | return MS3_ERR_TOO_BIGcxx . . $ MS3_ERR_TOO_BIG.; |
| 447 | } |
| 448 | |
| 449 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_PUTcxx . . $ MS3_CMD_PUT., bucket, key, 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`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, data, |
| 450 | length, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 451 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 452 | |
| 453 | return res; |
| 454 | } |
| 455 | |
| 456 | uint8_tcxx . . $ uint8_t# ms3_getcxx . . $ ms3_get(654dd417bc7241a).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *key, |
| 457 | uint8_tcxx . . $ uint8_t# **data, size_t *length) |
| 458 | { |
| 459 | uint8_tcxx . . $ uint8_t# res = 0; |
| 460 | struct memory_buffer_stcxx . . $ memory_buffer_st# buf; |
| 461 | |
| 462 | buf.datacxx . . $ memory_buffer_st#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 463 | buf.lengthcxx . . $ memory_buffer_st#length. = 0; |
| 464 | |
| 465 | if (!ms3 || !bucket || !key || key[0] == '\0') |
| 466 | { |
| 467 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 468 | } |
| 469 | else if (!ms3->read_cbcxx . . $ ms3_st#read_cb. && (!data || !length)) |
| 470 | { |
| 471 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 472 | } |
| 473 | |
| 474 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_GETcxx . . $ MS3_CMD_GET., bucket, key, 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`!, 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`!, 0, |
| 475 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &buf); |
| 476 | if (!ms3->read_cbcxx . . $ ms3_st#read_cb.) |
| 477 | { |
| 478 | *data = buf.datacxx . . $ memory_buffer_st#data.; |
| 479 | *length = buf.lengthcxx . . $ memory_buffer_st#length.; |
| 480 | } |
| 481 | |
| 482 | return res; |
| 483 | } |
| 484 | |
| 485 | uint8_tcxx . . $ uint8_t# ms3_copycxx . . $ ms3_copy(5b89988bcf9b7bd9).(ms3_stcxx . . $ ms3_st# *ms3, const char *source_bucket, const char *source_key, |
| 486 | const char *dest_bucket, const char *dest_key) |
| 487 | { |
| 488 | uint8_tcxx . . $ uint8_t# res = 0; |
| 489 | |
| 490 | if (!ms3 || !source_bucket || !source_key || !dest_bucket || !dest_key) |
| 491 | { |
| 492 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 493 | } |
| 494 | |
| 495 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_COPYcxx . . $ MS3_CMD_COPY., dest_bucket, dest_key, source_bucket, |
| 496 | source_key, 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`!, 0, 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`!); |
| 497 | return res; |
| 498 | } |
| 499 | |
| 500 | uint8_tcxx . . $ uint8_t# ms3_movecxx . . $ ms3_move(5b89988bcf9b7bd9).(ms3_stcxx . . $ ms3_st# *ms3, const char *source_bucket, const char *source_key, |
| 501 | const char *dest_bucket, const char *dest_key) |
| 502 | { |
| 503 | uint8_tcxx . . $ uint8_t# res = 0; |
| 504 | |
| 505 | if (!ms3 || !source_bucket || !source_key || !dest_bucket || !dest_key) |
| 506 | { |
| 507 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 508 | } |
| 509 | |
| 510 | res = ms3_copycxx . . $ ms3_copy(5b89988bcf9b7bd9).(ms3, source_bucket, source_key, dest_bucket, dest_key); |
| 511 | |
| 512 | if (res) |
| 513 | { |
| 514 | return res; |
| 515 | } |
| 516 | |
| 517 | res = ms3_deletecxx . . $ ms3_delete(246a3a9d301f06e2).(ms3, source_bucket, source_key); |
| 518 | |
| 519 | return res; |
| 520 | } |
| 521 | |
| 522 | uint8_tcxx . . $ uint8_t# ms3_deletecxx . . $ ms3_delete(246a3a9d301f06e2).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *key) |
| 523 | { |
| 524 | uint8_tcxx . . $ uint8_t# res; |
| 525 | |
| 526 | if (!ms3 || !bucket || !key) |
| 527 | { |
| 528 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 529 | } |
| 530 | |
| 531 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_DELETEcxx . . $ MS3_CMD_DELETE., bucket, key, 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`!, 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`!, |
| 532 | 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 533 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 534 | return res; |
| 535 | } |
| 536 | |
| 537 | uint8_tcxx . . $ uint8_t# ms3_statuscxx . . $ ms3_status(8ebd5a4b7e3d05dd).(ms3_stcxx . . $ ms3_st# *ms3, const char *bucket, const char *key, |
| 538 | ms3_status_stcxx . . $ ms3_status_st# *status) |
| 539 | { |
| 540 | uint8_tcxx . . $ uint8_t# res; |
| 541 | |
| 542 | if (!ms3 || !bucket || !key || !status) |
| 543 | { |
| 544 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 545 | } |
| 546 | |
| 547 | res = execute_requestcxx . . $ execute_request(1e38ed8c995393b8).(ms3, MS3_CMD_HEADcxx . . $ MS3_CMD_HEAD., bucket, key, 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`!, 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`!, 0, |
| 548 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 549 | status); |
| 550 | return res; |
| 551 | } |
| 552 | |
| 553 | void ms3_list_freecxx . . $ ms3_list_free(6ef619c34cf2eb6a).(ms3_list_stcxx . . $ ms3_list_st# *list) |
| 554 | { |
| 555 | // Deprecated |
| 556 | (void) list; |
| 557 | } |
| 558 | |
| 559 | void ms3_freecxx . . $ ms3_free(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) |
| 560 | { |
| 561 | ms3_cfreecxx . . $ ms3_cfree.(data); |
| 562 | } |
| 563 | |
| 564 | uint8_tcxx . . $ uint8_t# ms3_set_optioncxx . . $ ms3_set_option(4e3fc5dfc50b1941).(ms3_stcxx . . $ ms3_st# *ms3, ms3_set_option_tcxx . . $ ms3_set_option_t# option, void *value) |
| 565 | { |
| 566 | if (!ms3) |
| 567 | { |
| 568 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 569 | } |
| 570 | |
| 571 | switch (option) |
| 572 | { |
| 573 | case MS3_OPT_USE_HTTPcxx . . $ MS3_OPT_USE_HTTP.: |
| 574 | { |
| 575 | ms3->use_httpcxx . . $ ms3_st#use_http. = ms3->use_httpcxx . . $ ms3_st#use_http. ? 0 : 1; |
| 576 | break; |
| 577 | } |
| 578 | |
| 579 | case MS3_OPT_DISABLE_SSL_VERIFYcxx . . $ MS3_OPT_DISABLE_SSL_VERIFY.: |
| 580 | { |
| 581 | ms3->disable_verificationcxx . . $ ms3_st#disable_verification. = ms3->disable_verificationcxx . . $ ms3_st#disable_verification. ? 0 : 1; |
| 582 | break; |
| 583 | } |
| 584 | |
| 585 | case MS3_OPT_NO_CONTENT_TYPEcxx . . $ MS3_OPT_NO_CONTENT_TYPE.: |
| 586 | { |
| 587 | ms3->no_content_typecxx . . $ ms3_st#no_content_type. = ms3->no_content_typecxx . . $ ms3_st#no_content_type. ? 0 : 1; |
| 588 | break; |
| 589 | } |
| 590 | |
| 591 | case MS3_OPT_BUFFER_CHUNK_SIZEcxx . . $ MS3_OPT_BUFFER_CHUNK_SIZE.: |
| 592 | { |
| 593 | size_t new_size; |
| 594 | |
| 595 | if (!value) |
| 596 | { |
| 597 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 598 | } |
| 599 | |
| 600 | new_size = *(size_t *)value; |
| 601 | |
| 602 | if (new_size < 1) |
| 603 | { |
| 604 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 605 | } |
| 606 | |
| 607 | ms3->buffer_chunk_sizecxx . . $ ms3_st#buffer_chunk_size. = new_size; |
| 608 | break; |
| 609 | } |
| 610 | |
| 611 | case MS3_OPT_FORCE_LIST_VERSIONcxx . . $ MS3_OPT_FORCE_LIST_VERSION.: |
| 612 | { |
| 613 | uint8_tcxx . . $ uint8_t# list_version; |
| 614 | |
| 615 | if (!value) |
| 616 | { |
| 617 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 618 | } |
| 619 | |
| 620 | list_version = *(uint8_tcxx . . $ uint8_t# *)value; |
| 621 | |
| 622 | if (list_version < 1 || list_version > 2) |
| 623 | { |
| 624 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 625 | } |
| 626 | |
| 627 | ms3->list_versioncxx . . $ ms3_st#list_version. = list_version; |
| 628 | break; |
| 629 | } |
| 630 | |
| 631 | case MS3_OPT_FORCE_PROTOCOL_VERSIONcxx . . $ MS3_OPT_FORCE_PROTOCOL_VERSION.: |
| 632 | { |
| 633 | uint8_tcxx . . $ uint8_t# protocol_version; |
| 634 | |
| 635 | if (!value) |
| 636 | { |
| 637 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 638 | } |
| 639 | |
| 640 | protocol_version = *(uint8_tcxx . . $ uint8_t# *)value; |
| 641 | |
| 642 | if (protocol_version < 1 || protocol_version > 2) |
| 643 | { |
| 644 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 645 | } |
| 646 | |
| 647 | ms3->protocol_versioncxx . . $ ms3_st#protocol_version. = protocol_version; |
| 648 | break; |
| 649 | } |
| 650 | |
| 651 | case MS3_OPT_PORT_NUMBERcxx . . $ MS3_OPT_PORT_NUMBER.: |
| 652 | { |
| 653 | int port_number; |
| 654 | |
| 655 | if (!value) |
| 656 | { |
| 657 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 658 | } |
| 659 | memcpycxx . . $ memcpy(cc817cb175f282d).(&port_number, (void*)value, sizeof(int)); |
| 660 | |
| 661 | ms3->portcxx . . $ ms3_st#port. = port_number; |
| 662 | break; |
| 663 | } |
| 664 | |
| 665 | case MS3_OPT_READ_CBcxx . . $ MS3_OPT_READ_CB.: |
| 666 | { |
| 667 | if (!value) |
| 668 | { |
| 669 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 670 | } |
| 671 | |
| 672 | ms3->read_cbcxx . . $ ms3_st#read_cb. = value; |
| 673 | break; |
| 674 | } |
| 675 | |
| 676 | case MS3_OPT_USER_DATAcxx . . $ MS3_OPT_USER_DATA.: |
| 677 | { |
| 678 | ms3->user_datacxx . . $ ms3_st#user_data. = value; |
| 679 | break; |
| 680 | } |
| 681 | |
| 682 | case MS3_OPT_CONNECT_TIMEOUTcxx . . $ MS3_OPT_CONNECT_TIMEOUT.: |
| 683 | { |
| 684 | float timeout; |
| 685 | if (!value) |
| 686 | { |
| 687 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 688 | } |
| 689 | timeout = *(float *)value; |
| 690 | if (timeout < 0 || timeout >= UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! / 1000) |
| 691 | { |
| 692 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 693 | } |
| 694 | ms3->connect_timeout_mscxx . . $ ms3_st#connect_timeout_ms. = timeout * 1000; |
| 695 | break; |
| 696 | } |
| 697 | |
| 698 | case MS3_OPT_TIMEOUTcxx . . $ MS3_OPT_TIMEOUT.: |
| 699 | { |
| 700 | float timeout; |
| 701 | if (!value) |
| 702 | { |
| 703 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 704 | } |
| 705 | timeout = *(float *)value; |
| 706 | if (timeout < 0 || timeout >= UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! / 1000) |
| 707 | { |
| 708 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 709 | } |
| 710 | ms3->timeout_mscxx . . $ ms3_st#timeout_ms. = timeout * 1000; |
| 711 | break; |
| 712 | } |
| 713 | |
| 714 | default: |
| 715 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 716 | } |
| 717 | |
| 718 | return 0; |
| 719 | } |
| 720 | |
| 721 | uint8_tcxx . . $ uint8_t# ms3_assume_rolecxx . . $ ms3_assume_role(a44ea76fcb91cc1e).(ms3_stcxx . . $ ms3_st# *ms3) |
| 722 | { |
| 723 | uint8_tcxx . . $ uint8_t# res = 0; |
| 724 | |
| 725 | if (!ms3 || !ms3->iam_rolecxx . . $ ms3_st#iam_role.) |
| 726 | { |
| 727 | return MS3_ERR_PARAMETERcxx . . $ MS3_ERR_PARAMETER.; |
| 728 | } |
| 729 | |
| 730 | if (!strstrcxx . . $ strstr(a713fe7b9a57cf96).(ms3->iam_role_arncxx . . $ ms3_st#iam_role_arn., ms3->iam_rolecxx . . $ ms3_st#iam_role.)) |
| 731 | { |
| 732 | ms3debugcxx . . $ `storage/maria/libmarias3/src/debug.h:28:9`!("Lookup IAM role ARN"); |
| 733 | res = execute_assume_role_requestcxx . . $ execute_assume_role_request(6626a97feb6f8991).(ms3, MS3_CMD_LIST_ROLEcxx . . $ MS3_CMD_LIST_ROLE., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 734 | if(res) |
| 735 | { |
| 736 | return res; |
| 737 | } |
| 738 | |
| 739 | } |
| 740 | ms3debugcxx . . $ `storage/maria/libmarias3/src/debug.h:28:9`!("Assume IAM role"); |
| 741 | res = execute_assume_role_requestcxx . . $ execute_assume_role_request(6626a97feb6f8991).(ms3, MS3_CMD_ASSUME_ROLEcxx . . $ MS3_CMD_ASSUME_ROLE., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 742 | |
| 743 | return res; |
| 744 | } |
| 745 | |
| 746 | void ms3_set_content_typecxx . . $ ms3_set_content_type(b309a059e0336b33).(ms3_stcxx . . $ ms3_st# *ms3, const char *content_type) |
| 747 | { |
| 748 | if (!ms3) |
| 749 | { |
| 750 | return; |
| 751 | } |
| 752 | |
| 753 | ms3->content_type_outcxx . . $ ms3_st#content_type_out. = content_type; |
| 754 | } |
| 755 | |
| 756 | const char *ms3_get_content_typecxx . . $ ms3_get_content_type(e28dd5dd75044808).(ms3_stcxx . . $ ms3_st# *ms3) |
| 757 | { |
| 758 | if (!ms3) |
| 759 | { |
| 760 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 761 | } |
| 762 | return ms3->content_type_incxx . . $ ms3_st#content_type_in.; |
| 763 | } |