From ec7e6b920257e52a24f9fc56150c05f3bbc6da7d Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 5 May 2012 19:54:55 +0200 Subject: working protect fd through management --- openvpn/src/openvpn/manage.c | 2 +- openvpn/src/openvpn/misc.c | 2 +- openvpn/src/openvpn/socket.c | 26 ++++++-------------------- 3 files changed, 8 insertions(+), 22 deletions(-) (limited to 'openvpn/src') diff --git a/openvpn/src/openvpn/manage.c b/openvpn/src/openvpn/manage.c index b9807551..f28278f9 100644 --- a/openvpn/src/openvpn/manage.c +++ b/openvpn/src/openvpn/manage.c @@ -2894,7 +2894,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, diff --git a/openvpn/src/openvpn/misc.c b/openvpn/src/openvpn/misc.c index 2ded9bfc..3658c348 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/socket.c b/openvpn/src/openvpn/socket.c index e794c113..524343b5 100644 --- a/openvpn/src/openvpn/socket.c +++ b/openvpn/src/openvpn/socket.c @@ -865,12 +865,7 @@ create_socket_tcp (void) } #endif -#ifdef TARGET_ANDROID - /* Protects the socket from being routed via VPN */ - android_protect_socket(sd); -#endif - - return sd; + return sd; } static socket_descriptor_t @@ -898,11 +893,6 @@ create_socket_udp (const unsigned int flags) } #endif -#ifdef TARGET_ANDROID - /* Protects the socket from being routed via VPN */ - android_protect_socket(sd); -#endif - return sd; } @@ -922,10 +912,6 @@ create_socket_udp6 (const unsigned int flags) msg(M_SOCKERR, "UDP: failed setsockopt for IPV6_RECVPKTINFO"); } #endif -#ifdef TARGET_ANDROID - /* Protects the socket from being routed via VPN */ - android_protect_socket(sd); -#endif return sd; } @@ -945,10 +931,6 @@ create_socket_tcp6 (void) (void *) &on, sizeof (on)) < 0) msg (M_SOCKERR, "TCP: Cannot setsockopt SO_REUSEADDR on TCP6 socket"); } -#ifdef TARGET_ANDROID - /* Protects the socket from being routed via VPN */ - android_protect_socket(sd); -#endif return sd; } @@ -987,8 +969,12 @@ create_socket (struct link_socket *sock) ASSERT (0); } #ifdef TARGET_ANDROID + struct user_pass up; + strcpy(up.username ,__func__); management->connection.fdtosend = sock->sd; - management_auth_token (management,"'PROTECT-FD'"); + management_query_user_pass(management, &up , "PROTECTFD", GET_USER_PASS_NEED_OK,(void*) 0); + + #endif } -- cgit v1.2.3