summaryrefslogtreecommitdiff
path: root/src/client_configuration_struct.c
diff options
context:
space:
mode:
authorJakub Sławiński2005-11-03 20:37:56 +0100
committerJoshua Judson Rosen2014-07-17 21:15:00 +0200
commit63bbc710b23893742e5ccbd430f95bf2d29c2da6 (patch)
tree06d0585724cff8a4f1a7c052b5b89fd12c404094 /src/client_configuration_struct.c
parentv0.7.2 (diff)
downloadapf-63bbc710b23893742e5ccbd430f95bf2d29c2da6.tar.gz
v0.7.4
- Fixed: sockets in CLOSE_WAIT state left by afclient - Added: --localname and --localport options - Added: --localdesname option - Added: kicking user in 'opening' state - Fixed: info about kicked user - Fixed: TERM signal handling - Fixed: id lost after reconnection - Fixed: printing wrong client name in 'SSL_accept failed (timeout)' message - Fixed: ignored 'certificate' and 'key' options from config file - Added: config files for afclient - Modified: some options in afserver config file
Diffstat (limited to 'src/client_configuration_struct.c')
-rw-r--r--src/client_configuration_struct.c282
1 files changed, 282 insertions, 0 deletions
diff --git a/src/client_configuration_struct.c b/src/client_configuration_struct.c
new file mode 100644
index 0000000..6de1b5b
--- /dev/null
+++ b/src/client_configuration_struct.c
@@ -0,0 +1,282 @@
+/*
+ * active port forwarder - software for secure forwarding
+ * Copyright (C) 2003,2004,2005 jeremian <jeremian [at] poczta.fm>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "string_functions.h"
+#include "client_configuration_struct.h"
+
+/*
+ * Function name: ClientConfiguration_new
+ * Description: Create and initialize new ClientConfiguration structure.
+ * Returns: Pointer to newly created ClientConfiguration structure.
+ */
+
+ClientConfiguration*
+ClientConfiguration_new()
+{
+ ClientConfiguration* tmp = calloc(1, sizeof(ClientConfiguration));
+ if (tmp == NULL) {
+ return NULL;
+ }
+ return tmp;
+}
+
+/*
+ * Function name: ClientConfiguration_free
+ * Description: Free the memory allocated for ClientConfiguration structure.
+ * Arguments: cc - pointer to pointer to ClientConfiguration structure
+ */
+
+void
+ClientConfiguration_free(ClientConfiguration** cc)
+{
+ int i;
+ if (cc == NULL) {
+ return;
+ }
+ if ((*cc) == NULL) {
+ return;
+ }
+ if ((*cc)->keysFile) {
+ free((*cc)->keysFile);
+ (*cc)->keysFile = NULL;
+ }
+ if ((*cc)->storeFile) {
+ free((*cc)->storeFile);
+ (*cc)->storeFile = NULL;
+ }
+ if ((*cc)->realmsTable) {
+ for (i = 0; i < (*cc)->realmsNumber; ++i) {
+ if ((*cc)->realmsTable[i]) {
+ ClientRealm_free(&((*cc)->realmsTable[i]));
+ }
+ }
+ free((*cc)->realmsTable);
+ (*cc)->realmsTable = NULL;
+ }
+ free((*cc));
+ (*cc) = NULL;
+}
+
+/*
+ * Function name: ClientConfiguration_set_keysFile
+ * Description: Set keys filename.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * keysFile - keys filename
+ */
+
+void
+ClientConfiguration_set_keysFile(ClientConfiguration* cc, char* keysFile)
+{
+ if (cc == NULL) {
+ return;
+ }
+ string_cp(&(cc->keysFile), keysFile);
+}
+
+/*
+ * Function name: ClientConfiguration_set_storeFile
+ * Description: Set store filename.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * storeFile - store filename
+ */
+
+void
+ClientConfiguration_set_storeFile(ClientConfiguration* cc, char* storeFile)
+{
+ if (cc == NULL) {
+ return;
+ }
+ string_cp(&(cc->storeFile), storeFile);
+}
+
+/*
+ * Function name: ClientConfiguration_set_dateFormat
+ * Description: Set format of the date string.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * dateFormat - format of the date string
+ */
+
+void
+ClientConfiguration_set_dateFormat(ClientConfiguration* cc, char* dateFormat)
+{
+ if (cc == NULL) {
+ return;
+ }
+ string_cp(&(cc->dateFormat), dateFormat);
+}
+
+/*
+ * Function name: ClientConfiguration_set_realmsNumber
+ * Description: Set number of realms.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * realmsNumber - number of realms
+ */
+
+void
+ClientConfiguration_set_realmsNumber(ClientConfiguration* cc, int realmsNumber)
+{
+ if (cc == NULL) {
+ return;
+ }
+ cc->realmsNumber = realmsNumber;
+}
+
+/*
+ * Function name: ClientConfiguration_set_realmsTable
+ * Description: Set table of realms.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * realmsTable - table of realms
+ */
+
+void
+ClientConfiguration_set_realmsTable(ClientConfiguration* cc, ClientRealm** realmsTable)
+{
+ int i;
+ if (cc == NULL) {
+ return;
+ }
+ if (cc->realmsTable) {
+ for (i = 0; i < cc->realmsNumber; ++i) {
+ if (cc->realmsTable[i]) {
+ ClientRealm_free(&(cc->realmsTable[i]));
+ }
+ }
+ free(cc->realmsTable);
+ cc->realmsTable = NULL;
+ }
+ cc->realmsTable = realmsTable;
+}
+
+/*
+ * Function name: ClientConfiguration_set_ignorePublicKeys
+ * Description: Enable/disable the public keys checking.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * ignorePublicKeys - if the public keys checking is enabled/disabled
+ */
+
+void
+ClientConfiguration_set_ignorePublicKeys(ClientConfiguration* cc, char ignorePublicKeys)
+{
+ if (cc == NULL) {
+ return;
+ }
+ cc->ignorePublicKeys = ignorePublicKeys;
+}
+
+/*
+ * Function name: ClientConfiguration_get_keysFile
+ * Description: Get keys filename.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: Keys filename.
+ */
+
+char*
+ClientConfiguration_get_keysFile(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return NULL;
+ }
+ return cc->keysFile;
+}
+
+/*
+ * Function name: ClientConfiguration_get_storeFile
+ * Description: Get store filename.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: Store filename.
+ */
+
+char*
+ClientConfiguration_get_storeFile(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return NULL;
+ }
+ return cc->storeFile;
+}
+
+/*
+ * Function name: ClientConfiguration_get_dateFormat
+ * Description: Get format of the date string.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: Format of the date string.
+ */
+
+char*
+ClientConfiguration_get_dateFormat(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return NULL;
+ }
+ return cc->dateFormat;
+}
+
+/*
+ * Function name: ClientConfiguration_get_realmsNumber
+ * Description: Get number of realms.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: Number of realms.
+ */
+
+int
+ClientConfiguration_get_realmsNumber(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return -1;
+ }
+ return cc->realmsNumber;
+}
+
+/*
+ * Function name: ClientConfiguration_get_realmsTable
+ * Description: Get table of realms.
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: Table of realms.
+ */
+
+ClientRealm**
+ClientConfiguration_get_realmsTable(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return NULL;
+ }
+ return cc->realmsTable;
+}
+
+/*
+ * Function name: ClientConfiguration_get_ignorePublicKeys
+ * Description: Check if the public keys checking is enabled/disabled
+ * Arguments: cc - pointer to ClientConfiguration structure
+ * Returns: If the public keys checking is enabled/disabled.
+ */
+
+char
+ClientConfiguration_get_ignorePublicKeys(ClientConfiguration* cc)
+{
+ if (cc == NULL) {
+ return 0;
+ }
+ return cc->ignorePublicKeys;
+}