summaryrefslogtreecommitdiff
path: root/src/netops.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-04-26 13:51:14 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-04-26 17:27:42 +0200
commit1f0d4f3d8dd5c87d3f42a913a1af9d6f1f2da437 (patch)
tree1131f54640997311712161008ef652e77fda118a /src/netops.h
parent4f9d54146d569fffb679386fd3057e571afacd1f (diff)
downloadlibgit2-1f0d4f3d8dd5c87d3f42a913a1af9d6f1f2da437.tar.gz
netops: unit-test the cert host-name pattern matching
This kind of stuff should have unit tests, even if it's just to show what we expect to match successfully.
Diffstat (limited to 'src/netops.h')
-rw-r--r--src/netops.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/netops.h b/src/netops.h
index 666d66b12..8e3a2524f 100644
--- a/src/netops.h
+++ b/src/netops.h
@@ -54,6 +54,19 @@ enum {
GITNO_CONNECT_SSL_NO_CHECK_CERT = 2,
};
+/**
+ * Check if the name in a cert matches the wanted hostname
+ *
+ * Check if a pattern from a certificate matches the hostname we
+ * wanted to connect to according to RFC2818 rules (which specifies
+ * HTTP over TLS). Mainly, an asterisk matches anything, but is
+ * limited to a single url component.
+ *
+ * Note that this does not set an error message. It expects the user
+ * to provide the message for the user.
+ */
+int gitno__match_host(const char *pattern, const char *host);
+
void gitno_buffer_setup(gitno_socket *t, gitno_buffer *buf, char *data, size_t len);
void gitno_buffer_setup_callback(gitno_socket *t, gitno_buffer *buf, char *data, size_t len, int (*recv)(gitno_buffer *buf), void *cb_data);
int gitno_recv(gitno_buffer *buf);