Added long filename support to filerequests
This commit is contained in:
parent
cd7bf461e6
commit
8f1f76998c
@ -4304,6 +4304,12 @@ v0.33.19 26-Oct-2001
|
||||
mbcico:
|
||||
Removed IEMSI support since mbsebbs doesn't support it
|
||||
anymore.
|
||||
Filerequest responses are now created with long filenames.
|
||||
When sending files, if the remote has the FNC link flag, the
|
||||
filename is mangled to DOS 8.3 format when transmitted.
|
||||
File request response messages now displayy the long and
|
||||
short filename in the reply.
|
||||
Filerequest resonse messages now have a random quote added.
|
||||
|
||||
mbtask:
|
||||
Changed to handle the External Doors flag in the lastcaller
|
||||
|
@ -122,6 +122,7 @@ charset.o: libs.h structs.h common.h clcomm.h
|
||||
ftn.o: libs.h structs.h records.h clcomm.h dbftn.h common.h
|
||||
nodelist.o: libs.h structs.h records.h clcomm.h common.h
|
||||
pktname.o: libs.h structs.h records.h clcomm.h common.h
|
||||
mangle.o: libs.h structs.h clcomm.h common.h
|
||||
charconv.o: libs.h structs.h records.h common.h clcomm.h
|
||||
dostran.o: libs.h structs.h records.h common.h
|
||||
ftnmsg.o: libs.h structs.h common.h clcomm.h
|
||||
|
@ -1,8 +1,7 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* File ..................: mbcico/filelist.c
|
||||
* $Id$
|
||||
* Purpose ...............: fidonet mailer
|
||||
* Last modification date : 07-Aug-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
@ -61,8 +60,7 @@ static char *tmpkname(void)
|
||||
|
||||
char *xtodos(char *orig)
|
||||
{
|
||||
int i;
|
||||
char buf[8+1+3+1],*copy,*p,*q,*r;
|
||||
char buf[13], *copy, *p;
|
||||
|
||||
if (orig == NULL)
|
||||
return NULL;
|
||||
@ -78,41 +76,10 @@ char *xtodos(char *orig)
|
||||
else
|
||||
p = copy;
|
||||
|
||||
if (strcmp(q=copy+strlen(copy)-strlen(".tar.gz"),".tar.gz") == 0) {
|
||||
*q='\0';
|
||||
q=(char *)"tgz";
|
||||
} else if (strcmp(q=copy+strlen(copy)-strlen(".tar.z"),".tar.z") == 0) {
|
||||
*q='\0';
|
||||
q=(char *)"tgz";
|
||||
} else if (strcmp(q=copy+strlen(copy)-strlen(".tar.Z"),".tar.Z") == 0) {
|
||||
*q='\0';
|
||||
q=(char *)"taz";
|
||||
} else if ((q=strrchr(p,'.')))
|
||||
*q++='\0';
|
||||
else
|
||||
q=NULL;
|
||||
|
||||
r=buf;
|
||||
for (i=0;(i<8) && (*p);i++,p++,r++)
|
||||
switch (*p) {
|
||||
case '.':
|
||||
case '\\': *r='_'; break;
|
||||
default: *r=toupper(*p);
|
||||
}
|
||||
|
||||
if (q) {
|
||||
*r++='.';
|
||||
for (i=0;(i<3) && (*q);i++,q++,r++)
|
||||
switch (*q) {
|
||||
case '.':
|
||||
case '\\': *r='_'; break;
|
||||
default: *r=toupper(*q);
|
||||
}
|
||||
}
|
||||
*r++='\0';
|
||||
|
||||
name_mangle(p);
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
strncpy(buf, p, 12);
|
||||
Syslog('o', "name \"%s\" converted to \"%s\"", MBSE_SS(orig), MBSE_SS(buf));
|
||||
|
||||
free(copy);
|
||||
return xstrcpy(buf);
|
||||
}
|
||||
|
@ -155,6 +155,9 @@ int main(int argc, char *argv[])
|
||||
char *answermode = NULL, *p = NULL, *cmd = NULL;
|
||||
struct passwd *pw;
|
||||
FILE *fp;
|
||||
#ifdef IEMSI
|
||||
char temp[81];
|
||||
#endif
|
||||
|
||||
#ifdef MEMWATCH
|
||||
mwInit();
|
||||
@ -286,7 +289,32 @@ int main(int argc, char *argv[])
|
||||
tmpl = &callist;
|
||||
|
||||
while (argv[optind]) {
|
||||
|
||||
for (p = argv[optind]; (*p) && (*p == '*'); p++);
|
||||
#ifdef IEMSI
|
||||
if (strncasecmp(p, "EMSI_NAKEEC3", 12) == 0) {
|
||||
|
||||
Syslog('+', "Detected IEMSI client, starting BBS");
|
||||
sprintf(temp, "%s/bin/mbsebbs", getenv("MBSE_ROOT"));
|
||||
socket_shutdown(mypid);
|
||||
|
||||
if (execl(temp, "mbsebbs", (char *)NULL) == -1)
|
||||
perror("FATAL: Error loading BBS!");
|
||||
|
||||
/*
|
||||
* If this happens, nothing is logged!
|
||||
*/
|
||||
printf("\n\nFATAL: Loading of the BBS failed!\n\n");
|
||||
sleep(3);
|
||||
free_mem();
|
||||
if (envptr)
|
||||
free(envptr);
|
||||
#ifdef MEMWATCH
|
||||
mwTerm();
|
||||
#endif
|
||||
exit(100);
|
||||
}
|
||||
#endif
|
||||
if ((strcasecmp(argv[optind],"tsync") == 0) ||
|
||||
(strcasecmp(argv[optind],"yoohoo") == 0) ||
|
||||
(strcasecmp(argv[optind],"ibn") == 0) ||
|
||||
|
@ -1,8 +1,7 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* File ..................: mbcico/respfreq.c
|
||||
* Purpose ...............: Fidonet mailer
|
||||
* Last modification date : 04-Oct-2001
|
||||
* $Id$
|
||||
* Purpose ...............: Fidonet mailer - respond to filerequests
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
@ -296,14 +295,12 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
WriteError("$Can't read filerecord %d", idx.Record);
|
||||
} else {
|
||||
Send = FALSE;
|
||||
Syslog('f', "Found \"%s\" in %s", file.Name, area.Name);
|
||||
Syslog('f', "Found \"%s\" in %s", file.LName, area.Name);
|
||||
tnm = xstrcpy(area.Path);
|
||||
tnm = xstrcat(tnm, (char *)"/");
|
||||
tnm = xstrcat(tnm, file.Name);
|
||||
if ((stat(tnm, &st) == 0) &&
|
||||
(S_ISREG(st.st_mode)) &&
|
||||
(access(tnm, R_OK) == 0) &&
|
||||
((upd == 0L) ||
|
||||
tnm = xstrcat(tnm, file.LName);
|
||||
if ((stat(tnm, &st) == 0) && (S_ISREG(st.st_mode)) &&
|
||||
(access(tnm, R_OK) == 0) && ((upd == 0L) ||
|
||||
((newer) && (st.st_mtime <= upd)))) {
|
||||
Send = TRUE;
|
||||
}
|
||||
@ -320,7 +317,8 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
if (strcasecmp(area.Password, pw)) {
|
||||
Send = FALSE;
|
||||
Syslog('+', "Bad password for area %s", area.Name);
|
||||
add_report((char *)"ER: bad password for area %s", area.Name);
|
||||
add_report((char *)"ER: bad password for area %s",
|
||||
area.Name);
|
||||
}
|
||||
} else {
|
||||
Send = FALSE;
|
||||
@ -332,7 +330,8 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
if (strcasecmp(file.Password, pw)) {
|
||||
Send = FALSE;
|
||||
Syslog('+', "Bad password for file %s", file.Name);
|
||||
add_report((char *)"ER: bad password for file %s", file.Name);
|
||||
add_report((char *)"ER: bad password for file %s",
|
||||
file.LName);
|
||||
}
|
||||
} else {
|
||||
Send = FALSE;
|
||||
@ -351,7 +350,8 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
if (Send && CFG.Req_MBytes) {
|
||||
if ((st.st_size + report_total) > (CFG.Req_MBytes * 1048576)) {
|
||||
Send = FALSE;
|
||||
add_report((char *)"ER: file %s will exceed the request limit", file.Name);
|
||||
add_report((char *)"ER: file %s will exceed the request limit",
|
||||
file.Name);
|
||||
Syslog('+', "Exceeding request size limit");
|
||||
no_more = TRUE;
|
||||
}
|
||||
@ -361,8 +361,14 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
Syslog('f', "Will send %s", file.LName);
|
||||
report_total += st.st_size;
|
||||
report_count++;
|
||||
add_report((char *)"OK: Sending \"%s\" (%lu bytes)", file.Name, file.Size);
|
||||
add_list(&fl, tnm, file.Name, 0, 0L, NULL, 1);
|
||||
if (strcasecmp(file.Name, file.LName))
|
||||
add_report((char *)"OK: Sending \"%s\" as \"%s\" (%lu bytes)",
|
||||
file.LName, file.Name, file.Size);
|
||||
else
|
||||
add_report((char *)"OK: Sending \"%s\" (%lu bytes)",
|
||||
file.LName, file.Size);
|
||||
add_list(&fl, tnm, file.LName, 0, 0L, NULL, 1);
|
||||
|
||||
/*
|
||||
* Update file information
|
||||
*/
|
||||
@ -568,12 +574,14 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
|
||||
static void attach_report(file_list **fl)
|
||||
{
|
||||
FILE *fp;
|
||||
char tmpfn[PATH_MAX];
|
||||
char *tmpfn;
|
||||
char remname[14];
|
||||
long zeroes = 0L;
|
||||
long zeroes = 0L, recno, records;
|
||||
ftnmsg fmsg;
|
||||
char *svname;
|
||||
|
||||
tmpfn = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
if (report_text == NULL) {
|
||||
WriteError("Empty FREQ report");
|
||||
add_report((char *)"ER: empty request report, contact sysop");
|
||||
@ -590,6 +598,29 @@ static void attach_report(file_list **fl)
|
||||
else
|
||||
add_report((char *)"Maximum size : %d MBytes", CFG.Req_MBytes);
|
||||
|
||||
/*
|
||||
* Add random quote
|
||||
*/
|
||||
sprintf(tmpfn, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(tmpfn, "r+")) != NULL) {
|
||||
fread(&olhdr, sizeof(olhdr), 1, fp);
|
||||
fseek(fp, 0, SEEK_END);
|
||||
records = (ftell(fp) - olhdr.hdrsize) / olhdr.recsize;
|
||||
srand(getpid());
|
||||
recno = 1+(int) (1.0 * records * rand() / (RAND_MAX + 1.0));
|
||||
Syslog('f', "Selected quote %d out of %d records", recno, records);
|
||||
if (fseek(fp, olhdr.hdrsize + (recno * olhdr.recsize), SEEK_SET) == 0) {
|
||||
if (fread(&ol, olhdr.recsize, 1, fp) == 1) {
|
||||
add_report((char *)"\r... %s", ol.Oneline);
|
||||
} else {
|
||||
WriteError("Can't read %s", tmpfn);
|
||||
}
|
||||
} else {
|
||||
WriteError("$Can't seek record %d in %s", recno, tmpfn);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
add_report((char *)"\r--- mbcico v%s\r", VERSION);
|
||||
|
||||
sprintf(tmpfn, "%s/tmp/%08lX.rpl", getenv((char *)"MBSE_ROOT"), (unsigned long)sequencer());
|
||||
@ -628,6 +659,7 @@ static void attach_report(file_list **fl)
|
||||
|
||||
report_total = 0L;
|
||||
free(report_text);
|
||||
free(tmpfn);
|
||||
report_text = NULL;
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ void ListFileAreas(int Area)
|
||||
if (strlen(file.Desc[0]) > 36)
|
||||
file.Desc[0][36] = '\0';
|
||||
printf("%-12s %6ld %s %5ld %s %s\n",
|
||||
file.Name, file.Size / 1024, StrDateDMY(file.FileDate),
|
||||
file.TimesDL + file.TimesFTP + file.TimesReq, flags, file.Desc[0]);
|
||||
file.Name, (long)(file.Size / 1024), StrDateDMY(file.FileDate),
|
||||
(long)(file.TimesDL + file.TimesFTP + file.TimesReq), flags, file.Desc[0]);
|
||||
fcount++;
|
||||
fsize = fsize + file.Size;
|
||||
}
|
||||
|
Reference in New Issue
Block a user