summaryrefslogtreecommitdiff
path: root/src/ssl_routines.c
diff options
context:
space:
mode:
authorJakub Sławiński2006-02-05 15:14:03 +0100
committerJoshua Judson Rosen2014-07-17 21:15:02 +0200
commitb457fec36399c1f7de093d5e92bb4fa453b79c86 (patch)
tree2084c9a78d40213015e6f10e3e9e01bc4c0c51f1 /src/ssl_routines.c
parentUpdate copyright statements. (diff)
downloadapf-b457fec36399c1f7de093d5e92bb4fa453b79c86.tar.gz
v0.8
- Fixed: infinite loop after buffering message - Fixed: corrupt packets after closing connections in the stopped state - Fixed: bug in mapping user numbers between afclient and afserver - Fixed: premature close of the service connection - Fixed: invalid buffering when the connection is closing - Added: Multiple tunnels in one afclient<->afserver connection
Diffstat (limited to 'src/ssl_routines.c')
-rw-r--r--src/ssl_routines.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/ssl_routines.c b/src/ssl_routines.c
index 30a0714..ae20fe2 100644
--- a/src/ssl_routines.c
+++ b/src/ssl_routines.c
@@ -19,11 +19,21 @@
*/
#include <config.h>
-
-#include "ssl_routines.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
+
+#include "ssl_routines.h"
+
+/*
+ * Function name: check_public_key
+ * Description: Checks if the public key is trusted.
+ * Arguments: filename - the name of the file with stored keys
+ * hostname - the name of the host
+ * keyhash - the hash of the key
+ * Returns: The result of the check.
+ */
int
check_public_key(char* filename, char* hostname, char* keyhash)
@@ -32,6 +42,10 @@ check_public_key(char* filename, char* hostname, char* keyhash)
char buff[256];
int lspaceind, i;
+ assert(filename != NULL);
+ assert(hostname != NULL);
+ assert(keyhash != NULL);
+
memset(buff, 0, 256);
storefile = fopen(filename, "r");
@@ -68,10 +82,23 @@ check_public_key(char* filename, char* hostname, char* keyhash)
return SSL_PUBLIC_KEY_NOT_KNOWN;
}
+/*
+ * Function name: add_public_key
+ * Description: Adds the key to the store file.
+ * Arguments: filename - the name of the file with stored keys
+ * hostname - the name of the host
+ * keyhash - the hash of the key
+ */
+
void
add_public_key(char* filename, char* hostname, char* keyhash)
{
FILE* storefile;
+
+ assert(filename != NULL);
+ assert(hostname != NULL);
+ assert(keyhash != NULL);
+
storefile = fopen(filename, "a");
if (storefile == NULL) {
return;