diff options
author | 2023-10-08 19:07:13 +0530 | |
---|---|---|
committer | 2024-01-11 15:51:36 +0200 | |
commit | 2386f8510c14ce4692881c280dbf4491a5bb6528 (patch) | |
tree | 4e913f6f8d50bd602e47277a7135efb77f6bbb11 /net-libs | |
parent | media-gfx/tuxpaint: add 0.9.31 (diff) | |
download | gentoo-2386f8510c14ce4692881c280dbf4491a5bb6528.tar.gz gentoo-2386f8510c14ce4692881c280dbf4491a5bb6528.tar.bz2 gentoo-2386f8510c14ce4692881c280dbf4491a5bb6528.zip |
net-libs/rabbitmq-c: add 0.13.0
Bug: https://bugs.gentoo.org/908818
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'net-libs')
-rw-r--r-- | net-libs/rabbitmq-c/Manifest | 1 | ||||
-rw-r--r-- | net-libs/rabbitmq-c/files/rabbitmq-c-0.13.0-read-credentials-from-file.patch | 127 | ||||
-rw-r--r-- | net-libs/rabbitmq-c/rabbitmq-c-0.13.0.ebuild | 55 |
3 files changed, 183 insertions, 0 deletions
diff --git a/net-libs/rabbitmq-c/Manifest b/net-libs/rabbitmq-c/Manifest index 180421fdfa07..9bf1cf690b28 100644 --- a/net-libs/rabbitmq-c/Manifest +++ b/net-libs/rabbitmq-c/Manifest @@ -1 +1,2 @@ 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 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 <ckk@kvr.at> +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/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 +} |