Development of improved tic processing

This commit is contained in:
Michiel Broek
2002-11-26 20:35:50 +00:00
parent c8f93b2ac5
commit 2283b37d27
9 changed files with 422 additions and 381 deletions

View File

@@ -62,12 +62,6 @@ int Add_BBS()
int Keep = 0, DidDelete = FALSE;
fd_list *fdl = NULL;
/*
* First create 8.3 filename
*/
sprintf(temp1, "%s", TIC.NewName);
name_mangle(temp1);
/*
* First check for an existing record with the same filename,
* if it exists, update the record and we are ready. This will
@@ -77,9 +71,9 @@ int Add_BBS()
sprintf(fdbname, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), tic.FileArea);
if ((fdb = fopen(fdbname, "r+")) != NULL) {
while (fread(&frec, sizeof(frec), 1, fdb) == 1) {
if ((strcmp(frec.Name, temp1) == 0) && (strcmp(frec.LName, TIC.NewName) == 0)) {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewName);
sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewName);
if (strcmp(frec.Name, TIC.NewFile) == 0) {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewFile);
mkdirs(temp2, 0755);
if ((rc = file_cp(temp1, temp2))) {
WriteError("Copy to %s failed: %s", temp2, strerror(rc));
@@ -112,12 +106,24 @@ int Add_BBS()
fclose(fdb);
}
Syslog('f', "addbbs 1");
/*
* Create filedatabase record.
*/
memset(&frec, 0, sizeof(frec));
strcpy(frec.Name, temp1);
strcpy(frec.LName, TIC.NewName);
strncpy(frec.Name, TIC.NewFile, sizeof(frec.Name) -1);
if (strlen(TIC.NewFullName)) {
strncpy(frec.LName, TIC.NewFullName, sizeof(frec.LName) -1);
} else {
/*
* No LFN, fake it with a lowercase copy of the 8.3 filename.
*/
strncpy(frec.LName, TIC.NewFile, sizeof(frec.LName) -1);
for (i = 0; i < strlen(frec.LName); i++)
frec.LName[i] = tolower(frec.LName[i]);
}
Syslog('f', "addbbs 2");
frec.TicAreaCRC = StringCRC32(TIC.TicIn.Area);
frec.Size = TIC.FileSize;
frec.Crc32 = TIC.Crc_Int;
@@ -133,8 +139,9 @@ int Add_BBS()
if (strlen(TIC.TicIn.Magic))
sprintf(frec.Desc[i], "Magic Request: %s", TIC.TicIn.Magic);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewName);
sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewName);
Syslog('f', "addbbs 3");
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
sprintf(temp2, "%s/%s", TIC.BBSpath, frec.Name);
mkdirs(temp2, 0755);
if ((rc = file_cp(temp1, temp2))) {
@@ -143,11 +150,12 @@ int Add_BBS()
}
chmod(temp2, 0644);
lname = calloc(PATH_MAX, sizeof(char));
sprintf(lname, "%s/%s", TIC.BBSpath, frec.Name);
sprintf(lname, "%s/%s", TIC.BBSpath, frec.LName);
if (link(temp2, lname)) {
WriteError("$Create link %s to %s failed", lname, temp2);
WriteError("$Create link %s to %s failed", temp2, lname);
}
free(lname);
Syslog('f', "addbbs 4");
sprintf(fdbtemp, "%s/fdb/fdb%ld.temp", getenv("MBSE_ROOT"), tic.FileArea);
@@ -173,6 +181,7 @@ int Add_BBS()
tic_imp++;
return TRUE;
}
Syslog('f', "addbbs 5");
/*
* There are already files in the area. We must now see at
@@ -196,6 +205,7 @@ int Add_BBS()
}
} while ((!Found) && (!Done));
Syslog('f', "addbbs 6");
if (Found) {
if ((fdt = fopen(fdbtemp, "a+")) == NULL) {
WriteError("$Can't create %s", fdbtemp);
@@ -246,6 +256,7 @@ int Add_BBS()
}
fclose(fdt);
fclose(fdb);
Syslog('f', "addbbs 7");
/*
* Now make the changes for real.
@@ -273,6 +284,7 @@ int Add_BBS()
if ((i = file_rm(temp1)))
WriteError("file_rm(%s): %s", temp1, strerror(i));
Syslog('f', "addbbs 8");
/*
* Handle the replace option.
*/
@@ -282,10 +294,11 @@ int Add_BBS()
if ((fdb = fopen(fdbname, "r+")) != NULL) {
while (fread(&file, sizeof(file), 1, fdb) == 1) {
if (strlen(file.LName) == strlen(TIC.NewName)) {
if (strcasecmp(file.LName, TIC.NewName) != 0) {
if (strlen(file.LName) == strlen(frec.LName)) {
// FIXME: Search must be based on a reg_exp search
if (strcasecmp(file.LName, frec.LName) != 0) {
Found = TRUE;
for (i = 0; i < strlen(TIC.NewName); i++) {
for (i = 0; i < strlen(frec.LName); i++) {
if ((TIC.TicIn.Replace[i] != '?') && (toupper(TIC.TicIn.Replace[i]) != toupper(file.LName[i])))
Found = FALSE;
}
@@ -302,33 +315,37 @@ int Add_BBS()
fclose(fdb);
}
}
Syslog('f', "addbbs 9");
/*
* Handle the Keep number of files option
*/
if (TIC.KeepNum) {
Syslog('f', "AddBBS, handle KeepNum %d", TIC.KeepNum);
if ((fdb = fopen(fdbname, "r")) != NULL) {
while (fread(&file, sizeof(file), 1, fdb) == 1) {
if ((strlen(file.LName) == strlen(TIC.NewName)) && (!file.Deleted)) {
if ((strlen(file.LName) == strlen(frec.LName)) && (!file.Deleted)) {
Found = TRUE;
for (i = 0; i < strlen(file.LName); i++) {
if ((TIC.NewName[i] < '0') || (TIC.NewName[i] > '9')) {
if (TIC.NewName[i] != file.LName[i]) {
if ((frec.LName[i] < '0') || (frec.LName[i] > '9')) {
if (frec.LName[i] != file.LName[i]) {
Found = FALSE;
}
}
}
if (Found) {
Keep++;
Syslog('f', "Add \"%s\" to keeplist", file.LName);
fill_fdlist(&fdl, file.LName, file.UploadDate);
}
}
}
fclose(fdb);
}
Syslog('f', "addbbs 10");
/*
* If there are files to delete, mark them.
@@ -356,6 +373,7 @@ int Add_BBS()
}
tidy_fdlist(&fdl);
}
Syslog('f', "addbbs 11");
/*
* Now realy delete the marked files and clean the file
@@ -389,6 +407,7 @@ int Add_BBS()
DidDelete = FALSE;
}
}
Syslog('f', "addbbs 12");
tic_imp++;
return TRUE;

View File

@@ -49,7 +49,7 @@
void ForwardFile(fidoaddr Node, fa_list *sbl)
{
char *subject = NULL, *temp, *fwdfile = NULL, *queuedir, *listfile, *ticfile = NULL, fname[PATH_MAX], *ticname, flavor;
char *subject = NULL, *fwdfile = NULL, *queuedir, *listfile, *ticfile = NULL, fname[PATH_MAX], *ticname, flavor;
FILE *fp, *fi, *fl, *net;
faddr *dest, *routeto, *Fa, *Temp, *ba;
int i, z, n;
@@ -103,17 +103,14 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
* Create the full filename
*/
if (TIC.PassThru || TIC.SendOrg) {
sprintf(fwdfile, "%s/%s", TIC.Inbound, TIC.RealName);
subject = xstrcpy(TIC.RealName);
sprintf(fwdfile, "%s/%s", TIC.Inbound, TIC.TicIn.File);
subject = xstrcpy(TIC.TicIn.File);
} else {
/*
* Make sure the file attach is the 8.3 filename
*/
temp = xstrcpy(TIC.NewName);
name_mangle(temp);
sprintf(fwdfile, "%s/%s", TIC.BBSpath, temp);
subject = xstrcpy(temp);
free(temp);
sprintf(fwdfile, "%s/%s", TIC.BBSpath, TIC.NewFile);
subject = xstrcpy(TIC.NewFile);
}
flavor = 'f';
@@ -152,7 +149,10 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
MacroVars("b", "s", tic.Comment);
MacroVars("c", "d", TIC.FileCost);
MacroVars("d", "s", fgroup.Comment);
MacroVars("f", "s", TIC.TicIn.FullName);
if (TIC.PassThru || TIC.SendOrg)
MacroVars("f", "s", TIC.TicIn.FullName);
else
MacroVars("f", "s", TIC.NewFullName);
MacroVars("g", "d", TIC.FileSize);
MacroVars("h", "d", (TIC.FileSize / 1024));
MacroVars("i", "s", TIC.TicIn.Crc);
@@ -160,10 +160,10 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
MacroVars("m", "s", rfcdate(ftime));
MacroVars("n", "s", TIC.TicIn.Desc);
MacroVars("s", "s", nodes.Sysop);
if (TIC.SendOrg)
MacroVars("e", "s", TIC.RealName);
if (TIC.PassThru || TIC.SendOrg)
MacroVars("e", "s", TIC.TicIn.File);
else
MacroVars("e", "s", TIC.NewName);
MacroVars("e", "s", TIC.NewFile);
if (strlen(TIC.TicIn.Magic))
MacroVars("k", "s", TIC.TicIn.Magic);
if (strlen(TIC.TicIn.Replace))
@@ -195,26 +195,15 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
if (strlen(TIC.TicIn.Magic))
fprintf(fp, "Magic %s\r\n", TIC.TicIn.Magic);
if ((TIC.PassThru) || (TIC.SendOrg))
subject = xstrcpy(TIC.RealName);
else
subject = xstrcpy(TIC.NewName);
/*
* Create 8.3 filename if this is a long filename. In normal
* cases mbcico will transmit the long filename to the other
* node. If they can't process the TIC files which has a short
* 8.3 filename and they have a long filename in the inbound
* then in mbsetup these nodes need to be set to 8.3 filenames.
* The mailer will then transmit the file with a 8.3 name.
* Thank the inventors of the 8.3 filenames for this.
*/
temp = xstrcpy(subject);
name_mangle(temp);
fprintf(fp, "File %s\r\n", temp);
fprintf(fp, "Fullname %s\r\n", subject);
free(temp);
free(subject);
if ((TIC.PassThru) || (TIC.SendOrg)) {
fprintf(fp, "File %s\r\n", TIC.TicIn.File);
if (strlen(TIC.TicIn.FullName))
fprintf(fp, "Fullname %s\r\n", TIC.TicIn.FullName);
} else {
fprintf(fp, "File %s\r\n", TIC.NewFile);
if (strlen(TIC.NewFullName))
fprintf(fp, "Fullname %s\r\n", TIC.NewFullName);
}
fprintf(fp, "Size %ld\r\n", (long)(TIC.FileSize));
fprintf(fp, "Desc %s\r\n", TIC.TicIn.Desc);
fprintf(fp, "Crc %s\r\n", TIC.TicIn.Crc);
@@ -319,7 +308,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
if ((fp = fopen(fname, "a+")) != NULL) {
memset(&bill, 0, sizeof(bill));
bill.Node = nodes.Aka[0];
strcpy(bill.FileName, TIC.NewName);
strcpy(bill.FileName, TIC.NewFile);
strcpy(bill.FileEcho, TIC.TicIn.Area);
bill.Size = TIC.FileSize;
bill.Cost = TIC.FileCost;

View File

@@ -50,51 +50,36 @@ int Magics = 0; /* Processed magics */
char *Magic_Macro(int);
char *Magic_Macro(int C)
{
static char buf[PATH_MAX];
static char buf[PATH_MAX];
buf[0] = '\0';
switch(toupper(C)) {
case 'F':
sprintf(buf, "%s/%s", TIC.BBSpath, TIC.NewName);
break;
buf[0] = '\0';
switch(toupper(C)) {
case 'F': sprintf(buf, "%s/%s", TIC.BBSpath, TIC.NewFile);
break;
case 'P': sprintf(buf, "%s", TIC.BBSpath);
break;
case 'N': sprintf(buf, "%s", strtok(strdup(TIC.NewFile), "."));
break;
case 'E': sprintf(buf, "%s", strrchr(TIC.NewFile, '.'));
break;
case 'L': sprintf(buf, "%s", strrchr(TIC.NewFile, '.'));
buf[0] = buf[1];
buf[1] = buf[2];
buf[2] = '\0';
break;
case 'D': sprintf(buf, "%03d", Day_Of_Year());
break;
case 'C': sprintf(buf, "%03d", Day_Of_Year());
buf[0] = buf[1];
buf[1] = buf[2];
buf[2] = '\0';
break;
case 'A': sprintf(buf, "%s", TIC.TicIn.Area);
break;
}
case 'P':
sprintf(buf, "%s", TIC.BBSpath);
break;
case 'N':
sprintf(buf, "%s", strtok(strdup(TIC.NewName), "."));
break;
case 'E':
sprintf(buf, "%s", strrchr(TIC.NewName, '.'));
break;
case 'L':
sprintf(buf, "%s", strrchr(TIC.NewName, '.'));
buf[0] = buf[1];
buf[1] = buf[2];
buf[2] = '\0';
break;
case 'D':
sprintf(buf, "%03d", Day_Of_Year());
break;
case 'C':
sprintf(buf, "%03d", Day_Of_Year());
buf[0] = buf[1];
buf[1] = buf[2];
buf[2] = '\0';
break;
case 'A':
sprintf(buf, "%s", TIC.TicIn.Area);
break;
}
Syslog('f', "Mgc Macro(%c): \"%s\"", C, buf);
return buf;
Syslog('f', "Mgc Macro(%c): \"%s\"", C, buf);
return buf;
}
@@ -154,7 +139,7 @@ int GetMagicRec(int Typ, int First)
*q = '\0';
if ((re_comp(mask)) == NULL) {
if (re_exec(TIC.NewName)) {
if (re_exec(TIC.NewFile)) {
fclose(FeM);
free(temp);
return TRUE;
@@ -179,18 +164,18 @@ int GetMagicRec(int Typ, int First)
void MagicResult(char *format, ...)
{
char *outputstr;
va_list va_ptr;
char *outputstr;
va_list va_ptr;
outputstr = calloc(1024, sizeof(char));
outputstr = calloc(1024, sizeof(char));
va_start(va_ptr, format);
vsprintf(outputstr, format, va_ptr);
va_end(va_ptr);
va_start(va_ptr, format);
vsprintf(outputstr, format, va_ptr);
va_end(va_ptr);
Syslog('+', "Magic: %s", outputstr);
free(outputstr);
Magics++;
Syslog('+', "Magic: %s", outputstr);
free(outputstr);
Magics++;
}
@@ -198,96 +183,94 @@ void MagicResult(char *format, ...)
void Magic_CheckCompile(void);
void Magic_CheckCompile(void)
{
if (magic.Compile) {
CompileNL = TRUE;
Syslog('+', "Magic: Trigger Compile Nodelists");
}
if (magic.Compile) {
CompileNL = TRUE;
Syslog('+', "Magic: Trigger Compile Nodelists");
}
}
int Magic_MoveFile(void)
{
if (GetMagicRec(MG_MOVE, TRUE)) {
strcpy(TIC.TicIn.Area, magic.ToArea);
MagicResult((char *)"Move %s to Area %s", TIC.RealName, TIC.TicIn.Area);
return TRUE;
} else
return FALSE;
if (GetMagicRec(MG_MOVE, TRUE)) {
strcpy(TIC.TicIn.Area, magic.ToArea);
MagicResult((char *)"Move %s to Area %s", TIC.NewFile, TIC.TicIn.Area);
return TRUE;
} else
return FALSE;
}
void Magic_ExecCommand(void)
{
int i, j, k, Err, First = TRUE;
char Line[256];
char Temp[PATH_MAX];
char *cmd, *opts;
int i, j, k, Err, First = TRUE;
char Line[256], Temp[PATH_MAX], *cmd, *opts;
while (GetMagicRec(MG_EXEC, First)) {
First = FALSE;
j = 0;
memset(&Line, 0, sizeof(Line));
for (i = 0; i < strlen(magic.Cmd); i++) {
if (magic.Cmd[i] != '%') {
Line[j] = magic.Cmd[i];
j++;
} else {
i++;
if (magic.Cmd[i] == '%') {
Line[j] = '%';
j++;
} else {
Temp[0] = '\0';
sprintf(Temp, "%s", Magic_Macro(magic.Cmd[i]));
for (k = 0; k < strlen(Temp); k++) {
Line[j] = Temp[k];
j++;
}
}
}
while (GetMagicRec(MG_EXEC, First)) {
First = FALSE;
j = 0;
memset(&Line, 0, sizeof(Line));
for (i = 0; i < strlen(magic.Cmd); i++) {
if (magic.Cmd[i] != '%') {
Line[j] = magic.Cmd[i];
j++;
} else {
i++;
if (magic.Cmd[i] == '%') {
Line[j] = '%';
j++;
} else {
Temp[0] = '\0';
sprintf(Temp, "%s", Magic_Macro(magic.Cmd[i]));
for (k = 0; k < strlen(Temp); k++) {
Line[j] = Temp[k];
j++;
}
}
cmd = xstrcpy(getenv("MBSE_ROOT"));
cmd = xstrcat(cmd, (char *)"/bin/");
cmd = xstrcat(cmd, strtok(Line, " "));
opts = strtok(NULL, "\0");
MagicResult((char *)"Exec: \"%s %s\"", cmd, opts);
if ((Err = execute(cmd, opts, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) == 0) {
Magics++;
} else
Syslog('!', "Mgc Exec: (%s %s) returns %d", cmd, opts, Err);
Magic_CheckCompile();
}
}
cmd = xstrcpy(getenv("MBSE_ROOT"));
cmd = xstrcat(cmd, (char *)"/bin/");
cmd = xstrcat(cmd, strtok(Line, " "));
opts = strtok(NULL, "\0");
MagicResult((char *)"Exec: \"%s %s\"", cmd, opts);
if ((Err = execute(cmd, opts, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) == 0) {
Magics++;
} else
Syslog('!', "Mgc Exec: (%s %s) returns %d", cmd, opts, Err);
Magic_CheckCompile();
}
}
void Magic_CopyFile(void)
{
int First = TRUE, rc;
char *From, *To;
int First = TRUE, rc;
char *From, *To;
From = calloc(PATH_MAX, sizeof(char));
To = calloc(PATH_MAX, sizeof(char));
From = calloc(PATH_MAX, sizeof(char));
To = calloc(PATH_MAX, sizeof(char));
while (GetMagicRec(MG_COPY, First)) {
First = FALSE;
sprintf(From, "%s/%s", TIC.BBSpath, TIC.NewName);
sprintf(To, "%s/%s", magic.Path, TIC.NewName);
while (GetMagicRec(MG_COPY, First)) {
First = FALSE;
sprintf(From, "%s/%s", TIC.BBSpath, TIC.NewFile);
sprintf(To, "%s/%s", magic.Path, TIC.NewFile);
if ((rc = file_cp(From, To) == 0)) {
MagicResult((char *)"%s copied to %s", From, To);
Magic_CheckCompile();
} else
WriteError("Magic: copy: %s to %s failed, %s", strerror(rc));
}
if ((rc = file_cp(From, To) == 0)) {
MagicResult((char *)"%s copied to %s", From, To);
Magic_CheckCompile();
} else
WriteError("Magic: copy: %s to %s failed, %s", strerror(rc));
}
free(From);
free(To);
free(From);
free(To);
}
@@ -304,7 +287,7 @@ void Magic_UnpackFile(void)
getcwd(buf, 128);
if (chdir(magic.Path) == 0) {
sprintf(Fn, "%s/%s", TIC.BBSpath, TIC.NewName);
sprintf(Fn, "%s/%s", TIC.BBSpath, TIC.NewFile);
if ((unarc = unpacker(Fn)) != NULL) {
if (getarchiver(unarc)) {
cmd = xstrcpy(archiver.funarc);
@@ -334,78 +317,80 @@ void Magic_UnpackFile(void)
void Magic_Keepnum(void)
{
if (GetMagicRec(MG_KEEPNUM, TRUE)) {
TIC.KeepNum = magic.KeepNum;
MagicResult((char *)"Keep %d files", TIC.KeepNum);
}
if (GetMagicRec(MG_KEEPNUM, TRUE)) {
TIC.KeepNum = magic.KeepNum;
MagicResult((char *)"Keep %d files", TIC.KeepNum);
}
}
void Magic_UpDateAlias(void)
{
if (GetMagicRec(MG_UPDALIAS, TRUE)) {
UpDateAlias(TIC.TicIn.Area);
MagicResult((char *)"Update Alias");
}
if (GetMagicRec(MG_UPDALIAS, TRUE)) {
UpDateAlias(TIC.TicIn.Area);
MagicResult((char *)"Update Alias");
}
}
void Magic_AdoptFile(void)
{
int First = TRUE;
char *temp;
FILE *Tf;
int First = TRUE;
char *temp;
FILE *Tf;
temp = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
while (GetMagicRec(MG_ADOPT, First)) {
First = FALSE;
while (GetMagicRec(MG_ADOPT, First)) {
First = FALSE;
if (SearchTic(magic.ToArea)) {
MagicResult((char *)"Adoptfile in %s", magic.ToArea);
if (SearchTic(magic.ToArea)) {
MagicResult((char *)"Adoptfile in %s", magic.ToArea);
sprintf(temp, "%s/%s", TIC.Inbound, MakeTicName());
if ((Tf = fopen(temp, "a+")) == NULL)
WriteError("$Can't create %s", temp);
else {
fprintf(Tf, "Hatch\r\n");
fprintf(Tf, "NoMove\r\n");
fprintf(Tf, "Created MBSE BBS v%s, %s\r\n", VERSION, SHORTRIGHT);
fprintf(Tf, "Area %s\r\n", magic.ToArea);
fprintf(Tf, "Origin %s\r\n", aka2str(tic.Aka));
fprintf(Tf, "From %s\r\n", aka2str(tic.Aka));
if (strlen(TIC.TicIn.Replace))
fprintf(Tf, "Replaces %s\r\n", TIC.TicIn.Replace);
if (strlen(TIC.TicIn.Magic))
fprintf(Tf, "Magic %s\r\n", TIC.TicIn.Magic);
fprintf(Tf, "File %s\r\n", TIC.NewName);
fprintf(Tf, "Pth %s\r\n", TIC.BBSpath);
fprintf(Tf, "Desc %s\r\n", TIC.TicIn.Desc);
fprintf(Tf, "Crc %s\r\n", TIC.TicIn.Crc);
fprintf(Tf, "Pw %s\r\n", CFG.hatchpasswd);
fclose(Tf);
}
sprintf(temp, "%s/%s", TIC.Inbound, MakeTicName());
if ((Tf = fopen(temp, "a+")) == NULL)
WriteError("$Can't create %s", temp);
else {
fprintf(Tf, "Hatch\r\n");
fprintf(Tf, "NoMove\r\n");
fprintf(Tf, "Created MBSE BBS v%s, %s\r\n", VERSION, SHORTRIGHT);
fprintf(Tf, "Area %s\r\n", magic.ToArea);
fprintf(Tf, "Origin %s\r\n", aka2str(tic.Aka));
fprintf(Tf, "From %s\r\n", aka2str(tic.Aka));
if (strlen(TIC.TicIn.Replace))
fprintf(Tf, "Replaces %s\r\n", TIC.TicIn.Replace);
if (strlen(TIC.TicIn.Magic))
fprintf(Tf, "Magic %s\r\n", TIC.TicIn.Magic);
fprintf(Tf, "File %s\r\n", TIC.NewFile);
if (strlen(TIC.NewFullName))
fprintf(Tf, "Fullname %s\r\n", TIC.NewFullName);
fprintf(Tf, "Pth %s\r\n", TIC.BBSpath);
fprintf(Tf, "Desc %s\r\n", TIC.TicIn.Desc);
fprintf(Tf, "Crc %s\r\n", TIC.TicIn.Crc);
fprintf(Tf, "Pw %s\r\n", CFG.hatchpasswd);
fclose(Tf);
}
SearchTic(TIC.TicIn.Area);
} else
WriteError("Mgc Adopt: Area \"%s\" not found");
}
SearchTic(TIC.TicIn.Area);
} else
WriteError("Mgc Adopt: Area \"%s\" not found");
}
free(temp);
free(temp);
}
int Magic_DeleteFile(void)
{
int Result;
int Result;
if ((Result = GetMagicRec(MG_DELETE, TRUE)))
MagicResult((char *)"Delete file");
if ((Result = GetMagicRec(MG_DELETE, TRUE)))
MagicResult((char *)"Delete file");
return Result;
return Result;
}

View File

@@ -43,25 +43,26 @@
void mover(char *fn)
{
char *From, *To;
int rc;
char *From, *To;
int rc;
From = calloc(PATH_MAX, sizeof(char));
To = calloc(PATH_MAX, sizeof(char));
From = calloc(PATH_MAX, sizeof(char));
To = calloc(PATH_MAX, sizeof(char));
sprintf(From, "%s/%s", TIC.Inbound, fn);
sprintf(To, "%s/%s", CFG.badtic, fn);
Syslog('!', "Moving %s to %s", From, To);
sprintf(From, "%s/%s", TIC.Inbound, fn);
sprintf(To, "%s/%s", CFG.badtic, fn);
Syslog('!', "Moving %s to %s", From, To);
if (mkdirs(To, 0770)) {
if ((rc = file_mv(From, To)))
WriteError("$Failed to move %s to %s: %s", From, To, strerror(rc));
} else {
WriteError("$Can't create directory for %s", To);
if (mkdirs(To, 0770)) {
if ((rc = file_mv(From, To))) {
WriteError("$Failed to move %s to %s: %s", From, To, strerror(rc));
}
} else {
WriteError("$Can't create directory for %s", To);
}
free(From);
free(To);
free(From);
free(To);
}
@@ -71,8 +72,8 @@ void mover(char *fn)
*/
void MoveBad()
{
mover(TIC.TicName);
mover(TIC.RealName);
mover(TIC.TicName);
mover(TIC.NewFile);
}

View File

@@ -104,7 +104,7 @@ int ProcessTic(fa_list *sbl)
fflush(stdout);
}
if (strlen(TIC.RealName) == 0) {
if (TIC.Orphaned) {
WriteError("File not in inbound: %s", TIC.TicIn.File);
/*
* Now check the age of the .tic file.
@@ -123,7 +123,7 @@ int ProcessTic(fa_list *sbl)
return 2;
}
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicIn.File);
crc = file_crc(Temp, CFG.slow_util && do_quiet);
TIC.FileSize = file_size(Temp);
TIC.FileDate = file_time(Temp);
@@ -142,7 +142,7 @@ int ProcessTic(fa_list *sbl)
if (crc != TIC.Crc_Int) {
Syslog('!', "CRC: expected %08lX, the file is %08lX", TIC.Crc_Int, crc);
if (check_crc) {
Bad((char *)"CRC: error, %s may be damaged", TIC.RealName);
Bad((char *)"CRC: error, %s may be damaged", TIC.TicIn.File);
free(Temp);
return 1;
} else {
@@ -409,8 +409,8 @@ int ProcessTic(fa_list *sbl)
* is used for this file.
*/
if (strlen(tic.Convert) || tic.VirScan || tic.FileId || tic.ConvertAll || strlen(tic.Banner)) {
if ((unarc = unpacker(TIC.RealName)) == NULL)
Syslog('+', "Unknown archive format %s", TIC.RealName);
if ((unarc = unpacker(TIC.TicIn.File)) == NULL)
Syslog('+', "Unknown archive format %s", TIC.TicIn.File);
else {
IsArchive = TRUE;
if ((strlen(tic.Convert) && (strcmp(unarc, tic.Convert) == 0)) || (tic.ConvertAll))
@@ -424,8 +424,8 @@ int ProcessTic(fa_list *sbl)
* it's a passthru area.
*/
if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(temp2, "%s/%s", CFG.ticout, TIC.RealName);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File);
sprintf(temp2, "%s/%s", CFG.ticout, TIC.TicIn.File);
if ((rc = file_cp(temp1, temp2) == 0)) {
TIC.SendOrg = TRUE;
} else {
@@ -464,7 +464,7 @@ int ProcessTic(fa_list *sbl)
if (!unlink(temp1))
Syslog('+', "Removed stale %s", temp1);
if (!checkspace(temp2, TIC.RealName, UNPACK_FACTOR)) {
if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) {
Bad((char *)"Not enough free diskspace left");
free(Temp);
tidy_qualify(&qal);
@@ -491,7 +491,7 @@ int ProcessTic(fa_list *sbl)
if ((cmd == NULL) || (cmd == "")) {
Syslog('!', "No unarc command available");
} else {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
UnPacked = TRUE;
@@ -512,8 +512,8 @@ int ProcessTic(fa_list *sbl)
* whatever that is. This should catch single files
* with worms or other macro viri
*/
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.RealName);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File);
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File);
if ((rc = file_cp(temp1, temp2))) {
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
@@ -577,12 +577,12 @@ int ProcessTic(fa_list *sbl)
} else {
sprintf(temp1, "%s/tmp", getenv("MBSE_ROOT"));
chdir(temp1);
sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName);
sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.TicIn.File);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE;
} else {
sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName);
sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.TicIn.File);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE;
@@ -639,16 +639,15 @@ int ProcessTic(fa_list *sbl)
}
} /* not get FILE_ID.DIZ */
/*
* Rearc file if it is an unpacked archive.
*/
if ((MustRearc) && (UnPacked) && (tic.FileArea)) {
if (Rearc(tic.Convert)) {
if (strlen(tic.Banner)) {
Syslog('f', "Must replace banner 1");
}
/*
* Get new filesize for import and announce
*/
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewName);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize;
T_File.SizeKb = TIC.FileSize / 1024;
@@ -661,32 +660,31 @@ int ProcessTic(fa_list *sbl)
} else {
WriteError("Rearc failed");
} /* if Rearc() */
} else {
/*
* If the file is not unpacked, change the banner
* direct if this is needed.
*/
if ((strlen(tic.Banner)) && IsArchive) {
cmd = xstrcpy(archiver.barc);
if ((cmd == NULL) || (!strlen(cmd))) {
Syslog('!', "No banner command for %s", archiver.name);
}
/*
* Change banner if needed.
*/
if ((strlen(tic.Banner)) && IsArchive) {
cmd = xstrcpy(archiver.barc);
if ((cmd == NULL) || (!strlen(cmd))) {
Syslog('!', "No banner command for %s", archiver.name);
} else {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
sprintf(Temp, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner);
if (execute(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
WriteError("$Changing the banner failed");
} else {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(Temp, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner);
if (execute(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
WriteError("$Changing the banner failed");
} else {
sync();
Syslog('+', "New banner %s", tic.Banner);
TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize;
T_File.SizeKb = TIC.FileSize / 1024;
ReCalcCrc(temp1);
DidBanner = TRUE;
}
sync();
Syslog('+', "New banner %s", tic.Banner);
TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize;
T_File.SizeKb = TIC.FileSize / 1024;
ReCalcCrc(temp1);
DidBanner = TRUE;
}
}
} /* if MustRearc and Unpacked and not Passthtru */
}
DeleteVirusWork();
chdir(TIC.Inbound);
@@ -695,7 +693,7 @@ int ProcessTic(fa_list *sbl)
* If the file is converted, we set the date of the original
* received file as the file creation date.
*/
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewName);
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewFile);
if ((MustRearc || DidBanner) && CFG.ct_KeepDate) {
if ((tic.Touch) && (tic.FileArea)) {
ut.actime = mktime(localtime(&TIC.FileDate));
@@ -715,7 +713,7 @@ int ProcessTic(fa_list *sbl)
*/
if (tic.FileArea) {
Syslog('+', "Import: %s Area: %s", TIC.NewName, TIC.TicIn.Area);
Syslog('+', "Import: %s Area: %s", TIC.NewFile, TIC.TicIn.Area);
BBS_Imp = Add_BBS();
if (!BBS_Imp) {
@@ -726,25 +724,32 @@ int ProcessTic(fa_list *sbl)
}
}
Syslog('f', "Import is done");
chdir(TIC.Inbound);
Syslog('f', "Back in inbound");
/*
* Create file announce record
*/
if (tic.FileArea) {
Syslog('f', "Start magic check");
if (strlen(TIC.TicIn.Magic))
UpDateAlias(TIC.TicIn.Magic);
else
Magic_UpDateAlias();
Syslog('f', "done");
for (i = 0; i <= TIC.File_Id_Ct; i++)
strncpy(T_File.LDesc[i], TIC.File_Id[i], 48);
T_File.TotLdesc = TIC.File_Id_Ct;
T_File.Announce = tic.Announce;
sprintf(Temp, "%s", TIC.NewName);
name_mangle(Temp);
strncpy(T_File.Name, Temp, 12);
strncpy(T_File.LName, TIC.NewName, 80);
strncpy(T_File.Name, TIC.NewFile, 12);
strncpy(T_File.LName, TIC.NewFullName, 80);
T_File.Fdate = TIC.FileDate;
T_File.Cost = TIC.TicIn.Cost;
Syslog('f', "Toberep record filled");
Add_ToBeRep();
Syslog('f', "Added");
}
if (TIC.SendOrg && !tic.FileArea) {
@@ -753,11 +758,12 @@ int ProcessTic(fa_list *sbl)
* file in the inbound anymore so it can be
* deleted.
*/
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (file_rm(temp1) == 0)
Syslog('f', "Deleted %s", temp1);
}
Syslog('f', "Prepare forward");
if (DownLinks) {
First = TRUE;
@@ -775,9 +781,10 @@ int ProcessTic(fa_list *sbl)
tidy_faddr(p_from);
}
}
Syslog('f', "Seen-by's added");
/*
* Debugging, new style SB adding
* Add seen-by lines for all systems that will receive this file.
*/
for (tmpq = qal; tmpq; tmpq = tmpq->next) {
if (tmpq->send) {
@@ -790,6 +797,7 @@ int ProcessTic(fa_list *sbl)
}
uniq_list(&sbl);
sort_list(&sbl);
Syslog('f', "More added");
for (tmp = sbl; tmp; tmp = tmp->next)
Syslog('f', "final SB list %s", ascfnode(tmp->addr, 0x0f));

View File

@@ -165,13 +165,14 @@ int Tic()
int LoadTic(char *inb, char *tfn)
{
FILE *tfp;
char *Temp, *Temp2, *Buf, *Log = NULL;
char *Temp, *Temp2, *Buf, *Log = NULL, RealName[256];
int i, j, rc, bufsize, DescCnt = FALSE;
fa_list *sbl = NULL;
if (CFG.slow_util && do_quiet)
usleep(1);
memset(&RealName, 0, sizeof(RealName));
memset(&TIC, 0, sizeof(TIC));
memset(&T_File, 0, sizeof(T_File));
@@ -399,7 +400,7 @@ int LoadTic(char *inb, char *tfn)
*/
sprintf(Temp, "%s/%s", TIC.TicIn.Pth, TIC.TicIn.FullName);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, TIC.TicIn.FullName);
strcpy(RealName, TIC.TicIn.FullName);
} else {
WriteError("Can't find %s", Temp);
tidy_falist(&sbl);
@@ -425,17 +426,17 @@ int LoadTic(char *inb, char *tfn)
sprintf(Temp2, "%s", TIC.TicIn.File);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
} else {
tu(Temp2);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
} else {
tl(Temp2);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
}
}
}
@@ -444,38 +445,53 @@ int LoadTic(char *inb, char *tfn)
* If the above didn't find the file and we got a LFN
* the search again.
*/
if (strlen(TIC.TicIn.FullName) && (strlen(TIC.RealName) == 0)) {
if (strlen(TIC.TicIn.FullName) && (strlen(RealName) == 0)) {
sprintf(Temp2, "%s", TIC.TicIn.FullName);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
} else {
tu(Temp2);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
} else {
tl(Temp2);
sprintf(Temp, "%s/%s", TIC.Inbound, Temp2);
if (file_exist(Temp, R_OK) == 0) {
strcpy(TIC.RealName, Temp2);
strcpy(RealName, Temp2);
}
}
}
}
}
if (strlen(TIC.RealName) == 0) {
if (strlen(RealName) == 0) {
/*
* We leave RealName empty, the ProcessTic function
* will handle this orphaned tic file.
*/
TIC.Orphaned = TRUE;
WriteError("Can't find file in inbound");
} else {
Syslog('f', "Real filename in inbound is \"%s\"", TIC.RealName);
Syslog('f', "Real filename in inbound is \"%s\"", RealName);
Syslog('f', "8.3 name \"%s\", LFN \"%s\"", TIC.TicIn.File, TIC.TicIn.FullName);
strncpy(TIC.NewName, TIC.RealName, 80);
if (strcmp(RealName, TIC.TicIn.File)) {
/*
* File in inbound has not the same name as the name on disk.
* It may be a LFN but also a case difference. The whole tic
* processing is based on 8.3 filenames.
*/
sprintf(Temp, "%s/%s", TIC.Inbound, RealName);
sprintf(Temp2, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (rename(Temp, Temp2))
WriteError("$Can't rename %s to %s", Temp, Temp2);
else
Syslog('f', "Renamed %s to %s", Temp, Temp2);
}
}
strncpy(TIC.NewFile, TIC.TicIn.File, 80);
strncpy(TIC.NewFullName, TIC.TicIn.FullName, 255);
free(Temp2);
free(Temp);

View File

@@ -39,8 +39,8 @@ typedef struct _TICrec {
Tic_in TicIn; /* Original TIC record */
fidoaddr OrgAka; /* Origin address */
fidoaddr Aka; /* An address ? */
char NewName[81]; /* New name of file */
char RealName[81]; /* Real name on disk */
char NewFile[81]; /* New 8.3 filename */
char NewFullName[256]; /* New LFN name */
char File_Id[25][49]; /* Description */
int File_Id_Ct; /* Nr of lines */
unsigned long Crc_Int; /* Crc value */
@@ -52,6 +52,7 @@ typedef struct _TICrec {
unsigned Charge : 1; /* Charge for this file */
unsigned PassThru : 1; /* PassThru file */
unsigned NewAlias : 1; /* New alias is set */
unsigned Orphaned : 1; /* File is Orphaned */
long FileCost; /* Cost for this file */
char BBSpath[PATH_MAX]; /* Path to import in */
char BBSdesc[55]; /* Area description */

View File

@@ -48,14 +48,14 @@ extern int do_quiet;
char *MakeTicName()
{
static char buf[13];
static char buf[13];
buf[12] = '\0';
sprintf(buf, "%08lx.tic", sequencer());
buf[0] = 'm';
buf[1] = 'b';
buf[12] = '\0';
sprintf(buf, "%08lx.tic", sequencer());
buf[0] = 'm';
buf[1] = 'b';
return buf;
return buf;
}
@@ -65,13 +65,13 @@ char *MakeTicName()
*/
int Day_Of_Year()
{
time_t Now;
struct tm *Tm;
time_t Now;
struct tm *Tm;
Now = time(NULL);
Tm = localtime(&Now);
Now = time(NULL);
Tm = localtime(&Now);
return Tm->tm_yday;
return Tm->tm_yday;
}
@@ -81,93 +81,106 @@ int Day_Of_Year()
*/
int Rearc(char *unarc)
{
int i, j;
char temp[PATH_MAX], *cmd = NULL;
int i = 0, j = 0, k = 0;
char temp[PATH_MAX], *cmd = NULL;
Syslog('f', "Entering Rearc(%s)", unarc);
Syslog('f', "Entering Rearc(%s)", unarc);
i = 0;
while (TIC.NewName[i] != '.')
i++;
if (!getarchiver(unarc)) {
return FALSE;
}
cmd = xstrcpy(archiver.farc);
if (cmd == NULL) {
WriteError("Rearc(): No arc command available");
return FALSE;
}
while (TIC.NewFile[i] != '.')
i++;
i++;
j = 0;
for (; i < strlen(TIC.NewName); i++) {
if (TIC.NewName[i] > '9')
TIC.NewName[i] = tolower(unarc[j]);
j++;
while (TIC.NewFullName[k] != '.')
k++;
k++;
for (; i < strlen(TIC.NewFile); i++) {
if (TIC.NewFile[i] > '9') {
TIC.NewFile[i] = toupper(unarc[j]);
if (isupper(TIC.NewFullName[i]))
TIC.NewFullName[i] = toupper(unarc[k]);
else
TIC.NewFullName[i] = tolower(unarc[k]);
}
j++;
k++;
}
Syslog('f' , "NewName = \"%s\"", TIC.NewName);
Syslog('f' , "NewFile=\"%s\", NewFullName=\"%s\"", TIC.NewFile, TIC.NewFullName);
if (!getarchiver(unarc)) {
return FALSE;
}
cmd = xstrcpy(archiver.farc);
if (cmd == NULL) {
WriteError("Rearc(): No arc command available");
return FALSE;
} else {
sprintf(temp, "%s/%s .", TIC.Inbound, TIC.NewName);
if (execute(cmd, temp, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
/* MUST SET TIC.FileDate to NEW ARCHIVE */
return TRUE;
}
WriteError("Rearc(%s) Failed", unarc);
return FALSE;
}
sprintf(temp, "%s/%s .", TIC.Inbound, TIC.NewFile);
if (execute(cmd, temp, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
free(cmd);
return TRUE;
}
/*
* Restore filenames
*/
strncpy(TIC.NewFile, TIC.TicIn.File, sizeof(TIC.NewFile) -1);
strncpy(TIC.NewFullName, TIC.TicIn.FullName, sizeof(TIC.NewFullName) -1);
free(cmd);
WriteError("Rearc(%s) Failed", unarc);
return FALSE;
}
void DeleteVirusWork()
{
char *buf, *temp;
char *buf, *temp;
buf = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
getcwd(buf, PATH_MAX);
sprintf(temp, "%s/tmp", getenv("MBSE_ROOT"));
buf = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
getcwd(buf, PATH_MAX);
sprintf(temp, "%s/tmp", getenv("MBSE_ROOT"));
if (chdir(temp) == 0) {
Syslog('f', "DeleteVirusWork %s/arc", temp);
system("rm -r -f arc");
system("mkdir arc");
} else
WriteError("$Can't chdir to %s", temp);
if (chdir(temp) == 0) {
Syslog('f', "DeleteVirusWork %s/arc", temp);
system("rm -r -f arc");
system("mkdir arc");
} else
WriteError("$Can't chdir to %s", temp);
chdir(buf);
free(temp);
free(buf);
chdir(buf);
free(temp);
free(buf);
}
void Bad(char *format, ...)
{
char outstr[1024];
va_list va_ptr;
char outstr[1024];
va_list va_ptr;
va_start(va_ptr, format);
vsprintf(outstr, format, va_ptr);
va_end(va_ptr);
va_start(va_ptr, format);
vsprintf(outstr, format, va_ptr);
va_end(va_ptr);
WriteError(outstr);
MoveBad();
tic_bad++;
WriteError(outstr);
MoveBad();
tic_bad++;
}
void ReCalcCrc(char *fn)
{
TIC.Crc_Int = file_crc(fn, CFG.slow_util && do_quiet);
sprintf(TIC.TicIn.Crc, "%08lX", TIC.Crc_Int);
strcpy(T_File.Crc, TIC.TicIn.Crc);
TIC.Crc_Int = file_crc(fn, CFG.slow_util && do_quiet);
sprintf(TIC.TicIn.Crc, "%08lX", TIC.Crc_Int);
strcpy(T_File.Crc, TIC.TicIn.Crc);
}
@@ -253,27 +266,29 @@ int Get_File_Id()
void UpDateAlias(char *Alias)
{
char *path;
FILE *fp;
char *path;
FILE *fp;
Syslog('f', "UpDateAlias(%s) with %s", Alias, TIC.NewName);
Syslog('f', "UpDateAlias(%s) with %s", Alias, TIC.NewFile);
if (!strlen(CFG.req_magic)) {
WriteError("No magic filename path configured");
return;
}
if (!strlen(CFG.req_magic)) {
WriteError("No magic filename path configured");
return;
}
path = xstrcpy(CFG.req_magic);
path = xstrcat(path, (char *)"/");
path = xstrcat(path, Alias);
path = xstrcpy(CFG.req_magic);
path = xstrcat(path, (char *)"/");
path = xstrcat(path, Alias);
if ((fp = fopen(path, "w")) == NULL) {
WriteError("$Can't create %s", path);
return;
}
fprintf(fp, "%s\n", TIC.NewName);
fclose(fp);
if ((fp = fopen(path, "w")) == NULL) {
WriteError("$Can't create %s", path);
free(path);
return;
}
fprintf(fp, "%s\n", TIC.NewFile);
fclose(fp);
free(path);
}