From patchwork Sat Aug 15 13:06:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5242 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:798a:b0:87d:ab56:3700 with SMTP id o10csp872741maz; Sat, 15 Aug 2026 06:07:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AHgh+RqNuXRaWQFJeGGy3Ir7usV+zFqek687dQJTjYg8an06D89caztqBw8MFGTOfv08RdA86Mw61j0aWPs=@openvpn.net X-Received: by 2002:a05:6870:2807:b0:45e:e283:c71f with SMTP id 586e51a60fabf-45ee283f89emr574929fac.0.1786799233004; Sat, 15 Aug 2026 06:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1786799232; cv=none; d=google.com; s=arc-20260327; b=HYCFyNdD4bnBFg0vzqbxcilz6a6kReP11XREOsEkthrMPNxXor1JJ/rldfUDKTYli+ UTI6eHYqOE82in/VOh3Q4knFcWOsf4L0L08WpEX6vYeOufbYdCEUMbFFVs/gsyrSKnV2 P0YQFh0FJmyoB389bdNGxhwBhq69NwoHYZY27j60I7+VJbzKibeQ7CVmNTCa9dokdBtV JDxT7YRq+dmAFGwv5N9jjj59s2x4Y46Ta5nkMj8JF7FRI6ZDVFkgmgtYJ/XVphdDwENr 2ywJ11TVJRNgwnyYoJat3/MzWGbpxvLdp2j95z9AMMAIM/yZ3V1Ly0qjVlAbsIS6tElh NA2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=rkuvwTprE24fJNghi4ZBVGoXmVdkyqtzK8056YxkOMA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Xrw7kw75GTNmdOzArrPlkDC/y0CNe/51xhsahEeYdfnEnutVrMf6n2um/srjIthrax 1v91+V6JcAjo7ZzZEjOU1rj6q+LZb0csX1TSh9Q4p9W2ObP8G8aI9zkVy3bnkcLMA6Uc /dV9RTC6Wt+GSC8jQ4SUEEaw1ZP/kGsM5reW74M7gSibtOuWAcKSsvToh2mF3PlQeLpT Lj5wGfkIzXCAYQ1Vqa99EN11bwdovzQ1DD1FcozQDL3LntfEUJXlBuUosBwJZlQCgMq4 tLdwcZDGKJvD2rGHNj8GkysUibYkp2uD+lQ6PidMOyShKrC/pbFCDYw1IygLAtGZIpm/ fKOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Z2vJKQmw; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kyYoT6gg; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Gch9gs7L; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-45e8f909fbbsi6651992fac.61.2026.08.15.06.07.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Aug 2026 06:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Z2vJKQmw; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kyYoT6gg; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Gch9gs7L; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rkuvwTprE24fJNghi4ZBVGoXmVdkyqtzK8056YxkOMA=; b=Z2vJKQmwCdNKdXDsY0ItgqZD2p cScirOYM1fxO3bj/3wKfuIiKipG27iDjZgWhvIrfDld7gMvNpZ2dfNQ7H5KcCF19vQ1irPNWtPf9Q MrmTPuh3zkdatKyzES1/NClKSrj4Gn7x7pKrZzbrxzG8KwaKVsShe28kKPeBFb1Mkc7Y=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wvE6P-0005tY-Sg; Sat, 15 Aug 2026 13:07:09 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wvE6N-0005tM-Tr for openvpn-devel@lists.sourceforge.net; Sat, 15 Aug 2026 13:07:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gllhWvfh7w3BKPSYBNXOQwggUO8qGnC0x554PTpqb6k=; b=kyYoT6ggN++D8dHorWm9ytjI6M 7NyTNevyFHs4/DhBUiK+xt9JgCzl7uYEQMu065WOXFBQQiGGh2X2hjcgEWVRVnrpheofgN/71kk7z ug02oCo0hAeJp98FAEF1G6204pnveypFa2SJvMO0ZwKNtN9FCDfe4TntI63tRyxCArdE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gllhWvfh7w3BKPSYBNXOQwggUO8qGnC0x554PTpqb6k=; b=Gch9gs7LgppsdF75BWKgAIay7S hk/YxV/Zn8p5W/w8jTVXiwVMI4atyjT+oB+oBBnIjjrdbz/GShcdqBPBX3xEqRqZr9sOApADl1/o8 6z6xf76Zs0wz+zZdxdQjh04RRlD/3L08sDIb6ZWR5TaYkRiodP8bkeKkNyNpZa7jLTJA=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wvE6Q-00006l-HG for openvpn-devel@lists.sourceforge.net; Sat, 15 Aug 2026 13:07:07 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 67FD70xk020292 for ; Sat, 15 Aug 2026 15:07:00 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 67FD70vA020291 for openvpn-devel@lists.sourceforge.net; Sat, 15 Aug 2026 15:07:00 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sat, 15 Aug 2026 15:06:53 +0200 Message-ID: <20260815130700.20272-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld buffer seems to be where we collect string utility functions, so move them out of options. Change-Id: I09ad0d9baaa7351eecb5aafdb5c6e7b47cf7c909 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/o [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1wvE6Q-00006l-HG Subject: [Openvpn-devel] [PATCH v2] options: Move string utility functions to buffer X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1873594792362667648 X-GMAIL-MSGID: 1873594792362667648 From: Frank Lichtenheld buffer seems to be where we collect string utility functions, so move them out of options. Change-Id: I09ad0d9baaa7351eecb5aafdb5c6e7b47cf7c909 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1775 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1775 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 2f4d037..6531f3e 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -1142,6 +1142,38 @@ } bool +string_defined_equal(const char *s1, const char *s2) +{ + if (s1 && s2) + { + return !strcmp(s1, s2); + } + else + { + return false; + } +} + +char * +string_substitute(const char *src, char from, char to, struct gc_arena *gc) +{ + char *ret = (char *)gc_malloc(strlen(src) + 1, true, gc); + char *dest = ret; + char c; + + do + { + c = *src++; + if (c == from) + { + c = to; + } + *dest++ = c; + } while (c); + return ret; +} + +bool checked_snprintf(char *str, size_t size, const char *format, ...) { va_list arglist; diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 9bdb36a..2776bfc 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -952,6 +952,9 @@ return 0 == strncmp(str, prefix, strlen(prefix)); } +bool string_defined_equal(const char *s1, const char *s2); +char *string_substitute(const char *src, char from, char to, struct gc_arena *gc); + /** * Like snprintf() but returns an boolean. * diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 03cda5a..a95b6e0 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1101,25 +1101,6 @@ return get_ipv6_addr(ipv6_prefix_spec, NULL, NULL, M_WARN); } -static char * -string_substitute(const char *src, char from, char to, struct gc_arena *gc) -{ - char *ret = (char *)gc_malloc(strlen(src) + 1, true, gc); - char *dest = ret; - char c; - - do - { - c = *src++; - if (c == from) - { - c = to; - } - *dest++ = c; - } while (c); - return ret; -} - /** * Parses a hexstring and checks if the string has the correct length. Return * a verify_hash_list containing the parsed hash string. @@ -3574,19 +3555,6 @@ } } -bool -string_defined_equal(const char *s1, const char *s2) -{ - if (s1 && s2) - { - return !strcmp(s1, s2); - } - else - { - return false; - } -} - #if 0 static void ping_rec_err(msglvl_t msglevel) diff --git a/src/openvpn/options.h b/src/openvpn/options.h index d950a67..90a422b 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -896,8 +896,6 @@ void setenv_settings(struct env_set *es, const struct options *o); -bool string_defined_equal(const char *s1, const char *s2); - void options_postprocess(struct options *options, struct env_set *es); bool options_postprocess_pull(struct options *o, struct env_set *es);