From ec2008e9e53b99ba1725d8398e21b9cb04f6b8ca Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 2 Jun 2012 15:45:11 +0200 Subject: bring openvpn in sync with openvpn git master and patches submitted to mailing list --- openvpn/src/compat/compat.vcxproj | 172 ++-- openvpn/src/compat/compat.vcxproj.filters | 82 +- openvpn/src/openvpn/console.c | 3 +- openvpn/src/openvpn/error.c | 66 +- openvpn/src/openvpn/event.c | 4 - openvpn/src/openvpn/init.c | 25 +- openvpn/src/openvpn/manage.c | 175 ++-- openvpn/src/openvpn/manage.h | 3 +- openvpn/src/openvpn/misc.c | 2 +- openvpn/src/openvpn/openvpn.vcxproj | 520 ++++++------ openvpn/src/openvpn/openvpn.vcxproj.filters | 914 ++++++++++----------- openvpn/src/openvpn/options.c | 48 +- openvpn/src/openvpn/options.h | 5 +- openvpn/src/openvpn/socket.c | 10 +- openvpn/src/openvpn/syshead.h | 1 + openvpn/src/openvpn/tun.c | 4 +- openvpn/src/openvpn/tun.h | 3 - openvpn/src/openvpnserv/openvpnserv.vcxproj | 222 ++--- .../src/openvpnserv/openvpnserv.vcxproj.filters | 68 +- 19 files changed, 1149 insertions(+), 1178 deletions(-) (limited to 'openvpn/src') diff --git a/openvpn/src/compat/compat.vcxproj b/openvpn/src/compat/compat.vcxproj index 42979c11..d872fa75 100644 --- a/openvpn/src/compat/compat.vcxproj +++ b/openvpn/src/compat/compat.vcxproj @@ -1,87 +1,87 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {4B2E2719-E661-45D7-9203-F6F456B22F19} - compat - Win32Proj - - - - StaticLibrary - MultiByte - true - - - StaticLibrary - MultiByte - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - - - - Disabled - $(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - - - MaxSpeed - true - $(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {4B2E2719-E661-45D7-9203-F6F456B22F19} + compat + Win32Proj + + + + StaticLibrary + MultiByte + true + + + StaticLibrary + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + + + + Disabled + $(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + + + MaxSpeed + true + $(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openvpn/src/compat/compat.vcxproj.filters b/openvpn/src/compat/compat.vcxproj.filters index 00bb0ffa..9576c512 100644 --- a/openvpn/src/compat/compat.vcxproj.filters +++ b/openvpn/src/compat/compat.vcxproj.filters @@ -1,42 +1,42 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + \ No newline at end of file diff --git a/openvpn/src/openvpn/console.c b/openvpn/src/openvpn/console.c index 35372df7..afda8ca3 100644 --- a/openvpn/src/openvpn/console.c +++ b/openvpn/src/openvpn/console.c @@ -232,8 +232,7 @@ get_console_input (const char *prompt, const bool echo, char *input, const int c } } #else - msg (M_ERR, "Requiring input from console: %s", prompt); - msg (M_FATAL, "Sorry, but I can't get console input on this OS"); + msg (M_FATAL, "Sorry, but I can't get console input on this OS (%s)", prompt); #endif return ret; } diff --git a/openvpn/src/openvpn/error.c b/openvpn/src/openvpn/error.c index e2e24b1e..d6ad6393 100644 --- a/openvpn/src/openvpn/error.c +++ b/openvpn/src/openvpn/error.c @@ -308,46 +308,46 @@ void x_msg (const unsigned int flags, const char *format, ...) prefix, prefix_sep, m1); - virtual_output_print (vo, flags, m2); + virtual_output_print (vo, flags, m2); } } - if (!(flags & M_MSG_VIRT_OUT) ) + if (!(flags & M_MSG_VIRT_OUT)) { - if (use_syslog && !std_redir && !forked) - { + if (use_syslog && !std_redir && !forked) + { #if SYSLOG_CAPABILITY - syslog (level, "%s%s%s", - prefix, - prefix_sep, - m1); + syslog (level, "%s%s%s", + prefix, + prefix_sep, + m1); #endif - } + } else - { - FILE *fp = msg_fp(flags); - const bool show_usec = check_debug_level (DEBUG_LEVEL_USEC_TIME); - - if ((flags & M_NOPREFIX) || suppress_timestamps) - { - fprintf (fp, "%s%s%s%s", - prefix, - prefix_sep, - m1, - (flags&M_NOLF) ? "" : "\n"); - } - else - { - fprintf (fp, "%s %s%s%s%s", - time_string (0, 0, show_usec, &gc), - prefix, - prefix_sep, - m1, - (flags&M_NOLF) ? "" : "\n"); - } - fflush(fp); - ++x_msg_line_num; - } + { + FILE *fp = msg_fp(flags); + const bool show_usec = check_debug_level (DEBUG_LEVEL_USEC_TIME); + + if ((flags & M_NOPREFIX) || suppress_timestamps) + { + fprintf (fp, "%s%s%s%s", + prefix, + prefix_sep, + m1, + (flags&M_NOLF) ? "" : "\n"); + } + else + { + fprintf (fp, "%s %s%s%s%s", + time_string (0, 0, show_usec, &gc), + prefix, + prefix_sep, + m1, + (flags&M_NOLF) ? "" : "\n"); + } + fflush(fp); + ++x_msg_line_num; + } } if (flags & M_FATAL) diff --git a/openvpn/src/openvpn/event.c b/openvpn/src/openvpn/event.c index 0463d985..2a13e1cf 100644 --- a/openvpn/src/openvpn/event.c +++ b/openvpn/src/openvpn/event.c @@ -753,10 +753,6 @@ po_wait (struct event_set *es, const struct timeval *tv, struct event_set_return ++out; ++j; } - else if(pfdp->revents==0x0020) - { - openvpn_exit (OPENVPN_EXIT_STATUS_ERROR); - } else if (pfdp->revents) { msg (D_EVENT_ERRORS, "Error: poll: unknown revents=0x%04x", (unsigned int)pfdp->revents); diff --git a/openvpn/src/openvpn/init.c b/openvpn/src/openvpn/init.c index 810a0c6f..a25de5d2 100644 --- a/openvpn/src/openvpn/init.c +++ b/openvpn/src/openvpn/init.c @@ -1477,13 +1477,13 @@ do_open_tun (struct context *c) &gc); do_ifconfig (c->c1.tuntap, guess, TUN_MTU_SIZE (&c->c2.frame), c->c2.es); } - - /* possibly add routes */ - if(ifconfig_order() == ROUTE_BEFORE_TUN) { - // Ignore route_delay - do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, - c->c1.tuntap, c->plugins, c->c2.es); - } + + /* possibly add routes */ + if(ifconfig_order() == ROUTE_BEFORE_TUN) { + /* Ignore route_delay, would cause ROUTE_BEFORE_TUN to be ignored */ + do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, c->plugins, c->c2.es); + } /* open the tun device */ open_tun (c->options.dev, c->options.dev_type, c->options.dev_node, @@ -1516,11 +1516,10 @@ do_open_tun (struct context *c) c->c2.es); /* possibly add routes */ - if(ifconfig_order() == ROUTE_AFTER_TUN) { - if (!c->options.route_delay_defined) + if ((ifconfig_order() == ROUTE_AFTER_TUN) && (!c->options.route_delay_defined)) do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, c->c1.tuntap, c->plugins, c->c2.es); - } + /* * Did tun/tap driver give us an MTU? */ @@ -1724,9 +1723,8 @@ do_up (struct context *c, bool pulled_options, unsigned int option_types_found) save_pulled_options_digest (c, &c->c2.pulled_options_digest); #endif -#ifndef ROUTE_BEFORE_TUN /* if --route-delay was specified, start timer */ - if (c->options.route_delay_defined) + if ((ifconfig_order() == ROUTE_AFTER_TUN) && c->options.route_delay_defined) { event_timeout_init (&c->c2.route_wakeup, c->options.route_delay, now); event_timeout_init (&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); @@ -1734,7 +1732,6 @@ do_up (struct context *c, bool pulled_options, unsigned int option_types_found) tun_standby_init (c->c1.tuntap); } else -#endif { initialization_sequence_completed (c, 0); /* client/p2p --route-delay undefined */ } @@ -2292,10 +2289,10 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.mda_context = &c->c2.mda_context; #endif - to.tmp_dir = options->tmp_dir; #if P2MP_SERVER to.auth_user_pass_verify_script = options->auth_user_pass_verify_script; to.auth_user_pass_verify_script_via_file = options->auth_user_pass_verify_script_via_file; + to.tmp_dir = options->tmp_dir; if (options->ccd_exclusive) to.client_config_dir_exclusive = options->client_config_dir; #endif diff --git a/openvpn/src/openvpn/manage.c b/openvpn/src/openvpn/manage.c index f7ca8e15..cc22208e 100644 --- a/openvpn/src/openvpn/manage.c +++ b/openvpn/src/openvpn/manage.c @@ -58,9 +58,6 @@ #define MANAGEMENT_ECHO_FLAGS 0 #endif -#include - - /* tag for blank username/password */ static const char blank_up[] = "[[BLANK]]"; @@ -69,9 +66,6 @@ struct management *management; /* GLOBAL */ /* static forward declarations */ static void man_output_standalone (struct management *man, volatile int *signal_received); static void man_reset_client_socket (struct management *man, const bool exiting); -static ssize_t write_fd (int fd, void *ptr, size_t nbytes, int flags, int sendfd); -static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int flags, int *recvfd); - static void man_help () @@ -1811,6 +1805,78 @@ man_io_error (struct management *man, const char *prefix) return false; } +#ifdef TARGET_ANDROID +static ssize_t write_fd (int fd, void *ptr, size_t nbytes, int flags, int sendfd) +{ + struct msghdr msg; + struct iovec iov[1]; + + union { + struct cmsghdr cm; + char control[CMSG_SPACE(sizeof(int))]; + } control_un; + struct cmsghdr *cmptr; + + msg.msg_control = control_un.control; + msg.msg_controllen = sizeof(control_un.control); + + cmptr = CMSG_FIRSTHDR(&msg); + cmptr->cmsg_len = CMSG_LEN(sizeof(int)); + cmptr->cmsg_level = SOL_SOCKET; + cmptr->cmsg_type = SCM_RIGHTS; + *((int *) CMSG_DATA(cmptr)) = sendfd; + + msg.msg_name = NULL; + msg.msg_namelen = 0; + + iov[0].iov_base = ptr; + iov[0].iov_len = nbytes; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + + return (sendmsg(fd, &msg, flags)); +} + +static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int flags, int *recvfd) +{ + struct msghdr msghdr; + struct iovec iov[1]; + ssize_t n; + + union { + struct cmsghdr cm; + char control[CMSG_SPACE(sizeof (int))]; + } control_un; + struct cmsghdr *cmptr; + + msghdr.msg_control = control_un.control; + msghdr.msg_controllen = sizeof(control_un.control); + + msghdr.msg_name = NULL; + msghdr.msg_namelen = 0; + + iov[0].iov_base = ptr; + iov[0].iov_len = nbytes; + msghdr.msg_iov = iov; + msghdr.msg_iovlen = 1; + + if ( (n = recvmsg(fd, &msghdr, flags)) <= 0) + return (n); + + if ( (cmptr = CMSG_FIRSTHDR(&msghdr)) != NULL && + cmptr->cmsg_len == CMSG_LEN(sizeof(int))) { + if (cmptr->cmsg_level != SOL_SOCKET) + msg (M_ERR, "control level != SOL_SOCKET"); + if (cmptr->cmsg_type != SCM_RIGHTS) + msg (M_ERR, "control type != SCM_RIGHTS"); + *recvfd = *((int *) CMSG_DATA(cmptr)); + } else + *recvfd = -1; /* descriptor was not passed */ + + return (n); +} +#endif + static int man_read (struct management *man) @@ -1820,19 +1886,16 @@ man_read (struct management *man) */ unsigned char buf[256]; int len = 0; - int fd = -1; #ifdef TARGET_ANDROID - len = read_fd (man->connection.sd_cli, buf, sizeof (buf), MSG_NOSIGNAL, &fd); - __android_log_print(ANDROID_LOG_DEBUG,"openvpn-dbg","read_fd %d %d", len, fd); - if(fd >= 0) { - man->connection.lastfdreceived = fd; - if(len == 0) // No data message but a fd, return without resetting socket... - return 0; - } + int fd; + len = read_fd (man->connection.sd_cli, buf, sizeof (buf), MSG_NOSIGNAL, &fd); + if(fd >= 0) + man->connection.lastfdreceived = fd; #else - len = recv (man->connection.sd_cli, buf, sizeof (buf), MSG_NOSIGNAL); + len = recv (man->connection.sd_cli, buf, sizeof (buf), MSG_NOSIGNAL); #endif + if (len == 0) { man_reset_client_socket (man, false); @@ -1910,12 +1973,13 @@ man_write (struct management *man) { const int len = min_int (size_hint, BLEN (buf)); #ifdef TARGET_ANDROID - if (man->connection.fdtosend > 0) { - sent = write_fd (man->connection.sd_cli, BPTR (buf), len, MSG_NOSIGNAL,man->connection.fdtosend); + if (man->connection.fdtosend > 0) + { + sent = write_fd (man->connection.sd_cli, BPTR (buf), len, MSG_NOSIGNAL,man->connection.fdtosend); man->connection.fdtosend = -1; } else #endif - sent = send (man->connection.sd_cli, BPTR (buf), len, MSG_NOSIGNAL); + sent = send (man->connection.sd_cli, BPTR (buf), len, MSG_NOSIGNAL); if (sent >= 0) { buffer_list_advance (man->connection.out, sent); @@ -2910,7 +2974,7 @@ management_event_loop_n_seconds (struct management *man, int sec) * Get a username/password from management channel in standalone mode. */ bool - management_query_user_pass (struct management *man, +management_query_user_pass (struct management *man, struct user_pass *up, const char *type, const unsigned int flags, @@ -3108,79 +3172,6 @@ management_query_rsa_sig (struct management *man, #endif -#ifdef TARGET_ANDROID -static ssize_t write_fd (int fd, void *ptr, size_t nbytes, int flags, int sendfd) -{ - struct msghdr msg; - struct iovec iov[1]; - - union { - struct cmsghdr cm; - char control[CMSG_SPACE(sizeof(int))]; - } control_un; - struct cmsghdr *cmptr; - - msg.msg_control = control_un.control; - msg.msg_controllen = sizeof(control_un.control); - - cmptr = CMSG_FIRSTHDR(&msg); - cmptr->cmsg_len = CMSG_LEN(sizeof(int)); - cmptr->cmsg_level = SOL_SOCKET; - cmptr->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA(cmptr)) = sendfd; - - msg.msg_name = NULL; - msg.msg_namelen = 0; - - iov[0].iov_base = ptr; - iov[0].iov_len = nbytes; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - - return (sendmsg(fd, &msg, flags)); -} - -static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int flags, int *recvfd) -{ - struct msghdr msghdr; - struct iovec iov[1]; - ssize_t n; - - union { - struct cmsghdr cm; - char control[CMSG_SPACE(sizeof (int))]; - } control_un; - struct cmsghdr *cmptr; - - msghdr.msg_control = control_un.control; - msghdr.msg_controllen = sizeof(control_un.control); - - msghdr.msg_name = NULL; - msghdr.msg_namelen = 0; - - iov[0].iov_base = ptr; - iov[0].iov_len = nbytes; - msghdr.msg_iov = iov; - msghdr.msg_iovlen = 1; - - if ( (n = recvmsg(fd, &msghdr, flags)) <= 0) - return (n); - - if ( (cmptr = CMSG_FIRSTHDR(&msghdr)) != NULL && - cmptr->cmsg_len == CMSG_LEN(sizeof(int))) { - if (cmptr->cmsg_level != SOL_SOCKET) - msg (M_ERR, "control level != SOL_SOCKET"); - if (cmptr->cmsg_type != SCM_RIGHTS) - msg (M_ERR, "control type != SCM_RIGHTS"); - *recvfd = *((int *) CMSG_DATA(cmptr)); - } else - *recvfd = -1; /* descriptor was not passed */ - - return (n); -} -#endif - - /* * Return true if management_hold() would block */ diff --git a/openvpn/src/openvpn/manage.h b/openvpn/src/openvpn/manage.h index c7ffb42a..991b4896 100644 --- a/openvpn/src/openvpn/manage.h +++ b/openvpn/src/openvpn/manage.h @@ -208,7 +208,7 @@ struct man_persist { bool hold_release; const char *special_state_msg; - + counter_type bytes_in; counter_type bytes_out; }; @@ -307,7 +307,6 @@ struct man_connection { int fdtosend; int lastfdreceived; #endif - }; struct management diff --git a/openvpn/src/openvpn/misc.c b/openvpn/src/openvpn/misc.c index 3658c348..2ded9bfc 100644 --- a/openvpn/src/openvpn/misc.c +++ b/openvpn/src/openvpn/misc.c @@ -1176,7 +1176,7 @@ get_user_pass_cr (struct user_pass *up, if (ac) { char *response = (char *) gc_malloc (USER_PASS_LEN, false, &gc); - struct buffer packed_resp; + struct buffer packed_resp; buf_set_write (&packed_resp, (uint8_t*)up->password, USER_PASS_LEN); msg (M_INFO|M_NOPREFIX, "CHALLENGE: %s", ac->challenge_text); diff --git a/openvpn/src/openvpn/openvpn.vcxproj b/openvpn/src/openvpn/openvpn.vcxproj index 8ec8d901..51e19aff 100644 --- a/openvpn/src/openvpn/openvpn.vcxproj +++ b/openvpn/src/openvpn/openvpn.vcxproj @@ -1,261 +1,261 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {29DF226E-4D4E-440F-ADAF-5829CFD4CA94} - openvpn - Win32Proj - - - - Application - MultiByte - true - - - Application - MultiByte - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - false - - - - Disabled - $(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - $(SOURCEBASE);%(AdditionalIncludeDirectories) - - - libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies) - $(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories) - true - Console - MachineX86 - - - - - MaxSpeed - true - $(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - $(SOURCEBASE);%(AdditionalIncludeDirectories) - - - libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies) - $(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories) - true - Console - true - true - MachineX86 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8598c2c8-34c4-47a1-99b0-7c295a890615} - false - - - {4b2e2719-e661-45d7-9203-f6f456b22f19} - false - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94} + openvpn + Win32Proj + + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + $(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(SOURCEBASE);%(AdditionalIncludeDirectories) + + + libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies) + $(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + + + MaxSpeed + true + $(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(SOURCEBASE);%(AdditionalIncludeDirectories) + + + libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies) + $(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8598c2c8-34c4-47a1-99b0-7c295a890615} + false + + + {4b2e2719-e661-45d7-9203-f6f456b22f19} + false + + + + + \ No newline at end of file diff --git a/openvpn/src/openvpn/openvpn.vcxproj.filters b/openvpn/src/openvpn/openvpn.vcxproj.filters index 40336ba8..ec5e676c 100644 --- a/openvpn/src/openvpn/openvpn.vcxproj.filters +++ b/openvpn/src/openvpn/openvpn.vcxproj.filters @@ -1,458 +1,458 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + \ No newline at end of file diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c index dcb6340e..7b7fc684 100644 --- a/openvpn/src/openvpn/options.c +++ b/openvpn/src/openvpn/options.c @@ -35,6 +35,9 @@ #elif defined(_MSC_VER) #include "config-msvc.h" #endif +#ifdef HAVE_CONFIG_VERSION_H +#include "config-version.h" +#endif #include "syshead.h" @@ -859,6 +862,7 @@ init_options (struct options *o, const bool init_gc) o->pkcs11_pin_cache_period = -1; #endif /* ENABLE_PKCS11 */ +#ifdef ENABLE_TMPDIR /* Set default --tmp-dir */ #ifdef WIN32 /* On Windows, find temp dir via enviroment variables */ @@ -870,6 +874,7 @@ init_options (struct options *o, const bool init_gc) o->tmp_dir = "/tmp"; } #endif /* WIN32 */ +#endif /* ENABLE_TMPDIR */ } void @@ -1047,22 +1052,6 @@ string_substitute (const char *src, int from, int to, struct gc_arena *gc) return ret; } -bool -is_persist_option (const struct options *o) -{ - return o->persist_tun - || o->persist_key - || o->persist_local_ip - || o->persist_remote_ip - ; -} - -bool -is_stateful_restart (const struct options *o) -{ - return is_persist_option (o) || connection_list_defined (o); -} - #ifdef ENABLE_SSL static uint8_t * parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_arena *gc) @@ -2774,19 +2763,21 @@ options_postprocess_filechecks (struct options *options) options->management_user_pass, R_OK, "--management user/password file"); #endif /* ENABLE_MANAGEMENT */ -#if P2MP +#if ENABLE_TMPDIR errs |= check_file_access (CHKACC_FILE|CHKACC_ACPTSTDIN, options->auth_user_pass_file, R_OK, "--auth-user-pass"); -#endif /* P2MP */ + + errs |= check_file_access (CHKACC_FILE, options->tmp_dir, + R_OK|W_OK|X_OK, "Temporary directory (--tmp-dir)"); + +#endif /* ENABLE_TMPDIR */ /* ** System related ** */ errs |= check_file_access (CHKACC_FILE, options->chroot_dir, R_OK|X_OK, "--chroot directory"); errs |= check_file_access (CHKACC_DIRPATH|CHKACC_FILEXSTWR, options->writepid, R_OK|W_OK, "--writepid"); - errs |= check_file_access (CHKACC_FILE, options->tmp_dir, - R_OK|W_OK|X_OK, "Temporary directory (--tmp-dir)"); /* ** Log related ** */ errs |= check_file_access (CHKACC_DIRPATH|CHKACC_FILEXSTWR, options->status_file, @@ -3483,6 +3474,9 @@ usage_version (void) #ifdef CONFIGURE_DEFINES msg (M_INFO|M_NOPREFIX, "Compile time defines: %s", CONFIGURE_DEFINES); #endif +#ifdef CONFIGURE_GIT_REVISION + msg (M_INFO|M_NOPREFIX, "git revision: %s", CONFIGURE_GIT_REVISION); +#endif #endif openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */ } @@ -4033,8 +4027,8 @@ void options_string_import (struct options *options, static bool verify_permission (const char *name, - const char* file, - const unsigned int type, + const char* file, + const unsigned int type, const unsigned int allowed, unsigned int *found, const int msglevel) @@ -5473,11 +5467,6 @@ add_option (struct options *options, options->occ = false; } #endif - else if (streq (p[0], "tmp-dir") && p[1]) - { - VERIFY_PERMISSION (OPT_P_GENERAL); - options->tmp_dir = p[1]; - } #if P2MP #if P2MP_SERVER else if (streq (p[0], "server") && p[1] && p[2]) @@ -5759,6 +5748,11 @@ add_option (struct options *options, warn_multiple_script (options->learn_address_script, "learn-address"); options->learn_address_script = p[1]; } + else if (streq (p[0], "tmp-dir") && p[1]) + { + VERIFY_PERMISSION (OPT_P_GENERAL); + options->tmp_dir = p[1]; + } else if (streq (p[0], "client-config-dir") && p[1]) { VERIFY_PERMISSION (OPT_P_GENERAL); diff --git a/openvpn/src/openvpn/options.h b/openvpn/src/openvpn/options.h index 1be3dfaf..50d42fb7 100644 --- a/openvpn/src/openvpn/options.h +++ b/openvpn/src/openvpn/options.h @@ -403,7 +403,9 @@ struct options struct plugin_option_list *plugin_list; #endif +#ifdef ENABLE_TMPDIR const char *tmp_dir; +#endif #if P2MP @@ -749,9 +751,6 @@ bool apply_push_options (struct options *options, unsigned int *option_types_found, struct env_set *es); -bool is_persist_option (const struct options *o); -bool is_stateful_restart (const struct options *o); - void options_detach (struct options *o); void options_server_import (struct options *o, diff --git a/openvpn/src/openvpn/socket.c b/openvpn/src/openvpn/socket.c index b92c2828..d417172a 100644 --- a/openvpn/src/openvpn/socket.c +++ b/openvpn/src/openvpn/socket.c @@ -40,7 +40,6 @@ #include "misc.h" #include "manage.h" - #include "memdbg.h" const int proto_overhead[] = { /* indexed by PROTO_x */ @@ -375,7 +374,7 @@ getaddr6 (unsigned int flags, /* * Resolve hostname - */ + */ while (true) { /* try hostname lookup */ @@ -859,7 +858,8 @@ create_socket_tcp (void) msg (M_SOCKERR, "TCP: Cannot setsockopt SO_LINGER on TCP socket"); } #endif - return sd; + + return sd; } static socket_descriptor_t @@ -886,7 +886,6 @@ create_socket_udp (const unsigned int flags) #endif } #endif - return sd; } @@ -906,7 +905,6 @@ create_socket_udp6 (const unsigned int flags) msg(M_SOCKERR, "UDP: failed setsockopt for IPV6_RECVPKTINFO"); } #endif - return sd; } @@ -1328,7 +1326,7 @@ socket_connect (socket_descriptor_t *sd, } /* For stream protocols, allocate a buffer to build up packet. - Called after frame has been finalized. */ + Called after frame has been finalized. */ static void socket_frame_init (const struct frame *frame, struct link_socket *sock) diff --git a/openvpn/src/openvpn/syshead.h b/openvpn/src/openvpn/syshead.h index 8ce40f7e..ed00e821 100644 --- a/openvpn/src/openvpn/syshead.h +++ b/openvpn/src/openvpn/syshead.h @@ -506,6 +506,7 @@ socket_defined (const socket_descriptor_t sd) #if P2MP && !defined(ENABLE_CLIENT_ONLY) #define P2MP_SERVER 1 +#define ENABLE_TMPDIR 1 #else #define P2MP_SERVER 0 #endif diff --git a/openvpn/src/openvpn/tun.c b/openvpn/src/openvpn/tun.c index 92ad001e..8057c16e 100644 --- a/openvpn/src/openvpn/tun.c +++ b/openvpn/src/openvpn/tun.c @@ -46,10 +46,10 @@ #include "manage.h" #include "route.h" #include "win32.h" + #include "memdbg.h" #include - #ifdef WIN32 /* #define SIMULATE_DHCP_FAILED */ /* simulate bad DHCP negotiation */ @@ -1739,7 +1739,7 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len) ret = readv(tt->fd, vect, 2); return(ret - sizeof(pi)); } - else + else return read (tt->fd, buf, len); } diff --git a/openvpn/src/openvpn/tun.h b/openvpn/src/openvpn/tun.h index 095e77eb..0f4f0123 100644 --- a/openvpn/src/openvpn/tun.h +++ b/openvpn/src/openvpn/tun.h @@ -76,7 +76,6 @@ struct tuntap_options { int netbios_node_type; /* NBT 1,2,4,8 (46) */ - #define N_DHCP_ADDR 4 /* Max # of addresses allowed for DNS, WINS, etc. */ @@ -315,8 +314,6 @@ route_order(void) } - - #ifdef WIN32 #define TUN_PASS_BUFFER diff --git a/openvpn/src/openvpnserv/openvpnserv.vcxproj b/openvpn/src/openvpnserv/openvpnserv.vcxproj index 0b75ed01..f2c00718 100644 --- a/openvpn/src/openvpnserv/openvpnserv.vcxproj +++ b/openvpn/src/openvpnserv/openvpnserv.vcxproj @@ -1,112 +1,112 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD} - openvpnserv - Win32Proj - - - - Application - MultiByte - true - - - Application - MultiByte - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)-Output\$(Configuration)\ - $(Configuration)\ - false - - - - Disabled - $(SOURCEBASE);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - $(SOURCEBASE);%(AdditionalIncludeDirectories) - - - true - Console - MachineX86 - - - - - MaxSpeed - true - $(SOURCEBASE);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - $(SOURCEBASE);%(AdditionalIncludeDirectories) - - - true - Console - true - true - MachineX86 - - - - - - - - - - - - - - - {8598c2c8-34c4-47a1-99b0-7c295a890615} - false - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD} + openvpnserv + Win32Proj + + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Platform)-Output\$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + $(SOURCEBASE);%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(SOURCEBASE);%(AdditionalIncludeDirectories) + + + true + Console + MachineX86 + + + + + MaxSpeed + true + $(SOURCEBASE);%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(SOURCEBASE);%(AdditionalIncludeDirectories) + + + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + + {8598c2c8-34c4-47a1-99b0-7c295a890615} + false + + + + + \ No newline at end of file diff --git a/openvpn/src/openvpnserv/openvpnserv.vcxproj.filters b/openvpn/src/openvpnserv/openvpnserv.vcxproj.filters index 0c89b4f4..a6f8ecc6 100644 --- a/openvpn/src/openvpnserv/openvpnserv.vcxproj.filters +++ b/openvpn/src/openvpnserv/openvpnserv.vcxproj.filters @@ -1,35 +1,35 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Resource Files + + \ No newline at end of file -- cgit v1.2.3