From patchwork Wed Aug 19 21:18:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5258 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:4319:b0:87d:ab56:3700 with SMTP id q25csp991300mae; Wed, 19 Aug 2026 14:18:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AHgh+RrJwoF3QB3zr4xgdCYCHpMcdkwhv4fAh3XMZ08PsdTeKxruP9HY7t+1tnTac1V6CyBFK8q82Z9JDD0=@openvpn.net X-Received: by 2002:a4a:ee0b:0:b0:6b0:5bd1:4722 with SMTP id 006d021491bc7-6b13c37ec75mr7425072eaf.13.1787174305152; Wed, 19 Aug 2026 14:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1787174305; cv=none; d=google.com; s=arc-20260327; b=Q8j/vgKPkOi8AfJYndD6d0mugISlt4oeBpulGoyX16Iy1tCjCNcUABk0lsBhN2OyZh DyXDRbsy3ZnGqqvX3DZKIAGeAKxt/OhlR9/SF9zxxH7DHO9eNffZKpFCuW7BCAb5Xn3W C3L7jCEHemniDyEyV4oQc+k68tNdUCQYApnY82xKl2UASkpw+dHdTyDKYG720xVcTrVP s8qPJedqcKmzHSGqSCZTgNMzRGCTszJmujpModbzNkr4nCacrVhoOJmOyZNrBQS9BzHj /igXbXWiQgQTPMd6NnZxkaUUOnJMCD6WGRE++eo/IDmVRa7xakQVlkqeoYNJZI8nbz9P j+Cg== 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=KNsXlmYW3UtC/NN+QEOreoXCqYXl5of/7wl4L0/fXJU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=OfTZJxdMM3Au9P3+t4lfdE4g2xxOwDb7/tLFXHccktnXAXyvFndur0+563iimvSi8v CgON0qRBHwj6hzDTgk/7JZZLjePw/bwSDfJVUBFhVIWYC9c2ti7g4XGNgmepIEgmFwBP qP/uvJHRlJcUBDddAymLO3FlnZUeswLtZMKYRNVGJkfDp9B/u6Ya+oAdpiI7RhL5IuZ3 5Tuve/oAFqpiWw5pPPFN/KrcQiL1QX+L8E5H55+nEb/vq3bRGObVkAx9fgjaeEaqHXjX IIsnrE4djFPDxRtgwBfDkCMnjqRxLT8YerKoiWXqBwKPx9zLN3SojvA0D9Sjat0zJhL6 FI5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=cKsejwYY; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=RkbR0uVO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jCZczssf; 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-45f22d82c30si11878765fac.130.2026.08.19.14.18.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Aug 2026 14:18:25 -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=cKsejwYY; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=RkbR0uVO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jCZczssf; 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=KNsXlmYW3UtC/NN+QEOreoXCqYXl5of/7wl4L0/fXJU=; b=cKsejwYYQr5rfrUR2SDMLU4HcL qRxckhBZ4ZaUtAgNk0P6H1HT6y5WEjNhOXMH3QK67VPObmWsXL2qxH34+IBVs/VP14JI7OphAGCsm 3og0J7IEOIfIplDJA+RrIMf0uS1VP8ZUzriyuiN2pLelNIEC8tQ+jdjV1X+ex9s+XWss=; 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 1wwnfy-00026e-BC; Wed, 19 Aug 2026 21:18:22 +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 1wwnfw-00026W-S0 for openvpn-devel@lists.sourceforge.net; Wed, 19 Aug 2026 21:18:20 +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=tklaHUHfH0dJBj6AHNnkqPopgXJraQAzRK1c+yNQv/I=; b=RkbR0uVO3syulpvs1PgtqZaCKT Xrz1hE4zOdSCdbu/q7QroMQAHUu7lHKE4lM4jPlMPIkqt6JR6396EGWU8bgFFBAtL8JLtcWlzHfTM 55cFqC9mis4QGsqSc8j8kg81IhjRh1HBK4D2vCZYBUbEFleH2y7LKZxaOUjKrXBR54KU=; 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=tklaHUHfH0dJBj6AHNnkqPopgXJraQAzRK1c+yNQv/I=; b=jCZczssfDXMs47NtoNMrwLwWxw G+rut10jgIbdnW9zZXmla4tvRVBCO1OXwK9qkrpcZqkvdmoC4MzIGq30GUCriYo5sZo3QvaEM9w4o ZNmsuMF3BJX00jEDU0OaOiQsCB1vG+XtBmnAi2AF2+x/lHLQZzEjGlGF6X7C0y5UW4Iw=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wwnfv-0000Zd-6u for openvpn-devel@lists.sourceforge.net; Wed, 19 Aug 2026 21:18:20 +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 67JLIC7h003239 for ; Wed, 19 Aug 2026 23:18:12 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 67JLIC8U003238 for openvpn-devel@lists.sourceforge.net; Wed, 19 Aug 2026 23:18:12 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 19 Aug 2026 23:18:05 +0200 Message-ID: <20260819211812.3214-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: 1wwnfv-0000Zd-6u Subject: [Openvpn-devel] [PATCH v5] 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: 1873988084130089093 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 5 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 f14caa2..8c19902 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -1086,6 +1086,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 85277ff..651aaed 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -1766,6 +1766,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 9f060e3..418329e 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1087,25 +1087,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. @@ -3566,19 +3547,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 0fd505a..c23d0b3 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -901,8 +901,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);