Skip to content

Commit

Permalink
Namespace cleanup: s/set_http_proxy/openconnect_set_http_proxy/
Browse files Browse the repository at this point in the history
Now the library namespace is entirely prefixed by openconnect_ with no
inappropriate pollution. At least on platforms where the linker version
scripts work.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed May 14, 2012
1 parent 23267ee commit 4ba8fff
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cstp.c
Expand Up @@ -625,7 +625,7 @@ int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout)
return work_done;
default:
vpn_progress(vpninfo, PRG_ERR, _("SSL_write failed: %d\n"), ret);
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
goto do_reconnect;
}
}
Expand Down
4 changes: 2 additions & 2 deletions dtls.c
Expand Up @@ -345,7 +345,7 @@ int dtls_try_handshake(struct openconnect_info *vpninfo)
}

vpn_progress(vpninfo, PRG_ERR, _("DTLS handshake failed: %d\n"), ret);
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);

/* Kill the new (failed) connection... */
SSL_free(vpninfo->new_dtls_ssl);
Expand Down Expand Up @@ -600,7 +600,7 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout)
vpn_progress(vpninfo, PRG_ERR,
_("DTLS got write error %d. Falling back to SSL\n"),
ret);
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
dtls_restart(vpninfo);
vpninfo->outgoing_queue = this;
vpninfo->outgoing_qlen++;
Expand Down
2 changes: 1 addition & 1 deletion libopenconnect.map.in
Expand Up @@ -52,5 +52,5 @@ OPENCONNECT_PRIVATE {
openconnect_SSL_printf;
openconnect_version_str;
openconnect_create_useragent;
report_ssl_errors;
openconnect_report_ssl_errors;
};
2 changes: 1 addition & 1 deletion openconnect-internal.h
Expand Up @@ -285,7 +285,7 @@ int openconnect_open_https(struct openconnect_info *vpninfo);
void openconnect_close_https(struct openconnect_info *vpninfo);
int get_cert_md5_fingerprint(struct openconnect_info *vpninfo, X509 *cert,
char *buf);
void report_ssl_errors(struct openconnect_info *vpninfo);
void openconnect_report_ssl_errors(struct openconnect_info *vpninfo);

/* mainloop.c */
int vpn_add_pollfd(struct openconnect_info *vpninfo, int fd, short events);
Expand Down
32 changes: 16 additions & 16 deletions ssl.c
Expand Up @@ -83,7 +83,7 @@ int openconnect_SSL_write(struct openconnect_info *vpninfo, char *buf, size_t le
FD_SET(vpninfo->ssl_fd, &wr_set);
else {
vpn_progress(vpninfo, PRG_ERR, _("Failed to write to SSL socket"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EIO;
}
if (vpninfo->cancel_fd != -1) {
Expand Down Expand Up @@ -120,7 +120,7 @@ int openconnect_SSL_read(struct openconnect_info *vpninfo, char *buf, size_t len
FD_SET(vpninfo->ssl_fd, &wr_set);
else {
vpn_progress(vpninfo, PRG_ERR, _("Failed to read from SSL socket"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EIO;
}
if (vpninfo->cancel_fd != -1) {
Expand Down Expand Up @@ -161,7 +161,7 @@ static int print_err(const char *str, size_t len, void *ptr)
return 0;
}

void report_ssl_errors(struct openconnect_info *vpninfo)
void openconnect_report_ssl_errors(struct openconnect_info *vpninfo)
{
ERR_print_errors_cb(print_err, vpninfo);
}
Expand Down Expand Up @@ -205,7 +205,7 @@ int openconnect_SSL_gets(struct openconnect_info *vpninfo, char *buf, size_t len
FD_SET(vpninfo->ssl_fd, &wr_set);
else {
vpn_progress(vpninfo, PRG_ERR, _("Failed to read from SSL socket\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
ret = -EIO;
break;
}
Expand Down Expand Up @@ -267,7 +267,7 @@ static int load_pkcs12_certificate(struct openconnect_info *vpninfo, PKCS12 *p12
if (!PKCS12_parse(p12, vpninfo->cert_password?:pass, &pkey, &cert, &ca)) {
unsigned long err = ERR_peek_error();

report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);

if (ERR_GET_LIB(err) == ERR_LIB_PKCS12 &&
ERR_GET_FUNC(err) == PKCS12_F_PKCS12_PARSE &&
Expand Down Expand Up @@ -340,13 +340,13 @@ static int load_tpm_certificate(struct openconnect_info *vpninfo)
e = ENGINE_by_id("tpm");
if (!e) {
vpn_progress(vpninfo, PRG_ERR, _("Can't load TPM engine.\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EINVAL;
}
if (!ENGINE_init(e) || !ENGINE_set_default_RSA(e) ||
!ENGINE_set_default_RAND(e)) {
vpn_progress(vpninfo, PRG_ERR, _("Failed to init TPM engine\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
ENGINE_free(e);
return -EINVAL;
}
Expand All @@ -356,21 +356,21 @@ static int load_tpm_certificate(struct openconnect_info *vpninfo)
vpninfo->cert_password, NULL, 0)) {
vpn_progress(vpninfo, PRG_ERR,
_("Failed to set TPM SRK password\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
}
}
key = ENGINE_load_private_key(e, vpninfo->sslkey, NULL, NULL);
if (!key) {
vpn_progress(vpninfo, PRG_ERR,
_("Failed to load TPM private key\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
ENGINE_free(e);
ENGINE_finish(e);
return -EINVAL;
}
if (!SSL_CTX_use_PrivateKey(vpninfo->https_ctx, key)) {
vpn_progress(vpninfo, PRG_ERR, _("Add key from TPM failed\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
ENGINE_free(e);
ENGINE_finish(e);
return -EINVAL;
Expand Down Expand Up @@ -398,7 +398,7 @@ static int reload_pem_cert(struct openconnect_info *vpninfo)
BIO_free(b);
vpn_progress(vpninfo, PRG_ERR,
_("Failed to reload X509 cert for expiry check\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EIO;
}
vpninfo->cert_x509 = PEM_read_bio_X509_AUX(b, NULL, NULL, NULL);
Expand Down Expand Up @@ -433,7 +433,7 @@ static int load_certificate(struct openconnect_info *vpninfo)
/* Not PKCS#12 */
if (vpninfo->cert_type == CERT_TYPE_PKCS12) {
vpn_progress(vpninfo, PRG_ERR, _("Read PKCS#12 failed\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EINVAL;
}
/* Clear error and fall through to see if it's a PEM file... */
Expand All @@ -445,7 +445,7 @@ static int load_certificate(struct openconnect_info *vpninfo)
vpninfo->cert)) {
vpn_progress(vpninfo, PRG_ERR,
_("Loading certificate failed\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
return -EINVAL;
}

Expand Down Expand Up @@ -499,7 +499,7 @@ static int load_certificate(struct openconnect_info *vpninfo)
SSL_FILETYPE_PEM)) {
unsigned long err = ERR_peek_error();

report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);

#ifndef EVP_F_EVP_DECRYPTFINAL_EX
#define EVP_F_EVP_DECRYPTFINAL_EX EVP_F_EVP_DECRYPTFINAL
Expand Down Expand Up @@ -1218,7 +1218,7 @@ int openconnect_open_https(struct openconnect_info *vpninfo)
vpn_progress(vpninfo, PRG_ERR,
_("Failed to open CA file '%s'\n"),
vpninfo->cafile);
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
close(ssl_sock);
return -EINVAL;
}
Expand Down Expand Up @@ -1248,7 +1248,7 @@ int openconnect_open_https(struct openconnect_info *vpninfo)
FD_SET(ssl_sock, &wr_set);
else {
vpn_progress(vpninfo, PRG_ERR, _("SSL connection failure\n"));
report_ssl_errors(vpninfo);
openconnect_report_ssl_errors(vpninfo);
SSL_free(https_ssl);
close(ssl_sock);
return -EINVAL;
Expand Down
5 changes: 3 additions & 2 deletions www/changelog.xml
Expand Up @@ -20,10 +20,11 @@
<li>Add <tt>--config</tt> option for reading options from file.</li>
<li>Improve OpenSSL DTLS compatibility to work on Ubuntu 10.04.</li>
<li>Flush progress logging output promptly after each message.</li>
<li>Add symbol versioning for shared library (on sane platforms)</li>
<li>Add <tt>openconnect_set_cancel_fd()</tt> function to allow clean cancellation</li>
<li>Add symbol versioning for shared library (on sane platforms).</li>
<li>Add <tt>openconnect_set_cancel_fd()</tt> function to allow clean cancellation.</li>
<li>Fix corruption of URL in <tt>openconnect_parse_url()</tt> if it specifies a port number.</li>
<li>Fix inappropriate <tt>exit()</tt> calls from library code.</li>
<li>Library namespace cleanup &#8212; all symbols now have the prefix <tt>openconnect_</tt> on platforms where symbol versioning works.</li>
</ul><br/>
</li>
<li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-3.18.tar.gz">OpenConnect v3.18</a></b>
Expand Down

0 comments on commit 4ba8fff

Please sign in to comment.