0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

Core: implemented IV_OPENVPN_GUI_VERSION.

Clients can set via guiVersion string in OpenVPN 3 API.
This commit is contained in:
James Yonan 2014-01-07 11:49:48 -07:00
parent 64ea490e75
commit b6df43fd88
5 changed files with 16 additions and 0 deletions

View File

@ -299,6 +299,7 @@ namespace openvpn {
bool disable_client_cert;
int default_key_direction;
bool force_aes_cbc_ciphersuites;
std::string gui_version;
ProtoContextOptions::Ptr proto_context_options;
HTTPProxyTransport::Options::Ptr http_proxy_options;
};
@ -385,6 +386,7 @@ namespace openvpn {
state->disable_client_cert = config.disableClientCert;
state->default_key_direction = config.defaultKeyDirection;
state->force_aes_cbc_ciphersuites = config.forceAesCbcCiphersuites;
state->gui_version = config.guiVersion;
if (!config.proxyHost.empty())
{
HTTPProxyTransport::Options::Ptr ho(new HTTPProxyTransport::Options());
@ -571,6 +573,7 @@ namespace openvpn {
cc.disable_client_cert = state->disable_client_cert;
cc.default_key_direction = state->default_key_direction;
cc.force_aes_cbc_ciphersuites = state->force_aes_cbc_ciphersuites;
cc.gui_version = state->gui_version;
#if defined(USE_TUN_BUILDER)
cc.socket_protect = &state->socket_protect;
cc.builder = this;

View File

@ -142,6 +142,11 @@ namespace openvpn {
// or in addition to content string above).
std::vector<KeyValue> contentList;
// Set to identity OpenVPN GUI version.
// Format should be "<gui_identifier><space><version>"
// Passed to server as IV_OPENVPN_GUI_VERSION.
std::string guiVersion;
// Use a different server than that specified in "remote"
// option of profile
std::string serverOverride;

View File

@ -113,6 +113,7 @@ namespace openvpn {
#endif
}
std::string gui_version;
std::string server_override;
Protocol proto_override;
int conn_timeout;
@ -192,6 +193,7 @@ namespace openvpn {
cp->load(opt, *proto_context_options, config.default_key_direction);
cp->set_xmit_creds(!autologin || pcc.hasEmbeddedPassword());
cp->ssl_ctx.reset(new ClientSSLAPI(cc));
cp->gui_version = config.gui_version;
cp->frame = frame;
cp->now = &now_;
cp->rng = rng;

View File

@ -269,6 +269,9 @@ namespace openvpn {
Time::Duration keepalive_ping;
Time::Duration keepalive_timeout;
// GUI version, passed to server as IV_OPENVPN_GUI_VERSION
std::string gui_version;
void load(const OptionList& opt, const ProtoContextOptions& pco, const int default_key_direction)
{
// first set defaults
@ -563,6 +566,8 @@ namespace openvpn {
std::string peer_info_string() const
{
std::ostringstream out;
if (!gui_version.empty())
out << "IV_OPENVPN_GUI_VERSION=" << gui_version << '\n';
out << "IV_VER=" << OPENVPN_VERSION << '\n';
out << "IV_PLAT=" << platform_name() << '\n';
out << "IV_NCP=1\n"; // negotiable crypto parameters

View File

@ -274,6 +274,7 @@ int main(int argc, char *argv[])
OPENVPN_THROW_EXCEPTION("merge config error: " << pm.status_string() << " : " << pm.error());
ClientAPI::Config config;
config.guiVersion = "cli 1.0";
config.content = pm.profile_content();
config.serverOverride = server;
config.protoOverride = proto;