Skip to contentSkip to conversation

get rid of TAG_FILE_INLINE constant

PATCH In review Antonio Quartulli 3 participants 6 messages May 8, 2020 – May 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get rid of TAG_FILE_INLINE constant

Now that the whole inline logic has been converted to using bool flags, the TAG_FILE_INLINE constant is not useful anymore.

Get rid of the constant as it's now unused and to prevent any future developer from mistakenly use it again.

---

to be applied after all other fixes, as they remove the few last usages of this constant.

 src/openvpn/common.h | 6 ------
 src/openvpn/crypto.c | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)
src/openvpn/common.h +0 -6
index 4e6f4809..623b3e0d 100644
@@ -88,12 +88,6 @@ typedef unsigned long ptr_type;
  */
 #define PUSH_REQUEST_INTERVAL 5
 
-/*
- * A sort of pseudo-filename for data provided inline within
- * the configuration file.
- */
-#define INLINE_FILE_TAG "[[INLINE]]"
-
 /*
  * Script security warning
  */
src/openvpn/crypto.c +1 -1
index 672aa14a..f1a52d8c 100644
@@ -1189,7 +1189,7 @@ print_key_filename(const char *str, bool is_inline)
 {
     if (is_inline)
     {
-        return INLINE_FILE_TAG;
+        return "[[INLINE]]";
     }
 
     return np(str);
Signature · 1 line
2.26.2
#1 lore raw

I managed to totally revert the name of the constant in the commit subject and commit message..

may somebody fix this upon merge? :-)

It should be: INLINE_FILE_TAG

Cheers,

Quoted 48 lines · Antonio Quartulli

Now that the whole inline logic has been converted to using bool flags, the TAG_FILE_INLINE constant is not useful anymore.

Get rid of the constant as it's now unused and to prevent any future developer from mistakenly use it again.

---

to be applied after all other fixes, as they remove the few last usages of this constant.

 src/openvpn/common.h | 6 ------
 src/openvpn/crypto.c | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)
src/openvpn/common.h +0 -6
index 4e6f4809..623b3e0d 100644
@@ -88,12 +88,6 @@ typedef unsigned long ptr_type;
  */
 #define PUSH_REQUEST_INTERVAL 5
 
-/*
- * A sort of pseudo-filename for data provided inline within
- * the configuration file.
- */
-#define INLINE_FILE_TAG "[[INLINE]]"
-
 /*
  * Script security warning
  */
src/openvpn/crypto.c +1 -1
index 672aa14a..f1a52d8c 100644
@@ -1189,7 +1189,7 @@ print_key_filename(const char *str, bool is_inline)
 {
     if (is_inline)
     {
-        return INLINE_FILE_TAG;
+        return "[[INLINE]]";
     }
 
     return np(str);
Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Antonio Quartulli
Quoted 40 lines · Antonio Quartulli

Now that the whole inline logic has been converted to using bool flags, the TAG_FILE_INLINE constant is not useful anymore.

Get rid of the constant as it's now unused and to prevent any future developer from mistakenly use it again.

---

to be applied after all other fixes, as they remove the few last usages of this constant.

 src/openvpn/common.h | 6 ------
 src/openvpn/crypto.c | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)
src/openvpn/common.h +0 -6
index 4e6f4809..623b3e0d 100644
@@ -88,12 +88,6 @@ typedef unsigned long ptr_type;
  */
 #define PUSH_REQUEST_INTERVAL 5
 
-/*
- * A sort of pseudo-filename for data provided inline within
- * the configuration file.
- */
-#define INLINE_FILE_TAG "[[INLINE]]"
-
 /*
  * Script security warning
  */
src/openvpn/crypto.c +0 -0
index 672aa14a..f1a52d8c 100644

src/openvpn/crypto.c print_key_filename(const char *str, bool is_inline) · line 1195

Quoted 8 lines
src/openvpn/crypto.c +1 -1
@@ -1189,7 +1189,7 @@ print_key_filename(const char *str, bool is_inline)
 {
     if (is_inline)
     {
-        return INLINE_FILE_TAG;
+        return "[[INLINE]]";
     }
 
     return np(str);

This looks promising, but is not complete - and breaking compilation:

$ git grep INLINE_FILE_TAG
src/openvpn/tls_crypt.c:        client_filename = INLINE_FILE_TAG;
$ make -j5
[...]
make[3]: Entering directory `/home/davids/devel/OpenVPN/openvpn/src/openvpn'
  CC       tls_crypt.o
tls_crypt.c: In function ‘tls_crypt_v2_write_client_key_file’:
tls_crypt.c:706:27: error: ‘INLINE_FILE_TAG’ undeclared (first use in this
function)
         client_filename = INLINE_FILE_TAG;
                           ^

I haven't dug into if client_filename really needs to be set to INLINE_FILE_TAG.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#3 lore raw

Hi,

Quoted 16 lines · David Sommerseth

This looks promising, but is not complete - and breaking compilation:

$ git grep INLINE_FILE_TAG
src/openvpn/tls_crypt.c:        client_filename = INLINE_FILE_TAG;
$ make -j5
[...]
make[3]: Entering directory `/home/davids/devel/OpenVPN/openvpn/src/openvpn'
  CC       tls_crypt.o
tls_crypt.c: In function ‘tls_crypt_v2_write_client_key_file’:
tls_crypt.c:706:27: error: ‘INLINE_FILE_TAG’ undeclared (first use in this
function)
         client_filename = INLINE_FILE_TAG;
                           ^
Quoted 2 lines

I haven't dug into if client_filename really needs to be set to INLINE_FILE_TAG.

whoop - I prepared a patch for this last occurrence (to be applied before this patch), but did not send it.

Incoming...

Signature · 1 line
Antonio Quartulli
Acked-by on v1 1/1
#4 lore raw
In reply to Antonio Quartulli
Quoted 40 lines · Antonio Quartulli

Now that the whole inline logic has been converted to using bool flags, the TAG_FILE_INLINE constant is not useful anymore.

Get rid of the constant as it's now unused and to prevent any future developer from mistakenly use it again.

---

to be applied after all other fixes, as they remove the few last usages of this constant.

 src/openvpn/common.h | 6 ------
 src/openvpn/crypto.c | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)
src/openvpn/common.h +0 -6
index 4e6f4809..623b3e0d 100644
@@ -88,12 +88,6 @@ typedef unsigned long ptr_type;
  */
 #define PUSH_REQUEST_INTERVAL 5
 
-/*
- * A sort of pseudo-filename for data provided inline within
- * the configuration file.
- */
-#define INLINE_FILE_TAG "[[INLINE]]"
-
 /*
  * Script security warning
  */
src/openvpn/crypto.c +0 -0
index 672aa14a..f1a52d8c 100644

src/openvpn/crypto.c print_key_filename(const char *str, bool is_inline) · line 1195

Quoted 8 lines
src/openvpn/crypto.c +1 -1
@@ -1189,7 +1189,7 @@ print_key_filename(const char *str, bool is_inline)
 {
     if (is_inline)
     {
-        return INLINE_FILE_TAG;
+        return "[[INLINE]]";
     }
 
     return np(str);

So with Antonio's explaination in message-id <[email protected]...> and applying message-id <[email protected]...> ([PATCH] tls-crypt-v2: fix testing of inline key, which I just gave an ACK) before this patch, it is all good.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#5 lore raw
In reply to Antonio Quartulli

Your patch has been applied to the master branch. I have dutifully fixed the "INLINE_FILE_TAG" confusion in the commit message :-)

Lightly compile-tested. Buildbot can do more testing (but this is one of the patches that would break compilation anywhere, so "trivially correct).

commit 27ad978fd6721f05f0c484a1bdbf775b0ab36ab2

Author: Antonio Quartulli
Date:   Fri May 8 23:23:56 2020 +0200
     get rid of INLINE_FILE_TAG constant

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19863.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering