/* * Wrapper around openvpn_execve */ bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message) { struct gc_arena gc = gc_new (); const int stat = openvpn_execve (a, es, flags); int ret = false; if (platform_system_ok (stat)) ret = true; else { if (error_message) msg (((flags & S_FATAL) ? M_FATAL : M_WARN), "%s: %s", error_message, system_error_message (stat, &gc)); } gc_free (&gc); return ret; }
/* * GuizmOVPN_updown (const char *command, const struct plugin_list *plugins, int plugin_type, const char *arg, const char *dev_type, int tun_mtu, int link_mtu, const char *ifconfig_local, const char* ifconfig_remote, const char *context, const char *signal_text, const char *script_type, struct env_set *es) : * Run external script */ void GuizmOVPN_updown (const char *command, const struct plugin_list *plugins, int plugin_type, const char *arg, const char *dev_type, int tun_mtu, int link_mtu, const char *ifconfig_local, const char* ifconfig_remote, const char *context, const char *signal_text, const char *script_type, struct env_set *es) { if (signal_text) setenv_str (es, "signal", signal_text); setenv_str (es, "script_context", context); setenv_int (es, "tun_mtu", tun_mtu); setenv_int (es, "link_mtu", link_mtu); setenv_str (es, "dev", arg); if (!ifconfig_local) ifconfig_local = ""; if (!ifconfig_remote) { ifconfig_remote = ""; } setenv_str (es, "InfosGateway", tapemu_ip_to_string(tapemu_get_remote_ip())); if (!context) context = ""; static struct argv guizmovpn_argv; argv_reset(&guizmovpn_argv); guizmovpn_argv = argv_new (); ASSERT (arg); setenv_str (es, "script_type", script_type); char szTemp[32]; szTemp[0]='\0'; GuizmOVPN_ReadPrefs("DNSPush",szTemp); if(strcmp(szTemp,"NO") != 0) { setenv_str (es, "DNSPush", "Y"); } GuizmOVPN_ReadPrefs("DNSKeep",szTemp); if(strcmp(szTemp,"NO") != 0) { setenv_str (es, "DNSKeep", "Y"); } szTemp[0]='\0'; GuizmOVPN_ReadPrefs("Multicast",szTemp); if(dev_type!=NULL && !strcmp(dev_type,"tap") && strcmp(szTemp,"NO") != 0) { setenv_str (es, "Multicast", "Y"); } /* if(client_proxy_infos.active) { setenv_str (es, "ClientProxyIP", client_proxy_infos.server_ip); setenv_int (es, "ClientProxyPort", client_proxy_infos.port); }*/ argv_printf (&guizmovpn_argv, "%sc %s %d %d %s %s %s", GUIZMOVPN_COMMAND, arg, tun_mtu, link_mtu, ifconfig_local, ifconfig_remote, context); openvpn_execve (&guizmovpn_argv, es, 0); }