Upgrading for TIC longfilenames

This commit is contained in:
Michiel Broek 2001-12-08 20:31:42 +00:00
parent 8ded931968
commit 8eebc55e6d
8 changed files with 135 additions and 168 deletions

View File

@ -4358,6 +4358,8 @@ v0.33.19 26-Oct-2001
For all files received in tic area, the crc of the tic area
name is stored in the filerecord. This is for the future
rescan option.
Implemented long filenames with hatch. Now uses ticfile key-
word Fullname for the long filename.
mbfile:
During check the file databases are reset to filemode 0660.

View File

@ -1269,7 +1269,7 @@ struct _nodes {
unsigned PackNetmail : 1; /* Pack netmail */
unsigned ARCmailCompat : 1; /* ARCmail Compatibility */
unsigned ARCmailAlpha : 1; /* Allow a..z ARCmail name */
unsigned xFNC : 1; /* FileName Conversion */
unsigned FNC : 1; /* Node needs 8.3 filenames*/
char xExtra[94];
time_t StartDate; /* Node start date */
@ -1504,7 +1504,7 @@ struct _filerecord {
char Origin[24]; /* Origin system */
char From[24]; /* From system */
char Crc[9]; /* CRC 32 */
char Replace[13]; /* Replace file */
char Replace[81]; /* Replace file */
char Magic[21]; /* Magic name */
char Desc[256]; /* Short description */
char LDesc[25][49]; /* Long description */

View File

@ -45,7 +45,7 @@
void ForwardFile(fidoaddr Node, fa_list *sbl)
{
char *subject = NULL, *fwdfile = NULL, *ticfile = NULL, fname[128];
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[128];
FILE *fp, *net;
char flavor;
faddr *dest, *route, *Fa;
@ -170,7 +170,16 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
subject = xstrcpy(TIC.TicIn.OrgName);
else
subject = xstrcpy(TIC.NewName);
fprintf(fp, "File %s\r\n", tu(subject));
if (nodes.FNC) {
temp = xstrcpy(subject);
name_mangle(temp);
fprintf(fp, "File %s\r\n", temp); // mbcico will send the file with this name
fprintf(fp, "Fullname %s\r\n", subject);
free(temp);
} else {
fprintf(fp, "File %s\r\n", tu(subject));
fprintf(fp, "Fullname %s\r\n", subject);
}
free(subject);
fprintf(fp, "Desc %s\r\n", TIC.TicIn.Desc);
fprintf(fp, "Crc %s\r\n", TIC.TicIn.Crc);

View File

@ -105,7 +105,7 @@ int CheckHatch(char *temp)
{
DIR *dp;
struct dirent *de;
char *fn, tf[81], tmp[4];
char *fn, tf[81], tmp[4], *temp2;
int i, Match, hatched = FALSE;
FILE *Tf;
@ -165,7 +165,12 @@ int CheckHatch(char *temp)
fprintf(Tf, "Replaces %s\r\n", hatch.Replace);
if (strlen(hatch.Magic))
fprintf(Tf, "Magic %s\r\n", hatch.Magic);
fprintf(Tf, "File %s\r\n", de->d_name);
temp2 = calloc(strlen(de->d_name) + 1, sizeof(char));
sprintf(temp2, "%s", de->d_name);
name_mangle(temp2);
fprintf(Tf, "File %s\r\n", temp2);
free(temp2);
fprintf(Tf, "Fullname %s\r\n", de->d_name);
fprintf(Tf, "Pth %s\r\n", temp);
fprintf(Tf, "Desc ");
for (i = 0; i < strlen(hatch.Desc); i++) {

View File

@ -105,6 +105,7 @@ int ProcessTic(fa_list *sbl, char *Realname)
*/
Temp2 = calloc(PATH_MAX, sizeof(char));
sprintf(Temp2, "%s%s", TIC.FilePath, Realname);
Syslog('f', "Realname with path \"%s\"", Temp2);
if (file_exist(Temp, R_OK) && !file_exist(Temp2, R_OK)) {
if (rename(Temp2, Temp))
WriteError("$Rename %s to %s failed", Temp2, Temp);

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbfido/tic.c
* $Id$
* Purpose ...............: Process .tic files
* Last modification date : 15-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -164,10 +163,10 @@ int Tic()
int LoadTic(char *inb, char *tfn)
{
FILE *tfp;
char *Temp, *Buf, *Log = NULL, *Realname;
char *Temp, *Buf, *Log = NULL;
int i, j, rc;
fa_list *sbl = NULL;
int Kwd, DescCnt = FALSE;
int DescCnt = FALSE;
if (CFG.slow_util && do_quiet)
usleep(1);
@ -187,116 +186,80 @@ int LoadTic(char *inb, char *tfn)
Temp = calloc(256, sizeof(char));
Buf = calloc(256, sizeof(char));
Realname = calloc(PATH_MAX, sizeof(char));
while ((fgets(Buf, 256, tfp)) != NULL) {
/*
* Remove all garbage from the .TIC file.
*/
Temp[0] = '\0';
j = 0;
for (i = 0; i < strlen(Buf); i++)
if ((Buf[i] >= ' ') || (Buf[i] < 0)) {
if (isprint(Buf[i])) {
Temp[j] = Buf[i];
j++;
}
Temp[j] = '\0';
Kwd = FALSE;
if (strncasecmp(Temp, "hatch", 5) == 0) {
TIC.TicIn.Hatch = TRUE;
if (strncasecmp(Temp, "hatch", 5) == 0)
Kwd = TIC.Hatch = TRUE;
} else if (TIC.TicIn.Hatch && (strncasecmp(Temp, "pth ", 4) == 0)) {
sprintf(TIC.TicIn.Pth, "%s/", Temp+4);
if (TIC.Hatch) {
if (strncasecmp(Temp, "pth ", 4) == 0) {
sprintf(TIC.FilePath, "%s/", Temp+4);
Kwd = TRUE;
}
} else if (TIC.TicIn.Hatch && (strncasecmp(Temp, "nomove", 6) == 0)) {
TIC.TicIn.NoMove = TRUE;
if (strncasecmp(Temp, "nomove", 6) == 0)
Kwd = TIC.NoMove = TRUE;
} else if (TIC.TicIn.Hatch && (strncasecmp(Temp, "hatchnew", 8) == 0)) {
TIC.TicIn.HatchNew = TRUE;
if (strncasecmp(Temp, "hatchnew", 8) == 0)
Kwd = TIC.HatchNew = TRUE;
}
} else if (strncasecmp(Temp, "area ", 5) == 0) {
strncpy(TIC.TicIn.Area, Temp+5, 20);
strncpy(T_File.Echo, Temp+5, 20);
if (strncasecmp(Temp, "area ", 5) == 0) {
strcpy(TIC.TicIn.Area, Temp+5);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "origin ", 7) == 0) {
strncpy(TIC.TicIn.Origin, Temp+7, 80);
strncpy(T_File.Origin, Temp+7, 80);
if (strncasecmp(Temp, "origin ", 7) == 0) {
strcpy(TIC.TicIn.Origin, Temp+7);
strcpy(T_File.Origin, Temp+7);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "from ", 5) == 0) {
strncpy(TIC.TicIn.From, Temp+5, 80);
strncpy(T_File.From, Temp+5, 80);
if (strncasecmp(Temp, "from ", 5) == 0) {
strcpy(TIC.TicIn.From, Temp+5);
strcpy(T_File.From, Temp+5);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "file ", 5) == 0) {
strncpy(TIC.TicIn.File, Temp+5, 80);
if (strncasecmp(Temp, "file ", 5) == 0) {
sprintf(Realname, "%s", Temp+5); /* Moved here for test Michiel/Redy */
if (TIC.Hatch)
strcpy(TIC.TicIn.OrgName, Temp+5);
else
strcpy(TIC.TicIn.OrgName, tl(Temp+5));
// sprintf(Realname, "%s", Temp+5); /* Temp removed */
strcpy(TIC.NewName, TIC.TicIn.OrgName);
strcpy(T_File.Name, TIC.TicIn.OrgName);
Kwd = TRUE;
}
if (strncasecmp(Temp, "fullname", 8) == 0) {
strcpy(TIC.TicIn.LName, Temp+8);
} else if (strncasecmp(Temp, "fullname ", 9) == 0) {
strncpy(TIC.TicIn.FullName, Temp+9, 80);
Syslog('f', "Long filename: %s", TIC.TicIn.LName);
}
if (strncasecmp(Temp, "created ", 8) == 0) {
strcpy(TIC.TicIn.Created, Temp+8);
Kwd = TRUE;
}
if (strncasecmp(Temp, "magic ", 6) == 0) {
strcpy(TIC.TicIn.Magic, Temp+6);
strcpy(T_File.Magic, Temp+6);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "created ", 8) == 0) {
strncpy(TIC.TicIn.Created, Temp+8, 80);
if (strncasecmp(Temp, "crc ", 4) == 0) {
} else if (strncasecmp(Temp, "magic ", 6) == 0) {
strncpy(TIC.TicIn.Magic, Temp+6, 20);
strncpy(T_File.Magic, Temp+6, 20);
} else if (strncasecmp(Temp, "crc ", 4) == 0) {
TIC.Crc_Int = strtoul(Temp+4, (char **)NULL, 16);
sprintf(TIC.TicIn.Crc, "%08lX", TIC.Crc_Int);
strcpy(T_File.Crc, TIC.TicIn.Crc);
Kwd = TRUE;
}
if (strncasecmp(Temp, "pw ", 3) == 0) {
strcpy(TIC.TicIn.Pw, Temp+3);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "pw ", 3) == 0) {
strncpy(TIC.TicIn.Pw, Temp+3, 20);
if (strncasecmp(Temp, "replaces ", 9) == 0) {
strcpy(TIC.TicIn.Replace, Temp+9);
strcpy(T_File.Replace, Temp+9);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "replaces ", 9) == 0) {
strncpy(TIC.TicIn.Replace, Temp+9, 80);
strncpy(T_File.Replace, Temp+9, 80);
if (strncasecmp(Temp, "desc ", 5) == 0) {
} else if (strncasecmp(Temp, "desc ", 5) == 0) {
if (!DescCnt) {
strcpy(TIC.TicIn.Desc, Temp+5);
strcpy(T_File.Desc, TIC.TicIn.Desc);
Kwd = TRUE;
strncpy(TIC.TicIn.Desc, Temp+5, 255);
strncpy(T_File.Desc, TIC.TicIn.Desc, 255);
DescCnt = TRUE;
} else {
Syslog('!', "More than one \"Desc\" line");
}
}
if (strncasecmp(Temp, "path ", 5) == 0) {
strcpy(TIC.TicIn.Path[TIC.TicIn.TotPath], Temp+5);
} else if (strncasecmp(Temp, "path ", 5) == 0) {
strncpy(TIC.TicIn.Path[TIC.TicIn.TotPath], Temp+5, 80);
TIC.TicIn.TotPath++;
TIC.Aka.zone = atoi(strtok(Temp+5, ":"));
TIC.Aka.net = atoi(strtok(NULL, "/"));
@ -307,69 +270,46 @@ int LoadTic(char *inb, char *tfn)
(CFG.aka[i].net == TIC.Aka.net) &&
(CFG.aka[i].node == TIC.Aka.node) &&
(!CFG.aka[i].point))
TIC.PathErr = TRUE;
Kwd = TRUE;
}
if (strncasecmp(Temp, "seenby ", 7) == 0) {
TIC.TicIn.PathError = TRUE;
} else if (strncasecmp(Temp, "seenby ", 7) == 0) {
fill_list(&sbl, Temp+7, NULL);
Kwd = TRUE;
}
if (strncasecmp(Temp, "areadesc ", 9) == 0) {
strcpy(TIC.TicIn.AreaDesc, Temp+9);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "areadesc ", 9) == 0) {
strncpy(TIC.TicIn.AreaDesc, Temp+9, 60);
if (strncasecmp(Temp, "to ", 3) == 0) {
} else if (strncasecmp(Temp, "to ", 3) == 0) {
/*
* Drop this one
*/
Kwd = TRUE;
}
if (strncasecmp(Temp, "size ", 5) == 0) {
} else if (strncasecmp(Temp, "size ", 5) == 0) {
TIC.TicIn.Size = atoi(Temp+5);
Kwd = TRUE;
}
if (strncasecmp(Temp, "date ", 5) == 0) {
} else if (strncasecmp(Temp, "date ", 5) == 0) {
Syslog('f', "Date: %s", Temp+5);
Kwd = TRUE;
}
if (strncasecmp(Temp, "cost ", 5) == 0) {
TIC.TicIn.UplinkCost = atoi(Temp+5);
Kwd = TRUE;
}
} else if (strncasecmp(Temp, "cost ", 5) == 0) {
TIC.TicIn.Cost = atoi(Temp+5);
if (strncasecmp(Temp, "ldesc ", 6) == 0) {
} else if (strncasecmp(Temp, "ldesc ", 6) == 0) {
if (TIC.TicIn.TotLDesc < 25) {
Temp[86] = '\0';
strcpy(TIC.TicIn.LDesc[TIC.TicIn.TotLDesc], Temp+6);
strncpy(TIC.TicIn.LDesc[TIC.TicIn.TotLDesc], Temp+6, 80);
TIC.TicIn.TotLDesc++;
}
Kwd = TRUE;
}
/*
* If we didn't find a matching keyword it is a line we
* will just remember and forward if there are downlinks.
*/
if (!Kwd) {
} else if (strncasecmp(Temp, "destination ", 12) != 0) {
/*
* Consider Destination keyword not as a passthru
* line and drop it.
* Drop this one
*/
if (strncasecmp(Temp, "destination ", 12) != 0) {
if (TIC.TicIn.Unknowns < 25) {
strcpy(TIC.TicIn.Unknown[TIC.TicIn.Unknowns], Temp);
TIC.TicIn.Unknowns++;
}
} else {
/*
* If we didn't find a matching keyword it is a line we
* will just remember and forward if there are downlinks.
*/
if (TIC.TicIn.Unknowns < 25) {
strcpy(TIC.TicIn.Unknown[TIC.TicIn.Unknowns], Temp);
TIC.TicIn.Unknowns++;
}
}
}
fclose(tfp);
if (TIC.TicIn.TotLDesc) {
@ -386,7 +326,7 @@ int LoadTic(char *inb, char *tfn)
if (TIC.TicIn.TotLDesc) {
T_File.TotLdesc = TIC.TicIn.TotLDesc;
for (i = 0; i <= TIC.TicIn.TotLDesc; i++)
strcpy(T_File.LDesc[i], TIC.TicIn.LDesc[i]);
strncpy(T_File.LDesc[i], TIC.TicIn.LDesc[i], 48);
}
/*
@ -404,7 +344,7 @@ int LoadTic(char *inb, char *tfn)
/*
* Show in logfile what we are doing
*/
Syslog('+', "Processing %s, %s area %s from %s", TIC.TicName, TIC.TicIn.OrgName, TIC.TicIn.Area, TIC.TicIn.From);
Syslog('+', "Processing %s, %s area %s from %s", TIC.TicName, TIC.TicIn.File, TIC.TicIn.Area, TIC.TicIn.From);
Syslog('+', "+- %s", TIC.TicIn.Created);
Log = NULL;
@ -425,13 +365,13 @@ int LoadTic(char *inb, char *tfn)
Log = NULL;
}
sprintf(Temp, "%s", TIC.TicIn.From);
strcpy(Temp, TIC.TicIn.From);
TIC.Aka.zone = atoi(strtok(Temp, ":"));
TIC.Aka.net = atoi(strtok(NULL, "/"));
TIC.Aka.node = atoi(strtok(NULL, "@\0"));
if (SearchFidonet(TIC.Aka.zone))
strcpy(TIC.Aka.domain, fidonet.domain);
sprintf(Temp, "%s", TIC.TicIn.Origin);
strcpy(Temp, TIC.TicIn.Origin);
TIC.OrgAka.zone = atoi(strtok(Temp, ":"));
TIC.OrgAka.net = atoi(strtok(NULL, "/"));
TIC.OrgAka.node = atoi(strtok(NULL, "@\0"));
@ -441,9 +381,8 @@ int LoadTic(char *inb, char *tfn)
free(Buf);
tic_in++;
rc = ProcessTic(sbl, Realname);
rc = ProcessTic(sbl);
tidy_falist(&sbl);
free(Realname);
return rc;
}

View File

@ -1,13 +1,20 @@
/* $Id$ */
#ifndef _TIC_H
#define _TIC_H
typedef struct _tic_in {
unsigned Hatch : 1; /* Hatch keyword */
unsigned NoMove : 1; /* Nomove keyword */
unsigned HatchNew : 1; /* Hatchnew keyword */
unsigned PathError : 1; /* Our system is in path */
char Pth[PATH_MAX]; /* Path to hatched file */
char Area[21]; /* Area name */
char Origin[81]; /* Origin address */
char From[81]; /* From name */
char OrgName[81]; /* Original filename */
char LName[81]; /* Long filename */
char File[81]; /* File keyword */
char FullName[256]; /* Long filename */
char Replace[81]; /* File to replace */
char Created[81]; /* Created text */
char Path[25][81]; /* Travelled path */
@ -18,7 +25,7 @@ typedef struct _tic_in {
char Pw[21]; /* Password */
char AreaDesc[61]; /* Area description */
char Date[61]; /* Date field */
long UplinkCost; /* Uplink cost */
long Cost; /* Uplink cost */
off_t Size; /* Size of file */
char LDesc[25][81]; /* Long description */
int TotLDesc; /* Total lines */
@ -35,6 +42,7 @@ typedef struct _TICrec {
fidoaddr OrgAka; /* Origin address */
fidoaddr Aka; /* An address ? */
char NewName[81]; /* New name of file */
char RealName[81]; /* Real name on disk */
char File_Id[25][49]; /* Description */
int File_Id_Ct; /* Nr of lines */
unsigned long Crc_Int; /* Crc value */
@ -45,7 +53,6 @@ typedef struct _TICrec {
char FilePath[PATH_MAX]; /* Path to the file */
unsigned PathErr : 1; /* If path error */
unsigned OtherPath : 1; /* If otherpath is true */
unsigned Hatch : 1; /* If internal hatched */
unsigned NoMove : 1; /* No move magic */
unsigned HatchNew : 1; /* Hatch in new areas */
unsigned SendOrg : 1; /* Send original file */

View File

@ -626,15 +626,16 @@ void NScreen(void)
mvprintw(18,31, "18. Statistics");
mvprintw(19,31, "19. No EMSI");
mvprintw(11,51, "20. No YooHoo/2U2");
mvprintw(12,51, "21. No Filerequest");
mvprintw(13,51, "22. Don't call");
mvprintw(14,51, "23. No Hold mail");
mvprintw(15,51, "24. Pickup primary");
mvprintw(16,51, "25. No Zmodem");
mvprintw(17,51, "26. No Zedzap");
mvprintw(18,51, "27. No Hydra");
mvprintw(19,51, "28. No TCP/IP");
mvprintw(10,51, "20. No YooHoo/2U2");
mvprintw(11,51, "21. No Filerequest");
mvprintw(12,51, "22. Don't call");
mvprintw(13,51, "23. No Hold mail");
mvprintw(14,51, "24. Pickup primary");
mvprintw(15,51, "25. No Zmodem");
mvprintw(16,51, "26. No Zedzap");
mvprintw(17,51, "27. No Hydra");
mvprintw(18,51, "28. No TCP/IP");
mvprintw(19,51, "29. 8.3 names");
}
@ -755,17 +756,18 @@ int EditNodeRec(int Area)
show_str(18,21,1, temp1);
show_bool(19,21, nodes.Deleted);
show_bool(19,47, nodes.NoEMSI);
show_bool(11,70, nodes.NoWaZOO);
show_bool(12,70, nodes.NoFreqs);
show_bool(13,70, nodes.NoCall);
show_bool(14,70, nodes.NoHold);
show_bool(15,70, nodes.NoPUA);
show_bool(16,70, nodes.NoZmodem);
show_bool(17,70, nodes.NoZedzap);
show_bool(18,70, nodes.NoHydra);
show_bool(19,70, nodes.NoTCP);
show_bool(10,70, nodes.NoWaZOO);
show_bool(11,70, nodes.NoFreqs);
show_bool(12,70, nodes.NoCall);
show_bool(13,70, nodes.NoHold);
show_bool(14,70, nodes.NoPUA);
show_bool(15,70, nodes.NoZmodem);
show_bool(16,70, nodes.NoZedzap);
show_bool(17,70, nodes.NoHydra);
show_bool(18,70, nodes.NoTCP);
show_bool(19,70, nodes.FNC);
switch(select_menu(28)) {
switch(select_menu(29)) {
case 0: crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&nodes, crc1, nodeshdr.recsize);
if ((crc != crc1) || GrpChanged) {
@ -865,15 +867,16 @@ int EditNodeRec(int Area)
NScreen(); break;
case 18:S_Stat(); NScreen(); break;
case 19:E_BOOL(19,47, nodes.NoEMSI, "Disable ^EMSI handshake^ with this node")
case 20:E_BOOL(11,70, nodes.NoWaZOO, "Disable ^YooHoo/2U2 handshake^ (FTSC-0006) with this node")
case 21:E_BOOL(12,70, nodes.NoFreqs, "Disallow ^file requests^ from this node")
case 22:E_BOOL(13,70, nodes.NoCall, "Don't ^call^ this node")
case 23:E_BOOL(14,70, nodes.NoHold, "Don't ^hold hold-mail^ when we call (no = only pickup)")
case 24:E_BOOL(15,70, nodes.NoPUA, "Only pickup mail from the ^primary^ address")
case 25:E_BOOL(16,70, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node")
case 26:E_BOOL(17,70, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node")
case 27:E_BOOL(18,70, nodes.NoHydra, "Disable ^Hydra^ protocol with this node")
case 28:E_BOOL(19,70, nodes.NoTCP, "Disable ^TCP/IP^ protocol whith this node")
case 20:E_BOOL(10,70, nodes.NoWaZOO, "Disable ^YooHoo/2U2 handshake^ (FTSC-0006) with this node")
case 21:E_BOOL(11,70, nodes.NoFreqs, "Disallow ^file requests^ from this node")
case 22:E_BOOL(12,70, nodes.NoCall, "Don't ^call^ this node")
case 23:E_BOOL(13,70, nodes.NoHold, "Don't ^hold hold-mail^ when we call (no = only pickup)")
case 24:E_BOOL(14,70, nodes.NoPUA, "Only pickup mail from the ^primary^ address")
case 25:E_BOOL(15,70, nodes.NoZmodem, "Disable ^Zmodem^ protocol with this node")
case 26:E_BOOL(16,70, nodes.NoZedzap, "Disable ^Zedzap^ protocol with this node")
case 27:E_BOOL(17,70, nodes.NoHydra, "Disable ^Hydra^ protocol with this node")
case 28:E_BOOL(18,70, nodes.NoTCP, "Disable ^TCP/IP^ protocol whith this node")
case 29:E_BOOL(19,70, nodes.FNC, "Node needs ^DOS 8.3^ filenames")
}
}
}
@ -1177,7 +1180,8 @@ int node_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " No TCP/IP %s", getboolean(nodes.NoTCP));
fprintf(fp, " Pack Netmail %s\n", getboolean(nodes.PackNetmail));
fprintf(fp, " ARCmail comp. %s", getboolean(nodes.ARCmailCompat));
fprintf(fp, " ACRmail a..z %s\n\n", getboolean(nodes.ARCmailAlpha));
fprintf(fp, " ACRmail a..z %s", getboolean(nodes.ARCmailAlpha));
fprintf(fp, " 8.3 filenames %s\n\n", getboolean(nodes.FNC));
fprintf(fp, " Statistics Send KBytes Received KBytes\n");
fprintf(fp, " ------------ -------- -------- -------- --------\n");