diff --git a/external/libcurl/Makefile.autosetup b/external/libcurl/Makefile.autosetup index 892fb0ebc..7c6d7da82 100644 --- a/external/libcurl/Makefile.autosetup +++ b/external/libcurl/Makefile.autosetup @@ -1,127 +1,128 @@ include @builddir@/mk/defs.mk LIB= curl .PATH: $(top_srcdir)/external/curl/lib VPATH= $(top_srcdir)/external/curl/lib .PATH: $(top_srcdir)/external/curl/lib/curlx VPATH+= $(top_srcdir)/external/curl/lib/curlx .PATH: $(top_srcdir)/external/curl/lib/vtls VPATH+= $(top_srcdir)/external/curl/lib/vtls .PATH: $(top_srcdir)/external/curl/lib/vauth VPATH+= $(top_srcdir)/external/curl/lib/vauth .PATH: $(top_srcdir)/external/curl/lib/vquic VPATH+= $(top_srcdir)/external/curl/lib/vquic SRCS= \ version.c \ asyn-base.c \ asyn-thrdd.c \ base64.c \ bufref.c \ cf-https-connect.c \ cf-socket.c \ cfilters.c \ conncache.c \ connect.c \ content_encoding.c \ cookie.c \ curl_addrinfo.c \ curl_fopen.c \ curl_get_line.c \ curl_threads.c \ curl_trc.c \ dynbuf.c \ easy.c \ easygetopt.c \ easyoptions.c \ escape.c \ fopen.c \ formdata.c \ getenv.c \ getinfo.c \ hash.c \ headers.c \ hostip.c \ hostip4.c \ hostip6.c \ hsts.c \ http_chunks.c \ http_proxy.c \ http.c \ idn.c \ if2ip.c \ llist.c \ macos.c \ mime.c \ mprintf.c \ multi.c \ multi_ntfy.c \ netrc.c \ nonblock.c \ noproxy.c \ parsedate.c \ progress.c \ rand.c \ rename.c \ select.c \ sendf.c \ setopt.c \ share.c \ slist.c \ socks.c \ speedcheck.c \ splay.c \ strcase.c \ strdup.c \ strerr.c \ strerror.c \ strparse.c \ timeval.c \ transfer.c \ url.c \ urlapi.c \ warnless.c \ vtls.c \ vtls_scache.c \ openssl.c \ keylog.c \ + curl_memrchr.c \ hostcheck.c \ vauth.c \ vquic.c \ bufq.c \ cf-h1-proxy.c \ cf-h2-proxy.c \ cf-haproxy.c \ cf-ip-happy.c \ dynhds.c \ http1.c \ http_digest.c \ http_aws_sigv4.c \ digest.c \ sha256.c \ md5.c \ hmac.c \ altsvc.c \ curl_sha512_256.c \ cw-out.c \ request.c \ socketpair.c \ timediff.c \ uint-table.c \ uint-bset.c \ uint-spbset.c \ uint-hash.c \ cshutdn.c \ multi_ev.c \ cw-pause.c \ strequal.c \ wait.c LOCAL_CFLAGS= -DHAVE_CONFIG_H \ -DBUILDING_LIBCURL \ -I$(top_srcdir)/external/libcurl \ -I$(top_builddir)/external/libcurl \ -I$(top_srcdir)/external/curl/lib \ -I$(top_srcdir)/external/curl/include include $(MK)/static-lib.mk diff --git a/external/libcurl/curl_config.h b/external/libcurl/curl_config.h index 6454984d1..4c8937a6c 100644 --- a/external/libcurl/curl_config.h +++ b/external/libcurl/curl_config.h @@ -359,199 +359,201 @@ /* Define to 1 if you have a IPv6 capable working inet_pton function. */ #define HAVE_INET_PTON 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the ioctl function. */ #define HAVE_IOCTL 1 /* Define to 1 if you have the ioctlsocket function. */ /* #undef HAVE_IOCTLSOCKET */ /* Define to 1 if you have the IoctlSocket camel case function. */ /* #undef HAVE_IOCTLSOCKET_CAMEL */ /* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */ /* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ /* Define to 1 if you have a working ioctlsocket FIONBIO function. */ /* #undef HAVE_IOCTLSOCKET_FIONBIO */ /* Define to 1 if you have a working ioctl FIONBIO function. */ #define HAVE_IOCTL_FIONBIO 1 /* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ #define HAVE_IOCTL_SIOCGIFADDR 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_IO_H */ /* Define to 1 if you have the lber.h header file. */ /* #undef HAVE_LBER_H */ /* Define to 1 if you have the ldap.h header file. */ /* #undef HAVE_LDAP_H */ /* Define to 1 if you have the `ldap_init_fd' function. */ /* #undef HAVE_LDAP_INIT_FD */ /* Use LDAPS implementation */ /* #undef HAVE_LDAP_SSL */ /* Define to 1 if you have the ldap_ssl.h header file. */ /* #undef HAVE_LDAP_SSL_H */ /* Define to 1 if you have the `ldap_url_parse' function. */ /* #undef HAVE_LDAP_URL_PARSE */ /* Define to 1 if you have the `brotlidec' library (-lbrotlidec). */ /* #undef HAVE_LIBBROTLIDEC */ /* Define to 1 if you have the header file. */ #define HAVE_LIBGEN_H 1 /* Define to 1 if you have the `idn2' library (-lidn2). */ /* #undef HAVE_LIBIDN2 */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBPSL_H */ /* Define to 1 if using libressl. */ /* #undef HAVE_LIBRESSL */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBRTMP_RTMP_H */ /* Define to 1 if you have the `ssh' library (-lssh). */ /* #undef HAVE_LIBSSH */ /* Define to 1 if you have the `ssh2' library (-lssh2). */ /* #undef HAVE_LIBSSH2 */ /* Define to 1 if you have the `ssl' library (-lssl). */ #define HAVE_LIBSSL 1 /* Define to 1 if you have the `wolfssh' library (-lwolfssh). */ /* #undef HAVE_LIBWOLFSSH */ /* if zlib is available */ #define HAVE_LIBZ 1 /* Define to 1 if you have the `zstd' library (-lzstd). */ /* #undef HAVE_LIBZSTD */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LINUX_TCP_H */ /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if the compiler supports the 'long long' data type. */ #define HAVE_LONGLONG 1 /* Define to 1 if you have the `mach_absolute_time' function. */ /* #undef HAVE_MACH_ABSOLUTE_TIME */ /* Define to 1 if you have the memrchr function or macro. */ +#if !defined(__APPLE__) #define HAVE_MEMRCHR 1 +#endif /* Define to 1 if you have the MSG_NOSIGNAL flag. */ #define HAVE_MSG_NOSIGNAL 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MSH3_H */ /* Define to 1 if you have the header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_NETINET_IN6_H */ /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_TCP_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_UDP_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_NGHTTP2_NGHTTP2_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NGHTTP3_NGHTTP3_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NGTCP2_NGTCP2_CRYPTO_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_NGTCP2_NGTCP2_H */ /* if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE */ /* #undef HAVE_OLD_GSSMIT */ /* if you have opendir */ #define HAVE_OPENDIR 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_CRYPTO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_ERR_H 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_PEM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_RSA_H 1 /* if you have the functions SSL_CTX_set_srp_username and SSL_CTX_set_srp_password */ #define HAVE_OPENSSL_SRP 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_SSL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_X509_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_PEM_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have a working POSIX-style strerror_r function. */ #define HAVE_POSIX_STRERROR_R 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_PROTO_BSDSOCKET_H */ /* if you have */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the header file. */ #define HAVE_PWD_H 1 /* Define to 1 if you have the `quiche_conn_set_qlog_fd' function. */ /* #undef HAVE_QUICHE_CONN_SET_QLOG_FD */ /* Define to 1 if you have the header file. */ /* #undef HAVE_QUICHE_H */ /* Define to 1 if you have the recv function. */ #define HAVE_RECV 1 diff --git a/libpkg/pkg.h.in b/libpkg/pkg.h.in index 939a12849..fbf7e297b 100644 --- a/libpkg/pkg.h.in +++ b/libpkg/pkg.h.in @@ -1,149 +1,155 @@ /*- * Copyright (c) 2011-2024 Baptiste Daroussin * Copyright (c) 2011-2012 Julien Laffaye * Copyright (c) 2011 Will Andrews * Copyright (c) 2011 Philippe Pepiot * Copyright (c) 2011-2012 Marin Atanasov Nikolov * Copyright (c) 2013-2014 Matthew Seaman * Copyright (c) 2014-2016 Vsevolod Stakhov * Copyright (c) 2023-2024 Serenity Cyber Security, LLC * Author: Gleb Popov * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _PKG_H #define _PKG_H #ifdef __cplusplus extern "C" { #define restrict #endif #include #include #include #include #include #include #include +#if defined(__APPLE__) +#define st_mtim st_mtimespec +#define st_atim st_atimespec +#define st_ctim st_ctimespec +#endif + /* The expected name of the pkg(8) binary executable. */ #ifndef PKG_EXEC_NAME #define PKG_EXEC_NAME "pkg" #endif /* The expected name of the pkg-static(8) binary */ #ifndef PKG_STATIC_NAME #define PKG_STATIC_NAME "pkg-static" #endif #define PKGVERSION "@VERSION@" /* PORTVERSION equivalent for proper pkg-static->ports-mgmt/pkg * version comparison in pkgdb_query_newpkgversion() */ #define PKG_PORTVERSION "@VERSION@" /* The OS major version at the time of compilation */ #ifdef __FreeBSD__ #define OSMAJOR __FreeBSD__ #endif /* Not supported under DragonFly */ #ifdef __DragonFly__ #undef OSMAJOR #endif #ifdef __NetBSD_Version__ #define OSMAJOR ((__NetBSD_Version__ + 1000000) / 100000000) #endif #ifndef __DECONST #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #endif #ifndef NELEM #define NELEM(array) (sizeof(array) / sizeof((array)[0])) #endif #ifndef STREQ #define STREQ(s1, s2) (strcmp(s1, s2) == 0) #endif #ifndef STRIEQ #define STRIEQ(s1, s2) (strcasecmp(s1, s2) == 0) #endif /* Special exit status for worker processes indicating that a restart * is desired -- eg. after a child has updated pkg(8) itself. */ #define EX_NEEDRESTART 4 struct iovec; struct pkg; struct pkg_dep; struct pkg_conflict; struct pkg_file; struct pkg_dir; struct pkg_option; struct pkg_license; struct pkg_config_file; struct pkg_create; struct pkg_repo_create; struct pkgdb; struct pkgdb_it; struct pkg_jobs; struct pkg_solve_problem; struct pkg_key; struct pkg_repo; struct pkg_plugin; struct pkg_manifest_parser; struct pkg_base; typedef struct ucl_object_s pkg_object; typedef void * pkg_iter; struct pkg_kv { char *key; char *value; }; typedef vec_t(struct pkg_kv *) pkg_kvl_t; /** * The system-wide pkg(8) status: ie. is it a) installed or otherwise * available on the sysem, b) database (local.sqlite) initialised and * c) has at least one package installed (which should be pkg * itself). PKG_STATUS_UNINSTALLED logically cannot be returned by * pkg(8) itself, but it can be useful for the pkg bootstrapper * /usr/bin/pkg or for applications that link against libpkg.so diff --git a/libpkg/private/pkg.h b/libpkg/private/pkg.h index c7d23ff20..65e1e314d 100644 --- a/libpkg/private/pkg.h +++ b/libpkg/private/pkg.h @@ -537,208 +537,222 @@ struct pkg_repo { void *fetch_priv; bool silent; pkghash *trusted_fp; pkghash *revoked_fp; struct { int in; int out; pid_t pid; } sshio; struct pkg_repo_meta *meta; bool enable; unsigned int priority; ip_version_t ip; kvlist_t env; int dfd; char *dbpath; /* Opaque repository data */ void *priv; struct pkg_repo *next, *prev; }; typedef vec_t(struct action *) actions_t; struct keyword { char *keyword; actions_t actions; }; struct plist { char last_file[MAXPATHLEN]; const char *stage; int stagefd; bool in_include; int plistdirfd; char prefix[MAXPATHLEN]; xstring *pre_install_buf; xstring *post_install_buf; xstring *pre_deinstall_buf; xstring *post_deinstall_buf; struct pkg *pkg; char *uname; char *gname; const char *slash; int64_t flatsize; hardlinks_t hardlinks; mode_t perm; pkghash *keywords; kvlist_t variables; }; struct file_attr { char *owner; char *group; mode_t mode; u_long fflags; }; struct action { int (*perform)(struct plist *, char *, struct file_attr *); }; /* sql helpers */ typedef struct _sql_prstmt { sqlite3_stmt *stmt; const char *sql; } sql_prstmt; #define STMT(x) (sql_prepared_statements[(x)].stmt) #define SQL(x) (sql_prepared_statements[(x)].sql) typedef enum { ARG_TEXT, ARG_INT64, } arg_type_t; typedef struct { arg_type_t type; union { const char *text; int64_t i64; } v; } sql_arg_t; static inline sql_arg_t make_text_arg(const char *s) { sql_arg_t a = { .type = ARG_TEXT, .v.text = s }; return (a); } static inline sql_arg_t make_int64_arg(int64_t i) { sql_arg_t a = { .type = ARG_INT64, .v.i64 = i }; return (a); } -#define SQL_ARG(x) _Generic((x), \ +#if !defined(__APPLE__) + #define SQL_ARG(x) _Generic((x), \ const char *: make_text_arg, \ char *: make_text_arg, \ int64_t: make_int64_arg, \ u_long: (sql_arg_t(*)(int64_t))make_int64_arg, \ int: (sql_arg_t(*)(int64_t))make_int64_arg, \ bool: (sql_arg_t(*)(int64_t))make_int64_arg, \ u_int: (sql_arg_t(*)(int64_t))make_int64_arg, \ u_short: (sql_arg_t(*)(int64_t))make_int64_arg \ )(x) +#else + #define SQL_ARG(x) _Generic((x), \ + const char *: make_text_arg, \ + char *: make_text_arg, \ + int64_t: make_int64_arg, \ + long: (sql_arg_t(*)(int64_t))make_int64_arg, \ + u_long: (sql_arg_t(*)(int64_t))make_int64_arg, \ + int: (sql_arg_t(*)(int64_t))make_int64_arg, \ + bool: (sql_arg_t(*)(int64_t))make_int64_arg, \ + u_int: (sql_arg_t(*)(int64_t))make_int64_arg, \ + u_short: (sql_arg_t(*)(int64_t))make_int64_arg \ + )(x) +#endif /** * rc script actions */ typedef enum { PKG_RC_START = 0, PKG_RC_STOP } pkg_rc_attr; /** * Remove and unregister the package. * @param pkg An installed package to delete * @param rpkg A package which will replace pkg, or NULL * @param db An opened pkgdb * @return An error code. */ int pkg_delete(struct pkg *pkg, struct pkg *rpkg, struct pkgdb *db, int flags, struct triggers *); #define PKG_DELETE_UPGRADE (1 << 1) /* delete as a split upgrade */ #define PKG_DELETE_NOSCRIPT (1 << 2) /* don't run delete scripts */ #define PKG_DELETE_NOEXEC (1 << 3) /* don't run delete scripts which execute things*/ #define PKG_DELETE_KEEPFILES (1 << 4) /* don't delete files */ int pkg_fetch_file_to_fd(struct pkg_repo *repo, int dest, struct fetch_item *, bool silent); int pkg_repo_open(struct pkg_repo *repo); int pkg_repo_fetch_package(struct pkg *pkg); int pkg_repo_mirror_package(struct pkg *pkg, const char *destdir); int pkg_repo_fetch_remote_extract_fd(struct pkg_repo *repo, struct pkg_repo_content *); int pkg_repo_meta_dump_fd(struct pkg_repo_meta *target, const int fd); int pkg_repo_fetch_meta(struct pkg_repo *repo, time_t *t); int pkg_repo_fetch_remote_extract_fd(struct pkg_repo *repo, struct pkg_repo_content *); int pkg_repo_fetch_data_fd(struct pkg_repo *repo, struct pkg_repo_content *); struct pkg_repo_meta *pkg_repo_meta_default(void); int pkg_repo_meta_load(const int fd, struct pkg_repo_meta **target); void pkg_repo_meta_free(struct pkg_repo_meta *meta); ucl_object_t * pkg_repo_meta_to_ucl(struct pkg_repo_meta *meta); bool pkg_repo_meta_is_special_file(const char *file, struct pkg_repo_meta *meta); bool pkg_repo_meta_is_old_file(const char *file, struct pkg_repo_meta *meta); typedef enum { HASH_UNKNOWN, HASH_SHA256, HASH_BLAKE2 } hash_t; struct fingerprint { hash_t type; char hash[BUFSIZ]; }; int pkg_repo_load_fingerprints(struct pkg_repo *repo); int pkg_start_stop_rc_scripts(struct pkg *, pkg_rc_attr attr); int pkg_script_run(struct pkg *, pkg_script type, bool upgrade, bool noexec); int pkg_lua_script_run(struct pkg *, pkg_lua_script type, bool upgrade); ucl_object_t *pkg_lua_script_to_ucl(charv_t *); int pkg_script_run_child(int pid, int *pstat, int inputfd, const char* script_name); int pkg_open2(struct pkg **p, struct archive **a, struct archive_entry **ae, const char *path, int flags, int fd); int pkg_validate(struct pkg *pkg, struct pkgdb *db); void pkg_list_free(struct pkg *, pkg_list); struct pkg_kv *pkg_kv_new(const char *key, const char *val); void pkg_kv_free(struct pkg_kv *); struct pkg_kv *pkg_kv_search(kvlist_t *, char *); void pkg_kv_sort(kvlist_t *); DEFINE_VEC_INSERT_SORTED_PROTO(kvlist_t, pkg_kv, struct pkg_kv *); void pkg_dep_free(struct pkg_dep *); void pkg_file_free(struct pkg_file *); void pkg_option_free(struct pkg_option *); void pkg_conflict_free(struct pkg_conflict *); void pkg_config_file_free(struct pkg_config_file *); struct iovec; struct packing; int packing_init(struct packing **pack, const char *path, pkg_formats format, int clevel, int threads, time_t timestamp, bool overwrite); int packing_append_file_attr(struct packing *pack, const char *filepath, const char *newpath, const char *uname, const char *gname, mode_t perm, u_long fflags); int packing_append_iovec(struct packing *pack, const char *buffer, struct iovec *iov, int niov); int packing_append_buffer(struct packing *pack, const char *buffer, const char *path, int size); void packing_get_filename(struct packing *pack, const char *filename); void packing_finish(struct packing *pack); pkg_formats packing_format_from_string(const char *str); const char* packing_format_to_string(pkg_formats format); bool packing_is_valid_format(const char *str); int pkg_delete_files(struct pkgdb *db, struct pkg *pkg, struct pkg *rpkg, int flags, struct triggers *t);