[Openvpn-devel] Remove deprecated plugin functions from code samples

Message ID CACDCbPo_kdRDHe7-zJZnELyBGBpLEan=hKv6ScTHzE1KT=inzg@mail.gmail.com
State Under Review
Delegated to: David Sommerseth
Headers show
Series
  • [Openvpn-devel] Remove deprecated plugin functions from code samples
Related show

Commit Message

Greg Cox June 30, 2018, 4:58 p.m.
While writing up a plugin, I found that the sample plugin code was using
openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are listed
as 'deprecated' in openvpn-plugin.h, it made sense to me that you shouldn't
list those functions as sample code for others to clone.

This edits only sample code and since it's my first patch I thought I'd
limit to that.  src/plugins/auth-pam and src/plugins/down-root have similar
'issues', though, and may need the same treatment, if I have the right idea.

Thanks for reading.
-Greg

---
 sample/sample-plugins/defer/simple.c    | 5 +++--
 sample/sample-plugins/defer/simple.def  | 4 ++--
 sample/sample-plugins/log/log.c         | 6 ++++--
 sample/sample-plugins/simple/simple.c   | 6 ++++--
 sample/sample-plugins/simple/simple.def | 4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)

--
2.15.2 (Apple Git-101.1)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Comments

Antonio Quartulli June 30, 2018, 5:49 p.m. | #1
Hi,

On 01/07/18 00:58, Greg Cox wrote:
> While writing up a plugin, I found that the sample plugin code was using
> openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are listed
> as 'deprecated' in openvpn-plugin.h, it made sense to me that you shouldn't
> list those functions as sample code for others to clone.
> 
> This edits only sample code and since it's my first patch I thought I'd
> limit to that.  src/plugins/auth-pam and src/plugins/down-root have similar
> 'issues', though, and may need the same treatment, if I have the right idea.
> 
> Thanks for reading.
> -Greg
> 

I'd remove the last paragraph and the greetings from the commit message.
But this might be done at commit time.

> ---
>  sample/sample-plugins/defer/simple.c    | 5 +++--
>  sample/sample-plugins/defer/simple.def  | 4 ++--
>  sample/sample-plugins/log/log.c         | 6 ++++--
>  sample/sample-plugins/simple/simple.c   | 6 ++++--
>  sample/sample-plugins/simple/simple.def | 4 ++--
>  5 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/sample/sample-plugins/defer/simple.c
> b/sample/sample-plugins/defer/simple.c
> index
> d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc9c70aa24f8722e5a1d67f9
> 100644
> --- a/sample/sample-plugins/defer/simple.c
> +++ b/sample/sample-plugins/defer/simple.c
> @@ -131,11 +131,12 @@ atoi_null0(const char *str)
>  }
> 
>  OPENVPN_EXPORT openvpn_plugin_handle_t
> -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
> char *envp[])
> +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
> char *envp[],
> +                       struct openvpn_plugin_string_list **return_list)
>  {
>      struct plugin_context *context;
> 
> -    printf("FUNC: openvpn_plugin_open_v1\n");
> +    printf("FUNC: openvpn_plugin_open_v2\n");
> 
>      /*
>       * Allocate our context
> diff --git a/sample/sample-plugins/defer/simple.def
> b/sample/sample-plugins/defer/simple.def
> index
> a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
> 100755
> --- a/sample/sample-plugins/defer/simple.def
> +++ b/sample/sample-plugins/defer/simple.def
> @@ -1,6 +1,6 @@
>  LIBRARY   OpenVPN_PLUGIN_SAMPLE
>  DESCRIPTION "Sample OpenVPN plug-in module."
>  EXPORTS
> -   openvpn_plugin_open_v1   @1
> -   openvpn_plugin_func_v1   @2
> +   openvpn_plugin_open_v2   @1
> +   openvpn_plugin_func_v2   @2
>     openvpn_plugin_close_v1  @3
> diff --git a/sample/sample-plugins/log/log.c
> b/sample/sample-plugins/log/log.c
> index
> ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a311fb61436cdfd61dd02f78
> 100644
> --- a/sample/sample-plugins/log/log.c
> +++ b/sample/sample-plugins/log/log.c
> @@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])
>  }
> 
>  OPENVPN_EXPORT openvpn_plugin_handle_t
> -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
> char *envp[])
> +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
> char *envp[],
> +                       struct openvpn_plugin_string_list **return_list)
>  {
>      struct plugin_context *context;
> 
> @@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char
> *envp[])
>  }
> 
>  OPENVPN_EXPORT int
> -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
> const char *argv[], const char *envp[])
> +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
> const char *argv[], const char *envp[],
> +                       void *per_client_context, struct
> openvpn_plugin_string_list **return_list)
>  {
>      struct plugin_context *context = (struct plugin_context *) handle;
> 
> diff --git a/sample/sample-plugins/simple/simple.c
> b/sample/sample-plugins/simple/simple.c
> index
> 950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb0a4d4fa621627a6099ba76
> 100644
> --- a/sample/sample-plugins/simple/simple.c
> +++ b/sample/sample-plugins/simple/simple.c
> @@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])
>  }
> 
>  OPENVPN_EXPORT openvpn_plugin_handle_t
> -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
> char *envp[])
> +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
> char *envp[],
> +                       struct openvpn_plugin_string_list **return_list)
>  {
>      struct plugin_context *context;
> 
> @@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const
> char *argv[], const char *
>  }
> 
>  OPENVPN_EXPORT int
> -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
> const char *argv[], const char *envp[])
> +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
> const char *argv[], const char *envp[],
> +                       void *per_client_context, struct
> openvpn_plugin_string_list **return_list)
>  {
>      struct plugin_context *context = (struct plugin_context *) handle;
> 
> diff --git a/sample/sample-plugins/simple/simple.def
> b/sample/sample-plugins/simple/simple.def
> index
> a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
> 100755
> --- a/sample/sample-plugins/simple/simple.def
> +++ b/sample/sample-plugins/simple/simple.def
> @@ -1,6 +1,6 @@
>  LIBRARY   OpenVPN_PLUGIN_SAMPLE
>  DESCRIPTION "Sample OpenVPN plug-in module."
>  EXPORTS
> -   openvpn_plugin_open_v1   @1
> -   openvpn_plugin_func_v1   @2
> +   openvpn_plugin_open_v2   @1
> +   openvpn_plugin_func_v2   @2
>     openvpn_plugin_close_v1  @3
> --
> 2.15.2 (Apple Git-101.1)

did you concatenate two patches? or what happened? It seems that the
part after this is not recognised as proper patch.


Cheers,
Gert Doering June 30, 2018, 5:55 p.m. | #2
Hi,

On Sun, Jul 01, 2018 at 01:49:26AM +0800, Antonio Quartulli wrote:
[..]
> did you concatenate two patches? or what happened? It seems that the
> part after this is not recognised as proper patch.

If the patch gets an ACK otherwise, I can (usually) fix this on commit.

gert
Greg Cox June 30, 2018, 9:08 p.m. | #3
On Sat, Jun 30, 2018 at 5:49 PM, Antonio Quartulli <a@unstable.cc> wrote:

> I'd remove the last paragraph and the greetings from the commit message.
> But this might be done at commit time.
>

​It was unclear how to handle "explain what I'm wanting" in one mail.
Sorry.
​

> did you concatenate two patches? or what happened? It seems that the
> part after this is not recognised as proper patch.
>

I think I dropped a few lines from `git format-patch HEAD~1 --stdout`​ on
accident.  Take two:



From 2f221fe6111572dc897dc91cfd9ad4929df478ec Mon Sep 17 00:00:00 2001
From: Greg Cox <gcox@mozilla.com>
Date: Fri, 29 Jun 2018 21:53:54 +0000
Subject: [PATCH] Remove deprecated plugin functions from code samples

---
 sample/sample-plugins/defer/simple.c    | 5 +++--
 sample/sample-plugins/defer/simple.def  | 4 ++--
 sample/sample-plugins/log/log.c         | 6 ++++--
 sample/sample-plugins/simple/simple.c   | 6 ++++--
 sample/sample-plugins/simple/simple.def | 4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/sample/sample-plugins/defer/simple.c
b/sample/sample-plugins/defer/simple.c
index
d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc9c70aa24f8722e5a1d67f9
100644
--- a/sample/sample-plugins/defer/simple.c
+++ b/sample/sample-plugins/defer/simple.c
@@ -131,11 +131,12 @@ atoi_null0(const char *str)
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

-    printf("FUNC: openvpn_plugin_open_v1\n");
+    printf("FUNC: openvpn_plugin_open_v2\n");

     /*
      * Allocate our context
diff --git a/sample/sample-plugins/defer/simple.def
b/sample/sample-plugins/defer/simple.def
index
a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
100755
--- a/sample/sample-plugins/defer/simple.def
+++ b/sample/sample-plugins/defer/simple.def
@@ -1,6 +1,6 @@
 LIBRARY   OpenVPN_PLUGIN_SAMPLE
 DESCRIPTION "Sample OpenVPN plug-in module."
 EXPORTS
-   openvpn_plugin_open_v1   @1
-   openvpn_plugin_func_v1   @2
+   openvpn_plugin_open_v2   @1
+   openvpn_plugin_func_v2   @2
    openvpn_plugin_close_v1  @3
diff --git a/sample/sample-plugins/log/log.c
b/sample/sample-plugins/log/log.c
index
ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a311fb61436cdfd61dd02f78
100644
--- a/sample/sample-plugins/log/log.c
+++ b/sample/sample-plugins/log/log.c
@@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

@@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char
*envp[])
 }

 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[])
+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[],
+                       void *per_client_context, struct
openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context = (struct plugin_context *) handle;

diff --git a/sample/sample-plugins/simple/simple.c
b/sample/sample-plugins/simple/simple.c
index
950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb0a4d4fa621627a6099ba76
100644
--- a/sample/sample-plugins/simple/simple.c
+++ b/sample/sample-plugins/simple/simple.c
@@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

@@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const
char *argv[], const char *
 }

 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[])
+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[],
+                       void *per_client_context, struct
openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context = (struct plugin_context *) handle;

diff --git a/sample/sample-plugins/simple/simple.def
b/sample/sample-plugins/simple/simple.def
index
a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
100755
--- a/sample/sample-plugins/simple/simple.def
+++ b/sample/sample-plugins/simple/simple.def
@@ -1,6 +1,6 @@
 LIBRARY   OpenVPN_PLUGIN_SAMPLE
 DESCRIPTION "Sample OpenVPN plug-in module."
 EXPORTS
-   openvpn_plugin_open_v1   @1
-   openvpn_plugin_func_v1   @2
+   openvpn_plugin_open_v2   @1
+   openvpn_plugin_func_v2   @2
    openvpn_plugin_close_v1  @3
--
2.15.2 (Apple Git-101.1)
<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 30, 2018 at 5:49 PM, Antonio Quartulli <span dir="ltr">&lt;<a href="mailto:a@unstable.cc" target="_blank">a@unstable.cc</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I&#39;d remove the last paragraph and the greetings from the commit message.<br>
But this might be done at commit time.<br></blockquote><div><br></div><div style="font-family:courier new,monospace" class="gmail_default">​It was unclear how to handle &quot;explain what I&#39;m wanting&quot; in one mail.  Sorry.<br></div><div style="font-family:courier new,monospace" class="gmail_default">​</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">did you concatenate two patches? or what happened? It seems that the<br>
part after this is not recognised as proper patch.<br></blockquote><div> </div><div style="font-family:courier new,monospace" class="gmail_default">I think I dropped a few lines from `git format-patch HEAD~1 --stdout`​ on accident.  Take two:</div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default">From 2f221fe6111572dc897dc91cfd9ad4929df478ec Mon Sep 17 00:00:00 2001<br>From: Greg Cox &lt;<a href="mailto:gcox@mozilla.com">gcox@mozilla.com</a>&gt;<br>Date: Fri, 29 Jun 2018 21:53:54 +0000<br>Subject: [PATCH] Remove deprecated plugin functions from code samples<br><br>---<br> sample/sample-plugins/defer/simple.c    | 5 +++--<br> sample/sample-plugins/defer/simple.def  | 4 ++--<br> sample/sample-plugins/log/log.c         | 6 ++++--<br> sample/sample-plugins/simple/simple.c   | 6 ++++--<br> sample/sample-plugins/simple/simple.def | 4 ++--<br> 5 files changed, 15 insertions(+), 10 deletions(-)<br><br>diff --git a/sample/sample-plugins/defer/simple.c b/sample/sample-plugins/defer/simple.c<br>index d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc9c70aa24f8722e5a1d67f9 100644<br>--- a/sample/sample-plugins/defer/simple.c<br>+++ b/sample/sample-plugins/defer/simple.c<br>@@ -131,11 +131,12 @@ atoi_null0(const char *str)<br> }<br><br> OPENVPN_EXPORT openvpn_plugin_handle_t<br>-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char *envp[])<br>+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const char *envp[],<br>+                       struct openvpn_plugin_string_list **return_list)<br> {<br>     struct plugin_context *context;<br><br>-    printf(&quot;FUNC: openvpn_plugin_open_v1\n&quot;);<br>+    printf(&quot;FUNC: openvpn_plugin_open_v2\n&quot;);<br><br>     /*<br>      * Allocate our context<br>diff --git a/sample/sample-plugins/defer/simple.def b/sample/sample-plugins/defer/simple.def<br>index a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a 100755<br>--- a/sample/sample-plugins/defer/simple.def<br>+++ b/sample/sample-plugins/defer/simple.def<br>@@ -1,6 +1,6 @@<br> LIBRARY   OpenVPN_PLUGIN_SAMPLE<br> DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br> EXPORTS<br>-   openvpn_plugin_open_v1   @1<br>-   openvpn_plugin_func_v1   @2<br>+   openvpn_plugin_open_v2   @1<br>+   openvpn_plugin_func_v2   @2<br>    openvpn_plugin_close_v1  @3<br>diff --git a/sample/sample-plugins/log/log.c b/sample/sample-plugins/log/log.c<br>index ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a311fb61436cdfd61dd02f78 100644<br>--- a/sample/sample-plugins/log/log.c<br>+++ b/sample/sample-plugins/log/log.c<br>@@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])<br> }<br><br> OPENVPN_EXPORT openvpn_plugin_handle_t<br>-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char *envp[])<br>+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const char *envp[],<br>+                       struct openvpn_plugin_string_list **return_list)<br> {<br>     struct plugin_context *context;<br><br>@@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char *envp[])<br> }<br><br> OPENVPN_EXPORT int<br>-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])<br>+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[],<br>+                       void *per_client_context, struct openvpn_plugin_string_list **return_list)<br> {<br>     struct plugin_context *context = (struct plugin_context *) handle;<br><br>diff --git a/sample/sample-plugins/simple/simple.c b/sample/sample-plugins/simple/simple.c<br>index 950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb0a4d4fa621627a6099ba76 100644<br>--- a/sample/sample-plugins/simple/simple.c<br>+++ b/sample/sample-plugins/simple/simple.c<br>@@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])<br> }<br><br> OPENVPN_EXPORT openvpn_plugin_handle_t<br>-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char *envp[])<br>+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const char *envp[],<br>+                       struct openvpn_plugin_string_list **return_list)<br> {<br>     struct plugin_context *context;<br><br>@@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char *<br> }<br><br> OPENVPN_EXPORT int<br>-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])<br>+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[],<br>+                       void *per_client_context, struct openvpn_plugin_string_list **return_list)<br> {<br>     struct plugin_context *context = (struct plugin_context *) handle;<br><br>diff --git a/sample/sample-plugins/simple/simple.def b/sample/sample-plugins/simple/simple.def<br>index a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a 100755<br>--- a/sample/sample-plugins/simple/simple.def<br>+++ b/sample/sample-plugins/simple/simple.def<br>@@ -1,6 +1,6 @@<br> LIBRARY   OpenVPN_PLUGIN_SAMPLE<br> DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br> EXPORTS<br>-   openvpn_plugin_open_v1   @1<br>-   openvpn_plugin_func_v1   @2<br>+   openvpn_plugin_open_v2   @1<br>+   openvpn_plugin_func_v2   @2<br>    openvpn_plugin_close_v1  @3<br>--<br>2.15.2 (Apple Git-101.1)<br><br></div><br></div></div></div>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Yovie Ramadhan June 30, 2018, 10:55 p.m. | #4
Minggu, 01 Juli 2018, Antonio Quartulli <a@unstable.cc> menulis:

> Hi,
>
> On 01/07/18 00:58, Greg Cox wrote:
> > While writing up a plugin, I found that the sample plugin code was using
> > openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are listed
> > as 'deprecated' in openvpn-plugin.h, it made sense to me that you
> shouldn't
> > list those functions as sample code for others to clone.
> >
> > This edits only sample code and since it's my first patch I thought I'd
> > limit to that.  src/plugins/auth-pam and src/plugins/down-root have
> similar
> > 'issues', though, and may need the same treatment, if I have the right
> idea.
> >
> > Thanks for reading.
> > -Greg
> >
>
> I'd remove the last paragraph and the greetings from the commit message.
> But this might be done at commit time.
>
> > ---
> >  sample/sample-plugins/defer/simple.c    | 5 +++--
> >  sample/sample-plugins/defer/simple.def  | 4 ++--
> >  sample/sample-plugins/log/log.c         | 6 ++++--
> >  sample/sample-plugins/simple/simple.c   | 6 ++++--
> >  sample/sample-plugins/simple/simple.def | 4 ++--
> >  5 files changed, 15 insertions(+), 10 deletions(-)
> >
> > diff --git a/sample/sample-plugins/defer/simple.c
> > b/sample/sample-plugins/defer/simple.c
> > index
> > d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc9c70aa24f872
> 2e5a1d67f9
> > 100644
> > --- a/sample/sample-plugins/defer/simple.c
> > +++ b/sample/sample-plugins/defer/simple.c
> > @@ -131,11 +131,12 @@ atoi_null0(const char *str)
> >  }
> >
> >  OPENVPN_EXPORT openvpn_plugin_handle_t
> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[])
> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[],
> > +                       struct openvpn_plugin_string_list **return_list)
> >  {
> >      struct plugin_context *context;
> >
> > -    printf("FUNC: openvpn_plugin_open_v1\n");
> > +    printf("FUNC: openvpn_plugin_open_v2\n");
> >
> >      /*
> >       * Allocate our context
> > diff --git a/sample/sample-plugins/defer/simple.def
> > b/sample/sample-plugins/defer/simple.def
> > index
> > a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae
> 9898be221a
> > 100755
> > --- a/sample/sample-plugins/defer/simple.def
> > +++ b/sample/sample-plugins/defer/simple.def
> > @@ -1,6 +1,6 @@
> >  LIBRARY   OpenVPN_PLUGIN_SAMPLE
> >  DESCRIPTION "Sample OpenVPN plug-in module."
> >  EXPORTS
> > -   openvpn_plugin_open_v1   @1
> > -   openvpn_plugin_func_v1   @2
> > +   openvpn_plugin_open_v2   @1
> > +   openvpn_plugin_func_v2   @2
> >     openvpn_plugin_close_v1  @3
> > diff --git a/sample/sample-plugins/log/log.c
> > b/sample/sample-plugins/log/log.c
> > index
> > ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a311fb61436cdf
> d61dd02f78
> > 100644
> > --- a/sample/sample-plugins/log/log.c
> > +++ b/sample/sample-plugins/log/log.c
> > @@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])
> >  }
> >
> >  OPENVPN_EXPORT openvpn_plugin_handle_t
> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[])
> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[],
> > +                       struct openvpn_plugin_string_list **return_list)
> >  {
> >      struct plugin_context *context;
> >
> > @@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char
> > *envp[])
> >  }
> >
> >  OPENVPN_EXPORT int
> > -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
> > const char *argv[], const char *envp[])
> > +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
> > const char *argv[], const char *envp[],
> > +                       void *per_client_context, struct
> > openvpn_plugin_string_list **return_list)
> >  {
> >      struct plugin_context *context = (struct plugin_context *) handle;
> >
> > diff --git a/sample/sample-plugins/simple/simple.c
> > b/sample/sample-plugins/simple/simple.c
> > index
> > 950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb0a4d4fa62162
> 7a6099ba76
> > 100644
> > --- a/sample/sample-plugins/simple/simple.c
> > +++ b/sample/sample-plugins/simple/simple.c
> > @@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])
> >  }
> >
> >  OPENVPN_EXPORT openvpn_plugin_handle_t
> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[])
> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
> const
> > char *envp[],
> > +                       struct openvpn_plugin_string_list **return_list)
> >  {
> >      struct plugin_context *context;
> >
> > @@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const
> > char *argv[], const char *
> >  }
> >
> >  OPENVPN_EXPORT int
> > -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
> > const char *argv[], const char *envp[])
> > +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
> > const char *argv[], const char *envp[],
> > +                       void *per_client_context, struct
> > openvpn_plugin_string_list **return_list)
> >  {
> >      struct plugin_context *context = (struct plugin_context *) handle;
> >
> > diff --git a/sample/sample-plugins/simple/simple.def
> > b/sample/sample-plugins/simple/simple.def
> > index
> > a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae
> 9898be221a
> > 100755
> > --- a/sample/sample-plugins/simple/simple.def
> > +++ b/sample/sample-plugins/simple/simple.def
> > @@ -1,6 +1,6 @@
> >  LIBRARY   OpenVPN_PLUGIN_SAMPLE
> >  DESCRIPTION "Sample OpenVPN plug-in module."
> >  EXPORTS
> > -   openvpn_plugin_open_v1   @1
> > -   openvpn_plugin_func_v1   @2
> > +   openvpn_plugin_open_v2   @1
> > +   openvpn_plugin_func_v2   @2
> >     openvpn_plugin_close_v1  @3
> > --
> > 2.15.2 (Apple Git-101.1)
>
> did you concatenate two patches? or what happened? It seems that the
> part after this is not recognised as proper patch.
>
>
> Cheers,
>
>
> --
> Antonio Quartulli
>
>
<br><br>Minggu, 01 Juli 2018, Antonio Quartulli &lt;a@unstable.cc&gt; menulis:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On 01/07/18 00:58, Greg Cox wrote:<br>
&gt; While writing up a plugin, I found that the sample plugin code was using<br>
&gt; openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are listed<br>
&gt; as &#39;deprecated&#39; in openvpn-plugin.h, it made sense to me that you shouldn&#39;t<br>
&gt; list those functions as sample code for others to clone.<br>
&gt; <br>
&gt; This edits only sample code and since it&#39;s my first patch I thought I&#39;d<br>
&gt; limit to that.  src/plugins/auth-pam and src/plugins/down-root have similar<br>
&gt; &#39;issues&#39;, though, and may need the same treatment, if I have the right idea.<br>
&gt; <br>
&gt; Thanks for reading.<br>
&gt; -Greg<br>
&gt; <br>
<br>
I&#39;d remove the last paragraph and the greetings from the commit message.<br>
But this might be done at commit time.<br>
<br>
&gt; ---<br>
&gt;  sample/sample-plugins/defer/<wbr>simple.c    | 5 +++--<br>
&gt;  sample/sample-plugins/defer/<wbr>simple.def  | 4 ++--<br>
&gt;  sample/sample-plugins/log/log.<wbr>c         | 6 ++++--<br>
&gt;  sample/sample-plugins/simple/<wbr>simple.c   | 6 ++++--<br>
&gt;  sample/sample-plugins/simple/<wbr>simple.def | 4 ++--<br>
&gt;  5 files changed, 15 insertions(+), 10 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; b/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; index<br>
&gt; d18695b59d6966e5cc84a19e176ea9<wbr>ec18d0b452..<wbr>d55e47be01aa346cfc9c70aa24f872<wbr>2e5a1d67f9<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; +++ b/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; @@ -131,11 +131,12 @@ atoi_null0(const char *str)<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; -    printf(&quot;FUNC: openvpn_plugin_open_v1\n&quot;);<br>
&gt; +    printf(&quot;FUNC: openvpn_plugin_open_v2\n&quot;);<br>
&gt; <br>
&gt;      /*<br>
&gt;       * Allocate our context<br>
&gt; diff --git a/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; b/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; index<br>
&gt; a87507d1fdc0f0bfd0434de577a818<wbr>ef0cc62afb..<wbr>556f362308bc6ce81829253f7a7fae<wbr>9898be221a<br>
&gt; 100755<br>
&gt; --- a/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; +++ b/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; @@ -1,6 +1,6 @@<br>
&gt;  LIBRARY   OpenVPN_PLUGIN_SAMPLE<br>
&gt;  DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br>
&gt;  EXPORTS<br>
&gt; -   openvpn_plugin_open_v1   @1<br>
&gt; -   openvpn_plugin_func_v1   @2<br>
&gt; +   openvpn_plugin_open_v2   @1<br>
&gt; +   openvpn_plugin_func_v2   @2<br>
&gt;     openvpn_plugin_close_v1  @3<br>
&gt; diff --git a/sample/sample-plugins/log/<wbr>log.c<br>
&gt; b/sample/sample-plugins/log/<wbr>log.c<br>
&gt; index<br>
&gt; ecf62c0e653c8ec852ab641e753637<wbr>47b795c1af..<wbr>efa8e5184db34f36a311fb61436cdf<wbr>d61dd02f78<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/log/<wbr>log.c<br>
&gt; +++ b/sample/sample-plugins/log/<wbr>log.c<br>
&gt; @@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; @@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char<br>
&gt; *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT int<br>
&gt; -openvpn_plugin_func_v1(<wbr>openvpn_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[])<br>
&gt; +openvpn_plugin_func_v2(<wbr>openvpn_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[],<br>
&gt; +                       void *per_client_context, struct<br>
&gt; openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context = (struct plugin_context *) handle;<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/<wbr>simple/simple.c<br>
&gt; b/sample/sample-plugins/<wbr>simple/simple.c<br>
&gt; index<br>
&gt; 950c547e22c1d44c59812eb90606fb<wbr>db52981021..<wbr>66695950abfcbc6ebb0a4d4fa62162<wbr>7a6099ba76<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/<wbr>simple/simple.c<br>
&gt; +++ b/sample/sample-plugins/<wbr>simple/simple.c<br>
&gt; @@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(<wbr>unsigned int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; @@ -97,7 +98,8 @@ openvpn_plugin_open_v1(<wbr>unsigned int *type_mask, const<br>
&gt; char *argv[], const char *<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT int<br>
&gt; -openvpn_plugin_func_v1(<wbr>openvpn_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[])<br>
&gt; +openvpn_plugin_func_v2(<wbr>openvpn_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[],<br>
&gt; +                       void *per_client_context, struct<br>
&gt; openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context = (struct plugin_context *) handle;<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/<wbr>simple/simple.def<br>
&gt; b/sample/sample-plugins/<wbr>simple/simple.def<br>
&gt; index<br>
&gt; a87507d1fdc0f0bfd0434de577a818<wbr>ef0cc62afb..<wbr>556f362308bc6ce81829253f7a7fae<wbr>9898be221a<br>
&gt; 100755<br>
&gt; --- a/sample/sample-plugins/<wbr>simple/simple.def<br>
&gt; +++ b/sample/sample-plugins/<wbr>simple/simple.def<br>
&gt; @@ -1,6 +1,6 @@<br>
&gt;  LIBRARY   OpenVPN_PLUGIN_SAMPLE<br>
&gt;  DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br>
&gt;  EXPORTS<br>
&gt; -   openvpn_plugin_open_v1   @1<br>
&gt; -   openvpn_plugin_func_v1   @2<br>
&gt; +   openvpn_plugin_open_v2   @1<br>
&gt; +   openvpn_plugin_func_v2   @2<br>
&gt;     openvpn_plugin_close_v1  @3<br>
&gt; --<br>
&gt; 2.15.2 (Apple Git-101.1)<br>
<br>
did you concatenate two patches? or what happened? It seems that the<br>
part after this is not recognised as proper patch.<br>
<br>
<br>
Cheers,<br>
<br>
<br>
-- <br>
Antonio Quartulli<br>
<br>
</blockquote>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Yovie Ramadhan June 30, 2018, 10:56 p.m. | #5
Minggu, 01 Juli 2018, Yovie Ramadhan <ramadhanyovie99@gmail.com> menulis:

>
>
> Minggu, 01 Juli 2018, Antonio Quartulli <a@unstable.cc> menulis:
>
>> Hi,
>>
>> On 01/07/18 00:58, Greg Cox wrote:
>> > While writing up a plugin, I found that the sample plugin code was using
>> > openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are
>> listed
>> > as 'deprecated' in openvpn-plugin.h, it made sense to me that you
>> shouldn't
>> > list those functions as sample code for others to clone.
>> >
>> > This edits only sample code and since it's my first patch I thought I'd
>> > limit to that.  src/plugins/auth-pam and src/plugins/down-root have
>> similar
>> > 'issues', though, and may need the same treatment, if I have the right
>> idea.
>> >
>> > Thanks for reading.
>> > -Greg
>> >
>>
>> I'd remove the last paragraph and the greetings from the commit message.
>> But this might be done at commit time.
>>
>> > ---
>> >  sample/sample-plugins/defer/simple.c    | 5 +++--
>> >  sample/sample-plugins/defer/simple.def  | 4 ++--
>> >  sample/sample-plugins/log/log.c         | 6 ++++--
>> >  sample/sample-plugins/simple/simple.c   | 6 ++++--
>> >  sample/sample-plugins/simple/simple.def | 4 ++--
>> >  5 files changed, 15 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/sample/sample-plugins/defer/simple.c
>> > b/sample/sample-plugins/defer/simple.c
>> > index
>> > d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc
>> 9c70aa24f8722e5a1d67f9
>> > 100644
>> > --- a/sample/sample-plugins/defer/simple.c
>> > +++ b/sample/sample-plugins/defer/simple.c
>> > @@ -131,11 +131,12 @@ atoi_null0(const char *str)
>> >  }
>> >
>> >  OPENVPN_EXPORT openvpn_plugin_handle_t
>> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[])
>> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[],
>> > +                       struct openvpn_plugin_string_list **return_list)
>> >  {
>> >      struct plugin_context *context;
>> >
>> > -    printf("FUNC: openvpn_plugin_open_v1\n");
>> > +    printf("FUNC: openvpn_plugin_open_v2\n");
>> >
>> >      /*
>> >       * Allocate our context
>> > diff --git a/sample/sample-plugins/defer/simple.def
>> > b/sample/sample-plugins/defer/simple.def
>> > index
>> > a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce818
>> 29253f7a7fae9898be221a
>> > 100755
>> > --- a/sample/sample-plugins/defer/simple.def
>> > +++ b/sample/sample-plugins/defer/simple.def
>> > @@ -1,6 +1,6 @@
>> >  LIBRARY   OpenVPN_PLUGIN_SAMPLE
>> >  DESCRIPTION "Sample OpenVPN plug-in module."
>> >  EXPORTS
>> > -   openvpn_plugin_open_v1   @1
>> > -   openvpn_plugin_func_v1   @2
>> > +   openvpn_plugin_open_v2   @1
>> > +   openvpn_plugin_func_v2   @2
>> >     openvpn_plugin_close_v1  @3
>> > diff --git a/sample/sample-plugins/log/log.c
>> > b/sample/sample-plugins/log/log.c
>> > index
>> > ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a3
>> 11fb61436cdfd61dd02f78
>> > 100644
>> > --- a/sample/sample-plugins/log/log.c
>> > +++ b/sample/sample-plugins/log/log.c
>> > @@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])
>> >  }
>> >
>> >  OPENVPN_EXPORT openvpn_plugin_handle_t
>> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[])
>> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[],
>> > +                       struct openvpn_plugin_string_list **return_list)
>> >  {
>> >      struct plugin_context *context;
>> >
>> > @@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char
>> > *envp[])
>> >  }
>> >
>> >  OPENVPN_EXPORT int
>> > -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
>> > const char *argv[], const char *envp[])
>> > +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
>> > const char *argv[], const char *envp[],
>> > +                       void *per_client_context, struct
>> > openvpn_plugin_string_list **return_list)
>> >  {
>> >      struct plugin_context *context = (struct plugin_context *) handle;
>> >
>> > diff --git a/sample/sample-plugins/simple/simple.c
>> > b/sample/sample-plugins/simple/simple.c
>> > index
>> > 950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb
>> 0a4d4fa621627a6099ba76
>> > 100644
>> > --- a/sample/sample-plugins/simple/simple.c
>> > +++ b/sample/sample-plugins/simple/simple.c
>> > @@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])
>> >  }
>> >
>> >  OPENVPN_EXPORT openvpn_plugin_handle_t
>> > -openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[])
>> > +openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[],
>> const
>> > char *envp[],
>> > +                       struct openvpn_plugin_string_list **return_list)
>> >  {
>> >      struct plugin_context *context;
>> >
>> > @@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const
>> > char *argv[], const char *
>> >  }
>> >
>> >  OPENVPN_EXPORT int
>> > -openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
>> > const char *argv[], const char *envp[])
>> > +openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
>> > const char *argv[], const char *envp[],
>> > +                       void *per_client_context, struct
>> > openvpn_plugin_string_list **return_list)
>> >  {
>> >      struct plugin_context *context = (struct plugin_context *) handle;
>> >
>> > diff --git a/sample/sample-plugins/simple/simple.def
>> > b/sample/sample-plugins/simple/simple.def
>> > index
>> > a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce818
>> 29253f7a7fae9898be221a
>> > 100755
>> > --- a/sample/sample-plugins/simple/simple.def
>> > +++ b/sample/sample-plugins/simple/simple.def
>> > @@ -1,6 +1,6 @@
>> >  LIBRARY   OpenVPN_PLUGIN_SAMPLE
>> >  DESCRIPTION "Sample OpenVPN plug-in module."
>> >  EXPORTS
>> > -   openvpn_plugin_open_v1   @1
>> > -   openvpn_plugin_func_v1   @2
>> > +   openvpn_plugin_open_v2   @1
>> > +   openvpn_plugin_func_v2   @2
>> >     openvpn_plugin_close_v1  @3
>> > --
>> > 2.15.2 (Apple Git-101.1)
>>
>> did you concatenate two patches? or what happened? It seems that the
>> part after this is not recognised as proper patch.
>>
>>
>> Cheers,
>>
>>
>> --
>> Antonio Quartulli
>>
>>
<br><br>Minggu, 01 Juli 2018, Yovie Ramadhan &lt;<a href="mailto:ramadhanyovie99@gmail.com">ramadhanyovie99@gmail.com</a>&gt; menulis:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br>Minggu, 01 Juli 2018, Antonio Quartulli &lt;a@unstable.cc&gt; menulis:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On 01/07/18 00:58, Greg Cox wrote:<br>
&gt; While writing up a plugin, I found that the sample plugin code was using<br>
&gt; openvpn_plugin_open_v1.  Since that and openvpn_plugin_func_v1 are listed<br>
&gt; as &#39;deprecated&#39; in openvpn-plugin.h, it made sense to me that you shouldn&#39;t<br>
&gt; list those functions as sample code for others to clone.<br>
&gt; <br>
&gt; This edits only sample code and since it&#39;s my first patch I thought I&#39;d<br>
&gt; limit to that.  src/plugins/auth-pam and src/plugins/down-root have similar<br>
&gt; &#39;issues&#39;, though, and may need the same treatment, if I have the right idea.<br>
&gt; <br>
&gt; Thanks for reading.<br>
&gt; -Greg<br>
&gt; <br>
<br>
I&#39;d remove the last paragraph and the greetings from the commit message.<br>
But this might be done at commit time.<br>
<br>
&gt; ---<br>
&gt;  sample/sample-plugins/defer/si<wbr>mple.c    | 5 +++--<br>
&gt;  sample/sample-plugins/defer/si<wbr>mple.def  | 4 ++--<br>
&gt;  sample/sample-plugins/log/log.<wbr>c         | 6 ++++--<br>
&gt;  sample/sample-plugins/simple/s<wbr>imple.c   | 6 ++++--<br>
&gt;  sample/sample-plugins/simple/s<wbr>imple.def | 4 ++--<br>
&gt;  5 files changed, 15 insertions(+), 10 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; b/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; index<br>
&gt; d18695b59d6966e5cc84a19e176ea9<wbr>ec18d0b452..d55e47be01aa346cfc<wbr>9c70aa24f8722e5a1d67f9<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; +++ b/sample/sample-plugins/defer/<wbr>simple.c<br>
&gt; @@ -131,11 +131,12 @@ atoi_null0(const char *str)<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; -    printf(&quot;FUNC: openvpn_plugin_open_v1\n&quot;);<br>
&gt; +    printf(&quot;FUNC: openvpn_plugin_open_v2\n&quot;);<br>
&gt; <br>
&gt;      /*<br>
&gt;       * Allocate our context<br>
&gt; diff --git a/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; b/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; index<br>
&gt; a87507d1fdc0f0bfd0434de577a818<wbr>ef0cc62afb..556f362308bc6ce818<wbr>29253f7a7fae9898be221a<br>
&gt; 100755<br>
&gt; --- a/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; +++ b/sample/sample-plugins/defer/<wbr>simple.def<br>
&gt; @@ -1,6 +1,6 @@<br>
&gt;  LIBRARY   OpenVPN_PLUGIN_SAMPLE<br>
&gt;  DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br>
&gt;  EXPORTS<br>
&gt; -   openvpn_plugin_open_v1   @1<br>
&gt; -   openvpn_plugin_func_v1   @2<br>
&gt; +   openvpn_plugin_open_v2   @1<br>
&gt; +   openvpn_plugin_func_v2   @2<br>
&gt;     openvpn_plugin_close_v1  @3<br>
&gt; diff --git a/sample/sample-plugins/log/lo<wbr>g.c<br>
&gt; b/sample/sample-plugins/log/lo<wbr>g.c<br>
&gt; index<br>
&gt; ecf62c0e653c8ec852ab641e753637<wbr>47b795c1af..efa8e5184db34f36a3<wbr>11fb61436cdfd61dd02f78<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/log/lo<wbr>g.c<br>
&gt; +++ b/sample/sample-plugins/log/lo<wbr>g.c<br>
&gt; @@ -70,7 +70,8 @@ get_env(const char *name, const char *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; @@ -164,7 +165,8 @@ show(const int type, const char *argv[], const char<br>
&gt; *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT int<br>
&gt; -openvpn_plugin_func_v1(openvp<wbr>n_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[])<br>
&gt; +openvpn_plugin_func_v2(openvp<wbr>n_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[],<br>
&gt; +                       void *per_client_context, struct<br>
&gt; openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context = (struct plugin_context *) handle;<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/simple<wbr>/simple.c<br>
&gt; b/sample/sample-plugins/simple<wbr>/simple.c<br>
&gt; index<br>
&gt; 950c547e22c1d44c59812eb90606fb<wbr>db52981021..66695950abfcbc6ebb<wbr>0a4d4fa621627a6099ba76<br>
&gt; 100644<br>
&gt; --- a/sample/sample-plugins/simple<wbr>/simple.c<br>
&gt; +++ b/sample/sample-plugins/simple<wbr>/simple.c<br>
&gt; @@ -72,7 +72,8 @@ get_env(const char *name, const char *envp[])<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT openvpn_plugin_handle_t<br>
&gt; -openvpn_plugin_open_v1(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[])<br>
&gt; +openvpn_plugin_open_v2(unsign<wbr>ed int *type_mask, const char *argv[], const<br>
&gt; char *envp[],<br>
&gt; +                       struct openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context;<br>
&gt; <br>
&gt; @@ -97,7 +98,8 @@ openvpn_plugin_open_v1(unsigne<wbr>d int *type_mask, const<br>
&gt; char *argv[], const char *<br>
&gt;  }<br>
&gt; <br>
&gt;  OPENVPN_EXPORT int<br>
&gt; -openvpn_plugin_func_v1(openvp<wbr>n_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[])<br>
&gt; +openvpn_plugin_func_v2(openvp<wbr>n_plugin_handle_t handle, const int type,<br>
&gt; const char *argv[], const char *envp[],<br>
&gt; +                       void *per_client_context, struct<br>
&gt; openvpn_plugin_string_list **return_list)<br>
&gt;  {<br>
&gt;      struct plugin_context *context = (struct plugin_context *) handle;<br>
&gt; <br>
&gt; diff --git a/sample/sample-plugins/simple<wbr>/simple.def<br>
&gt; b/sample/sample-plugins/simple<wbr>/simple.def<br>
&gt; index<br>
&gt; a87507d1fdc0f0bfd0434de577a818<wbr>ef0cc62afb..556f362308bc6ce818<wbr>29253f7a7fae9898be221a<br>
&gt; 100755<br>
&gt; --- a/sample/sample-plugins/simple<wbr>/simple.def<br>
&gt; +++ b/sample/sample-plugins/simple<wbr>/simple.def<br>
&gt; @@ -1,6 +1,6 @@<br>
&gt;  LIBRARY   OpenVPN_PLUGIN_SAMPLE<br>
&gt;  DESCRIPTION &quot;Sample OpenVPN plug-in module.&quot;<br>
&gt;  EXPORTS<br>
&gt; -   openvpn_plugin_open_v1   @1<br>
&gt; -   openvpn_plugin_func_v1   @2<br>
&gt; +   openvpn_plugin_open_v2   @1<br>
&gt; +   openvpn_plugin_func_v2   @2<br>
&gt;     openvpn_plugin_close_v1  @3<br>
&gt; --<br>
&gt; 2.15.2 (Apple Git-101.1)<br>
<br>
did you concatenate two patches? or what happened? It seems that the<br>
part after this is not recognised as proper patch.<br>
<br>
<br>
Cheers,<br>
<br>
<br>
-- <br>
Antonio Quartulli<br>
<br>
</blockquote>
</blockquote>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Antonio Quartulli July 1, 2018, 4:56 a.m. | #6
On 01/07/18 05:08, Greg Cox wrote:
> On Sat, Jun 30, 2018 at 5:49 PM, Antonio Quartulli <a@unstable.cc> wrote:
> 
>> I'd remove the last paragraph and the greetings from the commit message.
>> But this might be done at commit time.
>>
> 
> ​It was unclear how to handle "explain what I'm wanting" in one mail.
> Sorry.
> ​

When creating a patch with "git-format-patch" there are three dashes at
the end of the commit message ("---") - anything you write after that
will be dropped when merging the patch, thus that's where you can write
what you want to explain :)

> 
>> did you concatenate two patches? or what happened? It seems that the
>> part after this is not recognised as proper patch.
>>
> 
> I think I dropped a few lines from `git format-patch HEAD~1 --stdout`​ on
> accident.  Take two:
> 

Thanks. Normally "git format-patch" + "git send-email" take care of all
the details for you (without --stdout, but by just using the produced
file), so to ensure that the patch lands properly formatted.


You can try next time :)

Cheers,

Patch

diff --git a/sample/sample-plugins/defer/simple.c
b/sample/sample-plugins/defer/simple.c
index
d18695b59d6966e5cc84a19e176ea9ec18d0b452..d55e47be01aa346cfc9c70aa24f8722e5a1d67f9
100644
--- a/sample/sample-plugins/defer/simple.c
+++ b/sample/sample-plugins/defer/simple.c
@@ -131,11 +131,12 @@  atoi_null0(const char *str)
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

-    printf("FUNC: openvpn_plugin_open_v1\n");
+    printf("FUNC: openvpn_plugin_open_v2\n");

     /*
      * Allocate our context
diff --git a/sample/sample-plugins/defer/simple.def
b/sample/sample-plugins/defer/simple.def
index
a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
100755
--- a/sample/sample-plugins/defer/simple.def
+++ b/sample/sample-plugins/defer/simple.def
@@ -1,6 +1,6 @@ 
 LIBRARY   OpenVPN_PLUGIN_SAMPLE
 DESCRIPTION "Sample OpenVPN plug-in module."
 EXPORTS
-   openvpn_plugin_open_v1   @1
-   openvpn_plugin_func_v1   @2
+   openvpn_plugin_open_v2   @1
+   openvpn_plugin_func_v2   @2
    openvpn_plugin_close_v1  @3
diff --git a/sample/sample-plugins/log/log.c
b/sample/sample-plugins/log/log.c
index
ecf62c0e653c8ec852ab641e75363747b795c1af..efa8e5184db34f36a311fb61436cdfd61dd02f78
100644
--- a/sample/sample-plugins/log/log.c
+++ b/sample/sample-plugins/log/log.c
@@ -70,7 +70,8 @@  get_env(const char *name, const char *envp[])
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

@@ -164,7 +165,8 @@  show(const int type, const char *argv[], const char
*envp[])
 }

 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[])
+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[],
+                       void *per_client_context, struct
openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context = (struct plugin_context *) handle;

diff --git a/sample/sample-plugins/simple/simple.c
b/sample/sample-plugins/simple/simple.c
index
950c547e22c1d44c59812eb90606fbdb52981021..66695950abfcbc6ebb0a4d4fa621627a6099ba76
100644
--- a/sample/sample-plugins/simple/simple.c
+++ b/sample/sample-plugins/simple/simple.c
@@ -72,7 +72,8 @@  get_env(const char *name, const char *envp[])
 }

 OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const
char *envp[])
+openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const
char *envp[],
+                       struct openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context;

@@ -97,7 +98,8 @@  openvpn_plugin_open_v1(unsigned int *type_mask, const
char *argv[], const char *
 }

 OPENVPN_EXPORT int
-openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[])
+openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type,
const char *argv[], const char *envp[],
+                       void *per_client_context, struct
openvpn_plugin_string_list **return_list)
 {
     struct plugin_context *context = (struct plugin_context *) handle;

diff --git a/sample/sample-plugins/simple/simple.def
b/sample/sample-plugins/simple/simple.def
index
a87507d1fdc0f0bfd0434de577a818ef0cc62afb..556f362308bc6ce81829253f7a7fae9898be221a
100755
--- a/sample/sample-plugins/simple/simple.def
+++ b/sample/sample-plugins/simple/simple.def
@@ -1,6 +1,6 @@ 
 LIBRARY   OpenVPN_PLUGIN_SAMPLE
 DESCRIPTION "Sample OpenVPN plug-in module."
 EXPORTS
-   openvpn_plugin_open_v1   @1
-   openvpn_plugin_func_v1   @2
+   openvpn_plugin_open_v2   @1
+   openvpn_plugin_func_v2   @2
    openvpn_plugin_close_v1  @3