Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add openconnect_set_key_password()
For auto-provisioning via NetworkManager it's actually quite useful to be
able to set vpninfo->cert_password and have that special case handled,
instead of having to inject the password into the user's keyring somehow.

It's either that or revise the FSID hack...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed Oct 11, 2018
1 parent ae8d3c1 commit a75cc71
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions libopenconnect.map.in
Expand Up @@ -99,6 +99,7 @@ OPENCONNECT_5_5 {
openconnect_get_supported_protocols;
openconnect_free_supported_protocols;
openconnect_has_tss2_blob_support;
openconnect_set_key_password;
} OPENCONNECT_5_4;

OPENCONNECT_PRIVATE {
Expand Down
7 changes: 7 additions & 0 deletions library.c
Expand Up @@ -655,6 +655,13 @@ void openconnect_set_cert_expiry_warning(struct openconnect_info *vpninfo,
vpninfo->cert_expire_warning = seconds;
}

int openconnect_set_key_password(struct openconnect_info *vpninfo, const char *pass)
{
STRDUP(vpninfo->cert_password, pass);

return 0;
}

void openconnect_set_pfs(struct openconnect_info *vpninfo, unsigned val)
{
vpninfo->pfs = val;
Expand Down
2 changes: 2 additions & 0 deletions openconnect.h
Expand Up @@ -37,6 +37,7 @@ extern "C" {

/*
* API version 5.5:
* - add openconnect_set_key_password()
* - Add openconnect_has_tss2_blob_support()
* - Add openconnect_get_supported_protocols()
* - Add openconnect_free_supported_protocols()
Expand Down Expand Up @@ -513,6 +514,7 @@ int openconnect_set_mobile_info(struct openconnect_info *vpninfo,
const char *mobile_device_uniqueid);
int openconnect_set_client_cert(struct openconnect_info *, const char *cert,
const char *sslkey);
int openconnect_set_key_password(struct openconnect_info *vpninfo, const char *pass);
const char *openconnect_get_ifname(struct openconnect_info *);
void openconnect_set_reqmtu(struct openconnect_info *, int reqmtu);
void openconnect_set_dpd(struct openconnect_info *, int min_seconds);
Expand Down

0 comments on commit a75cc71

Please sign in to comment.