Ticket #268: 8225.patch
File 8225.patch, 4.1 KB (added by , 12 years ago) |
---|
-
version.m4
From: James Yonan <james@openvpn.net> Date: mar, 25 set 2012 02:05:41 +0300 Subject: [PATCH] On the client, allow certain peer info fields to be pushed even if push-peer-info isn't specified in the config. This is needed to allow the compression handshake to work correctly (i.e. where the client indicates its support for LZO and/or Snappy). Fields that have privacy implications such as Mac Address and UV_ * fields will not be pushed to the server as before unless push-peer-info is specified by client config. Version 2.1.21c ---
a b 1 1 dnl define the OpenVPN version 2 define(PRODUCT_VERSION,[2.1.21 b])2 define(PRODUCT_VERSION,[2.1.21c]) 3 3 dnl define the TAP version 4 4 define(PRODUCT_TAP_ID,[tap0901]) 5 5 define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9]) -
ssl.c
a b 3907 3907 bool ret = false; 3908 3908 3909 3909 #ifdef ENABLE_PUSH_PEER_INFO 3910 if (session->opt->push_peer_info) /* write peer info */ 3911 { 3912 struct env_set *es = session->opt->es; 3913 struct env_item *e; 3914 struct buffer out = alloc_buf_gc (512*3, &gc); 3910 { 3911 struct env_set *es = session->opt->es; 3912 struct env_item *e; 3913 struct buffer out = alloc_buf_gc (512*3, &gc); 3915 3914 3916 3917 3915 /* push version */ 3916 buf_printf (&out, "IV_VER=%s\n", PACKAGE_VERSION); 3918 3917 3919 3918 /* push platform */ 3920 3919 #if defined(TARGET_LINUX) 3921 3920 buf_printf (&out, "IV_PLAT=linux\n"); 3922 3921 #elif defined(TARGET_SOLARIS) 3923 3922 buf_printf (&out, "IV_PLAT=solaris\n"); 3924 3923 #elif defined(TARGET_OPENBSD) 3925 3924 buf_printf (&out, "IV_PLAT=openbsd\n"); 3926 3925 #elif defined(TARGET_DARWIN) 3927 3926 buf_printf (&out, "IV_PLAT=mac\n"); 3928 3927 #elif defined(TARGET_NETBSD) 3929 3928 buf_printf (&out, "IV_PLAT=netbsd\n"); 3930 3929 #elif defined(TARGET_FREEBSD) 3931 3930 buf_printf (&out, "IV_PLAT=freebsd\n"); 3932 3931 #elif defined(WIN32) 3933 3932 buf_printf (&out, "IV_PLAT=win\n"); 3934 3933 #endif 3935 3934 3936 /* push mac addr */ 3937 { 3938 struct route_gateway_info rgi; 3939 get_default_gateway (&rgi); 3940 if (rgi.flags & RGI_HWADDR_DEFINED) 3941 buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (rgi.hwaddr, 6, 0, 1, ":", &gc)); 3942 } 3943 3944 /* push compression status */ 3935 /* push compression status */ 3945 3936 #ifdef USE_COMP 3946 3937 comp_generate_peer_info_string(&session->opt->comp_options, &out); 3947 3938 #endif 3948 3939 3949 /* push env vars that begin with UV_ */ 3950 for (e=es->list; e != NULL; e=e->next) 3940 if (session->opt->push_peer_info) 3941 { 3942 /* push mac addr */ 3951 3943 { 3952 if (e->string) 3953 { 3954 if (!strncmp(e->string, "UV_", 3) && buf_safe(&out, strlen(e->string)+1)) 3955 buf_printf (&out, "%s\n", e->string); 3956 } 3944 struct route_gateway_info rgi; 3945 get_default_gateway (&rgi); 3946 if (rgi.flags & RGI_HWADDR_DEFINED) 3947 buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (rgi.hwaddr, 6, 0, 1, ":", &gc)); 3957 3948 } 3958 3949 3959 if (!write_string(buf, BSTR(&out), -1)) 3960 goto error; 3961 } 3962 else 3950 /* push env vars that begin with UV_ */ 3951 for (e=es->list; e != NULL; e=e->next) 3952 { 3953 if (e->string) 3954 { 3955 if (!strncmp(e->string, "UV_", 3) && buf_safe(&out, strlen(e->string)+1)) 3956 buf_printf (&out, "%s\n", e->string); 3957 } 3958 } 3959 } 3960 3961 if (!write_string(buf, BSTR(&out), -1)) 3962 goto error; 3963 } 3964 #else 3965 { 3966 if (!write_empty_string (buf)) /* no peer info */ 3967 goto error; 3968 } 3963 3969 #endif 3964 {3965 if (!write_empty_string (buf)) /* no peer info */3966 goto error;3967 }3968 3970 ret = true; 3969 3971 3970 3972 error: