From 427aed27427f356a75db3288d7b96ce7e2a044b2 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 11 Jan 2024 19:06:53 +0000 Subject: gentoo auto-resync : 11:01:2024 - 19:06:52 --- net-libs/rabbitmq-c/Manifest | 5 +- ...bitmq-c-0.13.0-read-credentials-from-file.patch | 127 +++++++++++++++++++++ net-libs/rabbitmq-c/metadata.xml | 9 +- net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild | 55 +++++++++ 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 net-libs/rabbitmq-c/files/rabbitmq-c-0.13.0-read-credentials-from-file.patch create mode 100644 net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild (limited to 'net-libs/rabbitmq-c') diff --git a/net-libs/rabbitmq-c/Manifest b/net-libs/rabbitmq-c/Manifest index 0e39bb3b64c7..8947c3c96f71 100644 --- a/net-libs/rabbitmq-c/Manifest +++ b/net-libs/rabbitmq-c/Manifest @@ -1,3 +1,6 @@ +AUX rabbitmq-c-0.13.0-read-credentials-from-file.patch 4241 BLAKE2B 7643d57b94b5ec340dfdb1a886ab7e8a3a5b29cf2e17efd27a29d85adfd67d892c520b91799f4dcdc6959fda1361583364509fdd366abac16aeaba56aefdbc98 SHA512 64b143f6ea985dcaf9a847b3b973ea1a7a9fd9e77271f874b010b3fa59e74e283c1083904288fd3cc1e6767912e2e8a8bbcae10aa6769fa50fd905a29f386300 DIST rabbitmq-c-0.11.0.tar.gz 145638 BLAKE2B dce862d132d4bca010dbc284957f34a35d55407ea0eb4fb79369f699207c01cc7ed64c1bd58bea2d1178bd2c02176c3e93b66177fc975175b1da9ab9baaf661f SHA512 0c3dbb6e2b862e9f25e3f76df798ea272bbd81de2865950b95adf1f1e5791eb20d7c9d5a76cb7d2fda54bad5f12bdf69cbfa7e9fd1afdede6f9ec729ca2287de +DIST rabbitmq-c-0.13.0.tar.gz 126670 BLAKE2B dbb759bfb21cdce532bb770fecc21e18881da198f55278301143e9d4a0f070f58c00e4cadab71c6b4a0b91f198a1fd66cc405f518d52972cf68c0ef33ee2176c SHA512 a93c104846b7d004c97019f81879db4daf747fd29ee6f4feaf287302c0f24d5d34d8c7bc232805ccabf105fd1aa6dfcb88218236bb6bb33cebf64ec9e3dcd77c EBUILD rabbitmq-c-0.11.0.ebuild 1286 BLAKE2B beae7e19f65fa4260410fab82d0b15a2dfdec12589a4eb29132cd79a2059858105c42bd013c1dca736a03f869ce5d2c1fccd55d1d6462f34d98151cd6d283076 SHA512 7e5272781de1477a477780d8beb75a3f62e4b9de412bd4c29558d57b175000e4d2dc09c74b85030d799d40efb59668ceda38d862e2dd87b996cfe5f6cfb5dc18 -MISC metadata.xml 335 BLAKE2B b2cff371cbfbcd9eaeed0d85b658ab9df7fe669dec9e679f0155c31e794afb76a2592bc0a575eea231beeaac51cb5707c1ac0c593631f0e3e04cdb8a2e872a19 SHA512 68639ae3aed6e2846355f5690d7aa4d4af2d94078b489beb972b23eeef2e9bf62c99529c9580e6b88e857d47e82c4896e5e9fb7ed6ecf8f03135d8cd702d4f0c +EBUILD rabbitmq-c-0.13.0.ebuild 1321 BLAKE2B 99c751c9ef4275542a69a8ad268444f853dd8686d1d049c166e8ab52f61a6d2392e2f4d869f0025097cfe8c93412919ca2590ea92353b61200a80c120fa59439 SHA512 b8b28cebfd2d0763b9be300fb60f0b633a377def32f3e0a1c96fb10edb9de2d1103f3ea5aae2335f93769f909c7316689b6c4fe33f87446649e535e942908199 +MISC metadata.xml 559 BLAKE2B 4d90132455a2ebec576c99568628ef8990be9cc378d6eb0626929f7c6f321dd2f82280f9333da35cba64bc079ced417b88423efe780f445eb73325b71bce45c8 SHA512 7053f4dd3049af2fe7121abbf32fd448e2e310a827dd40e48deabbe324a9f4767820b5e1e834e9d9e8496ff16bb145557dcad40bb556cb0d56b1446300db366d diff --git a/net-libs/rabbitmq-c/files/rabbitmq-c-0.13.0-read-credentials-from-file.patch b/net-libs/rabbitmq-c/files/rabbitmq-c-0.13.0-read-credentials-from-file.patch new file mode 100644 index 000000000000..363068139adf --- /dev/null +++ b/net-libs/rabbitmq-c/files/rabbitmq-c-0.13.0-read-credentials-from-file.patch @@ -0,0 +1,127 @@ +From 463054383fbeef889b409a7f843df5365288e2a0 Mon Sep 17 00:00:00 2001 +From: Christian Kastner +Date: Tue, 13 Jun 2023 14:21:52 +0200 +Subject: [PATCH] Add option to read username/password from file (#781) + +* Add option to read username/password from file +--- + tools/common.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 66 insertions(+) + +diff --git a/tools/common.c b/tools/common.c +index 73b47e25..7efe557b 100644 +--- a/tools/common.c ++++ b/tools/common.c +@@ -18,6 +18,11 @@ + #include "compat.h" + #endif + ++/* For when reading auth data from a file */ ++#define MAXAUTHTOKENLEN 128 ++#define USERNAMEPREFIX "username:" ++#define PASSWORDPREFIX "password:" ++ + void die(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); +@@ -125,6 +130,7 @@ static char *amqp_vhost; + static char *amqp_username; + static char *amqp_password; + static int amqp_heartbeat = 0; ++static char *amqp_authfile; + #ifdef WITH_SSL + static int amqp_ssl = 0; + static char *amqp_cacert = "/etc/ssl/certs/cacert.pem"; +@@ -147,6 +153,8 @@ struct poptOption connect_options[] = { + "the password to login with", "password"}, + {"heartbeat", 0, POPT_ARG_INT, &amqp_heartbeat, 0, + "heartbeat interval, set to 0 to disable", "heartbeat"}, ++ {"authfile", 0, POPT_ARG_STRING, &amqp_authfile, 0, ++ "path to file containing username/password for authentication", "file"}, + #ifdef WITH_SSL + {"ssl", 0, POPT_ARG_NONE, &amqp_ssl, 0, "connect over SSL/TLS", NULL}, + {"cacert", 0, POPT_ARG_STRING, &amqp_cacert, 0, +@@ -158,6 +166,50 @@ struct poptOption connect_options[] = { + #endif /* WITH_SSL */ + {NULL, '\0', 0, NULL, 0, NULL, NULL}}; + ++void read_authfile(const char *path) { ++ size_t n; ++ FILE *fp = NULL; ++ char token[MAXAUTHTOKENLEN]; ++ ++ if ((amqp_username = malloc(MAXAUTHTOKENLEN)) == NULL || ++ (amqp_password = malloc(MAXAUTHTOKENLEN)) == NULL) { ++ die("Out of memory"); ++ } else if ((fp = fopen(path, "r")) == NULL) { ++ die("Could not read auth data file %s", path); ++ } ++ ++ if (fgets(token, MAXAUTHTOKENLEN, fp) == NULL || ++ strncmp(token, USERNAMEPREFIX, strlen(USERNAMEPREFIX))) { ++ die("Malformed auth file (missing username)"); ++ } ++ strncpy(amqp_username, &token[strlen(USERNAMEPREFIX)], MAXAUTHTOKENLEN); ++ /* Missing newline means token was cut off */ ++ n = strlen(amqp_username); ++ if (amqp_username[n - 1] != '\n') { ++ die("Username too long"); ++ } else { ++ amqp_username[n - 1] = '\0'; ++ } ++ ++ if (fgets(token, MAXAUTHTOKENLEN, fp) == NULL || ++ strncmp(token, PASSWORDPREFIX, strlen(PASSWORDPREFIX))) { ++ die("Malformed auth file (missing password)"); ++ } ++ strncpy(amqp_password, &token[strlen(PASSWORDPREFIX)], MAXAUTHTOKENLEN); ++ /* Missing newline means token was cut off */ ++ n = strlen(amqp_password); ++ if (amqp_password[n - 1] != '\n') { ++ die("Password too long"); ++ } else { ++ amqp_password[n - 1] = '\0'; ++ } ++ ++ (void)fgetc(fp); ++ if (!feof(fp)) { ++ die("Malformed auth file (trailing data)"); ++ } ++} ++ + static void init_connection_info(struct amqp_connection_info *ci) { + ci->user = NULL; + ci->password = NULL; +@@ -237,6 +289,8 @@ static void init_connection_info(struct amqp_connection_info *ci) { + if (amqp_username) { + if (amqp_url) { + die("--username and --url options cannot be used at the same time"); ++ } else if (amqp_authfile) { ++ die("--username and --authfile options cannot be used at the same time"); + } + + ci->user = amqp_username; +@@ -245,11 +299,23 @@ static void init_connection_info(struct amqp_connection_info *ci) { + if (amqp_password) { + if (amqp_url) { + die("--password and --url options cannot be used at the same time"); ++ } else if (amqp_authfile) { ++ die("--password and --authfile options cannot be used at the same time"); + } + + ci->password = amqp_password; + } + ++ if (amqp_authfile) { ++ if (amqp_url) { ++ die("--authfile and --url options cannot be used at the same time"); ++ } ++ ++ read_authfile(amqp_authfile); ++ ci->user = amqp_username; ++ ci->password = amqp_password; ++ } ++ + if (amqp_vhost) { + if (amqp_url) { + die("--vhost and --url options cannot be used at the same time"); diff --git a/net-libs/rabbitmq-c/metadata.xml b/net-libs/rabbitmq-c/metadata.xml index 0fed8249ebef..e7e3e0b1837d 100644 --- a/net-libs/rabbitmq-c/metadata.xml +++ b/net-libs/rabbitmq-c/metadata.xml @@ -1,7 +1,14 @@ - + + prathamIN@proton.me + Pratham K + + + proxy-maint@gentoo.org + Proxy Maintainers + Builds cli tools to interact with brokers diff --git a/net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild b/net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild new file mode 100644 index 000000000000..01d68044d959 --- /dev/null +++ b/net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild @@ -0,0 +1,55 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +DESCRIPTION="RabbitMQ C client" +HOMEPAGE="https://github.com/alanxz/rabbitmq-c" + +if [[ ${PV} == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/alanxz/${PN}.git" +else + SRC_URI="https://github.com/alanxz/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +fi + +LICENSE="MIT" +SLOT="0/4" +IUSE="doc test +ssl static-libs tools" + +REQUIRED_USE="test? ( static-libs )" + +RESTRICT="!test? ( test )" + +RDEPEND="ssl? ( dev-libs/openssl:0= ) + tools? ( dev-libs/popt )" +DEPEND="${RDEPEND}" +BDEPEND="doc? ( app-doc/doxygen ) + tools? ( app-text/xmlto )" + +PATCHES=( + "${FILESDIR}"/${P}-read-credentials-from-file.patch +) + +src_configure() { + local mycmakeargs=( + -DBUILD_API_DOCS=$(usex doc) + -DBUILD_STATIC_LIBS=$(usex static-libs) + -DBUILD_TESTING=$(usex test) + -DBUILD_TOOLS=$(usex tools) + -DBUILD_TOOLS_DOCS=$(usex tools) + -DENABLE_SSL_SUPPORT=$(usex ssl) + ) + cmake_src_configure +} + +src_test() { + pushd "${BUILD_DIR}" > /dev/null || die + + # Skip "basic" test which requires running local rabbitmq-server instance, + # see https://github.com/alanxz/rabbitmq-c/issues/530 + ctest -v -E basic || die +} -- cgit v1.2.3