Skip to contentSkip to conversation

Change in openvpn[master]: Reformat the whole project with clang-format

Openvpn-devel In review ordex (Code Review) 2 participants 14 messages Apr 14, 2025 – Aug 4, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1730386897000.I2566ad493629e1f5fdfa6f6483b8973463404e3e@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 14:

(8 comments)

Patchset:

PS14:
the change is extremely long, so not easy to comment to everything, but I threw a few concerns worth checking.

File sample/sample-plugins/client-connect/sample-client-connect.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/c6e0d1ce_30cbe3ba :
PS14, Line 135: stderr,
this hurts me a bit, for two reasons:
1) "stderr," should just stay on the same line as fprintf, given that there is enough space;
2) when going to a new line, I personally prefer to see the text aligned to the opening parenthesis.

http://gerrit.openvpn.net/c/openvpn/+/791/comment/27a22e79_01461376 :
PS14, Line 251: MODULE,
same as above, I expected MODULE to be on the line above

NOTE: I won't report any other occurrence of this in the rest of the patch

http://gerrit.openvpn.net/c/openvpn/+/791/comment/3682efec_128649c3 :
PS14, Line 252: "env has UV_WANT_CC_ASYNC=%d, but "
here there is a more generic question to answer: do we want to keep string on the same line, even if they are too long? Pro being that the casual reader could be reasonably able to grep an error message (with some magic, due to format patterns).

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/e5889e88_f1a4caaa :
PS14, Line 267: np(context->test_valid_user),
I'd vote for putting these arguments on the same line, if there is enough space.

http://gerrit.openvpn.net/c/openvpn/+/791/comment/8f6e4102_5edbebdb :
PS14, Line 294: const char *envp[])
ratio behind this change? one arg per line?

http://gerrit.openvpn.net/c/openvpn/+/791/comment/99dbd0d9_8682fdd3 :
PS14, Line 418: plog(context, PLOG_NOTE, "FUNC: openvpn_plugin_client_constructor_v1");
how about forcing a new line after variables declaration?

File sample/sample-plugins/log/log_v3.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/c1025c39_05185d3b :
PS14, Line 87: "log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
this is probably another instance of the same situation as before.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 14
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 14 Apr 2025 19:21:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 14:

(6 comments)

File sample/sample-plugins/client-connect/sample-client-connect.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/1bf6c87b_4e6169ab :
PS14, Line 135: stderr,

Quoted 1 line

this hurts me a bit, for two reasons: […]

Not quite sure why it doesn't align to "(", it does for almost all other occurences. I think it might have a trade-off here between trying to align and trying to get the string in the colum limit.

http://gerrit.openvpn.net/c/openvpn/+/791/comment/4cf494a4_79f7b8ce :
PS14, Line 251: MODULE,

Quoted 1 line

same as above, I expected MODULE to be on the line above […]

So basically what you want is "BinPackArguments: true", will apply that.

http://gerrit.openvpn.net/c/openvpn/+/791/comment/d9dba330_b8c72914 :
PS14, Line 252: "env has UV_WANT_CC_ASYNC=%d, but "

Quoted 1 line

here there is a more generic question to answer: do we want to keep string on the same line, even if […]

Has nothing to do with this patch though, AFAICT

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/8b72fd16_d619cd73 :
PS14, Line 294: const char *envp[])

Quoted 1 line

ratio behind this change? one arg per line?

yes. This is BinPackParameters. Do you also want that set to "true"?

http://gerrit.openvpn.net/c/openvpn/+/791/comment/d94e4661_457ff043 :
PS14, Line 418: plog(context, PLOG_NOTE, "FUNC: openvpn_plugin_client_constructor_v1");

Quoted 1 line

how about forcing a new line after variables declaration?

Doesn't seem to be supported. There is a feature request for it: https://github.com/llvm/llvm-project/issues/97303

File sample/sample-plugins/log/log_v3.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/c9c800e4_6ecdeccd :
PS14, Line 87: "log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");

Quoted 1 line

this is probably another instance of the same situation as before.

yes

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 14
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 16 Apr 2025 11:47:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 14:

(2 comments)

File sample/sample-plugins/client-connect/sample-client-connect.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/cd08c6bb_0b6173ee :
PS14, Line 252: "env has UV_WANT_CC_ASYNC=%d, but "

Quoted 1 line

Has nothing to do with this patch though, AFAICT

You're right. I thought it was the right moment to trigger the discussion, so we can possibly find a clang-format option that addresses this.

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/6b1aef69_72e254a0 :
PS14, Line 294: const char *envp[])

Quoted 1 line

yes. This is BinPackParameters. […]

I think we should. It will also make BinPackParameters consistent with BinPackArguments

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 14
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 16 Apr 2025 11:52:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 16:

(4 comments)

File sample/sample-plugins/client-connect/sample-client-connect.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/763d178b_37f47877 :
PS14, Line 251: MODULE,

Quoted 1 line

So basically what you want is "BinPackArguments: true", will apply that.

Done

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/e720aaa5_9dff2c4a :
PS14, Line 267: np(context->test_valid_user),

Quoted 1 line

I'd vote for putting these arguments on the same line, if there is enough space.

Done

http://gerrit.openvpn.net/c/openvpn/+/791/comment/6d71e7fc_faa3fc2d :
PS14, Line 418: plog(context, PLOG_NOTE, "FUNC: openvpn_plugin_client_constructor_v1");

Quoted 1 line

Doesn't seem to be supported. There is a feature request for it: https://github. […]

Acknowledged

File sample/sample-plugins/log/log_v3.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/5a59375c_600cff63 :
PS14, Line 87: "log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");

Quoted 1 line

yes

Acknowledged

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 16
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 16 Apr 2025 13:48:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 16:

(1 comment)

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/d4a601b3_b1efe856 :
PS14, Line 294: const char *envp[])

Quoted 1 line

I think we should. […]

I disagree. Note that when setting BinPackParameters to true this will apply to all functions and all parameters. I think in general if the parameters to do fit on one line, it is better to put them one per line. Let's see what others think.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 16
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 16 Apr 2025 13:55:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 17:

(1 comment)

File sample/sample-plugins/defer/multi-auth.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/86c264e5_529758c0 :
PS14, Line 294: const char *envp[])

Quoted 1 line

I disagree. […]

BinPackParameter is set to true now after cron2 agreed with you.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 17
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 30 Apr 2025 13:04:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 18:

(5 comments)

Patchset:

PS18:
Overall this is impressively good. Some changes (struct opening bracket) should have been done all along :-) - others just make sense. I have a few that I do not like and I think one actual bug in the ruleset (do...while() in buffer.c).

File src/openvpn/buffer.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/e228108e_a877cddf :
PS18, Line 850: } while (c);
it should not do that

http://gerrit.openvpn.net/c/openvpn/+/791/comment/450ac52e_57fa1b4a :
PS18, Line 915: && c != 127)) /* allow ascii non-control and UTF-8, consider DEL to be a control */
this is ugly, but I guess the best way to fix it is to manually move the comment before the if() line

File src/openvpn/comp.h:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/07c11cf5_a35c47d6 :
PS18, Line 93: bool check_compression_settings_valid(struct compress_options *info, int msglevel);
this is one of the changes I'm not sure we want - having the return type on the line before gives us more line length for the actual prototype, and also it eases "grep ^function" to find prototype + function implementation (my use case, which I could certainly solve differently)

File src/openvpn/console_builtin.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/ecc1640a_115b4d7b :
PS18, Line 74: msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");
the extra spaces around foo|bar are not really to my liking ("this belongs together" vibes)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 18
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Sat, 24 May 2025 14:14:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 18:

(3 comments)

File src/openvpn/buffer.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/6892fcb6_41f2daaf :
PS18, Line 850: } while (c);

Quoted 1 line

it should not do that

Why?

http://gerrit.openvpn.net/c/openvpn/+/791/comment/18dc39e2_b722d6bf :
PS18, Line 915: && c != 127)) /* allow ascii non-control and UTF-8, consider DEL to be a control */

Quoted 1 line

this is ugly, but I guess the best way to fix it is to manually move the comment before the if() lin […]

Yes.

File src/openvpn/console_builtin.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/e785d1b2_41139a46 :
PS18, Line 74: msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");

Quoted 1 line

the extra spaces around foo|bar are not really to my liking ("this belongs together" vibes)

Interestingly one of the things we can't configure in clang-format. The space around binary operators is not optional.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 18
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Mon, 26 May 2025 09:54:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 19:

(4 comments)

File src/openvpn/buffer.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/5fa573c3_de511cf1 :
PS18, Line 850: } while (c);

Quoted 1 line

Why?

As discussed on IRC this is actually correct for our current formatting.

http://gerrit.openvpn.net/c/openvpn/+/791/comment/5173a895_ec42235c :
PS18, Line 915: && c != 127)) /* allow ascii non-control and UTF-8, consider DEL to be a control */

Quoted 1 line

Yes.

Done in separate commit.

File src/openvpn/comp.h:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/ca6252bf_a8b50dfe :
PS18, Line 93: bool check_compression_settings_valid(struct compress_options *info, int msglevel);

Quoted 1 line

this is one of the changes I'm not sure we want - having the return type on the line before gives us […]

As discussed in IRC this is consistent with what we have. Switched the .clang-format to use "AllDefinitions" instead which doesn't change anything but better matches our policy.

File src/openvpn/console_builtin.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/9b83c0b1_41c7cd5f :
PS18, Line 74: msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");

Quoted 1 line

Interestingly one of the things we can't configure in clang-format. […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 19
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Mon, 26 May 2025 10:40:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, ordex, plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/791?usp=email

to look at the new patch set (#22).

Change subject: Reformat the whole project with clang-format
......................................................................

Reformat the whole project with clang-format

Done with pre-commit run -a, so the version
defined in pre-commit config is used.

Change-Id I2566ad493629e1f5fdfa6f6483b8973463404e3e

---
M include/openvpn-msg.h
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M sample/sample-plugins/log/log.c
M sample/sample-plugins/log/log_v3.c
M sample/sample-plugins/simple/base64.c
M sample/sample-plugins/simple/simple.c
M src/compat/compat-basename.c
M src/compat/compat-dirname.c
M src/compat/compat-gettimeofday.c
M src/openvpn/argv.c
M src/openvpn/argv.h
M src/openvpn/auth_token.c
M src/openvpn/auth_token.h
M src/openvpn/base64.c
M src/openvpn/base64.h
M src/openvpn/basic.h
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/circ_list.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/common.h
M src/openvpn/comp-lz4.c
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/compstub.c
M src/openvpn/console.c
M src/openvpn/console.h
M src/openvpn/console_builtin.c
M src/openvpn/console_systemd.c
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_epoch.c
M src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/cryptoapi.c
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_freebsd.h
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_linux.h
M src/openvpn/dco_win.c
M src/openvpn/dco_win.h
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/env_set.c
M src/openvpn/env_set.h
M src/openvpn/errlevel.h
M src/openvpn/error.c
M src/openvpn/error.h
M src/openvpn/event.c
M src/openvpn/event.h
M src/openvpn/fdmisc.c
M src/openvpn/fdmisc.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/fragment.c
M src/openvpn/fragment.h
M src/openvpn/gremlin.c
M src/openvpn/gremlin.h
M src/openvpn/helper.c
M src/openvpn/httpdigest.c
M src/openvpn/httpdigest.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/integer.h
M src/openvpn/interval.c
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/lladdr.c
M src/openvpn/lzo.c
M src/openvpn/lzo.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/memdbg.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/mroute.c
M src/openvpn/mroute.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mstats.c
M src/openvpn/mstats.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mtu.c
M src/openvpn/mtu.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/multi_io.c
M src/openvpn/networking.h
M src/openvpn/networking_freebsd.c
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/ntlm.c
M src/openvpn/occ.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/openvpn.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/options_util.c
M src/openvpn/options_util.h
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/ovpn_dco_freebsd.h
M src/openvpn/packet_id.c
M src/openvpn/packet_id.h
M src/openvpn/perf.c
M src/openvpn/perf.h
M src/openvpn/ping.c
M src/openvpn/ping.h
M src/openvpn/pkcs11.c
M src/openvpn/pkcs11.h
M src/openvpn/pkcs11_backend.h
M src/openvpn/pkcs11_mbedtls.c
M src/openvpn/pkcs11_openssl.c
M src/openvpn/platform.c
M src/openvpn/platform.h
M src/openvpn/plugin.c
M src/openvpn/plugin.h
M src/openvpn/pool.c
M src/openvpn/pool.h
M src/openvpn/proto.c
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/ps.c
M src/openvpn/ps.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/pushlist.h
M src/openvpn/reflect_filter.c
M src/openvpn/reflect_filter.h
M src/openvpn/reliable.c
M src/openvpn/reliable.h
A src/openvpn/ring_buffer.h
M src/openvpn/route.c
M src/openvpn/route.h
M src/openvpn/run_command.c
M src/openvpn/run_command.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M src/openvpn/session_id.h
M src/openvpn/shaper.c
M src/openvpn/shaper.h
M src/openvpn/sig.c
M src/openvpn/sig.h
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_openssl.h
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_util.c
M src/openvpn/ssl_util.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/ssl_verify_backend.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/ssl_verify_mbedtls.h
M src/openvpn/ssl_verify_openssl.c
M src/openvpn/status.c
M src/openvpn/status.h
M src/openvpn/syshead.h
M src/openvpn/tls_crypt.c
M src/openvpn/tls_crypt.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpn/wfp_block.c
M src/openvpn/wfp_block.h
M src/openvpn/win32-util.c
M src/openvpn/win32.c
M src/openvpn/win32.h
M src/openvpn/xkey_common.h
M src/openvpn/xkey_helper.c
M src/openvpn/xkey_provider.c
M src/openvpnmsica/dllmain.c
M src/openvpnmsica/msica_arg.c
M src/openvpnmsica/msica_arg.h
M src/openvpnmsica/msiex.c
M src/openvpnmsica/msiex.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnserv/service.c
M src/openvpnserv/service.h
M src/openvpnserv/validate.c
M src/openvpnserv/validate.h
M src/plugins/auth-pam/auth-pam.c
M src/plugins/auth-pam/pamdl.c
M src/plugins/auth-pam/utils.c
M src/plugins/auth-pam/utils.h
M src/plugins/down-root/down-root.c
M src/tapctl/basic.h
M src/tapctl/error.h
M src/tapctl/main.c
M src/tapctl/tap.c
M src/tapctl/tap.h
M tests/ntlm_support.c
M tests/unit_tests/example_test/test.c
M tests/unit_tests/example_test/test2.c
M tests/unit_tests/openvpn/cert_data.h
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/mock_ssl_dependencies.c
M tests/unit_tests/openvpn/pkey_test_utils.c
M tests/unit_tests/openvpn/test_argv.c
M tests/unit_tests/openvpn/test_auth_token.c
M tests/unit_tests/openvpn/test_buffer.c
M tests/unit_tests/openvpn/test_crypto.c
M tests/unit_tests/openvpn/test_cryptoapi.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_ncp.c
M tests/unit_tests/openvpn/test_networking.c
M tests/unit_tests/openvpn/test_packet_id.c
M tests/unit_tests/openvpn/test_pkcs11.c
M tests/unit_tests/openvpn/test_pkt.c
M tests/unit_tests/openvpn/test_provider.c
M tests/unit_tests/openvpn/test_ssl.c
M tests/unit_tests/openvpn/test_tls_crypt.c
M tests/unit_tests/openvpn/test_user_pass.c
M tests/unit_tests/plugins/auth-pam/test_search_and_replace.c

255 files changed, 11,864 insertions(+), 15,015 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/791/22

include/openvpn-msg.h +41 -22
index e0d0bb0..6e43588 100644
@@ -27,7 +27,8 @@
 #include <windef.h>
 #include <ws2tcpip.h>
 
-typedef enum {
+typedef enum
+{
     msg_acknowledgement,
     msg_add_address,
     msg_del_address,
@@ -51,28 +52,33 @@
     msg_create_adapter
 } message_type_t;
 
-typedef struct {
+typedef struct
+{
     message_type_t type;
     size_t size;
     int message_id;
 } message_header_t;
 
-typedef union {
+typedef union
+{
     struct in_addr ipv4;
     struct in6_addr ipv6;
 } inet_address_t;
 
-typedef struct {
+typedef struct
+{
     int index;
     char name[256];
 } interface_t;
 
-typedef enum {
-    wfp_block_local = 1<<0,
-    wfp_block_dns = 1<<1
+typedef enum
+{
+    wfp_block_local = 1 << 0,
+    wfp_block_dns = 1 << 1
 } wfp_block_flags_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     short family;
     inet_address_t address;
@@ -80,7 +86,8 @@
     interface_t iface;
 } address_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     short family;
     inet_address_t prefix;
@@ -90,7 +97,8 @@
     int metric;
 } route_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
     char domains[512];
@@ -100,14 +108,16 @@
 } dns_cfg_message_t;
 
 
-typedef enum {
+typedef enum
+{
     nrpt_dnssec
 } nrpt_flags_t;
 
-#define NRPT_ADDR_NUM 8   /* Max. number of addresses */
+#define NRPT_ADDR_NUM  8  /* Max. number of addresses */
 #define NRPT_ADDR_SIZE 48 /* Max. address strlen + some */
 typedef char nrpt_address_t[NRPT_ADDR_SIZE];
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
     nrpt_address_t addresses[NRPT_ADDR_NUM];
@@ -116,14 +126,16 @@
     nrpt_flags_t flags;
 } nrpt_dns_cfg_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
     int addr_len;
     inet_address_t addr[4]; /* support up to 4 dns addresses */
 } wins_cfg_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
     int disable_nbt;
@@ -135,41 +147,48 @@
 
 /* TODO: NTP */
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     short family;
     interface_t iface;
 } flush_neighbors_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     int error_number;
 } ack_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     wfp_block_flags_t flags;
     interface_t iface;
 } wfp_block_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
 } enable_dhcp_message_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     interface_t iface;
     short family;
     int mtu;
 } set_mtu_message_t;
 
-typedef enum {
+typedef enum
+{
     ADAPTER_TYPE_DCO,
     ADAPTER_TYPE_TAP,
 } adapter_type_t;
 
-typedef struct {
+typedef struct
+{
     message_header_t header;
     adapter_type_t adapter_type;
 } create_adapter_message_t;
sample/sample-plugins/client-connect/sample-client-connect.c +52 -59

265 lines not on this page · raw message

sample/sample-plugins/defer/multi-auth.c +35 -41

209 lines not on this page · raw message

sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +26 -25

119 lines not on this page · raw message

sample/sample-plugins/log/log.c +19 -19
index 82595cf..0a96c63 100644
@@ -37,7 +37,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -77,7 +78,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -93,19 +94,17 @@
     /*
      * Which callbacks to intercept.
      */
-    *type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
+    *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 void
@@ -173,9 +172,10 @@
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     show(type, argv, envp);
 
@@ -186,8 +186,8 @@
         const char *username = get_env("username", envp);
         const char *password = get_env("password", envp);
 
-        if (username && !strcmp(username, context->username)
-            && password && !strcmp(password, context->password))
+        if (username && !strcmp(username, context->username) && password
+            && !strcmp(password, context->password))
         {
             return OPENVPN_PLUGIN_FUNC_SUCCESS;
         }
@@ -205,6 +205,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/log/log_v3.c +24 -27

106 lines not on this page · raw message

sample/sample-plugins/simple/base64.c +15 -17
index 6855966..5b2cff5 100644
@@ -100,21 +100,20 @@
  *
  */
 OPENVPN_EXPORT int
-openvpn_plugin_open_v3(const int v3structver,
-                       struct openvpn_plugin_args_open_in const *args,
+openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in const *args,
                        struct openvpn_plugin_args_open_return *ret)
 {
     /* Check that we are API compatible */
     if (v3structver != OPENVPN_PLUGINv3_STRUCTVER)
     {
-        printf("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
+        printf(
+            "base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
     /*  Which callbacks to intercept.  */
-    ret->type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
+    ret->type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                     | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
 
     /* we don't need a plug-in context in this example, but OpenVPN expects "something" */
     ret->handle = calloc(1, 1);
@@ -127,8 +126,8 @@
 
     /* Print some version information about the OpenVPN process using this plug-in */
     ovpn_log(PLOG_NOTE, PLUGIN_NAME, "OpenVPN %s  (Major: %i, Minor: %i, Patch: %s)\n",
-             args->ovpn_version, args->ovpn_version_major,
-             args->ovpn_version_minor, args->ovpn_version_patch);
+             args->ovpn_version, args->ovpn_version_major, args->ovpn_version_minor,
+             args->ovpn_version_patch);
 
     return OPENVPN_PLUGIN_FUNC_SUCCESS;
 }
@@ -156,10 +155,10 @@
  */
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    if (type != OPENVPN_PLUGIN_TLS_VERIFY
-        && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+    if (type != OPENVPN_PLUGIN_TLS_VERIFY && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
     {
         ovpn_log(PLOG_ERR, PLUGIN_NAME, "Unsupported plug-in hook call attempted");
         return OPENVPN_PLUGIN_FUNC_ERROR;
@@ -176,14 +175,13 @@
     /* test the BASE64 encode function */
     char *buf = NULL;
     int r = ovpn_base64_encode(clcert_cn, strlen(clcert_cn), &buf);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'",
-             clcert_cn, r, buf);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'", clcert_cn, r,
+             buf);
 
     /* test the BASE64 decode function */
-    char buf2[256] = {0};
+    char buf2[256] = { 0 };
     r = ovpn_base64_decode(buf, &buf2, 255);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'",
-             buf, r, buf2);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'", buf, r, buf2);
 
     /* Verify the result, and free the buffer allocated by ovpn_base64_encode() */
     r = strcmp(clcert_cn, buf2);
@@ -203,6 +201,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/simple/simple.c +10 -8
index e17f3fa..2666e2f 100644
@@ -39,7 +39,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -79,7 +80,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -98,21 +99,22 @@
      */
     *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     /* get username/password from envp string array */
     const char *username = get_env("username", envp);
     const char *password = get_env("password", envp);
 
     /* check entered username/password against what we require */
-    if (username && !strcmp(username, context->username)
-        && password && !strcmp(password, context->password))
+    if (username && !strcmp(username, context->username) && password
+        && !strcmp(password, context->password))
     {
         return OPENVPN_PLUGIN_FUNC_SUCCESS;
     }
@@ -125,6 +127,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
src/compat/compat-basename.c +1 -1
index abb4f49..ea8bfbb 100644
@@ -42,7 +42,7 @@
         /* If NULL, check for \ instead ... might be Windows a path */
         p = strrchr(filename, '\\');
     }
-    return p ? p + 1 : (char *) filename;
+    return p ? p + 1 : (char *)filename;
 }
 
 #endif /* HAVE_BASENAME */
src/compat/compat-dirname.c +2 -2
index c131dee..527f252 100644
@@ -90,7 +90,7 @@
         /* The '/' is the last character, we have to look further.  */
         if (runp != path)
         {
-            last_slash = (char *) __memrchr(path, separator, runp - path);
+            last_slash = (char *)__memrchr(path, separator, runp - path);
         }
     }
 
@@ -135,7 +135,7 @@
         /* This assignment is ill-designed but the XPG specs require to
          * return a string containing "." in any case no directory part is
          * found and so a static and constant string is required.  */
-        path = (char *) dot;
+        path = (char *)dot;
     }
 
     return path;
src/compat/compat-gettimeofday.c +2 -2
index 997f360..23b5734 100644
@@ -49,7 +49,7 @@
 {
     const time_t t = time(NULL);
     const DWORD gtc = GetTickCount();
-    gtc_base = t - gtc/1000;
+    gtc_base = t - gtc / 1000;
     gtc_last = gtc;
 }
 
@@ -113,7 +113,7 @@
     return 0;
 }
 
-#else  /* ifdef _WIN32 */
+#else /* ifdef _WIN32 */
 
 #include <time.h>
 
src/openvpn/argv.c +5 -6
index 95215c0..78d37c7 100644
@@ -285,8 +285,7 @@
  *           free()d to avoid memory leaks.
  */
 static char *
-argv_prep_format(const char *format, const char delim, size_t *count,
-                 struct gc_arena *gc)
+argv_prep_format(const char *format, const char delim, size_t *count, struct gc_arena *gc)
 {
     if (format == NULL)
     {
@@ -312,7 +311,7 @@
              * the string is empty; the resulting format string
              * will never start with a delimiter.
              */
-            if (j > 0)  /* Has anything been written to the output string? */
+            if (j > 0) /* Has anything been written to the output string? */
             {
                 f[j++] = delim;
             }
@@ -348,7 +347,7 @@
 static bool
 argv_printf_arglist(struct argv *argres, const char *format, va_list arglist)
 {
-    const char delim = 0x1D;  /* ASCII Group Separator (GS) */
+    const char delim = 0x1D; /* ASCII Group Separator (GS) */
     bool res = false;
 
     /*
@@ -485,8 +484,8 @@
     argv_reset(argres);
 
     char *parms[MAX_PARMS + 1] = { 0 };
-    int nparms = parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0,
-                            D_ARGV_PARSE_CMD, &argres->gc);
+    int nparms =
+        parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0, D_ARGV_PARSE_CMD, &argres->gc);
     if (nparms)
     {
         int i;
src/openvpn/argv.h +8 -7
index 098a1cb..9aaa55b 100644
@@ -32,7 +32,8 @@
 
 #include "buffer.h"
 
-struct argv {
+struct argv
+{
     struct gc_arena gc;
     size_t capacity;
     size_t argc;
@@ -56,21 +57,21 @@
 bool argv_printf(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 bool argv_printf_cat(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 #endif /* ifndef ARGV_H */
src/openvpn/auth_token.c +42 -49

245 lines not on this page · raw message

src/openvpn/auth_token.h +7 -15
index 5859905..f127127 100644
@@ -59,27 +59,22 @@
  * This function will free() an existing multi->auth_token and keep the
  * existing initial timestamp and session id contained in that token.
  */
-void
-generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
+void generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
 
 /**
  * Verifies the auth token to be in the format that generate_auth_token
  * create and checks if the token is valid.
  *
  */
-unsigned
-verify_auth_token(struct user_pass *up, struct tls_multi *multi,
-                  struct tls_session *session);
-
+unsigned verify_auth_token(struct user_pass *up, struct tls_multi *multi,
+                           struct tls_session *session);
 
 
 /**
  * Loads an HMAC secret from a file or if no file is present generates a
  * epheremal secret for the run time of the server and stores it into ctx
  */
-void
-auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file,
-                       bool key_inline);
+void auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline);
 
 
 /**
@@ -126,8 +121,7 @@
 static inline bool
 is_auth_token(const char *password)
 {
-    return (memcmp_constant_time(SESSION_ID_PREFIX, password,
-                                 strlen(SESSION_ID_PREFIX)) == 0);
+    return (memcmp_constant_time(SESSION_ID_PREFIX, password, strlen(SESSION_ID_PREFIX)) == 0);
 }
 /**
  * Checks if a client should be sent a new auth token to update its
@@ -135,15 +129,13 @@
  * @param multi     Pointer the multi object of the TLS session
  * @param session   Pointer to the TLS session itself
  */
-void
-resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
+void resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
 
 
 /**
  * Checks if the timer to resend the auth-token has expired and if a new
  * auth-token should be send to the client and triggers the resending
  */
-void
-check_send_auth_token(struct context *c);
+void check_send_auth_token(struct context *c);
 
 #endif /* AUTH_TOKEN_H */
src/openvpn/base64.c +5 -6
index a9c2f4c..54d5b79 100644
@@ -41,8 +41,7 @@
 
 #include "memdbg.h"
 
-static char base64_chars[] =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 /*
  * base64 encode input data of length size to malloced
  * buffer which is returned as *str.  Returns string
@@ -60,14 +59,14 @@
     {
         return -1;
     }
-    p = s = (char *) malloc(size * 4 / 3 + 4);
+    p = s = (char *)malloc(size * 4 / 3 + 4);
     if (p == NULL)
     {
         return -1;
     }
-    q = (const unsigned char *) data;
+    q = (const unsigned char *)data;
     i = 0;
-    for (i = 0; i < size; )
+    for (i = 0; i < size;)
     {
         c = q[i++];
         c *= 256;
@@ -196,5 +195,5 @@
             *q++ = val & 0xff;
         }
     }
-    return q - (unsigned char *) data;
+    return q - (unsigned char *)data;
 }
src/openvpn/base64.h +2 -4
index 7b4224a..be7aa64 100644
@@ -35,12 +35,10 @@
 #define _BASE64_H_
 
 /** Compute resulting base64 length.  6 bits per byte, padded to 4 bytes. */
-#define OPENVPN_BASE64_LENGTH(binary_length) \
-    ((((8 * binary_length) / 6) + 3) & ~3)
+#define OPENVPN_BASE64_LENGTH(binary_length) ((((8 * binary_length) / 6) + 3) & ~3)
 
 /** Compute the maximal number of bytes encoded in a base64 string. */
-#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) \
-    ((base64_length / 4) * 3)
+#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) ((base64_length / 4) * 3)
 
 int openvpn_base64_encode(const void *data, int size, char **str);
 
src/openvpn/basic.h +1 -1
index f603ecc..0360803 100644
@@ -27,7 +27,7 @@
 #define BOOL_CAST(x) ((x) ? (true) : (false))
 
 /* size of an array */
-#define SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 /* clear an object (may be optimized away, use secure_memzero() to erase secrets) */
 #define CLEAR(x) memset(&(x), 0, sizeof(x))
src/openvpn/buffer.c +46 -56

271 lines not on this page · raw message

src/openvpn/buffer.h +101 -113

374 lines not on this page · raw message

src/openvpn/circ_list.h +26 -29

75 lines not on this page · raw message

src/openvpn/clinat.c +7 -16
index f040724..7bf4d82 100644
@@ -33,8 +33,7 @@
 #include "memdbg.h"
 
 static bool
-add_entry(struct client_nat_option_list *dest,
-          const struct client_nat_entry *e)
+add_entry(struct client_nat_option_list *dest, const struct client_nat_entry *e)
 {
     if (dest->n >= MAX_CLIENT_NAT)
     {
@@ -60,9 +59,7 @@
         for (i = 0; i < list->n; ++i)
         {
             const struct client_nat_entry *e = &list->entries[i];
-            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s",
-                i,
-                e->type,
+            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s", i, e->type,
                 print_in_addr_t(e->network, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->netmask, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->foreign_network, IA_NET_ORDER, &gc));
@@ -103,11 +100,8 @@
 }
 
 void
-add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                              const char *type,
-                              const char *network,
-                              const char *netmask,
-                              const char *foreign_network,
+add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                              const char *network, const char *netmask, const char *foreign_network,
                               int msglevel)
 {
     struct client_nat_entry e;
@@ -180,9 +174,7 @@
         dirstr = "IN";
     }
 
-    msg(msglevel, "** CNAT %s %s %s -> %s",
-        dirstr,
-        prefix,
+    msg(msglevel, "** CNAT %s %s %s -> %s", dirstr, prefix,
         print_in_addr_t(iph->saddr, IA_NET_ORDER, &gc),
         print_in_addr_t(iph->daddr, IA_NET_ORDER, &gc));
 
@@ -190,11 +182,10 @@
 }
 
 void
-client_nat_transform(const struct client_nat_option_list *list,
-                     struct buffer *ipbuf,
+client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                      const int direction)
 {
-    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *) BPTR(ipbuf);
+    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR(ipbuf);
     int i;
     uint32_t addr, *addr_ptr;
     const uint32_t *from, *to;
src/openvpn/clinat.h +12 -12
index 334b3f2..a9b42dd 100644
@@ -31,7 +31,8 @@
 #define CN_OUTGOING 0
 #define CN_INCOMING 1
 
-struct client_nat_entry {
+struct client_nat_entry
+{
 #define CN_SNAT 0
 #define CN_DNAT 1
     int type;
@@ -40,28 +41,27 @@
     in_addr_t foreign_network;
 };
 
-struct client_nat_option_list {
+struct client_nat_option_list
+{
     int n;
     struct client_nat_entry entries[MAX_CLIENT_NAT];
 };
 
 struct client_nat_option_list *new_client_nat_list(struct gc_arena *gc);
 
-struct client_nat_option_list *clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc);
+struct client_nat_option_list *clone_client_nat_option_list(
+    const struct client_nat_option_list *src, struct gc_arena *gc);
 
-void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src);
+void copy_client_nat_option_list(struct client_nat_option_list *dest,
+                                 const struct client_nat_option_list *src);
 
 void print_client_nat_list(const struct client_nat_option_list *list, int msglevel);
 
-void add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                                   const char *type,
-                                   const char *network,
-                                   const char *netmask,
-                                   const char *foreign_network,
-                                   int msglevel);
+void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                                   const char *network, const char *netmask,
+                                   const char *foreign_network, int msglevel);
 
-void client_nat_transform(const struct client_nat_option_list *list,
-                          struct buffer *ipbuf,
+void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                           const int direction);
 
 #endif /* if !defined(CLINAT_H) */
src/openvpn/common.h +7 -6
index 5d4cf2e..645ebb9 100644
@@ -28,7 +28,7 @@
  * Statistics counters and associated printf format.
  */
 typedef uint64_t counter_type;
-#define counter_format  "%" PRIu64
+#define counter_format "%" PRIu64
 
 /*
  * Time intervals
@@ -38,17 +38,17 @@
 /*
  * Used as an upper bound for timeouts.
  */
-#define BIG_TIMEOUT  (60*60*24*7)  /* one week (in seconds) */
+#define BIG_TIMEOUT (60 * 60 * 24 * 7) /* one week (in seconds) */
 
 /*
  * Printf formats for special types
  */
 #ifdef _WIN64
-#define ptr_format              "0x%016" PRIx64
+#define ptr_format "0x%016" PRIx64
 #else
-#define ptr_format              "0x%08lx"
+#define ptr_format "0x%08lx"
 #endif
-#define fragment_header_format  "0x%08x"
+#define fragment_header_format "0x%08x"
 
 /* these are used to cast the arguments
  * and MUST match the formats above */
@@ -95,6 +95,7 @@
 /*
  * Script security warning
  */
-#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
+#define SCRIPT_SECURITY_WARNING \
+    "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
 
 #endif /* ifndef COMMON_H */
src/openvpn/comp-lz4.c +13 -28

86 lines not on this page · raw message

src/openvpn/comp.c +5 -5
index b2aa07e..82979a8 100644
@@ -172,10 +172,10 @@
     {
 #ifdef USE_COMP
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since data-channel offloading is enabled.");
+                      "since data-channel offloading is enabled.");
 #else
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since OpenVPN was built without compression support.");
+                      "since OpenVPN was built without compression support.");
 #endif
         return false;
     }
@@ -183,14 +183,14 @@
     if ((info->flags & COMP_F_ALLOW_STUB_ONLY) && comp_non_stub_enabled(info))
     {
         msg(msglevel, "Compression is not allowed since allow-compression is "
-            "set to 'stub-only'");
+                      "set to 'stub-only'");
         return false;
     }
 #ifndef ENABLE_LZ4
     if (info->alg == COMP_ALGV2_LZ4 || info->alg == COMP_ALG_LZ4)
     {
         msg(msglevel, "OpenVPN is compiled without LZ4 support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
@@ -198,7 +198,7 @@
     if (info->alg == COMP_ALG_LZO)
     {
         msg(msglevel, "OpenVPN is compiled without LZO support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
src/openvpn/comp.h +21 -24

102 lines not on this page · raw message

src/openvpn/compstub.c +9 -23
index 109d691..0d6e0e0 100644
@@ -46,8 +46,7 @@
 }
 
 static void
-stub_compress(struct buffer *buf, struct buffer work,
-              struct compress_context *compctx,
+stub_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
               const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -57,7 +56,7 @@
     if (compctx->flags & COMP_F_SWAP)
     {
         uint8_t *head = BPTR(buf);
-        uint8_t *tail  = BEND(buf);
+        uint8_t *tail = BEND(buf);
         ASSERT(buf_safe(buf, 1));
         ++buf->len;
 
@@ -73,8 +72,7 @@
 }
 
 static void
-stub_decompress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stub_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     uint8_t c;
@@ -108,8 +106,7 @@
 
 
 static void
-stubv2_compress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stubv2_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -121,8 +118,7 @@
 }
 
 static void
-stubv2_decompress(struct buffer *buf, struct buffer work,
-                  struct compress_context *compctx,
+stubv2_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                   const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -158,19 +154,9 @@
     }
 }
 
-const struct compress_alg compv2_stub_alg = {
-    "stubv2",
-    stub_compress_init,
-    stub_compress_uninit,
-    stubv2_compress,
-    stubv2_decompress
-};
+const struct compress_alg compv2_stub_alg = { "stubv2", stub_compress_init, stub_compress_uninit,
+                                              stubv2_compress, stubv2_decompress };
 
-const struct compress_alg comp_stub_alg = {
-    "stub",
-    stub_compress_init,
-    stub_compress_uninit,
-    stub_compress,
-    stub_decompress
-};
+const struct compress_alg comp_stub_alg = { "stub", stub_compress_init, stub_compress_uninit,
+                                            stub_compress, stub_decompress };
 #endif /* USE_STUB */
src/openvpn/console.c +4 -6
index 617e146..deb280e 100644
@@ -38,7 +38,7 @@
 #endif
 
 
-struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* GLOBAL */
+struct _query_user query_user[QUERY_USER_NUMSLOTS]; /* GLOBAL */
 
 
 void
@@ -54,16 +54,14 @@
 
 
 void
-query_user_add(char *prompt, size_t prompt_len,
-               char *resp, size_t resp_len,
-               bool echo)
+query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     int i;
 
     /* Ensure input is sane.  All these must be present otherwise it is
      * a programming error.
      */
-    ASSERT( prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL );
+    ASSERT(prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL);
 
     /* Seek to the last unused slot */
     for (i = 0; i < QUERY_USER_NUMSLOTS; i++)
@@ -73,7 +71,7 @@
             break;
         }
     }
-    ASSERT( i < QUERY_USER_NUMSLOTS );  /* Unlikely, but we want to panic if it happens */
+    ASSERT(i < QUERY_USER_NUMSLOTS); /* Unlikely, but we want to panic if it happens */
 
     /* Save the information needed for the user interaction */
     query_user[i].prompt = prompt;
src/openvpn/console.h +11 -14
index 589f778..e2dddec 100644
@@ -31,16 +31,17 @@
 /**
  *  Configuration setup for declaring what kind of information to ask a user for
  */
-struct _query_user {
-    char *prompt;             /**< Prompt to present to the user */
-    size_t prompt_len;        /**< Length of the prompt string */
-    char *response;           /**< The user's response */
-    size_t response_len;      /**< Length the of the user response */
-    bool echo;                /**< True: The user should see what is being typed, otherwise mask it */
+struct _query_user
+{
+    char *prompt;        /**< Prompt to present to the user */
+    size_t prompt_len;   /**< Length of the prompt string */
+    char *response;      /**< The user's response */
+    size_t response_len; /**< Length the of the user response */
+    bool echo;           /**< True: The user should see what is being typed, otherwise mask it */
 };
 
 #define QUERY_USER_NUMSLOTS 10
-extern struct _query_user query_user[];  /**< Global variable, declared in console.c */
+extern struct _query_user query_user[]; /**< Global variable, declared in console.c */
 
 /**
  * Wipes all data put into all of the query_user structs
@@ -59,9 +60,7 @@
  * @param echo       Should the user input be echoed to the user?  If False, input will be masked
  *
  */
-void query_user_add(char *prompt, size_t prompt_len,
-                    char *resp, size_t resp_len,
-                    bool echo);
+void query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo);
 
 
 /**
@@ -108,7 +107,7 @@
 {
     return query_user_exec_builtin();
 }
-#endif  /* defined(ENABLE_SYSTEMD) */
+#endif /* defined(ENABLE_SYSTEMD) */
 
 
 /**
@@ -119,9 +118,7 @@
  *
  */
 static inline bool
-query_user_SINGLE(char *prompt, size_t prompt_len,
-                  char *resp, size_t resp_len,
-                  bool echo)
+query_user_SINGLE(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     query_user_clear();
     query_user_add(prompt, prompt_len, resp, resp_len, echo);
src/openvpn/console_builtin.c +12 -11
index ba61d3f..a0984bf 100644
@@ -68,11 +68,10 @@
 
     HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
     int orig_stderr = get_orig_stderr(); /* guaranteed to be always valid */
-    if ((in == INVALID_HANDLE_VALUE)
-        || win32_service_interrupt(&win32_signal)
+    if ((in == INVALID_HANDLE_VALUE) || win32_service_interrupt(&win32_signal)
         || (_write(orig_stderr, prompt, strlen(prompt)) == -1))
     {
-        msg(M_WARN|M_ERRNO, "get_console_input_win32(): unexpected error");
+        msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");
         return false;
     }
 
@@ -136,7 +135,7 @@
     return false;
 }
 
-#endif   /* _WIN32 */
+#endif /* _WIN32 */
 
 
 #ifdef HAVE_TERMIOS_H
@@ -178,7 +177,7 @@
     }
 }
 
-#endif   /* HAVE_TERMIOS_H */
+#endif /* HAVE_TERMIOS_H */
 
 
 /**
@@ -210,15 +209,17 @@
      * (in which case neither stdin or stderr are connected to a tty and
      * /dev/tty can not be open()ed anymore)
      */
-    if (!isatty(0) && !isatty(2) )
+    if (!isatty(0) && !isatty(2))
     {
-        int fd = open( "/dev/tty", O_RDWR );
+        int fd = open("/dev/tty", O_RDWR);
         if (fd < 0)
         {
-            msg(M_FATAL, "neither stdin nor stderr are a tty device and you have neither a "
+            msg(M_FATAL,
+                "neither stdin nor stderr are a tty device and you have neither a "
                 "controlling tty nor systemd - can't ask for '%s'.  If you used --daemon, "
                 "you need to use --askpass to make passphrase-protected keys work, and you "
-                "can not use --auth-nocache.", prompt );
+                "can not use --auth-nocache.",
+                prompt);
         }
         close(fd);
     }
@@ -286,8 +287,8 @@
     /* Loop through configured query_user slots */
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
-        if (!get_console_input(query_user[i].prompt, query_user[i].echo,
-                               query_user[i].response, query_user[i].response_len) )
+        if (!get_console_input(query_user[i].prompt, query_user[i].echo, query_user[i].response,
+                               query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/console_systemd.c +4 -6
index 91ebb35..af67b15 100644
@@ -51,9 +51,7 @@
      * mounted, as well as the systemd-ask-password executable
      * being available */
 
-    return (sd_booted() > 0)
-           && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
-
+    return (sd_booted() > 0) && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
 }
 
 static bool
@@ -80,7 +78,7 @@
         return false;
     }
     memset(input, 0, capacity);
-    if (read(std_out, input, capacity-1) != 0)
+    if (read(std_out, input, capacity - 1) != 0)
     {
         chomp(input);
         ret = true;
@@ -100,7 +98,7 @@
 bool
 query_user_exec_systemd(void)
 {
-    bool ret = true;  /* Presume everything goes okay */
+    bool ret = true; /* Presume everything goes okay */
     int i;
 
     /* If systemd is not available, use the default built-in mechanism */
@@ -113,7 +111,7 @@
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
         if (!get_console_input_systemd(query_user[i].prompt, query_user[i].echo,
-                                       query_user[i].response, query_user[i].response_len) )
+                                       query_user[i].response, query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/crypto.c +122 -168

145 lines not on this page · raw message

src/openvpn/crypto.h +88 -102

190 lines not on this page · raw message

src/openvpn/crypto_backend.h +17 -17
index 8bb7f47..239724c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_epoch.c +27 -43

70 lines not on this page · raw message

src/openvpn/crypto_epoch.h +16 -30

46 lines not on this page · raw message

src/openvpn/crypto_mbedtls.c +74 -74

148 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +14 -17
index 6575bad..fceae43 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_openssl.c +85 -97

182 lines not on this page · raw message

src/openvpn/crypto_openssl.h +14 -12
index 85f53f6..3e0067c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/cryptoapi.c +57 -52

109 lines not on this page · raw message

src/openvpn/dco.c +57 -59

116 lines not on this page · raw message

src/openvpn/dco.h +12 -15
index f38316d..b1bd210 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.c +14 -22
index b8816c6..7175d37 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.h +7 -4
index e1a054e..28d97bb 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_internal.h +5 -8
index 27d03ef..866b364 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_linux.c +79 -113

192 lines not on this page · raw message

src/openvpn/dco_linux.h +5 -3
index 4e441ec..1800752 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_win.c +63 -56

119 lines not on this page · raw message

src/openvpn/dco_win.h +20 -23

43 lines not on this page · raw message

src/openvpn/dhcp.c +28 -28

56 lines not on this page · raw message

src/openvpn/dhcp.h +21 -19
index c578c6a..109d97c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dns.c +35 -36

71 lines not on this page · raw message

src/openvpn/dns.h +21 -12
index d33f64e..9610358 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.c +7 -14
index f20ee8a..9a5681d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.h +9 -13
index 52c5312..5bbccbd 100644

Lines of this file are not shown. View the raw message.

src/openvpn/errlevel.h +115 -115

230 lines not on this page · raw message

src/openvpn/error.c +51 -86

137 lines not on this page · raw message

src/openvpn/error.h +77 -41

118 lines not on this page · raw message

src/openvpn/event.c +80 -98

178 lines not on this page · raw message

src/openvpn/event.h +34 -31

65 lines not on this page · raw message

src/openvpn/fdmisc.c +1 -1
index 3d8654c..f6be9fd 100644

Lines of this file are not shown. View the raw message.

src/openvpn/fdmisc.h +1 -1
index 17b6994..1ff66aa 100644

Lines of this file are not shown. View the raw message.

src/openvpn/forward.c +113 -152

265 lines not on this page · raw message

src/openvpn/forward.h +32 -33

65 lines not on this page · raw message

src/openvpn/fragment.c +40 -54

94 lines not on this page · raw message

src/openvpn/fragment.h +39 -39

78 lines not on this page · raw message

src/openvpn/gremlin.c +12 -13
index b58defe..8bd68e5 100644

Lines of this file are not shown. View the raw message.

src/openvpn/gremlin.h +17 -15
index bf1cfea..a0491b4 100644

Lines of this file are not shown. View the raw message.

src/openvpn/helper.c +48 -40

88 lines not on this page · raw message

src/openvpn/httpdigest.c +39 -50

89 lines not on this page · raw message

src/openvpn/httpdigest.h +13 -21
index 50cf451..1d1bc49 100644

Lines of this file are not shown. View the raw message.

src/openvpn/init.c +306 -476

782 lines not on this page · raw message

src/openvpn/init.h +15 -19
index 5c6b9c1..a650de6 100644

Lines of this file are not shown. View the raw message.

src/openvpn/integer.h +9 -8
index c568036..e1f7950 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.c +4 -7
index f1abeee..35c1382 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.h +9 -11
index 60030fd..d2473e4 100644

Lines of this file are not shown. View the raw message.

src/openvpn/list.c +59 -57

116 lines not on this page · raw message

src/openvpn/list.h +8 -19
index 783570f..678e817 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lladdr.c +7 -19
index cc677b4..d8bcad9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.c +10 -17
index 01db221..a8649f8 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.h +21 -17
index 03da2af..d5bab54 100644

Lines of this file are not shown. View the raw message.

src/openvpn/manage.c +278 -355

633 lines not on this page · raw message

src/openvpn/manage.h +114 -143

257 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +7 -9
index aeb0c5f..94d56f9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.c +3 -3
index 3346a11..0585395 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.h +3 -3
index b9c1645..9c41a58 100644

Lines of this file are not shown. View the raw message.

src/openvpn/memdbg.h +5 -3
index 6947275..743a853 100644

Lines of this file are not shown. View the raw message.

src/openvpn/misc.c +139 -138

277 lines not on this page · raw message

src/openvpn/misc.h +36 -41

77 lines not on this page · raw message

src/openvpn/mroute.c +32 -45

77 lines not on this page · raw message

src/openvpn/mroute.h +62 -67

129 lines not on this page · raw message

src/openvpn/mss.c +33 -47

80 lines not on this page · raw message

src/openvpn/mss.h +1 -2
index 426af5e..46a956e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.c +1 -1
index cbef26a..b9c6741 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.h +2 -1
index ea0237f..8d63457 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.c +8 -8
index 71991dd..5bc2578 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.h +4 -2
index 334d6eb..500aec2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtu.c +20 -29

49 lines not on this page · raw message

src/openvpn/mtu.h +65 -76

141 lines not on this page · raw message

src/openvpn/mudp.c +30 -33

63 lines not on this page · raw message

src/openvpn/multi.c +356 -479

835 lines not on this page · raw message

src/openvpn/multi.h +65 -67

132 lines not on this page · raw message

src/openvpn/multi_io.c +66 -74

140 lines not on this page · raw message

src/openvpn/networking.h +25 -36

61 lines not on this page · raw message

src/openvpn/networking_freebsd.c +20 -34

54 lines not on this page · raw message

src/openvpn/networking_iproute2.c +37 -57

94 lines not on this page · raw message

src/openvpn/networking_sitnl.c +165 -209

374 lines not on this page · raw message

src/openvpn/ntlm.c +50 -55

105 lines not on this page · raw message

src/openvpn/occ.c +96 -111

207 lines not on this page · raw message

src/openvpn/occ.h +15 -16
index 8631bce..1ac93b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openssl_compat.h +16 -19
index 6baaaea..f9e1460 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.c +9 -12
index 54d5a06..51dcd92 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.h +68 -64

132 lines not on this page · raw message

src/openvpn/options.c +711 -830

1,541 lines not on this page · raw message

src/openvpn/options.h +95 -115

210 lines not on this page · raw message

src/openvpn/options_util.c +3 -4
index 80d0c08..e2c445c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/options_util.h +4 -8
index 2474e7f..27a97a9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.c +5 -13
index d423067..196b175 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.h +2 -2
index 448389d..87f9a25 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ovpn_dco_freebsd.h +28 -24

52 lines not on this page · raw message

src/openvpn/packet_id.c +41 -72

113 lines not on this page · raw message

src/openvpn/packet_id.h +29 -33

62 lines not on this page · raw message

src/openvpn/perf.c +31 -43

74 lines not on this page · raw message

src/openvpn/perf.h +22 -22

44 lines not on this page · raw message

src/openvpn/ping.c +3 -6
index f570d95..0fdca7b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ping.h +5 -6
index 4cb89b4..085b52f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11.c +165 -383

548 lines not on this page · raw message

src/openvpn/pkcs11.h +12 -37

49 lines not on this page · raw message

src/openvpn/pkcs11_backend.h +2 -4
index dce6822..834456f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_mbedtls.c +7 -12
index 13b8a86..21c9d47 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_openssl.c +40 -41

81 lines not on this page · raw message

src/openvpn/platform.c +36 -38

74 lines not on this page · raw message

src/openvpn/platform.h +7 -7
index 56f8909..b3b13a7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/plugin.c +85 -116

201 lines not on this page · raw message

src/openvpn/plugin.h +26 -35

61 lines not on this page · raw message

src/openvpn/pool.c +49 -75

124 lines not on this page · raw message

src/openvpn/pool.h +10 -8
index 9c3905d..39f9d98 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.c +13 -25
index 90930fe..6ab40a2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.h +90 -84

174 lines not on this page · raw message

src/openvpn/proxy.c +80 -120

200 lines not on this page · raw message

src/openvpn/proxy.h +15 -12
index cf1fbdb..054fe8c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ps.c +53 -69

122 lines not on this page · raw message

src/openvpn/ps.h +3 -4
index 59aecbe..1309eae 100644

Lines of this file are not shown. View the raw message.

src/openvpn/push.c +84 -108

192 lines not on this page · raw message

src/openvpn/push.h +8 -13
index 048b4c4..84931fb 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pushlist.h +4 -2
index d946a5f..f4d4370 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.c +8 -6
index a5bcf94..8b4ff2d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.h +5 -7
index ae7be21..1981067 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reliable.c +28 -35

63 lines not on this page · raw message

src/openvpn/reliable.h +25 -29

54 lines not on this page · raw message

src/openvpn/ring_buffer.h new file +124 -0

124 lines not on this page · raw message

src/openvpn/route.c +420 -687

1,107 lines not on this page · raw message

src/openvpn/route.h +108 -115

223 lines not on this page · raw message

src/openvpn/run_command.c +12 -16
index 8b5fa4f..5fefb55 100644

Lines of this file are not shown. View the raw message.

src/openvpn/run_command.h +20 -21

41 lines not on this page · raw message

src/openvpn/schedule.c +16 -35

51 lines not on this page · raw message

src/openvpn/schedule.h +5 -8
index 1608708..5a9db6f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/session_id.h +1 -2
index 5ce9a96..7a75261 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.c +1 -2
index 1075954..005719e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.h +9 -10
index 2b3eeb9..b53d4ad 100644

Lines of this file are not shown. View the raw message.

src/openvpn/sig.c +28 -31

59 lines not on this page · raw message

src/openvpn/sig.h +2 -2
index fe81af9..bd1a895 100644

Lines of this file are not shown. View the raw message.

src/openvpn/socket.c +339 -560

899 lines not on this page · raw message

src/openvpn/socket.h +162 -227

389 lines not on this page · raw message

src/openvpn/socks.c +55 -61

116 lines not on this page · raw message

src/openvpn/socks.h +9 -11
index 0eaa9da..03d74d9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl.c +265 -427

692 lines not on this page · raw message

src/openvpn/ssl.h +45 -71

116 lines not on this page · raw message

src/openvpn/ssl_backend.h +27 -38

65 lines not on this page · raw message

src/openvpn/ssl_common.h +94 -85

179 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +122 -181

303 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +36 -29

65 lines not on this page · raw message

src/openvpn/ssl_ncp.c +44 -57

101 lines not on this page · raw message

src/openvpn/ssl_ncp.h +11 -20
index 6159264..51cd4f2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_openssl.c +144 -178

322 lines not on this page · raw message

src/openvpn/ssl_openssl.h +8 -6
index f26b44e..48c23f3 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_pkt.c +38 -70

108 lines not on this page · raw message

src/openvpn/ssl_pkt.h +44 -62

106 lines not on this page · raw message

src/openvpn/ssl_util.c +152 -141

293 lines not on this page · raw message

src/openvpn/ssl_util.h +7 -5
index e50f899..6f48c23 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify.c +165 -166

331 lines not on this page · raw message

src/openvpn/ssl_verify.h +24 -27

51 lines not on this page · raw message

src/openvpn/ssl_verify_backend.h +15 -15
index eb80cc8..87e381b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +55 -67

122 lines not on this page · raw message

src/openvpn/ssl_verify_mbedtls.h +1 -2
index ff21157..f5f34e4 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_openssl.c +44 -54

98 lines not on this page · raw message

src/openvpn/status.c +11 -19
index 4b0e516..83300ff 100644

Lines of this file are not shown. View the raw message.

src/openvpn/status.h +10 -12
index eaed22a..292e63a 100644

Lines of this file are not shown. View the raw message.

src/openvpn/syshead.h +25 -23

48 lines not on this page · raw message

src/openvpn/tls_crypt.c +87 -140

227 lines not on this page · raw message

src/openvpn/tls_crypt.h +22 -29

51 lines not on this page · raw message

src/openvpn/tun.c +616 -944

1,560 lines not on this page · raw message

src/openvpn/tun.h +58 -65

123 lines not on this page · raw message

src/openvpn/tun_afunix.c +6 -11
index 50ef765..fb8da91 100644

Lines of this file are not shown. View the raw message.

src/openvpn/tun_afunix.h +4 -11
index 21ae676..1a3467c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.c +10 -14
index d0beb48..638554d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.h +3 -6
index f6cf385..30f2c2d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/wfp_block.c +31 -66

97 lines not on this page · raw message

src/openvpn/wfp_block.h +3 -5
index fc5ec7e..0fb2554 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32-util.c +1 -1
index dd55743..9c45842 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32.c +87 -100

187 lines not on this page · raw message

src/openvpn/win32.h +30 -33

63 lines not on this page · raw message

src/openvpn/xkey_common.h +15 -19
index 84c6329..3f63919 100644

Lines of this file are not shown. View the raw message.

src/openvpn/xkey_helper.c +47 -50

97 lines not on this page · raw message

src/openvpn/xkey_provider.c +154 -146

300 lines not on this page · raw message

src/openvpnmsica/dllmain.c +14 -17
index 6f14a5c..242b804 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.c +11 -10
index 0f5b2fb..2f1bbba 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.h +5 -13
index 2a3e931..67bddde 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.c +13 -21
index c0f5853..ddf078f 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.h +6 -21
index ab029cc..3fb1b90 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/openvpnmsica.c +179 -170

349 lines not on this page · raw message

src/openvpnmsica/openvpnmsica.h +75 -79

154 lines not on this page · raw message

src/openvpnserv/common.c +24 -25

49 lines not on this page · raw message

src/openvpnserv/interactive.c +196 -211

407 lines not on this page · raw message

src/openvpnserv/service.c +21 -25

46 lines not on this page · raw message

src/openvpnserv/service.h +13 -10
index bfbe466..4539262 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.c +16 -17
index 9231417..1547949 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.h +7 -6
index 3ef577b..4c55356 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/auth-pam.c +76 -68

144 lines not on this page · raw message

src/plugins/auth-pam/pamdl.c +29 -37

66 lines not on this page · raw message

src/plugins/auth-pam/utils.c +5 -4
index a6ccfbf..68216e4 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/utils.h +7 -9
index 844d2d1..916584a 100644

Lines of this file are not shown. View the raw message.

src/plugins/down-root/down-root.c +22 -17
index 253adcd..795a887 100644

Lines of this file are not shown. View the raw message.

src/tapctl/basic.h +9 -7
index 3814db1..ad8b3fa 100644

Lines of this file are not shown. View the raw message.

src/tapctl/error.h +45 -21

66 lines not on this page · raw message

src/tapctl/main.c +72 -60

132 lines not on this page · raw message

src/tapctl/tap.c +148 -271

419 lines not on this page · raw message

src/tapctl/tap.h +13 -29

42 lines not on this page · raw message

tests/ntlm_support.c +1 -1
index f5eba88..788f132 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test.c +4 -5
index c174025..139e06f 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test2.c +1 -1
index bb54633..3089432 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/cert_data.h +34 -36

70 lines not on this page · raw message

tests/unit_tests/openvpn/mock_management.c +1 -2
index c3e38b9..2adade5 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.c +2 -3
index b6ec744..6970ad8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.h +3 -6
index bc2ee5d..ffac529 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_ssl_dependencies.c +2 -2
index 5cfe8d0..7ae0e69 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/pkey_test_utils.c +5 -6
index 9a044ec..4af80ac 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_argv.c +9 -9
index 33b3dec..a65857b 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_auth_token.c +59 -66

125 lines not on this page · raw message

tests/unit_tests/openvpn/test_buffer.c +28 -37

65 lines not on this page · raw message

tests/unit_tests/openvpn/test_crypto.c +85 -131

216 lines not on this page · raw message

tests/unit_tests/openvpn/test_cryptoapi.c +41 -42

83 lines not on this page · raw message

tests/unit_tests/openvpn/test_misc.c +38 -35

73 lines not on this page · raw message

tests/unit_tests/openvpn/test_ncp.c +34 -46

80 lines not on this page · raw message

tests/unit_tests/openvpn/test_networking.c +4 -10
index 0434707..f2da83e 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_packet_id.c +25 -32

57 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkcs11.c +46 -47

93 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkt.c +94 -120

214 lines not on this page · raw message

tests/unit_tests/openvpn/test_provider.c +27 -26

53 lines not on this page · raw message

tests/unit_tests/openvpn/test_ssl.c +24 -31

55 lines not on this page · raw message

tests/unit_tests/openvpn/test_tls_crypt.c +105 -150

255 lines not on this page · raw message

tests/unit_tests/openvpn/test_user_pass.c +17 -14
index 400c0f4..e727c4e 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/plugins/auth-pam/test_search_and_replace.c +0 -2
index d40467f..5875c8e 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 22
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-MessageType: newpatchset

Part of the diff is not shown here. View the raw message.

#11 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, ordex, plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/791?usp=email

to look at the new patch set (#23).

Change subject: Reformat the whole project with clang-format
......................................................................

Reformat the whole project with clang-format

Done with pre-commit run -a, so the version
defined in pre-commit config is used.

This also changes the Github workflow so that
there is no commit that fails GHA.

Change-Id I2566ad493629e1f5fdfa6f6483b8973463404e3e

---
M .github/workflows/build.yaml
M include/openvpn-msg.h
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M sample/sample-plugins/log/log.c
M sample/sample-plugins/log/log_v3.c
M sample/sample-plugins/simple/base64.c
M sample/sample-plugins/simple/simple.c
M src/compat/compat-basename.c
M src/compat/compat-dirname.c
M src/compat/compat-gettimeofday.c
M src/openvpn/argv.c
M src/openvpn/argv.h
M src/openvpn/auth_token.c
M src/openvpn/auth_token.h
M src/openvpn/base64.c
M src/openvpn/base64.h
M src/openvpn/basic.h
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/circ_list.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/common.h
M src/openvpn/comp-lz4.c
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/compstub.c
M src/openvpn/console.c
M src/openvpn/console.h
M src/openvpn/console_builtin.c
M src/openvpn/console_systemd.c
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_epoch.c
M src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/cryptoapi.c
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_freebsd.h
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_linux.h
M src/openvpn/dco_win.c
M src/openvpn/dco_win.h
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/env_set.c
M src/openvpn/env_set.h
M src/openvpn/errlevel.h
M src/openvpn/error.c
M src/openvpn/error.h
M src/openvpn/event.c
M src/openvpn/event.h
M src/openvpn/fdmisc.c
M src/openvpn/fdmisc.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/fragment.c
M src/openvpn/fragment.h
M src/openvpn/gremlin.c
M src/openvpn/gremlin.h
M src/openvpn/helper.c
M src/openvpn/httpdigest.c
M src/openvpn/httpdigest.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/integer.h
M src/openvpn/interval.c
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/lladdr.c
M src/openvpn/lzo.c
M src/openvpn/lzo.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/memdbg.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/mroute.c
M src/openvpn/mroute.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mstats.c
M src/openvpn/mstats.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mtu.c
M src/openvpn/mtu.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/multi_io.c
M src/openvpn/networking.h
M src/openvpn/networking_freebsd.c
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/ntlm.c
M src/openvpn/occ.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/openvpn.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/options_util.c
M src/openvpn/options_util.h
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/ovpn_dco_freebsd.h
M src/openvpn/packet_id.c
M src/openvpn/packet_id.h
M src/openvpn/perf.c
M src/openvpn/perf.h
M src/openvpn/ping.c
M src/openvpn/ping.h
M src/openvpn/pkcs11.c
M src/openvpn/pkcs11.h
M src/openvpn/pkcs11_backend.h
M src/openvpn/pkcs11_mbedtls.c
M src/openvpn/pkcs11_openssl.c
M src/openvpn/platform.c
M src/openvpn/platform.h
M src/openvpn/plugin.c
M src/openvpn/plugin.h
M src/openvpn/pool.c
M src/openvpn/pool.h
M src/openvpn/proto.c
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/ps.c
M src/openvpn/ps.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M src/openvpn/pushlist.h
M src/openvpn/reflect_filter.c
M src/openvpn/reflect_filter.h
M src/openvpn/reliable.c
M src/openvpn/reliable.h
A src/openvpn/ring_buffer.h
M src/openvpn/route.c
M src/openvpn/route.h
M src/openvpn/run_command.c
M src/openvpn/run_command.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M src/openvpn/session_id.h
M src/openvpn/shaper.c
M src/openvpn/shaper.h
M src/openvpn/sig.c
M src/openvpn/sig.h
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_common.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_openssl.h
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_util.c
M src/openvpn/ssl_util.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/ssl_verify_backend.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/ssl_verify_mbedtls.h
M src/openvpn/ssl_verify_openssl.c
M src/openvpn/status.c
M src/openvpn/status.h
M src/openvpn/syshead.h
M src/openvpn/tls_crypt.c
M src/openvpn/tls_crypt.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpn/wfp_block.c
M src/openvpn/wfp_block.h
M src/openvpn/win32-util.c
M src/openvpn/win32.c
M src/openvpn/win32.h
M src/openvpn/xkey_common.h
M src/openvpn/xkey_helper.c
M src/openvpn/xkey_provider.c
M src/openvpnmsica/dllmain.c
M src/openvpnmsica/msica_arg.c
M src/openvpnmsica/msica_arg.h
M src/openvpnmsica/msiex.c
M src/openvpnmsica/msiex.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnserv/service.c
M src/openvpnserv/service.h
M src/openvpnserv/validate.c
M src/openvpnserv/validate.h
M src/plugins/auth-pam/auth-pam.c
M src/plugins/auth-pam/pamdl.c
M src/plugins/auth-pam/utils.c
M src/plugins/auth-pam/utils.h
M src/plugins/down-root/down-root.c
M src/tapctl/basic.h
M src/tapctl/error.h
M src/tapctl/main.c
M src/tapctl/tap.c
M src/tapctl/tap.h
M tests/ntlm_support.c
M tests/unit_tests/example_test/test.c
M tests/unit_tests/example_test/test2.c
M tests/unit_tests/openvpn/cert_data.h
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/mock_ssl_dependencies.c
M tests/unit_tests/openvpn/pkey_test_utils.c
M tests/unit_tests/openvpn/test_argv.c
M tests/unit_tests/openvpn/test_auth_token.c
M tests/unit_tests/openvpn/test_buffer.c
M tests/unit_tests/openvpn/test_crypto.c
M tests/unit_tests/openvpn/test_cryptoapi.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_ncp.c
M tests/unit_tests/openvpn/test_networking.c
M tests/unit_tests/openvpn/test_packet_id.c
M tests/unit_tests/openvpn/test_pkcs11.c
M tests/unit_tests/openvpn/test_pkt.c
M tests/unit_tests/openvpn/test_provider.c
M tests/unit_tests/openvpn/test_push_update_msg.c
M tests/unit_tests/openvpn/test_ssl.c
M tests/unit_tests/openvpn/test_tls_crypt.c
M tests/unit_tests/openvpn/test_user_pass.c
M tests/unit_tests/plugins/auth-pam/test_search_and_replace.c

258 files changed, 12,008 insertions(+), 15,234 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/791/23

.github/workflows/build.yaml +12 -21
index bd5895b..ba7f64b 100644
@@ -5,35 +5,26 @@
   pull_request:
 
 jobs:
-  checkuncrustify:
-    name: "Check code style with Uncrustify"
-    # Ubuntu 22.04 has uncrustify 0.72_f
-    runs-on: ubuntu-22.04
+  clang-format:
+    name: Check code style with clang-format
+    runs-on: ubuntu-24.04
     steps:
       - name: Install dependencies
-        run: sudo apt update && sudo apt install -y uncrustify
+        run: |
+          sudo apt update && sudo apt install -y python3-pip
+          pip3 install pre-commit
       - name: Checkout OpenVPN
         uses: actions/[email protected]... # v4.2.2
-        with:
-          path: openvpn
-      - name: Show uncrustify version
-        run: uncrustify --version
-      - name: Run uncrustify
-        run: ./dev-tools/reformat-all.sh
-        working-directory: openvpn
+      - name: Run clang-format
+        run: pre-commit run -a --show-diff-on-failure || true
       - name: Check for changes
-        run: git diff --output=uncrustify-changes.patch
-        working-directory: openvpn
-      - name: Show changes on standard output
-        run: git diff
-        working-directory: openvpn
+        run: git diff --output=format-changes.patch
       - uses: actions/[email protected]... # v4.6.2
         with:
-          name: uncrustify-changes.patch
-          path: 'openvpn/uncrustify-changes.patch'
+          name: format-changes.patch
+          path: format-changes.patch
       - name: Set job status
-        run: test ! -s uncrustify-changes.patch
-        working-directory: openvpn
+        run: test ! -s format-changes.patch
 
   android:
     strategy:
include/openvpn-msg.h +41 -22

159 lines not on this page · raw message

sample/sample-plugins/client-connect/sample-client-connect.c +52 -59

265 lines not on this page · raw message

sample/sample-plugins/defer/multi-auth.c +34 -40

208 lines not on this page · raw message

sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +26 -25

119 lines not on this page · raw message

sample/sample-plugins/log/log.c +19 -19
index 63d714f..70fa60d 100644
@@ -36,7 +36,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -75,7 +76,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -91,19 +92,17 @@
     /*
      * Which callbacks to intercept.
      */
-    *type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
+    *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 void
@@ -171,9 +170,10 @@
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     show(type, argv, envp);
 
@@ -184,8 +184,8 @@
         const char *username = get_env("username", envp);
         const char *password = get_env("password", envp);
 
-        if (username && !strcmp(username, context->username)
-            && password && !strcmp(password, context->password))
+        if (username && !strcmp(username, context->username) && password
+            && !strcmp(password, context->password))
         {
             return OPENVPN_PLUGIN_FUNC_SUCCESS;
         }
@@ -203,6 +203,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/log/log_v3.c +24 -27

106 lines not on this page · raw message

sample/sample-plugins/simple/base64.c +15 -17
index b6c0c97..8a1dedd 100644
@@ -98,21 +98,20 @@
  *
  */
 OPENVPN_EXPORT int
-openvpn_plugin_open_v3(const int v3structver,
-                       struct openvpn_plugin_args_open_in const *args,
+openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in const *args,
                        struct openvpn_plugin_args_open_return *ret)
 {
     /* Check that we are API compatible */
     if (v3structver != OPENVPN_PLUGINv3_STRUCTVER)
     {
-        printf("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
+        printf(
+            "base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
     /*  Which callbacks to intercept.  */
-    ret->type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
+    ret->type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                     | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
 
     /* we don't need a plug-in context in this example, but OpenVPN expects "something" */
     ret->handle = calloc(1, 1);
@@ -125,8 +124,8 @@
 
     /* Print some version information about the OpenVPN process using this plug-in */
     ovpn_log(PLOG_NOTE, PLUGIN_NAME, "OpenVPN %s  (Major: %i, Minor: %i, Patch: %s)\n",
-             args->ovpn_version, args->ovpn_version_major,
-             args->ovpn_version_minor, args->ovpn_version_patch);
+             args->ovpn_version, args->ovpn_version_major, args->ovpn_version_minor,
+             args->ovpn_version_patch);
 
     return OPENVPN_PLUGIN_FUNC_SUCCESS;
 }
@@ -154,10 +153,10 @@
  */
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    if (type != OPENVPN_PLUGIN_TLS_VERIFY
-        && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+    if (type != OPENVPN_PLUGIN_TLS_VERIFY && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
     {
         ovpn_log(PLOG_ERR, PLUGIN_NAME, "Unsupported plug-in hook call attempted");
         return OPENVPN_PLUGIN_FUNC_ERROR;
@@ -174,14 +173,13 @@
     /* test the BASE64 encode function */
     char *buf = NULL;
     int r = ovpn_base64_encode(clcert_cn, (int)strlen(clcert_cn), &buf);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'",
-             clcert_cn, r, buf);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'", clcert_cn, r,
+             buf);
 
     /* test the BASE64 decode function */
-    char buf2[256] = {0};
+    char buf2[256] = { 0 };
     r = ovpn_base64_decode(buf, &buf2, 255);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'",
-             buf, r, buf2);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'", buf, r, buf2);
 
     /* Verify the result, and free the buffer allocated by ovpn_base64_encode() */
     r = strcmp(clcert_cn, buf2);
@@ -201,6 +199,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/simple/simple.c +10 -8
index ed5bce5..8b2b793 100644
@@ -38,7 +38,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -77,7 +78,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -96,21 +97,22 @@
      */
     *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     /* get username/password from envp string array */
     const char *username = get_env("username", envp);
     const char *password = get_env("password", envp);
 
     /* check entered username/password against what we require */
-    if (username && !strcmp(username, context->username)
-        && password && !strcmp(password, context->password))
+    if (username && !strcmp(username, context->username) && password
+        && !strcmp(password, context->password))
     {
         return OPENVPN_PLUGIN_FUNC_SUCCESS;
     }
@@ -123,6 +125,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
src/compat/compat-basename.c +1 -1
index 18944f6..24f5af7 100644
@@ -41,7 +41,7 @@
         /* If NULL, check for \ instead ... might be Windows a path */
         p = strrchr(filename, '\\');
     }
-    return p ? p + 1 : (char *) filename;
+    return p ? p + 1 : (char *)filename;
 }
 
 #endif /* HAVE_BASENAME */
src/compat/compat-dirname.c +2 -2
index 17de8ad..a432bae 100644
@@ -89,7 +89,7 @@
         /* The '/' is the last character, we have to look further.  */
         if (runp != path)
         {
-            last_slash = (char *) __memrchr(path, separator, runp - path);
+            last_slash = (char *)__memrchr(path, separator, runp - path);
         }
     }
 
@@ -134,7 +134,7 @@
         /* This assignment is ill-designed but the XPG specs require to
          * return a string containing "." in any case no directory part is
          * found and so a static and constant string is required.  */
-        path = (char *) dot;
+        path = (char *)dot;
     }
 
     return path;
src/compat/compat-gettimeofday.c +2 -2
index de53cb5..29ded6c 100644
@@ -48,7 +48,7 @@
 {
     const time_t t = time(NULL);
     const DWORD gtc = GetTickCount();
-    gtc_base = t - gtc/1000;
+    gtc_base = t - gtc / 1000;
     gtc_last = gtc;
 }
 
@@ -112,7 +112,7 @@
     return 0;
 }
 
-#else  /* ifdef _WIN32 */
+#else /* ifdef _WIN32 */
 
 #include <time.h>
 
src/openvpn/argv.c +5 -6
index 34266d4..903fc0a 100644
@@ -284,8 +284,7 @@
  *           free()d to avoid memory leaks.
  */
 static char *
-argv_prep_format(const char *format, const char delim, size_t *count,
-                 struct gc_arena *gc)
+argv_prep_format(const char *format, const char delim, size_t *count, struct gc_arena *gc)
 {
     if (format == NULL)
     {
@@ -311,7 +310,7 @@
              * the string is empty; the resulting format string
              * will never start with a delimiter.
              */
-            if (j > 0)  /* Has anything been written to the output string? */
+            if (j > 0) /* Has anything been written to the output string? */
             {
                 f[j++] = delim;
             }
@@ -347,7 +346,7 @@
 static bool
 argv_printf_arglist(struct argv *argres, const char *format, va_list arglist)
 {
-    const char delim = 0x1D;  /* ASCII Group Separator (GS) */
+    const char delim = 0x1D; /* ASCII Group Separator (GS) */
     bool res = false;
 
     /*
@@ -484,8 +483,8 @@
     argv_reset(argres);
 
     char *parms[MAX_PARMS + 1] = { 0 };
-    int nparms = parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0,
-                            D_ARGV_PARSE_CMD, &argres->gc);
+    int nparms =
+        parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0, D_ARGV_PARSE_CMD, &argres->gc);
     if (nparms)
     {
         int i;
src/openvpn/argv.h +8 -7
index f694760..056fe31 100644
@@ -31,7 +31,8 @@
 
 #include "buffer.h"
 
-struct argv {
+struct argv
+{
     struct gc_arena gc;
     size_t capacity;
     size_t argc;
@@ -55,21 +56,21 @@
 bool argv_printf(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 bool argv_printf_cat(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 #endif /* ifndef ARGV_H */
src/openvpn/auth_token.c +42 -49

245 lines not on this page · raw message

src/openvpn/auth_token.h +7 -15
index 3d56ee6..1e4a413 100644
@@ -58,27 +58,22 @@
  * This function will free() an existing multi->auth_token and keep the
  * existing initial timestamp and session id contained in that token.
  */
-void
-generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
+void generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
 
 /**
  * Verifies the auth token to be in the format that generate_auth_token
  * create and checks if the token is valid.
  *
  */
-unsigned
-verify_auth_token(struct user_pass *up, struct tls_multi *multi,
-                  struct tls_session *session);
-
+unsigned verify_auth_token(struct user_pass *up, struct tls_multi *multi,
+                           struct tls_session *session);
 
 
 /**
  * Loads an HMAC secret from a file or if no file is present generates a
  * epheremal secret for the run time of the server and stores it into ctx
  */
-void
-auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file,
-                       bool key_inline);
+void auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline);
 
 
 /**
@@ -125,8 +120,7 @@
 static inline bool
 is_auth_token(const char *password)
 {
-    return (memcmp_constant_time(SESSION_ID_PREFIX, password,
-                                 strlen(SESSION_ID_PREFIX)) == 0);
+    return (memcmp_constant_time(SESSION_ID_PREFIX, password, strlen(SESSION_ID_PREFIX)) == 0);
 }
 /**
  * Checks if a client should be sent a new auth token to update its
@@ -134,15 +128,13 @@
  * @param multi     Pointer the multi object of the TLS session
  * @param session   Pointer to the TLS session itself
  */
-void
-resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
+void resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
 
 
 /**
  * Checks if the timer to resend the auth-token has expired and if a new
  * auth-token should be send to the client and triggers the resending
  */
-void
-check_send_auth_token(struct context *c);
+void check_send_auth_token(struct context *c);
 
 #endif /* AUTH_TOKEN_H */
src/openvpn/base64.c +5 -6
index a9c2f4c..54d5b79 100644
@@ -41,8 +41,7 @@
 
 #include "memdbg.h"
 
-static char base64_chars[] =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 /*
  * base64 encode input data of length size to malloced
  * buffer which is returned as *str.  Returns string
@@ -60,14 +59,14 @@
     {
         return -1;
     }
-    p = s = (char *) malloc(size * 4 / 3 + 4);
+    p = s = (char *)malloc(size * 4 / 3 + 4);
     if (p == NULL)
     {
         return -1;
     }
-    q = (const unsigned char *) data;
+    q = (const unsigned char *)data;
     i = 0;
-    for (i = 0; i < size; )
+    for (i = 0; i < size;)
     {
         c = q[i++];
         c *= 256;
@@ -196,5 +195,5 @@
             *q++ = val & 0xff;
         }
     }
-    return q - (unsigned char *) data;
+    return q - (unsigned char *)data;
 }
src/openvpn/base64.h +2 -4
index 7b4224a..be7aa64 100644
@@ -35,12 +35,10 @@
 #define _BASE64_H_
 
 /** Compute resulting base64 length.  6 bits per byte, padded to 4 bytes. */
-#define OPENVPN_BASE64_LENGTH(binary_length) \
-    ((((8 * binary_length) / 6) + 3) & ~3)
+#define OPENVPN_BASE64_LENGTH(binary_length) ((((8 * binary_length) / 6) + 3) & ~3)
 
 /** Compute the maximal number of bytes encoded in a base64 string. */
-#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) \
-    ((base64_length / 4) * 3)
+#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) ((base64_length / 4) * 3)
 
 int openvpn_base64_encode(const void *data, int size, char **str);
 
src/openvpn/basic.h +1 -1
index 47a86d9..aae84f5 100644
@@ -26,7 +26,7 @@
 #define BOOL_CAST(x) ((x) ? (true) : (false))
 
 /* size of an array */
-#define SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 /* clear an object (may be optimized away, use secure_memzero() to erase secrets) */
 #define CLEAR(x) memset(&(x), 0, sizeof(x))
src/openvpn/buffer.c +46 -56

271 lines not on this page · raw message

src/openvpn/buffer.h +101 -113

374 lines not on this page · raw message

src/openvpn/circ_list.h +26 -29

75 lines not on this page · raw message

src/openvpn/clinat.c +7 -16
index f120a54..a303285 100644
@@ -32,8 +32,7 @@
 #include "memdbg.h"
 
 static bool
-add_entry(struct client_nat_option_list *dest,
-          const struct client_nat_entry *e)
+add_entry(struct client_nat_option_list *dest, const struct client_nat_entry *e)
 {
     if (dest->n >= MAX_CLIENT_NAT)
     {
@@ -59,9 +58,7 @@
         for (i = 0; i < list->n; ++i)
         {
             const struct client_nat_entry *e = &list->entries[i];
-            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s",
-                i,
-                e->type,
+            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s", i, e->type,
                 print_in_addr_t(e->network, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->netmask, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->foreign_network, IA_NET_ORDER, &gc));
@@ -102,11 +99,8 @@
 }
 
 void
-add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                              const char *type,
-                              const char *network,
-                              const char *netmask,
-                              const char *foreign_network,
+add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                              const char *network, const char *netmask, const char *foreign_network,
                               int msglevel)
 {
     struct client_nat_entry e;
@@ -179,9 +173,7 @@
         dirstr = "IN";
     }
 
-    msg(msglevel, "** CNAT %s %s %s -> %s",
-        dirstr,
-        prefix,
+    msg(msglevel, "** CNAT %s %s %s -> %s", dirstr, prefix,
         print_in_addr_t(iph->saddr, IA_NET_ORDER, &gc),
         print_in_addr_t(iph->daddr, IA_NET_ORDER, &gc));
 
@@ -189,11 +181,10 @@
 }
 
 void
-client_nat_transform(const struct client_nat_option_list *list,
-                     struct buffer *ipbuf,
+client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                      const int direction)
 {
-    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *) BPTR(ipbuf);
+    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR(ipbuf);
     int i;
     uint32_t addr, *addr_ptr;
     const uint32_t *from, *to;
src/openvpn/clinat.h +12 -12
index d565a49..abfa0b7 100644
@@ -30,7 +30,8 @@
 #define CN_OUTGOING 0
 #define CN_INCOMING 1
 
-struct client_nat_entry {
+struct client_nat_entry
+{
 #define CN_SNAT 0
 #define CN_DNAT 1
     int type;
@@ -39,28 +40,27 @@
     in_addr_t foreign_network;
 };
 
-struct client_nat_option_list {
+struct client_nat_option_list
+{
     int n;
     struct client_nat_entry entries[MAX_CLIENT_NAT];
 };
 
 struct client_nat_option_list *new_client_nat_list(struct gc_arena *gc);
 
-struct client_nat_option_list *clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc);
+struct client_nat_option_list *clone_client_nat_option_list(
+    const struct client_nat_option_list *src, struct gc_arena *gc);
 
-void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src);
+void copy_client_nat_option_list(struct client_nat_option_list *dest,
+                                 const struct client_nat_option_list *src);
 
 void print_client_nat_list(const struct client_nat_option_list *list, int msglevel);
 
-void add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                                   const char *type,
-                                   const char *network,
-                                   const char *netmask,
-                                   const char *foreign_network,
-                                   int msglevel);
+void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                                   const char *network, const char *netmask,
+                                   const char *foreign_network, int msglevel);
 
-void client_nat_transform(const struct client_nat_option_list *list,
-                          struct buffer *ipbuf,
+void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                           const int direction);
 
 #endif /* if !defined(CLINAT_H) */
src/openvpn/common.h +7 -6
index d7f5d959..c0947da 100644
@@ -27,7 +27,7 @@
  * Statistics counters and associated printf format.
  */
 typedef uint64_t counter_type;
-#define counter_format  "%" PRIu64
+#define counter_format "%" PRIu64
 
 /*
  * Time intervals
@@ -37,17 +37,17 @@
 /*
  * Used as an upper bound for timeouts.
  */
-#define BIG_TIMEOUT  (60*60*24*7)  /* one week (in seconds) */
+#define BIG_TIMEOUT (60 * 60 * 24 * 7) /* one week (in seconds) */
 
 /*
  * Printf formats for special types
  */
 #ifdef _WIN64
-#define ptr_format              "0x%016" PRIx64
+#define ptr_format "0x%016" PRIx64
 #else
-#define ptr_format              "0x%08lx"
+#define ptr_format "0x%08lx"
 #endif
-#define fragment_header_format  "0x%08x"
+#define fragment_header_format "0x%08x"
 
 /* these are used to cast the arguments
  * and MUST match the formats above */
@@ -94,6 +94,7 @@
 /*
  * Script security warning
  */
-#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
+#define SCRIPT_SECURITY_WARNING \
+    "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
 
 #endif /* ifndef COMMON_H */
src/openvpn/comp-lz4.c +13 -28

86 lines not on this page · raw message

src/openvpn/comp.c +5 -5
index afea948..1a2e775 100644
@@ -171,10 +171,10 @@
     {
 #ifdef USE_COMP
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since data-channel offloading is enabled.");
+                      "since data-channel offloading is enabled.");
 #else
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since OpenVPN was built without compression support.");
+                      "since OpenVPN was built without compression support.");
 #endif
         return false;
     }
@@ -182,14 +182,14 @@
     if ((info->flags & COMP_F_ALLOW_STUB_ONLY) && comp_non_stub_enabled(info))
     {
         msg(msglevel, "Compression is not allowed since allow-compression is "
-            "set to 'stub-only'");
+                      "set to 'stub-only'");
         return false;
     }
 #ifndef ENABLE_LZ4
     if (info->alg == COMP_ALGV2_LZ4 || info->alg == COMP_ALG_LZ4)
     {
         msg(msglevel, "OpenVPN is compiled without LZ4 support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
@@ -197,7 +197,7 @@
     if (info->alg == COMP_ALG_LZO)
     {
         msg(msglevel, "OpenVPN is compiled without LZO support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
src/openvpn/comp.h +21 -24

102 lines not on this page · raw message

src/openvpn/compstub.c +9 -23
index 853e9ee..bf709df 100644
@@ -45,8 +45,7 @@
 }
 
 static void
-stub_compress(struct buffer *buf, struct buffer work,
-              struct compress_context *compctx,
+stub_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
               const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -56,7 +55,7 @@
     if (compctx->flags & COMP_F_SWAP)
     {
         uint8_t *head = BPTR(buf);
-        uint8_t *tail  = BEND(buf);
+        uint8_t *tail = BEND(buf);
         ASSERT(buf_safe(buf, 1));
         ++buf->len;
 
@@ -72,8 +71,7 @@
 }
 
 static void
-stub_decompress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stub_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     uint8_t c;
@@ -107,8 +105,7 @@
 
 
 static void
-stubv2_compress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stubv2_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -120,8 +117,7 @@
 }
 
 static void
-stubv2_decompress(struct buffer *buf, struct buffer work,
-                  struct compress_context *compctx,
+stubv2_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                   const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -157,19 +153,9 @@
     }
 }
 
-const struct compress_alg compv2_stub_alg = {
-    "stubv2",
-    stub_compress_init,
-    stub_compress_uninit,
-    stubv2_compress,
-    stubv2_decompress
-};
+const struct compress_alg compv2_stub_alg = { "stubv2", stub_compress_init, stub_compress_uninit,
+                                              stubv2_compress, stubv2_decompress };
 
-const struct compress_alg comp_stub_alg = {
-    "stub",
-    stub_compress_init,
-    stub_compress_uninit,
-    stub_compress,
-    stub_decompress
-};
+const struct compress_alg comp_stub_alg = { "stub", stub_compress_init, stub_compress_uninit,
+                                            stub_compress, stub_decompress };
 #endif /* USE_STUB */
src/openvpn/console.c +4 -6
index 7cc4fff..bdceaf2 100644
@@ -37,7 +37,7 @@
 #endif
 
 
-struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* GLOBAL */
+struct _query_user query_user[QUERY_USER_NUMSLOTS]; /* GLOBAL */
 
 
 void
@@ -53,16 +53,14 @@
 
 
 void
-query_user_add(char *prompt, size_t prompt_len,
-               char *resp, size_t resp_len,
-               bool echo)
+query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     int i;
 
     /* Ensure input is sane.  All these must be present otherwise it is
      * a programming error.
      */
-    ASSERT( prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL );
+    ASSERT(prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL);
 
     /* Seek to the last unused slot */
     for (i = 0; i < QUERY_USER_NUMSLOTS; i++)
@@ -72,7 +70,7 @@
             break;
         }
     }
-    ASSERT( i < QUERY_USER_NUMSLOTS );  /* Unlikely, but we want to panic if it happens */
+    ASSERT(i < QUERY_USER_NUMSLOTS); /* Unlikely, but we want to panic if it happens */
 
     /* Save the information needed for the user interaction */
     query_user[i].prompt = prompt;
src/openvpn/console.h +11 -14
index 3e99776..14b6116 100644
@@ -30,16 +30,17 @@
 /**
  *  Configuration setup for declaring what kind of information to ask a user for
  */
-struct _query_user {
-    char *prompt;             /**< Prompt to present to the user */
-    size_t prompt_len;        /**< Length of the prompt string */
-    char *response;           /**< The user's response */
-    size_t response_len;      /**< Length the of the user response */
-    bool echo;                /**< True: The user should see what is being typed, otherwise mask it */
+struct _query_user
+{
+    char *prompt;        /**< Prompt to present to the user */
+    size_t prompt_len;   /**< Length of the prompt string */
+    char *response;      /**< The user's response */
+    size_t response_len; /**< Length the of the user response */
+    bool echo;           /**< True: The user should see what is being typed, otherwise mask it */
 };
 
 #define QUERY_USER_NUMSLOTS 10
-extern struct _query_user query_user[];  /**< Global variable, declared in console.c */
+extern struct _query_user query_user[]; /**< Global variable, declared in console.c */
 
 /**
  * Wipes all data put into all of the query_user structs
@@ -58,9 +59,7 @@
  * @param echo       Should the user input be echoed to the user?  If False, input will be masked
  *
  */
-void query_user_add(char *prompt, size_t prompt_len,
-                    char *resp, size_t resp_len,
-                    bool echo);
+void query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo);
 
 
 /**
@@ -107,7 +106,7 @@
 {
     return query_user_exec_builtin();
 }
-#endif  /* defined(ENABLE_SYSTEMD) */
+#endif /* defined(ENABLE_SYSTEMD) */
 
 
 /**
@@ -118,9 +117,7 @@
  *
  */
 static inline bool
-query_user_SINGLE(char *prompt, size_t prompt_len,
-                  char *resp, size_t resp_len,
-                  bool echo)
+query_user_SINGLE(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     query_user_clear();
     query_user_add(prompt, prompt_len, resp, resp_len, echo);
src/openvpn/console_builtin.c +12 -11
index b6db701..b0228dd 100644
@@ -67,11 +67,10 @@
 
     HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
     int orig_stderr = get_orig_stderr(); /* guaranteed to be always valid */
-    if ((in == INVALID_HANDLE_VALUE)
-        || win32_service_interrupt(&win32_signal)
+    if ((in == INVALID_HANDLE_VALUE) || win32_service_interrupt(&win32_signal)
         || (_write(orig_stderr, prompt, strlen(prompt)) == -1))
     {
-        msg(M_WARN|M_ERRNO, "get_console_input_win32(): unexpected error");
+        msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");
         return false;
     }
 
@@ -135,7 +134,7 @@
     return false;
 }
 
-#endif   /* _WIN32 */
+#endif /* _WIN32 */
 
 
 #ifdef HAVE_TERMIOS_H
@@ -177,7 +176,7 @@
     }
 }
 
-#endif   /* HAVE_TERMIOS_H */
+#endif /* HAVE_TERMIOS_H */
 
 
 /**
@@ -209,15 +208,17 @@
      * (in which case neither stdin or stderr are connected to a tty and
      * /dev/tty can not be open()ed anymore)
      */
-    if (!isatty(0) && !isatty(2) )
+    if (!isatty(0) && !isatty(2))
     {
-        int fd = open( "/dev/tty", O_RDWR );
+        int fd = open("/dev/tty", O_RDWR);
         if (fd < 0)
         {
-            msg(M_FATAL, "neither stdin nor stderr are a tty device and you have neither a "
+            msg(M_FATAL,
+                "neither stdin nor stderr are a tty device and you have neither a "
                 "controlling tty nor systemd - can't ask for '%s'.  If you used --daemon, "
                 "you need to use --askpass to make passphrase-protected keys work, and you "
-                "can not use --auth-nocache.", prompt );
+                "can not use --auth-nocache.",
+                prompt);
         }
         close(fd);
     }
@@ -285,8 +286,8 @@
     /* Loop through configured query_user slots */
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
-        if (!get_console_input(query_user[i].prompt, query_user[i].echo,
-                               query_user[i].response, query_user[i].response_len) )
+        if (!get_console_input(query_user[i].prompt, query_user[i].echo, query_user[i].response,
+                               query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/console_systemd.c +4 -6
index 36103b2..d277bd4 100644
@@ -50,9 +50,7 @@
      * mounted, as well as the systemd-ask-password executable
      * being available */
 
-    return (sd_booted() > 0)
-           && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
-
+    return (sd_booted() > 0) && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
 }
 
 static bool
@@ -79,7 +77,7 @@
         return false;
     }
     memset(input, 0, capacity);
-    if (read(std_out, input, capacity-1) != 0)
+    if (read(std_out, input, capacity - 1) != 0)
     {
         chomp(input);
         ret = true;
@@ -99,7 +97,7 @@
 bool
 query_user_exec_systemd(void)
 {
-    bool ret = true;  /* Presume everything goes okay */
+    bool ret = true; /* Presume everything goes okay */
     int i;
 
     /* If systemd is not available, use the default built-in mechanism */
@@ -112,7 +110,7 @@
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
         if (!get_console_input_systemd(query_user[i].prompt, query_user[i].echo,
-                                       query_user[i].response, query_user[i].response_len) )
+                                       query_user[i].response, query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/crypto.c +122 -168

99 lines not on this page · raw message

src/openvpn/crypto.h +88 -102

190 lines not on this page · raw message

src/openvpn/crypto_backend.h +17 -17
index df5bc4d..59418f6 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_epoch.c +27 -43

70 lines not on this page · raw message

src/openvpn/crypto_epoch.h +16 -30

46 lines not on this page · raw message

src/openvpn/crypto_mbedtls.c +74 -74

148 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +14 -17
index 620732e..80f1d16 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_openssl.c +85 -97

182 lines not on this page · raw message

src/openvpn/crypto_openssl.h +14 -12
index 9680c18..6218b39 100644

Lines of this file are not shown. View the raw message.

src/openvpn/cryptoapi.c +57 -52

109 lines not on this page · raw message

src/openvpn/dco.c +57 -59

116 lines not on this page · raw message

src/openvpn/dco.h +12 -15
index 95abf71..59acb18 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.c +16 -23
index 04c1e3d..931f9f6 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.h +7 -4
index cbb1dda..2f486f0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_internal.h +5 -8
index 96aa281..83013ef 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_linux.c +67 -102

169 lines not on this page · raw message

src/openvpn/dco_linux.h +6 -4
index 9f15199..310d433 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_win.c +63 -56

119 lines not on this page · raw message

src/openvpn/dco_win.h +20 -23

43 lines not on this page · raw message

src/openvpn/dhcp.c +28 -28

56 lines not on this page · raw message

src/openvpn/dhcp.h +21 -19
index 34f4513..af5c2c4 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dns.c +36 -38

74 lines not on this page · raw message

src/openvpn/dns.h +21 -12
index 94c76e5..6d97b40 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.c +7 -14
index 7809237..6c7df8e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.h +9 -13
index 63237a7..3973a4e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/errlevel.h +115 -115

230 lines not on this page · raw message

src/openvpn/error.c +51 -86

137 lines not on this page · raw message

src/openvpn/error.h +77 -41

118 lines not on this page · raw message

src/openvpn/event.c +80 -98

178 lines not on this page · raw message

src/openvpn/event.h +34 -31

65 lines not on this page · raw message

src/openvpn/fdmisc.c +1 -1
index b8d9334..2c6525b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/fdmisc.h +1 -1
index de0007a..4c0ab65 100644

Lines of this file are not shown. View the raw message.

src/openvpn/forward.c +116 -156

272 lines not on this page · raw message

src/openvpn/forward.h +34 -37

71 lines not on this page · raw message

src/openvpn/fragment.c +40 -54

94 lines not on this page · raw message

src/openvpn/fragment.h +39 -39

78 lines not on this page · raw message

src/openvpn/gremlin.c +12 -13
index a3ecc8d..e6ebbef 100644

Lines of this file are not shown. View the raw message.

src/openvpn/gremlin.h +17 -15
index 3cbfb77..2422338 100644

Lines of this file are not shown. View the raw message.

src/openvpn/helper.c +48 -40

88 lines not on this page · raw message

src/openvpn/httpdigest.c +39 -50

89 lines not on this page · raw message

src/openvpn/httpdigest.h +13 -21
index ecdd6d3..1b51a62 100644

Lines of this file are not shown. View the raw message.

src/openvpn/init.c +308 -477

785 lines not on this page · raw message

src/openvpn/init.h +15 -19
index 081a295..a807874 100644

Lines of this file are not shown. View the raw message.

src/openvpn/integer.h +9 -8
index 4a95f4e..b82379e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.c +4 -7
index a2ac4f7..2b35314 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.h +9 -11
index 420a1be..b133c44 100644

Lines of this file are not shown. View the raw message.

src/openvpn/list.c +59 -57

116 lines not on this page · raw message

src/openvpn/list.h +8 -19
index 77807c7..fb3302d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lladdr.c +7 -19
index cc677b4..d8bcad9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.c +10 -17
index d5f60ca..3a73d5f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.h +21 -17
index c47db83..9d4fa30 100644

Lines of this file are not shown. View the raw message.

src/openvpn/manage.c +278 -355

633 lines not on this page · raw message

src/openvpn/manage.h +114 -143

257 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +7 -9
index 655c48f..62ed257 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.c +3 -3
index 76f2e58..0750fec 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.h +3 -3
index 8cc7ab1..7f8c1b7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/memdbg.h +5 -3
index 9f8ff11..738a775 100644

Lines of this file are not shown. View the raw message.

src/openvpn/misc.c +139 -138

277 lines not on this page · raw message

src/openvpn/misc.h +36 -41

77 lines not on this page · raw message

src/openvpn/mroute.c +32 -45

77 lines not on this page · raw message

src/openvpn/mroute.h +63 -68

131 lines not on this page · raw message

src/openvpn/mss.c +33 -47

80 lines not on this page · raw message

src/openvpn/mss.h +1 -2
index 1b1eafb..05f12a7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.c +1 -1
index d9ecee3..bd6316c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.h +2 -1
index b9f33b6..c38b0f2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.c +8 -8
index 9781724..81310a2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.h +4 -2
index 5158427d..f4b806c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtu.c +20 -29

49 lines not on this page · raw message

src/openvpn/mtu.h +65 -76

141 lines not on this page · raw message

src/openvpn/mudp.c +34 -35

69 lines not on this page · raw message

src/openvpn/multi.c +360 -481

841 lines not on this page · raw message

src/openvpn/multi.h +65 -67

132 lines not on this page · raw message

src/openvpn/multi_io.c +65 -73

138 lines not on this page · raw message

src/openvpn/networking.h +25 -36

61 lines not on this page · raw message

src/openvpn/networking_freebsd.c +20 -34

54 lines not on this page · raw message

src/openvpn/networking_iproute2.c +37 -57

94 lines not on this page · raw message

src/openvpn/networking_sitnl.c +165 -209

374 lines not on this page · raw message

src/openvpn/ntlm.c +50 -55

105 lines not on this page · raw message

src/openvpn/occ.c +96 -111

207 lines not on this page · raw message

src/openvpn/occ.h +15 -16
index d5f208e..369d94e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openssl_compat.h +16 -19
index 20f612e..143a3cf 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.c +9 -12
index 99c420a..f1e1f76 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.h +68 -64

132 lines not on this page · raw message

src/openvpn/options.c +752 -904

1,656 lines not on this page · raw message

src/openvpn/options.h +105 -126

231 lines not on this page · raw message

src/openvpn/options_util.c +12 -23
index e469c28..5251b21 100644

Lines of this file are not shown. View the raw message.

src/openvpn/options_util.h +6 -13
index 23fd78d..6f81b1e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.c +5 -13
index d6b9c2c..717f749 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.h +2 -2
index 29e8046..5c700bb 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ovpn_dco_freebsd.h +28 -24

52 lines not on this page · raw message

src/openvpn/packet_id.c +41 -72

113 lines not on this page · raw message

src/openvpn/packet_id.h +29 -33

62 lines not on this page · raw message

src/openvpn/perf.c +31 -43

74 lines not on this page · raw message

src/openvpn/perf.h +22 -22

44 lines not on this page · raw message

src/openvpn/ping.c +3 -6
index 50f255a..b9c0b96 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ping.h +5 -6
index 29ee2f2..48d4c0a 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11.c +165 -383

548 lines not on this page · raw message

src/openvpn/pkcs11.h +12 -37

49 lines not on this page · raw message

src/openvpn/pkcs11_backend.h +2 -4
index f65ba3f..caa0735 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_mbedtls.c +7 -12
index d1c8957..245aa8d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_openssl.c +40 -41

81 lines not on this page · raw message

src/openvpn/platform.c +36 -38

74 lines not on this page · raw message

src/openvpn/platform.h +7 -7
index 18ea97d..f1a2b01 100644

Lines of this file are not shown. View the raw message.

src/openvpn/plugin.c +85 -116

201 lines not on this page · raw message

src/openvpn/plugin.h +26 -35

61 lines not on this page · raw message

src/openvpn/pool.c +49 -75

124 lines not on this page · raw message

src/openvpn/pool.h +10 -8
index 9f50ca9..6cecef0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.c +13 -25
index 4820602..34b3378 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.h +90 -84

174 lines not on this page · raw message

src/openvpn/proxy.c +80 -120

200 lines not on this page · raw message

src/openvpn/proxy.h +15 -12
index fcca1ab..be16d83 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ps.c +53 -69

122 lines not on this page · raw message

src/openvpn/ps.h +3 -4
index c6f5633..e28c403 100644

Lines of this file are not shown. View the raw message.

src/openvpn/push.c +88 -114

202 lines not on this page · raw message

src/openvpn/push.h +15 -21
index b6770bc..22b940f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/push_util.c +3 -10
index b4d1e8b..0862a74 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pushlist.h +4 -2
index 1b66517..ef4de88 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.c +8 -6
index 17255f7..071df7c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.h +5 -7
index e3fb165..0601f4b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reliable.c +28 -35

63 lines not on this page · raw message

src/openvpn/reliable.h +25 -29

54 lines not on this page · raw message

src/openvpn/ring_buffer.h new file +124 -0

124 lines not on this page · raw message

src/openvpn/route.c +423 -692

1,115 lines not on this page · raw message

src/openvpn/route.h +112 -123

235 lines not on this page · raw message

src/openvpn/run_command.c +12 -16
index ed5b08c..4a1ef22 100644

Lines of this file are not shown. View the raw message.

src/openvpn/run_command.h +20 -21

41 lines not on this page · raw message

src/openvpn/schedule.c +16 -35

51 lines not on this page · raw message

src/openvpn/schedule.h +5 -8
index fad3f36..79311c5 100644

Lines of this file are not shown. View the raw message.

src/openvpn/session_id.h +1 -2
index 7c0a968..24e7ab0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.c +1 -2
index 1c8cfb3..fb2621e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.h +9 -10
index 9996b08..4483d15 100644

Lines of this file are not shown. View the raw message.

src/openvpn/sig.c +28 -31

59 lines not on this page · raw message

src/openvpn/sig.h +2 -2
index 93219f7..7e5dd9f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/socket.c +339 -560

899 lines not on this page · raw message

src/openvpn/socket.h +162 -227

389 lines not on this page · raw message

src/openvpn/socks.c +55 -61

116 lines not on this page · raw message

src/openvpn/socks.h +9 -11
index 985745b..b5a69b9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl.c +265 -427

692 lines not on this page · raw message

src/openvpn/ssl.h +46 -72

118 lines not on this page · raw message

src/openvpn/ssl_backend.h +27 -38

65 lines not on this page · raw message

src/openvpn/ssl_common.h +94 -85

179 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +122 -181

303 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +36 -29

65 lines not on this page · raw message

src/openvpn/ssl_ncp.c +44 -57

101 lines not on this page · raw message

src/openvpn/ssl_ncp.h +11 -20
index b01cd87..2b2ff85 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_openssl.c +144 -178

322 lines not on this page · raw message

src/openvpn/ssl_openssl.h +8 -6
index 966bb44..08a3d53 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_pkt.c +38 -70

108 lines not on this page · raw message

src/openvpn/ssl_pkt.h +44 -62

106 lines not on this page · raw message

src/openvpn/ssl_util.c +152 -141

293 lines not on this page · raw message

src/openvpn/ssl_util.h +7 -5
index 189b1d0..007ed69 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify.c +165 -166

331 lines not on this page · raw message

src/openvpn/ssl_verify.h +24 -27

51 lines not on this page · raw message

src/openvpn/ssl_verify_backend.h +15 -15
index 03f591c..a0559c9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +55 -67

122 lines not on this page · raw message

src/openvpn/ssl_verify_mbedtls.h +1 -2
index 3e380a6..0b2f2d2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_openssl.c +44 -54

98 lines not on this page · raw message

src/openvpn/status.c +11 -19
index 1f5e67a..34e5a2f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/status.h +10 -12
index ddbaeef..0c7a869 100644

Lines of this file are not shown. View the raw message.

src/openvpn/syshead.h +25 -23

48 lines not on this page · raw message

src/openvpn/tls_crypt.c +87 -140

227 lines not on this page · raw message

src/openvpn/tls_crypt.h +22 -29

51 lines not on this page · raw message

src/openvpn/tun.c +616 -944

1,560 lines not on this page · raw message

src/openvpn/tun.h +58 -65

123 lines not on this page · raw message

src/openvpn/tun_afunix.c +6 -11
index ac12070..4d48a31 100644

Lines of this file are not shown. View the raw message.

src/openvpn/tun_afunix.h +4 -11
index faca142..3346403 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.c +10 -14
index 5cc23f4..a6a6e93 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.h +3 -6
index 7602585..e2c9c44 100644

Lines of this file are not shown. View the raw message.

src/openvpn/wfp_block.c +31 -66

97 lines not on this page · raw message

src/openvpn/wfp_block.h +3 -5
index 6de39f5..5ca093c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32-util.c +1 -1
index c23d066..0d6d029 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32.c +87 -100

187 lines not on this page · raw message

src/openvpn/win32.h +30 -33

63 lines not on this page · raw message

src/openvpn/xkey_common.h +15 -19
index 111596e..3d65e1f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/xkey_helper.c +47 -50

97 lines not on this page · raw message

src/openvpn/xkey_provider.c +154 -146

300 lines not on this page · raw message

src/openvpnmsica/dllmain.c +14 -17
index 7121c02..e7d4a4b 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.c +11 -10
index 46bef2b..d750fb0 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.h +5 -13
index c8f7595..858fdb6 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.c +13 -21
index 3529e9a..12dc0db 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.h +6 -21
index d9afeb5..60c26b5 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/openvpnmsica.c +179 -170

349 lines not on this page · raw message

src/openvpnmsica/openvpnmsica.h +75 -79

154 lines not on this page · raw message

src/openvpnserv/common.c +24 -25

49 lines not on this page · raw message

src/openvpnserv/interactive.c +196 -211

407 lines not on this page · raw message

src/openvpnserv/service.c +21 -25

46 lines not on this page · raw message

src/openvpnserv/service.h +13 -10
index 8989e60..3d3b82b 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.c +16 -17
index 6ed5bea..59d5b86 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.h +7 -6
index bde1892..6f3bf09 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/auth-pam.c +75 -67

142 lines not on this page · raw message

src/plugins/auth-pam/pamdl.c +29 -37

66 lines not on this page · raw message

src/plugins/auth-pam/utils.c +5 -4
index 6524051..0da162d 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/utils.h +7 -9
index 0b90aee..a733feb 100644

Lines of this file are not shown. View the raw message.

src/plugins/down-root/down-root.c +21 -16
index 5f595fd..da476fc 100644

Lines of this file are not shown. View the raw message.

src/tapctl/basic.h +9 -7
index 571ae62..620c1ca 100644

Lines of this file are not shown. View the raw message.

src/tapctl/error.h +45 -21

66 lines not on this page · raw message

src/tapctl/main.c +72 -60

132 lines not on this page · raw message

src/tapctl/tap.c +148 -271

419 lines not on this page · raw message

src/tapctl/tap.h +13 -29

42 lines not on this page · raw message

tests/ntlm_support.c +1 -1
index 3960cc5..7007051 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test.c +4 -5
index c174025..139e06f 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test2.c +1 -1
index bb54633..3089432 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/cert_data.h +34 -36

70 lines not on this page · raw message

tests/unit_tests/openvpn/mock_management.c +1 -2
index 9674b45..b24e4c4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.c +2 -3
index 5407561..603520b 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.h +3 -6
index 40d7609..f4ebc23 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_ssl_dependencies.c +2 -2
index 2a562fc..7333c47 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/pkey_test_utils.c +5 -6
index 56608ea..c9aef46 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_argv.c +9 -9
index 33b3dec..a65857b 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_auth_token.c +59 -66

125 lines not on this page · raw message

tests/unit_tests/openvpn/test_buffer.c +28 -37

65 lines not on this page · raw message

tests/unit_tests/openvpn/test_crypto.c +85 -131

216 lines not on this page · raw message

tests/unit_tests/openvpn/test_cryptoapi.c +41 -42

83 lines not on this page · raw message

tests/unit_tests/openvpn/test_misc.c +38 -35

73 lines not on this page · raw message

tests/unit_tests/openvpn/test_ncp.c +34 -46

80 lines not on this page · raw message

tests/unit_tests/openvpn/test_networking.c +4 -10
index 0434707..f2da83e 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_packet_id.c +25 -32

57 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkcs11.c +46 -47

93 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkt.c +94 -120

214 lines not on this page · raw message

tests/unit_tests/openvpn/test_provider.c +27 -26

53 lines not on this page · raw message

tests/unit_tests/openvpn/test_push_update_msg.c +44 -48

92 lines not on this page · raw message

tests/unit_tests/openvpn/test_ssl.c +24 -31

55 lines not on this page · raw message

tests/unit_tests/openvpn/test_tls_crypt.c +105 -150

255 lines not on this page · raw message

tests/unit_tests/openvpn/test_user_pass.c +17 -14
index 74f67a7..460b37f 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/plugins/auth-pam/test_search_and_replace.c +0 -2
index 50b241d..a861bfd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 23
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-MessageType: newpatchset

Part of the diff is not shown here. View the raw message.

#12 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/791?usp=email )

Change subject: Reformat the whole project with clang-format
......................................................................

Patch Set 23: Code-Review+2

(3 comments)

Patchset:

PS23:
So, reviewed most of this, and especially tested this on all the testbeds (nothing fails). As agreed, move to "ColumnLimit: 0" afterwards with a cleanup patch, as the force-unwrapping by "100" creates ugliness and also "surprising submit fails" - we use common sense ;-)

File src/openvpn/crypto.c:

http://gerrit.openvpn.net/c/openvpn/+/791/comment/9105cd07_6cc952af :
PS18, Line 391: epoch);
not sure what happened here...

http://gerrit.openvpn.net/c/openvpn/+/791/comment/ce26f764_3092ba12 :
PS18, Line 1604: msg(M_FATAL,
this is another one where the result is uglier than the start... maybe it needs manual breaking of the string so it can fit "properly" in 2 lines

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/791?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Gerrit-Change-Number: 791
Gerrit-PatchSet: 23
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Mon, 04 Aug 2025 15:18:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#13 lore raw

PATCH v23 1/1 Reformat the whole project with clang-format

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Done with pre-commit run -a, so the version
defined in pre-commit config is used.

This also changes the Github workflow so that
there is no commit that fails GHA.

Change-Id I2566ad493629e1f5fdfa6f6483b8973463404e3e

---

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/+/791
This mail reflects revision 23 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

.github/workflows/build.yaml +12 -21
index bd5895b..ba7f64b 100644
@@ -5,35 +5,26 @@
   pull_request:
 
 jobs:
-  checkuncrustify:
-    name: "Check code style with Uncrustify"
-    # Ubuntu 22.04 has uncrustify 0.72_f
-    runs-on: ubuntu-22.04
+  clang-format:
+    name: Check code style with clang-format
+    runs-on: ubuntu-24.04
     steps:
       - name: Install dependencies
-        run: sudo apt update && sudo apt install -y uncrustify
+        run: |
+          sudo apt update && sudo apt install -y python3-pip
+          pip3 install pre-commit
       - name: Checkout OpenVPN
         uses: actions/[email protected]... # v4.2.2
-        with:
-          path: openvpn
-      - name: Show uncrustify version
-        run: uncrustify --version
-      - name: Run uncrustify
-        run: ./dev-tools/reformat-all.sh
-        working-directory: openvpn
+      - name: Run clang-format
+        run: pre-commit run -a --show-diff-on-failure || true
       - name: Check for changes
-        run: git diff --output=uncrustify-changes.patch
-        working-directory: openvpn
-      - name: Show changes on standard output
-        run: git diff
-        working-directory: openvpn
+        run: git diff --output=format-changes.patch
       - uses: actions/[email protected]... # v4.6.2
         with:
-          name: uncrustify-changes.patch
-          path: 'openvpn/uncrustify-changes.patch'
+          name: format-changes.patch
+          path: format-changes.patch
       - name: Set job status
-        run: test ! -s uncrustify-changes.patch
-        working-directory: openvpn
+        run: test ! -s format-changes.patch
 
   android:
     strategy:
include/openvpn-msg.h +41 -22

159 lines not on this page · raw message

sample/sample-plugins/client-connect/sample-client-connect.c +52 -59

265 lines not on this page · raw message

sample/sample-plugins/defer/multi-auth.c +34 -40

208 lines not on this page · raw message

sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +26 -25

119 lines not on this page · raw message

sample/sample-plugins/log/log.c +19 -19
index 63d714f..70fa60d 100644
@@ -36,7 +36,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -75,7 +76,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -91,19 +92,17 @@
     /*
      * Which callbacks to intercept.
      */
-    *type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
+    *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_DOWN)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_ROUTE_UP)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_IPCHANGE)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS)
+                 | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_FINAL);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 void
@@ -171,9 +170,10 @@
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     show(type, argv, envp);
 
@@ -184,8 +184,8 @@
         const char *username = get_env("username", envp);
         const char *password = get_env("password", envp);
 
-        if (username && !strcmp(username, context->username)
-            && password && !strcmp(password, context->password))
+        if (username && !strcmp(username, context->username) && password
+            && !strcmp(password, context->password))
         {
             return OPENVPN_PLUGIN_FUNC_SUCCESS;
         }
@@ -203,6 +203,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/log/log_v3.c +24 -27

106 lines not on this page · raw message

sample/sample-plugins/simple/base64.c +15 -17
index b6c0c97..8a1dedd 100644
@@ -98,21 +98,20 @@
  *
  */
 OPENVPN_EXPORT int
-openvpn_plugin_open_v3(const int v3structver,
-                       struct openvpn_plugin_args_open_in const *args,
+openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in const *args,
                        struct openvpn_plugin_args_open_return *ret)
 {
     /* Check that we are API compatible */
     if (v3structver != OPENVPN_PLUGINv3_STRUCTVER)
     {
-        printf("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
+        printf(
+            "base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
     /*  Which callbacks to intercept.  */
-    ret->type_mask =
-        OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
-        |OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
+    ret->type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_TLS_VERIFY)
+                     | OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT_V2);
 
     /* we don't need a plug-in context in this example, but OpenVPN expects "something" */
     ret->handle = calloc(1, 1);
@@ -125,8 +124,8 @@
 
     /* Print some version information about the OpenVPN process using this plug-in */
     ovpn_log(PLOG_NOTE, PLUGIN_NAME, "OpenVPN %s  (Major: %i, Minor: %i, Patch: %s)\n",
-             args->ovpn_version, args->ovpn_version_major,
-             args->ovpn_version_minor, args->ovpn_version_patch);
+             args->ovpn_version, args->ovpn_version_major, args->ovpn_version_minor,
+             args->ovpn_version_patch);
 
     return OPENVPN_PLUGIN_FUNC_SUCCESS;
 }
@@ -154,10 +153,10 @@
  */
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    if (type != OPENVPN_PLUGIN_TLS_VERIFY
-        && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
+    if (type != OPENVPN_PLUGIN_TLS_VERIFY && type != OPENVPN_PLUGIN_CLIENT_CONNECT_V2)
     {
         ovpn_log(PLOG_ERR, PLUGIN_NAME, "Unsupported plug-in hook call attempted");
         return OPENVPN_PLUGIN_FUNC_ERROR;
@@ -174,14 +173,13 @@
     /* test the BASE64 encode function */
     char *buf = NULL;
     int r = ovpn_base64_encode(clcert_cn, (int)strlen(clcert_cn), &buf);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'",
-             clcert_cn, r, buf);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 encoded '%s' (return value %i):  '%s'", clcert_cn, r,
+             buf);
 
     /* test the BASE64 decode function */
-    char buf2[256] = {0};
+    char buf2[256] = { 0 };
     r = ovpn_base64_decode(buf, &buf2, 255);
-    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'",
-             buf, r, buf2);
+    ovpn_log(PLOG_NOTE, PLUGIN_NAME, "BASE64 decoded '%s' (return value %i):  '%s'", buf, r, buf2);
 
     /* Verify the result, and free the buffer allocated by ovpn_base64_encode() */
     r = strcmp(clcert_cn, buf2);
@@ -201,6 +199,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
sample/sample-plugins/simple/simple.c +10 -8
index ed5bce5..8b2b793 100644
@@ -38,7 +38,8 @@
 /*
  * Our context, where we keep our state.
  */
-struct plugin_context {
+struct plugin_context
+{
     const char *username;
     const char *password;
 };
@@ -77,7 +78,7 @@
     /*
      * Allocate our context
      */
-    context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
+    context = (struct plugin_context *)calloc(1, sizeof(struct plugin_context));
     if (context == NULL)
     {
         printf("PLUGIN: allocating memory for context failed\n");
@@ -96,21 +97,22 @@
      */
     *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
 
-    return (openvpn_plugin_handle_t) context;
+    return (openvpn_plugin_handle_t)context;
 }
 
 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[],
+                       const char *envp[])
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
 
     /* get username/password from envp string array */
     const char *username = get_env("username", envp);
     const char *password = get_env("password", envp);
 
     /* check entered username/password against what we require */
-    if (username && !strcmp(username, context->username)
-        && password && !strcmp(password, context->password))
+    if (username && !strcmp(username, context->username) && password
+        && !strcmp(password, context->password))
     {
         return OPENVPN_PLUGIN_FUNC_SUCCESS;
     }
@@ -123,6 +125,6 @@
 OPENVPN_EXPORT void
 openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
 {
-    struct plugin_context *context = (struct plugin_context *) handle;
+    struct plugin_context *context = (struct plugin_context *)handle;
     free(context);
 }
src/compat/compat-basename.c +1 -1
index 18944f6..24f5af7 100644
@@ -41,7 +41,7 @@
         /* If NULL, check for \ instead ... might be Windows a path */
         p = strrchr(filename, '\\');
     }
-    return p ? p + 1 : (char *) filename;
+    return p ? p + 1 : (char *)filename;
 }
 
 #endif /* HAVE_BASENAME */
src/compat/compat-dirname.c +2 -2
index 17de8ad..a432bae 100644
@@ -89,7 +89,7 @@
         /* The '/' is the last character, we have to look further.  */
         if (runp != path)
         {
-            last_slash = (char *) __memrchr(path, separator, runp - path);
+            last_slash = (char *)__memrchr(path, separator, runp - path);
         }
     }
 
@@ -134,7 +134,7 @@
         /* This assignment is ill-designed but the XPG specs require to
          * return a string containing "." in any case no directory part is
          * found and so a static and constant string is required.  */
-        path = (char *) dot;
+        path = (char *)dot;
     }
 
     return path;
src/compat/compat-gettimeofday.c +2 -2
index de53cb5..29ded6c 100644
@@ -48,7 +48,7 @@
 {
     const time_t t = time(NULL);
     const DWORD gtc = GetTickCount();
-    gtc_base = t - gtc/1000;
+    gtc_base = t - gtc / 1000;
     gtc_last = gtc;
 }
 
@@ -112,7 +112,7 @@
     return 0;
 }
 
-#else  /* ifdef _WIN32 */
+#else /* ifdef _WIN32 */
 
 #include <time.h>
 
src/openvpn/argv.c +5 -6
index 34266d4..903fc0a 100644
@@ -284,8 +284,7 @@
  *           free()d to avoid memory leaks.
  */
 static char *
-argv_prep_format(const char *format, const char delim, size_t *count,
-                 struct gc_arena *gc)
+argv_prep_format(const char *format, const char delim, size_t *count, struct gc_arena *gc)
 {
     if (format == NULL)
     {
@@ -311,7 +310,7 @@
              * the string is empty; the resulting format string
              * will never start with a delimiter.
              */
-            if (j > 0)  /* Has anything been written to the output string? */
+            if (j > 0) /* Has anything been written to the output string? */
             {
                 f[j++] = delim;
             }
@@ -347,7 +346,7 @@
 static bool
 argv_printf_arglist(struct argv *argres, const char *format, va_list arglist)
 {
-    const char delim = 0x1D;  /* ASCII Group Separator (GS) */
+    const char delim = 0x1D; /* ASCII Group Separator (GS) */
     bool res = false;
 
     /*
@@ -484,8 +483,8 @@
     argv_reset(argres);
 
     char *parms[MAX_PARMS + 1] = { 0 };
-    int nparms = parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0,
-                            D_ARGV_PARSE_CMD, &argres->gc);
+    int nparms =
+        parse_line(cmdstr, parms, MAX_PARMS, "SCRIPT-ARGV", 0, D_ARGV_PARSE_CMD, &argres->gc);
     if (nparms)
     {
         int i;
src/openvpn/argv.h +8 -7
index f694760..056fe31 100644
@@ -31,7 +31,8 @@
 
 #include "buffer.h"
 
-struct argv {
+struct argv
+{
     struct gc_arena gc;
     size_t capacity;
     size_t argc;
@@ -55,21 +56,21 @@
 bool argv_printf(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 bool argv_printf_cat(struct argv *a, const char *format, ...)
 #ifdef __GNUC__
 #if __USE_MINGW_ANSI_STDIO
-__attribute__ ((format(gnu_printf, 2, 3)))
+    __attribute__((format(gnu_printf, 2, 3)))
 #else
-__attribute__ ((format(__printf__, 2, 3)))
+    __attribute__((format(__printf__, 2, 3)))
 #endif
 #endif
-;
+    ;
 
 #endif /* ifndef ARGV_H */
src/openvpn/auth_token.c +42 -49

245 lines not on this page · raw message

src/openvpn/auth_token.h +7 -15
index 3d56ee6..1e4a413 100644
@@ -58,27 +58,22 @@
  * This function will free() an existing multi->auth_token and keep the
  * existing initial timestamp and session id contained in that token.
  */
-void
-generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
+void generate_auth_token(const struct user_pass *up, struct tls_multi *multi);
 
 /**
  * Verifies the auth token to be in the format that generate_auth_token
  * create and checks if the token is valid.
  *
  */
-unsigned
-verify_auth_token(struct user_pass *up, struct tls_multi *multi,
-                  struct tls_session *session);
-
+unsigned verify_auth_token(struct user_pass *up, struct tls_multi *multi,
+                           struct tls_session *session);
 
 
 /**
  * Loads an HMAC secret from a file or if no file is present generates a
  * epheremal secret for the run time of the server and stores it into ctx
  */
-void
-auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file,
-                       bool key_inline);
+void auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline);
 
 
 /**
@@ -125,8 +120,7 @@
 static inline bool
 is_auth_token(const char *password)
 {
-    return (memcmp_constant_time(SESSION_ID_PREFIX, password,
-                                 strlen(SESSION_ID_PREFIX)) == 0);
+    return (memcmp_constant_time(SESSION_ID_PREFIX, password, strlen(SESSION_ID_PREFIX)) == 0);
 }
 /**
  * Checks if a client should be sent a new auth token to update its
@@ -134,15 +128,13 @@
  * @param multi     Pointer the multi object of the TLS session
  * @param session   Pointer to the TLS session itself
  */
-void
-resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
+void resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session);
 
 
 /**
  * Checks if the timer to resend the auth-token has expired and if a new
  * auth-token should be send to the client and triggers the resending
  */
-void
-check_send_auth_token(struct context *c);
+void check_send_auth_token(struct context *c);
 
 #endif /* AUTH_TOKEN_H */
src/openvpn/base64.c +5 -6
index a9c2f4c..54d5b79 100644
@@ -41,8 +41,7 @@
 
 #include "memdbg.h"
 
-static char base64_chars[] =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 /*
  * base64 encode input data of length size to malloced
  * buffer which is returned as *str.  Returns string
@@ -60,14 +59,14 @@
     {
         return -1;
     }
-    p = s = (char *) malloc(size * 4 / 3 + 4);
+    p = s = (char *)malloc(size * 4 / 3 + 4);
     if (p == NULL)
     {
         return -1;
     }
-    q = (const unsigned char *) data;
+    q = (const unsigned char *)data;
     i = 0;
-    for (i = 0; i < size; )
+    for (i = 0; i < size;)
     {
         c = q[i++];
         c *= 256;
@@ -196,5 +195,5 @@
             *q++ = val & 0xff;
         }
     }
-    return q - (unsigned char *) data;
+    return q - (unsigned char *)data;
 }
src/openvpn/base64.h +2 -4
index 7b4224a..be7aa64 100644
@@ -35,12 +35,10 @@
 #define _BASE64_H_
 
 /** Compute resulting base64 length.  6 bits per byte, padded to 4 bytes. */
-#define OPENVPN_BASE64_LENGTH(binary_length) \
-    ((((8 * binary_length) / 6) + 3) & ~3)
+#define OPENVPN_BASE64_LENGTH(binary_length) ((((8 * binary_length) / 6) + 3) & ~3)
 
 /** Compute the maximal number of bytes encoded in a base64 string. */
-#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) \
-    ((base64_length / 4) * 3)
+#define OPENVPN_BASE64_DECODED_LENGTH(base64_length) ((base64_length / 4) * 3)
 
 int openvpn_base64_encode(const void *data, int size, char **str);
 
src/openvpn/basic.h +1 -1
index 47a86d9..aae84f5 100644
@@ -26,7 +26,7 @@
 #define BOOL_CAST(x) ((x) ? (true) : (false))
 
 /* size of an array */
-#define SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 /* clear an object (may be optimized away, use secure_memzero() to erase secrets) */
 #define CLEAR(x) memset(&(x), 0, sizeof(x))
src/openvpn/buffer.c +46 -56

271 lines not on this page · raw message

src/openvpn/buffer.h +101 -113

374 lines not on this page · raw message

src/openvpn/circ_list.h +26 -29

75 lines not on this page · raw message

src/openvpn/clinat.c +7 -16
index f120a54..a303285 100644
@@ -32,8 +32,7 @@
 #include "memdbg.h"
 
 static bool
-add_entry(struct client_nat_option_list *dest,
-          const struct client_nat_entry *e)
+add_entry(struct client_nat_option_list *dest, const struct client_nat_entry *e)
 {
     if (dest->n >= MAX_CLIENT_NAT)
     {
@@ -59,9 +58,7 @@
         for (i = 0; i < list->n; ++i)
         {
             const struct client_nat_entry *e = &list->entries[i];
-            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s",
-                i,
-                e->type,
+            msg(msglevel, "  CNAT[%d] t=%d %s/%s/%s", i, e->type,
                 print_in_addr_t(e->network, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->netmask, IA_NET_ORDER, &gc),
                 print_in_addr_t(e->foreign_network, IA_NET_ORDER, &gc));
@@ -102,11 +99,8 @@
 }
 
 void
-add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                              const char *type,
-                              const char *network,
-                              const char *netmask,
-                              const char *foreign_network,
+add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                              const char *network, const char *netmask, const char *foreign_network,
                               int msglevel)
 {
     struct client_nat_entry e;
@@ -179,9 +173,7 @@
         dirstr = "IN";
     }
 
-    msg(msglevel, "** CNAT %s %s %s -> %s",
-        dirstr,
-        prefix,
+    msg(msglevel, "** CNAT %s %s %s -> %s", dirstr, prefix,
         print_in_addr_t(iph->saddr, IA_NET_ORDER, &gc),
         print_in_addr_t(iph->daddr, IA_NET_ORDER, &gc));
 
@@ -189,11 +181,10 @@
 }
 
 void
-client_nat_transform(const struct client_nat_option_list *list,
-                     struct buffer *ipbuf,
+client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                      const int direction)
 {
-    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *) BPTR(ipbuf);
+    struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR(ipbuf);
     int i;
     uint32_t addr, *addr_ptr;
     const uint32_t *from, *to;
src/openvpn/clinat.h +12 -12
index d565a49..abfa0b7 100644
@@ -30,7 +30,8 @@
 #define CN_OUTGOING 0
 #define CN_INCOMING 1
 
-struct client_nat_entry {
+struct client_nat_entry
+{
 #define CN_SNAT 0
 #define CN_DNAT 1
     int type;
@@ -39,28 +40,27 @@
     in_addr_t foreign_network;
 };
 
-struct client_nat_option_list {
+struct client_nat_option_list
+{
     int n;
     struct client_nat_entry entries[MAX_CLIENT_NAT];
 };
 
 struct client_nat_option_list *new_client_nat_list(struct gc_arena *gc);
 
-struct client_nat_option_list *clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc);
+struct client_nat_option_list *clone_client_nat_option_list(
+    const struct client_nat_option_list *src, struct gc_arena *gc);
 
-void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src);
+void copy_client_nat_option_list(struct client_nat_option_list *dest,
+                                 const struct client_nat_option_list *src);
 
 void print_client_nat_list(const struct client_nat_option_list *list, int msglevel);
 
-void add_client_nat_to_option_list(struct client_nat_option_list *dest,
-                                   const char *type,
-                                   const char *network,
-                                   const char *netmask,
-                                   const char *foreign_network,
-                                   int msglevel);
+void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
+                                   const char *network, const char *netmask,
+                                   const char *foreign_network, int msglevel);
 
-void client_nat_transform(const struct client_nat_option_list *list,
-                          struct buffer *ipbuf,
+void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
                           const int direction);
 
 #endif /* if !defined(CLINAT_H) */
src/openvpn/common.h +7 -6
index d7f5d959..c0947da 100644
@@ -27,7 +27,7 @@
  * Statistics counters and associated printf format.
  */
 typedef uint64_t counter_type;
-#define counter_format  "%" PRIu64
+#define counter_format "%" PRIu64
 
 /*
  * Time intervals
@@ -37,17 +37,17 @@
 /*
  * Used as an upper bound for timeouts.
  */
-#define BIG_TIMEOUT  (60*60*24*7)  /* one week (in seconds) */
+#define BIG_TIMEOUT (60 * 60 * 24 * 7) /* one week (in seconds) */
 
 /*
  * Printf formats for special types
  */
 #ifdef _WIN64
-#define ptr_format              "0x%016" PRIx64
+#define ptr_format "0x%016" PRIx64
 #else
-#define ptr_format              "0x%08lx"
+#define ptr_format "0x%08lx"
 #endif
-#define fragment_header_format  "0x%08x"
+#define fragment_header_format "0x%08x"
 
 /* these are used to cast the arguments
  * and MUST match the formats above */
@@ -94,6 +94,7 @@
 /*
  * Script security warning
  */
-#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
+#define SCRIPT_SECURITY_WARNING \
+    "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
 
 #endif /* ifndef COMMON_H */
src/openvpn/comp-lz4.c +13 -28

86 lines not on this page · raw message

src/openvpn/comp.c +5 -5
index afea948..1a2e775 100644
@@ -171,10 +171,10 @@
     {
 #ifdef USE_COMP
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since data-channel offloading is enabled.");
+                      "since data-channel offloading is enabled.");
 #else
         msg(msglevel, "Compression or compression stub framing is not allowed "
-            "since OpenVPN was built without compression support.");
+                      "since OpenVPN was built without compression support.");
 #endif
         return false;
     }
@@ -182,14 +182,14 @@
     if ((info->flags & COMP_F_ALLOW_STUB_ONLY) && comp_non_stub_enabled(info))
     {
         msg(msglevel, "Compression is not allowed since allow-compression is "
-            "set to 'stub-only'");
+                      "set to 'stub-only'");
         return false;
     }
 #ifndef ENABLE_LZ4
     if (info->alg == COMP_ALGV2_LZ4 || info->alg == COMP_ALG_LZ4)
     {
         msg(msglevel, "OpenVPN is compiled without LZ4 support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
@@ -197,7 +197,7 @@
     if (info->alg == COMP_ALG_LZO)
     {
         msg(msglevel, "OpenVPN is compiled without LZO support. Requested "
-            "compression cannot be enabled.");
+                      "compression cannot be enabled.");
         return false;
     }
 #endif
src/openvpn/comp.h +21 -24

102 lines not on this page · raw message

src/openvpn/compstub.c +9 -23
index 853e9ee..bf709df 100644
@@ -45,8 +45,7 @@
 }
 
 static void
-stub_compress(struct buffer *buf, struct buffer work,
-              struct compress_context *compctx,
+stub_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
               const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -56,7 +55,7 @@
     if (compctx->flags & COMP_F_SWAP)
     {
         uint8_t *head = BPTR(buf);
-        uint8_t *tail  = BEND(buf);
+        uint8_t *tail = BEND(buf);
         ASSERT(buf_safe(buf, 1));
         ++buf->len;
 
@@ -72,8 +71,7 @@
 }
 
 static void
-stub_decompress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stub_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     uint8_t c;
@@ -107,8 +105,7 @@
 
 
 static void
-stubv2_compress(struct buffer *buf, struct buffer work,
-                struct compress_context *compctx,
+stubv2_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                 const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -120,8 +117,7 @@
 }
 
 static void
-stubv2_decompress(struct buffer *buf, struct buffer work,
-                  struct compress_context *compctx,
+stubv2_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                   const struct frame *frame)
 {
     if (buf->len <= 0)
@@ -157,19 +153,9 @@
     }
 }
 
-const struct compress_alg compv2_stub_alg = {
-    "stubv2",
-    stub_compress_init,
-    stub_compress_uninit,
-    stubv2_compress,
-    stubv2_decompress
-};
+const struct compress_alg compv2_stub_alg = { "stubv2", stub_compress_init, stub_compress_uninit,
+                                              stubv2_compress, stubv2_decompress };
 
-const struct compress_alg comp_stub_alg = {
-    "stub",
-    stub_compress_init,
-    stub_compress_uninit,
-    stub_compress,
-    stub_decompress
-};
+const struct compress_alg comp_stub_alg = { "stub", stub_compress_init, stub_compress_uninit,
+                                            stub_compress, stub_decompress };
 #endif /* USE_STUB */
src/openvpn/console.c +4 -6
index 7cc4fff..bdceaf2 100644
@@ -37,7 +37,7 @@
 #endif
 
 
-struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* GLOBAL */
+struct _query_user query_user[QUERY_USER_NUMSLOTS]; /* GLOBAL */
 
 
 void
@@ -53,16 +53,14 @@
 
 
 void
-query_user_add(char *prompt, size_t prompt_len,
-               char *resp, size_t resp_len,
-               bool echo)
+query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     int i;
 
     /* Ensure input is sane.  All these must be present otherwise it is
      * a programming error.
      */
-    ASSERT( prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL );
+    ASSERT(prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL);
 
     /* Seek to the last unused slot */
     for (i = 0; i < QUERY_USER_NUMSLOTS; i++)
@@ -72,7 +70,7 @@
             break;
         }
     }
-    ASSERT( i < QUERY_USER_NUMSLOTS );  /* Unlikely, but we want to panic if it happens */
+    ASSERT(i < QUERY_USER_NUMSLOTS); /* Unlikely, but we want to panic if it happens */
 
     /* Save the information needed for the user interaction */
     query_user[i].prompt = prompt;
src/openvpn/console.h +11 -14
index 3e99776..14b6116 100644
@@ -30,16 +30,17 @@
 /**
  *  Configuration setup for declaring what kind of information to ask a user for
  */
-struct _query_user {
-    char *prompt;             /**< Prompt to present to the user */
-    size_t prompt_len;        /**< Length of the prompt string */
-    char *response;           /**< The user's response */
-    size_t response_len;      /**< Length the of the user response */
-    bool echo;                /**< True: The user should see what is being typed, otherwise mask it */
+struct _query_user
+{
+    char *prompt;        /**< Prompt to present to the user */
+    size_t prompt_len;   /**< Length of the prompt string */
+    char *response;      /**< The user's response */
+    size_t response_len; /**< Length the of the user response */
+    bool echo;           /**< True: The user should see what is being typed, otherwise mask it */
 };
 
 #define QUERY_USER_NUMSLOTS 10
-extern struct _query_user query_user[];  /**< Global variable, declared in console.c */
+extern struct _query_user query_user[]; /**< Global variable, declared in console.c */
 
 /**
  * Wipes all data put into all of the query_user structs
@@ -58,9 +59,7 @@
  * @param echo       Should the user input be echoed to the user?  If False, input will be masked
  *
  */
-void query_user_add(char *prompt, size_t prompt_len,
-                    char *resp, size_t resp_len,
-                    bool echo);
+void query_user_add(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo);
 
 
 /**
@@ -107,7 +106,7 @@
 {
     return query_user_exec_builtin();
 }
-#endif  /* defined(ENABLE_SYSTEMD) */
+#endif /* defined(ENABLE_SYSTEMD) */
 
 
 /**
@@ -118,9 +117,7 @@
  *
  */
 static inline bool
-query_user_SINGLE(char *prompt, size_t prompt_len,
-                  char *resp, size_t resp_len,
-                  bool echo)
+query_user_SINGLE(char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 {
     query_user_clear();
     query_user_add(prompt, prompt_len, resp, resp_len, echo);
src/openvpn/console_builtin.c +12 -11
index b6db701..b0228dd 100644
@@ -67,11 +67,10 @@
 
     HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
     int orig_stderr = get_orig_stderr(); /* guaranteed to be always valid */
-    if ((in == INVALID_HANDLE_VALUE)
-        || win32_service_interrupt(&win32_signal)
+    if ((in == INVALID_HANDLE_VALUE) || win32_service_interrupt(&win32_signal)
         || (_write(orig_stderr, prompt, strlen(prompt)) == -1))
     {
-        msg(M_WARN|M_ERRNO, "get_console_input_win32(): unexpected error");
+        msg(M_WARN | M_ERRNO, "get_console_input_win32(): unexpected error");
         return false;
     }
 
@@ -135,7 +134,7 @@
     return false;
 }
 
-#endif   /* _WIN32 */
+#endif /* _WIN32 */
 
 
 #ifdef HAVE_TERMIOS_H
@@ -177,7 +176,7 @@
     }
 }
 
-#endif   /* HAVE_TERMIOS_H */
+#endif /* HAVE_TERMIOS_H */
 
 
 /**
@@ -209,15 +208,17 @@
      * (in which case neither stdin or stderr are connected to a tty and
      * /dev/tty can not be open()ed anymore)
      */
-    if (!isatty(0) && !isatty(2) )
+    if (!isatty(0) && !isatty(2))
     {
-        int fd = open( "/dev/tty", O_RDWR );
+        int fd = open("/dev/tty", O_RDWR);
         if (fd < 0)
         {
-            msg(M_FATAL, "neither stdin nor stderr are a tty device and you have neither a "
+            msg(M_FATAL,
+                "neither stdin nor stderr are a tty device and you have neither a "
                 "controlling tty nor systemd - can't ask for '%s'.  If you used --daemon, "
                 "you need to use --askpass to make passphrase-protected keys work, and you "
-                "can not use --auth-nocache.", prompt );
+                "can not use --auth-nocache.",
+                prompt);
         }
         close(fd);
     }
@@ -285,8 +286,8 @@
     /* Loop through configured query_user slots */
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
-        if (!get_console_input(query_user[i].prompt, query_user[i].echo,
-                               query_user[i].response, query_user[i].response_len) )
+        if (!get_console_input(query_user[i].prompt, query_user[i].echo, query_user[i].response,
+                               query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/console_systemd.c +4 -6
index 36103b2..d277bd4 100644
@@ -50,9 +50,7 @@
      * mounted, as well as the systemd-ask-password executable
      * being available */
 
-    return (sd_booted() > 0)
-           && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
-
+    return (sd_booted() > 0) && (stat(SYSTEMD_ASK_PASSWORD_PATH, &c) == 0);
 }
 
 static bool
@@ -79,7 +77,7 @@
         return false;
     }
     memset(input, 0, capacity);
-    if (read(std_out, input, capacity-1) != 0)
+    if (read(std_out, input, capacity - 1) != 0)
     {
         chomp(input);
         ret = true;
@@ -99,7 +97,7 @@
 bool
 query_user_exec_systemd(void)
 {
-    bool ret = true;  /* Presume everything goes okay */
+    bool ret = true; /* Presume everything goes okay */
     int i;
 
     /* If systemd is not available, use the default built-in mechanism */
@@ -112,7 +110,7 @@
     for (i = 0; i < QUERY_USER_NUMSLOTS && query_user[i].response != NULL; i++)
     {
         if (!get_console_input_systemd(query_user[i].prompt, query_user[i].echo,
-                                       query_user[i].response, query_user[i].response_len) )
+                                       query_user[i].response, query_user[i].response_len))
         {
             /* Force the final result state to failed on failure */
             ret = false;
src/openvpn/crypto.c +122 -168

99 lines not on this page · raw message

src/openvpn/crypto.h +88 -102

190 lines not on this page · raw message

src/openvpn/crypto_backend.h +17 -17
index df5bc4d..59418f6 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_epoch.c +27 -43

70 lines not on this page · raw message

src/openvpn/crypto_epoch.h +16 -30

46 lines not on this page · raw message

src/openvpn/crypto_mbedtls.c +74 -74

148 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +14 -17
index 620732e..80f1d16 100644

Lines of this file are not shown. View the raw message.

src/openvpn/crypto_openssl.c +85 -97

182 lines not on this page · raw message

src/openvpn/crypto_openssl.h +14 -12
index 9680c18..6218b39 100644

Lines of this file are not shown. View the raw message.

src/openvpn/cryptoapi.c +57 -52

109 lines not on this page · raw message

src/openvpn/dco.c +57 -59

116 lines not on this page · raw message

src/openvpn/dco.h +12 -15
index 95abf71..59acb18 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.c +16 -23
index 04c1e3d..931f9f6 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_freebsd.h +7 -4
index cbb1dda..2f486f0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_internal.h +5 -8
index 96aa281..83013ef 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_linux.c +67 -102

169 lines not on this page · raw message

src/openvpn/dco_linux.h +6 -4
index 9f15199..310d433 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dco_win.c +63 -56

119 lines not on this page · raw message

src/openvpn/dco_win.h +20 -23

43 lines not on this page · raw message

src/openvpn/dhcp.c +28 -28

56 lines not on this page · raw message

src/openvpn/dhcp.h +21 -19
index 34f4513..af5c2c4 100644

Lines of this file are not shown. View the raw message.

src/openvpn/dns.c +36 -38

74 lines not on this page · raw message

src/openvpn/dns.h +21 -12
index 94c76e5..6d97b40 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.c +7 -14
index 7809237..6c7df8e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/env_set.h +9 -13
index 63237a7..3973a4e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/errlevel.h +115 -115

230 lines not on this page · raw message

src/openvpn/error.c +51 -86

137 lines not on this page · raw message

src/openvpn/error.h +77 -41

118 lines not on this page · raw message

src/openvpn/event.c +80 -98

178 lines not on this page · raw message

src/openvpn/event.h +34 -31

65 lines not on this page · raw message

src/openvpn/fdmisc.c +1 -1
index b8d9334..2c6525b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/fdmisc.h +1 -1
index de0007a..4c0ab65 100644

Lines of this file are not shown. View the raw message.

src/openvpn/forward.c +116 -156

272 lines not on this page · raw message

src/openvpn/forward.h +34 -37

71 lines not on this page · raw message

src/openvpn/fragment.c +40 -54

94 lines not on this page · raw message

src/openvpn/fragment.h +39 -39

78 lines not on this page · raw message

src/openvpn/gremlin.c +12 -13
index a3ecc8d..e6ebbef 100644

Lines of this file are not shown. View the raw message.

src/openvpn/gremlin.h +17 -15
index 3cbfb77..2422338 100644

Lines of this file are not shown. View the raw message.

src/openvpn/helper.c +48 -40

88 lines not on this page · raw message

src/openvpn/httpdigest.c +39 -50

89 lines not on this page · raw message

src/openvpn/httpdigest.h +13 -21
index ecdd6d3..1b51a62 100644

Lines of this file are not shown. View the raw message.

src/openvpn/init.c +308 -477

785 lines not on this page · raw message

src/openvpn/init.h +15 -19
index 081a295..a807874 100644

Lines of this file are not shown. View the raw message.

src/openvpn/integer.h +9 -8
index 4a95f4e..b82379e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.c +4 -7
index a2ac4f7..2b35314 100644

Lines of this file are not shown. View the raw message.

src/openvpn/interval.h +9 -11
index 420a1be..b133c44 100644

Lines of this file are not shown. View the raw message.

src/openvpn/list.c +59 -57

116 lines not on this page · raw message

src/openvpn/list.h +8 -19
index 77807c7..fb3302d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lladdr.c +7 -19
index cc677b4..d8bcad9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.c +10 -17
index d5f60ca..3a73d5f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/lzo.h +21 -17
index c47db83..9d4fa30 100644

Lines of this file are not shown. View the raw message.

src/openvpn/manage.c +278 -355

633 lines not on this page · raw message

src/openvpn/manage.h +114 -143

257 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +7 -9
index 655c48f..62ed257 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.c +3 -3
index 76f2e58..0750fec 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mbuf.h +3 -3
index 8cc7ab1..7f8c1b7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/memdbg.h +5 -3
index 9f8ff11..738a775 100644

Lines of this file are not shown. View the raw message.

src/openvpn/misc.c +139 -138

277 lines not on this page · raw message

src/openvpn/misc.h +36 -41

77 lines not on this page · raw message

src/openvpn/mroute.c +32 -45

77 lines not on this page · raw message

src/openvpn/mroute.h +63 -68

131 lines not on this page · raw message

src/openvpn/mss.c +33 -47

80 lines not on this page · raw message

src/openvpn/mss.h +1 -2
index 1b1eafb..05f12a7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.c +1 -1
index d9ecee3..bd6316c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mstats.h +2 -1
index b9f33b6..c38b0f2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.c +8 -8
index 9781724..81310a2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtcp.h +4 -2
index 5158427d..f4b806c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/mtu.c +20 -29

49 lines not on this page · raw message

src/openvpn/mtu.h +65 -76

141 lines not on this page · raw message

src/openvpn/mudp.c +34 -35

69 lines not on this page · raw message

src/openvpn/multi.c +360 -481

841 lines not on this page · raw message

src/openvpn/multi.h +65 -67

132 lines not on this page · raw message

src/openvpn/multi_io.c +65 -73

138 lines not on this page · raw message

src/openvpn/networking.h +25 -36

61 lines not on this page · raw message

src/openvpn/networking_freebsd.c +20 -34

54 lines not on this page · raw message

src/openvpn/networking_iproute2.c +37 -57

94 lines not on this page · raw message

src/openvpn/networking_sitnl.c +165 -209

374 lines not on this page · raw message

src/openvpn/ntlm.c +50 -55

105 lines not on this page · raw message

src/openvpn/occ.c +96 -111

207 lines not on this page · raw message

src/openvpn/occ.h +15 -16
index d5f208e..369d94e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openssl_compat.h +16 -19
index 20f612e..143a3cf 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.c +9 -12
index 99c420a..f1e1f76 100644

Lines of this file are not shown. View the raw message.

src/openvpn/openvpn.h +68 -64

132 lines not on this page · raw message

src/openvpn/options.c +752 -904

1,656 lines not on this page · raw message

src/openvpn/options.h +105 -126

231 lines not on this page · raw message

src/openvpn/options_util.c +12 -23
index e469c28..5251b21 100644

Lines of this file are not shown. View the raw message.

src/openvpn/options_util.h +6 -13
index 23fd78d..6f81b1e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.c +5 -13
index d6b9c2c..717f749 100644

Lines of this file are not shown. View the raw message.

src/openvpn/otime.h +2 -2
index 29e8046..5c700bb 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ovpn_dco_freebsd.h +28 -24

52 lines not on this page · raw message

src/openvpn/packet_id.c +41 -72

113 lines not on this page · raw message

src/openvpn/packet_id.h +29 -33

62 lines not on this page · raw message

src/openvpn/perf.c +31 -43

74 lines not on this page · raw message

src/openvpn/perf.h +22 -22

44 lines not on this page · raw message

src/openvpn/ping.c +3 -6
index 50f255a..b9c0b96 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ping.h +5 -6
index 29ee2f2..48d4c0a 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11.c +165 -383

548 lines not on this page · raw message

src/openvpn/pkcs11.h +12 -37

49 lines not on this page · raw message

src/openvpn/pkcs11_backend.h +2 -4
index f65ba3f..caa0735 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_mbedtls.c +7 -12
index d1c8957..245aa8d 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pkcs11_openssl.c +40 -41

81 lines not on this page · raw message

src/openvpn/platform.c +36 -38

74 lines not on this page · raw message

src/openvpn/platform.h +7 -7
index 18ea97d..f1a2b01 100644

Lines of this file are not shown. View the raw message.

src/openvpn/plugin.c +85 -116

201 lines not on this page · raw message

src/openvpn/plugin.h +26 -35

61 lines not on this page · raw message

src/openvpn/pool.c +49 -75

124 lines not on this page · raw message

src/openvpn/pool.h +10 -8
index 9f50ca9..6cecef0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.c +13 -25
index 4820602..34b3378 100644

Lines of this file are not shown. View the raw message.

src/openvpn/proto.h +90 -84

174 lines not on this page · raw message

src/openvpn/proxy.c +80 -120

200 lines not on this page · raw message

src/openvpn/proxy.h +15 -12
index fcca1ab..be16d83 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ps.c +53 -69

122 lines not on this page · raw message

src/openvpn/ps.h +3 -4
index c6f5633..e28c403 100644

Lines of this file are not shown. View the raw message.

src/openvpn/push.c +88 -114

202 lines not on this page · raw message

src/openvpn/push.h +15 -21
index b6770bc..22b940f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/push_util.c +3 -10
index b4d1e8b..0862a74 100644

Lines of this file are not shown. View the raw message.

src/openvpn/pushlist.h +4 -2
index 1b66517..ef4de88 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.c +8 -6
index 17255f7..071df7c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reflect_filter.h +5 -7
index e3fb165..0601f4b 100644

Lines of this file are not shown. View the raw message.

src/openvpn/reliable.c +28 -35

63 lines not on this page · raw message

src/openvpn/reliable.h +25 -29

54 lines not on this page · raw message

src/openvpn/ring_buffer.h new file +124 -0

124 lines not on this page · raw message

src/openvpn/route.c +423 -692

1,115 lines not on this page · raw message

src/openvpn/route.h +112 -123

235 lines not on this page · raw message

src/openvpn/run_command.c +12 -16
index ed5b08c..4a1ef22 100644

Lines of this file are not shown. View the raw message.

src/openvpn/run_command.h +20 -21

41 lines not on this page · raw message

src/openvpn/schedule.c +16 -35

51 lines not on this page · raw message

src/openvpn/schedule.h +5 -8
index fad3f36..79311c5 100644

Lines of this file are not shown. View the raw message.

src/openvpn/session_id.h +1 -2
index 7c0a968..24e7ab0 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.c +1 -2
index 1c8cfb3..fb2621e 100644

Lines of this file are not shown. View the raw message.

src/openvpn/shaper.h +9 -10
index 9996b08..4483d15 100644

Lines of this file are not shown. View the raw message.

src/openvpn/sig.c +28 -31

59 lines not on this page · raw message

src/openvpn/sig.h +2 -2
index 93219f7..7e5dd9f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/socket.c +339 -560

899 lines not on this page · raw message

src/openvpn/socket.h +162 -227

389 lines not on this page · raw message

src/openvpn/socks.c +55 -61

116 lines not on this page · raw message

src/openvpn/socks.h +9 -11
index 985745b..b5a69b9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl.c +265 -427

692 lines not on this page · raw message

src/openvpn/ssl.h +46 -72

118 lines not on this page · raw message

src/openvpn/ssl_backend.h +27 -38

65 lines not on this page · raw message

src/openvpn/ssl_common.h +94 -85

179 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +122 -181

303 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +36 -29

65 lines not on this page · raw message

src/openvpn/ssl_ncp.c +44 -57

101 lines not on this page · raw message

src/openvpn/ssl_ncp.h +11 -20
index b01cd87..2b2ff85 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_openssl.c +144 -178

322 lines not on this page · raw message

src/openvpn/ssl_openssl.h +8 -6
index 966bb44..08a3d53 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_pkt.c +38 -70

108 lines not on this page · raw message

src/openvpn/ssl_pkt.h +44 -62

106 lines not on this page · raw message

src/openvpn/ssl_util.c +152 -141

293 lines not on this page · raw message

src/openvpn/ssl_util.h +7 -5
index 189b1d0..007ed69 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify.c +165 -166

331 lines not on this page · raw message

src/openvpn/ssl_verify.h +24 -27

51 lines not on this page · raw message

src/openvpn/ssl_verify_backend.h +15 -15
index 03f591c..a0559c9 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +55 -67

122 lines not on this page · raw message

src/openvpn/ssl_verify_mbedtls.h +1 -2
index 3e380a6..0b2f2d2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_openssl.c +44 -54

98 lines not on this page · raw message

src/openvpn/status.c +11 -19
index 1f5e67a..34e5a2f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/status.h +10 -12
index ddbaeef..0c7a869 100644

Lines of this file are not shown. View the raw message.

src/openvpn/syshead.h +25 -23

48 lines not on this page · raw message

src/openvpn/tls_crypt.c +87 -140

227 lines not on this page · raw message

src/openvpn/tls_crypt.h +22 -29

51 lines not on this page · raw message

src/openvpn/tun.c +616 -944

1,560 lines not on this page · raw message

src/openvpn/tun.h +58 -65

123 lines not on this page · raw message

src/openvpn/tun_afunix.c +6 -11
index ac12070..4d48a31 100644

Lines of this file are not shown. View the raw message.

src/openvpn/tun_afunix.h +4 -11
index faca142..3346403 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.c +10 -14
index 5cc23f4..a6a6e93 100644

Lines of this file are not shown. View the raw message.

src/openvpn/vlan.h +3 -6
index 7602585..e2c9c44 100644

Lines of this file are not shown. View the raw message.

src/openvpn/wfp_block.c +31 -66

97 lines not on this page · raw message

src/openvpn/wfp_block.h +3 -5
index 6de39f5..5ca093c 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32-util.c +1 -1
index c23d066..0d6d029 100644

Lines of this file are not shown. View the raw message.

src/openvpn/win32.c +87 -100

187 lines not on this page · raw message

src/openvpn/win32.h +30 -33

63 lines not on this page · raw message

src/openvpn/xkey_common.h +15 -19
index 111596e..3d65e1f 100644

Lines of this file are not shown. View the raw message.

src/openvpn/xkey_helper.c +47 -50

97 lines not on this page · raw message

src/openvpn/xkey_provider.c +154 -146

300 lines not on this page · raw message

src/openvpnmsica/dllmain.c +14 -17
index 7121c02..e7d4a4b 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.c +11 -10
index 46bef2b..d750fb0 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msica_arg.h +5 -13
index c8f7595..858fdb6 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.c +13 -21
index 3529e9a..12dc0db 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/msiex.h +6 -21
index d9afeb5..60c26b5 100644

Lines of this file are not shown. View the raw message.

src/openvpnmsica/openvpnmsica.c +179 -170

349 lines not on this page · raw message

src/openvpnmsica/openvpnmsica.h +75 -79

154 lines not on this page · raw message

src/openvpnserv/common.c +24 -25

49 lines not on this page · raw message

src/openvpnserv/interactive.c +196 -211

407 lines not on this page · raw message

src/openvpnserv/service.c +21 -25

46 lines not on this page · raw message

src/openvpnserv/service.h +13 -10
index 8989e60..3d3b82b 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.c +16 -17
index 6ed5bea..59d5b86 100644

Lines of this file are not shown. View the raw message.

src/openvpnserv/validate.h +7 -6
index bde1892..6f3bf09 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/auth-pam.c +75 -67

142 lines not on this page · raw message

src/plugins/auth-pam/pamdl.c +29 -37

66 lines not on this page · raw message

src/plugins/auth-pam/utils.c +5 -4
index 6524051..0da162d 100644

Lines of this file are not shown. View the raw message.

src/plugins/auth-pam/utils.h +7 -9
index 0b90aee..a733feb 100644

Lines of this file are not shown. View the raw message.

src/plugins/down-root/down-root.c +21 -16
index 5f595fd..da476fc 100644

Lines of this file are not shown. View the raw message.

src/tapctl/basic.h +9 -7
index 571ae62..620c1ca 100644

Lines of this file are not shown. View the raw message.

src/tapctl/error.h +45 -21

66 lines not on this page · raw message

src/tapctl/main.c +72 -60

132 lines not on this page · raw message

src/tapctl/tap.c +148 -271

419 lines not on this page · raw message

src/tapctl/tap.h +13 -29

42 lines not on this page · raw message

tests/ntlm_support.c +1 -1
index 3960cc5..7007051 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test.c +4 -5
index c174025..139e06f 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/example_test/test2.c +1 -1
index bb54633..3089432 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/cert_data.h +34 -36

70 lines not on this page · raw message

tests/unit_tests/openvpn/mock_management.c +1 -2
index 9674b45..b24e4c4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.c +2 -3
index 5407561..603520b 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_msg.h +3 -6
index 40d7609..f4ebc23 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/mock_ssl_dependencies.c +2 -2
index 2a562fc..7333c47 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/pkey_test_utils.c +5 -6
index 56608ea..c9aef46 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_argv.c +9 -9
index 33b3dec..a65857b 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_auth_token.c +59 -66

125 lines not on this page · raw message

tests/unit_tests/openvpn/test_buffer.c +28 -37

65 lines not on this page · raw message

tests/unit_tests/openvpn/test_crypto.c +85 -131

216 lines not on this page · raw message

tests/unit_tests/openvpn/test_cryptoapi.c +41 -42

83 lines not on this page · raw message

tests/unit_tests/openvpn/test_misc.c +38 -35

73 lines not on this page · raw message

tests/unit_tests/openvpn/test_ncp.c +34 -46

80 lines not on this page · raw message

tests/unit_tests/openvpn/test_networking.c +4 -10
index 0434707..f2da83e 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_packet_id.c +25 -32

57 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkcs11.c +46 -47

93 lines not on this page · raw message

tests/unit_tests/openvpn/test_pkt.c +94 -120

214 lines not on this page · raw message

tests/unit_tests/openvpn/test_provider.c +27 -26

53 lines not on this page · raw message

tests/unit_tests/openvpn/test_push_update_msg.c +44 -48

92 lines not on this page · raw message

tests/unit_tests/openvpn/test_ssl.c +24 -31

55 lines not on this page · raw message

tests/unit_tests/openvpn/test_tls_crypt.c +105 -150

255 lines not on this page · raw message

tests/unit_tests/openvpn/test_user_pass.c +17 -14
index 74f67a7..460b37f 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/plugins/auth-pam/test_search_and_replace.c +0 -2
index 50b241d..a861bfd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#14 lore raw

[Openvpn-devel] [PATCH applied] Re: Reformat the whole project with clang-format

So this patch is huge, touches almost all files, and has the potential to sneak in "innocent" changes - which is why we have the clang-format rules published beforehand, so whoever wants can verify that this patch is, indeed, only the result of clang-format (checkout the commit before that, run "clang-format -i *.c *.h", then "diff" to the files after this commit).

This said, I have pushed it to all test instruments we have, and everything still compiles *and tests* fine. Just to be sure.

It has a few ugly warts where the code "as it was before" did not make it possible to apply the rules in a non-ugly way (like some SetLastError() calls with long /* comments */ after them) - there will be a few more commits coming that clean up these accidents, for example by moving the comment before the line so it does not need wrapping.

Also, we'll change the setting of "ColumnLimit" to "0" in a subsequent patch, as it turns out that the setting of "100" will also make clang-format un-wrap some multi-line statements in most interesting ways - so these are better left to human common sense. The limit we try to achieve is still "80, if you can, 100, if wrapping at 80 would be more ugly" (and we had heated discussions on which constructs are "ugly"... as they say, the beauty lies in the eyes of the beholder).

For whatever reason, error.h, openvpnmsica.c and tapctl/main.c differ here in function return type wrapping, but this will be addressed in a followup patch.

Your patch has been applied to the master branch.

commit 3cca3367e6e0ffeccb8e39cb2c739d1dcb086701

Author: Frank Lichtenheld
Date:   Mon Aug 4 17:18:47 2025 +0200
     Reformat the whole project with clang-format

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://gerrit.openvpn.net/c/openvpn/+/791
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering