diff options
author | Jakub Sławiński | 2004-01-09 18:48:31 +0100 |
---|---|---|
committer | Joshua Judson Rosen | 2014-07-17 21:14:55 +0200 |
commit | c691251feaffa310a51e0c2255eefc6b42f0e728 (patch) | |
tree | f7202a10873641aad3c93850948ec3d969c97735 /file.c | |
parent | v0.5.2 (diff) | |
download | apf-c691251feaffa310a51e0c2255eefc6b42f0e728.tar.gz |
v0.5.3
- Added: client password identification (weak)
- Added: sigint intercepting and server closing
- Modified: communication between server and client
- Added: 'nossl' and 'nozlib' modes
- Added: zlib support
- Lightly Modified: verbose mode
- Modified/Added: help screen and long options support
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -19,6 +19,7 @@ */ #include "file.h" +#include "activefor.h" #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -29,7 +30,7 @@ parsefile(char* name, int* status) { static ConfigurationT cfg; FILE* file = NULL; - int state; + int state, i, n; char buff[256]; char helpbuf1[256]; char helpbuf2[256]; @@ -75,6 +76,17 @@ parsefile(char* name, int* status) if (state == 1) { if (strcmp(helpbuf1, "newrealm")==0) { ++cfg.size; + TYPE_SET_SSL(cfg.realmtable[cfg.size-1].type); + TYPE_SET_ZLIB(cfg.realmtable[cfg.size-1].type); + } + else if (cfg.size == 0) { + return cfg; + } + else if (strcmp(helpbuf1, "nossl")==0) { + TYPE_UNSET_SSL(cfg.realmtable[cfg.size-1].type); + } + else if (strcmp(helpbuf1, "nozlib")==0) { + TYPE_UNSET_ZLIB(cfg.realmtable[cfg.size-1].type); } else { return cfg; @@ -120,6 +132,12 @@ parsefile(char* name, int* status) sizeof(char)); strcpy(cfg.realmtable[cfg.size-1].lisportnum, helpbuf2); } + else if (strcmp(helpbuf1, "pass")==0) { + n = strlen(helpbuf2); + for (i = 0; i < n; ++i) { + cfg.realmtable[cfg.size-1].pass[i%4] += helpbuf2[i]; + } + } else if (strcmp(helpbuf1, "manage")==0) { cfg.realmtable[cfg.size-1].manportnum = calloc(strlen(helpbuf2)+1, sizeof(char)); @@ -130,15 +148,15 @@ parsefile(char* name, int* status) sizeof(char)); strcpy(cfg.realmtable[cfg.size-1].users, helpbuf2); } - else if (strcmp(helpbuf1, "type")==0) { - if (cfg.realmtable[cfg.size-1].type != 0) { + else if (strcmp(helpbuf1, "proto")==0) { + if (TYPE_IS_SET(cfg.realmtable[cfg.size-1].type)) { return cfg; } if (strcmp(helpbuf2, "tcp")==0) { - cfg.realmtable[cfg.size-1].type = 1; + TYPE_SET_TCP(cfg.realmtable[cfg.size-1].type); } else if (strcmp(helpbuf2, "udp")==0) { - cfg.realmtable[cfg.size-1].type = 2; + TYPE_SET_UDP(cfg.realmtable[cfg.size-1].type); } else { return cfg; |