In management interface, added new ">CLIENT:ESTABLISHED" notification.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3763 e7ae566f-a301-0410-adde-c780ea21d3b5
... | ... |
@@ -2115,9 +2115,13 @@ management_notify_client_needing_auth (struct management *management, |
2115 | 2115 |
|
2116 | 2116 |
void |
2117 | 2117 |
management_connection_established (struct management *management, |
2118 |
- struct man_def_auth_context *mdac) |
|
2118 |
+ struct man_def_auth_context *mdac, |
|
2119 |
+ const struct env_set *es) |
|
2119 | 2120 |
{ |
2120 | 2121 |
mdac->flags |= DAF_CONNECTION_ESTABLISHED; |
2122 |
+ msg (M_CLIENT, ">CLIENT:ESTABLISHED,%lu", mdac->cid); |
|
2123 |
+ man_output_extra_env (management); |
|
2124 |
+ man_output_env (es, true); |
|
2121 | 2125 |
} |
2122 | 2126 |
|
2123 | 2127 |
void |
... | ... |
@@ -355,7 +355,8 @@ void management_notify_client_needing_auth (struct management *management, |
355 | 355 |
const struct env_set *es); |
356 | 356 |
|
357 | 357 |
void management_connection_established (struct management *management, |
358 |
- struct man_def_auth_context *mdac); |
|
358 |
+ struct man_def_auth_context *mdac, |
|
359 |
+ const struct env_set *es); |
|
359 | 360 |
|
360 | 361 |
void management_notify_client_close (struct management *management, |
361 | 362 |
struct man_def_auth_context *mdac, |
... | ... |
@@ -770,7 +770,16 @@ CLIENT notification types: |
770 | 770 |
>CLIENT:ENV,... |
771 | 771 |
>CLIENT:ENV,END |
772 | 772 |
|
773 |
-(2) Notify existing client disconnection. The environmental variables passed |
|
773 |
+(2) Notify successful client authentication and session initiation. |
|
774 |
+ Called after CONNECT. |
|
775 |
+ |
|
776 |
+ >CLIENT:ESTABLISHED,{CID} |
|
777 |
+ >CLIENT:ENV,name1=val1 |
|
778 |
+ >CLIENT:ENV,name2=val2 |
|
779 |
+ >CLIENT:ENV,... |
|
780 |
+ >CLIENT:ENV,END |
|
781 |
+ |
|
782 |
+(3) Notify existing client disconnection. The environmental variables passed |
|
774 | 783 |
are equivalent to those that would be passed to a --client-disconnect |
775 | 784 |
script. |
776 | 785 |
|
... | ... |
@@ -780,7 +789,7 @@ CLIENT notification types: |
780 | 780 |
>CLIENT:ENV,... |
781 | 781 |
>CLIENT:ENV,END |
782 | 782 |
|
783 |
-(3) Notify that a particular virtual address or subnet |
|
783 |
+(4) Notify that a particular virtual address or subnet |
|
784 | 784 |
is now associated with a specific client. |
785 | 785 |
|
786 | 786 |
>CLIENT:ADDRESS,{CID},{ADDR},{PRI} |
... | ... |
@@ -1698,7 +1698,7 @@ multi_connection_established (struct multi_context *m, struct multi_instance *mi |
1698 | 1698 |
|
1699 | 1699 |
#ifdef MANAGEMENT_DEF_AUTH |
1700 | 1700 |
if (management) |
1701 |
- management_connection_established (management, &mi->context.c2.mda_context); |
|
1701 |
+ management_connection_established (management, &mi->context.c2.mda_context, mi->context.c2.es); |
|
1702 | 1702 |
#endif |
1703 | 1703 |
|
1704 | 1704 |
gc_free (&gc); |
... | ... |
@@ -795,6 +795,8 @@ setenv_settings (struct env_set *es, const struct options *o) |
795 | 795 |
setenv_int (es, "verb", o->verbosity); |
796 | 796 |
setenv_int (es, "daemon", o->daemon); |
797 | 797 |
setenv_int (es, "daemon_log_redirect", o->log); |
798 |
+ setenv_unsigned (es, "daemon_start_time", time(NULL)); |
|
799 |
+ setenv_int (es, "daemon_pid", openvpn_getpid()); |
|
798 | 800 |
|
799 | 801 |
#ifdef ENABLE_CONNECTION |
800 | 802 |
if (o->connection_list) |