[PATCH 4/6] added openconnect_strdup()

David Woodhouse dwmw2 at infradead.org
Wed Aug 27 05:52:15 PDT 2014


On Wed, 2014-08-27 at 12:45 +0200, Nikos Mavrogiannopoulos wrote:
> 
> Some proposed changes attached. They are not thoroughly tested, but
> demonstrate the idea.

Looks good to me; thanks. I'll also change a bunch of 'char *' to 'const
char *' when I do it.

I'll give Kevin and Fabian a chance to opine from the Java and Shimo
points of view, but I think we should do it.

For GNOME, KDE and I think Java we are then able to just eliminate a lot
of strdup() calls which were done purely for the purpose of passing
strings in to libopenconnect:

[dwoodhou at i7 plasma-nm]$ git grep openconnect.*strdup
vpn/openconnect/openconnectauth.cpp:        openconnect_set_cafile(d->vpninfo, strdup(crt.data()));
vpn/openconnect/openconnectauth.cpp:        openconnect_set_http_proxy(d->vpninfo, strdup(proxy.data()));
vpn/openconnect/openconnectauth.cpp:        openconnect_set_client_cert (d->vpninfo, strdup(crt.data()), strdup(key.data()));
vpn/openconnect/openconnectauth.cpp:        openconnect_set_hostname(d->vpninfo, strdup(host.address.toAscii().data()));
vpn/openconnect/openconnectauth.cpp:        openconnect_set_urlpath(d->vpninfo, strdup(host.group.toAscii().data()));
[dwoodhou at i7 plasma-nm]$ cd ../network-manager-openconnect
[dwoodhou at i7 network-manager-openconnect]$ git grep openconnect.*strdup
auth-dialog/main.c:             openconnect_set_cafile(vpninfo, g_strdup (cafile));
auth-dialog/main.c:             openconnect_setup_csd(vpninfo, getuid(), 1, g_strdup (csd_wrapper));
auth-dialog/main.c:     if (proxy && proxy[0] && openconnect_set_http_proxy(vpninfo, g_strdup (proxy)))
auth-dialog/main.c:     openconnect_set_client_cert (vpninfo, g_strdup (cert), g_strdup (sslkey));
auth-dialog/main.c:             openconnect_set_hostname (ui_data->vpninfo, g_strdup(host->hostaddress));
auth-dialog/main.c:             openconnect_set_urlpath(ui_data->vpninfo, g_strdup(host->usergroup));

-- 
dwmw2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20140827/3062a3fc/attachment.bin>


More information about the openconnect-devel mailing list