Fixed safe cracker door, added setup for safe door

This commit is contained in:
Michiel Broek
2002-05-05 17:34:07 +00:00
parent 5a57e59627
commit faa9dcbe4f
10 changed files with 377 additions and 340 deletions

View File

@@ -62,31 +62,49 @@ char *aka2str(fidoaddr aka)
/*
* Try to create a aka structure of a string.
*/
fidoaddr str2aka(char *addr)
{
char a[256];
static char b[43];
char *temp;
fidoaddr n;
char *p, *temp = NULL;
static fidoaddr n;
sprintf(b, "%s~", addr);
n.zone = 0;
n.net = 0;
n.node = 0;
n.point = 0;
n.domain[0] = '\0';
if ((strchr(b, ':') == NULL) || (strchr(b, '@') == NULL))
/*
* Safety check
*/
if (strlen(addr) > 42)
return n;
sprintf(b, "%s~", addr);
if ((strchr(b, ':') == NULL) || (strchr(b, '/') == NULL))
return n;
/* First split the f:n/n.p and domain part
/*
* First split the f:n/n.p and domain part
*/
temp = strtok(b, "@");
strcpy(n.domain, strtok(NULL, "~"));
if ((strchr(b, '@'))) {
temp = strtok(b, "@");
p = strtok(NULL, "~");
if (p)
strcpy(n.domain, p);
}
/* Handle f:n/n.p part
/*
* Handle f:n/n.p part
*/
strcpy(a, strcat(temp, "~"));
if (temp)
strcpy(a, strcat(temp, "~"));
else
strcpy(a, b);
if (strchr(a, '.') == NULL) {
n.zone = atoi(strtok(a, ":"));
n.net = atoi(strtok(NULL, "/"));
@@ -101,5 +119,3 @@ fidoaddr str2aka(char *addr)
}