Fixed failed file attaches

This commit is contained in:
Michiel Broek 2002-06-02 13:03:50 +00:00
parent 8911a7c5b5
commit 996cb332ca
3 changed files with 73 additions and 62 deletions

View File

@ -197,6 +197,8 @@ v0.33.20 10-Feb-2002
When a virus scanner is started, de mbtask connection timeout When a virus scanner is started, de mbtask connection timeout
is set to one hour. is set to one hour.
Changed the confusing No Touch setting in tic areas to Touch. Changed the confusing No Touch setting in tic areas to Touch.
When a file to be attached doesn't exist, a error message is
logged and the attach is treaded as an error.
mbmsg: mbmsg:
When creating non-existend message bases, the path is created When creating non-existend message bases, the path is created

2
TODO
View File

@ -69,6 +69,8 @@ mbfido:
N: The first file received in a not yet created tic area is refused N: The first file received in a not yet created tic area is refused
after the area is created: node xxx not connected to area xxx. after the area is created: node xxx not connected to area xxx.
N: Doesn't erase netmail.jam and/or echomail.jam after a full mailscan.
mbcico: mbcico:
L: Implement modem connect response translation for ISDN lines, i.e. L: Implement modem connect response translation for ISDN lines, i.e.
make the CAUSE responses human readable. see McMail for this make the CAUSE responses human readable. see McMail for this

View File

@ -39,74 +39,81 @@
int attach(faddr noden, char *ofile, int mode, char flavor) int attach(faddr noden, char *ofile, int mode, char flavor)
{ {
FILE *fp; FILE *fp;
char *flofile; char *flofile;
int rc;
if (ofile == NULL) if (ofile == NULL)
return FALSE; return FALSE;
flofile = calloc(PATH_MAX, sizeof(char)); if ((rc = file_exist(ofile, R_OK))) {
sprintf(flofile, "%s", floname(&noden, flavor)); WriteError("attach: file %s failed, %s", ofile, strerror(rc));
return FALSE;
}
/* flofile = calloc(PATH_MAX, sizeof(char));
* Check if outbound directory exists and sprintf(flofile, "%s", floname(&noden, flavor));
* create if it doesn't exist.
*/
mkdirs(ofile, 0770);
/* /*
* Attach file to .flo * Check if outbound directory exists and
* * create if it doesn't exist.
* Note that mbcico when connected to a node opens the file "r+", */
* locks it with fcntl(F_SETLK), F_RDLCK, whence=0, start=0L, len=0L. mkdirs(ofile, 0770);
* It seems that this lock is released after the files in the .flo
* files are send. I don't know what will happen if we add entries
* to the .flo files, this must be tested!
*/
if ((fp = fopen(flofile, "a+")) == NULL) {
WriteError("$Can't open %s", flofile);
WriteError("May be locked by mbcico");
free(flofile);
return FALSE;
}
switch (mode) { /*
case LEAVE: * Attach file to .flo
if (strlen(CFG.dospath)) { *
if (CFG.leavecase) * Note that mbcico when connected to a node opens the file "r+",
fprintf(fp, "%s\r\n", Unix2Dos(ofile)); * locks it with fcntl(F_SETLK), F_RDLCK, whence=0, start=0L, len=0L.
else * It seems that this lock is released after the files in the .flo
fprintf(fp, "%s\r\n", tu(Unix2Dos(ofile))); * files are send. I don't know what will happen if we add entries
} else { * to the .flo files, this must be tested!
fprintf(fp, "%s\r\n", ofile); */
} if ((fp = fopen(flofile, "a+")) == NULL) {
break; WriteError("$Can't open %s", flofile);
case KFS: WriteError("May be locked by mbcico");
if (strlen(CFG.dospath)) {
if (CFG.leavecase)
fprintf(fp, "^%s\r\n", Unix2Dos(ofile));
else
fprintf(fp, "^%s\r\n", tu(Unix2Dos(ofile)));
} else {
fprintf(fp, "^%s\r\n", ofile);
}
break;
case TFS:
if (strlen(CFG.dospath)) {
if (CFG.leavecase)
fprintf(fp, "#%s\r\n", Unix2Dos(ofile));
else
fprintf(fp, "#%s\r\n", tu(Unix2Dos(ofile)));
} else {
fprintf(fp, "#%s\r\n", ofile);
}
break;
}
fclose(fp);
free(flofile); free(flofile);
return TRUE; return FALSE;
}
switch (mode) {
case LEAVE:
if (strlen(CFG.dospath)) {
if (CFG.leavecase)
fprintf(fp, "%s\r\n", Unix2Dos(ofile));
else
fprintf(fp, "%s\r\n", tu(Unix2Dos(ofile)));
} else {
fprintf(fp, "%s\r\n", ofile);
}
break;
case KFS:
if (strlen(CFG.dospath)) {
if (CFG.leavecase)
fprintf(fp, "^%s\r\n", Unix2Dos(ofile));
else
fprintf(fp, "^%s\r\n", tu(Unix2Dos(ofile)));
} else {
fprintf(fp, "^%s\r\n", ofile);
}
break;
case TFS:
if (strlen(CFG.dospath)) {
if (CFG.leavecase)
fprintf(fp, "#%s\r\n", Unix2Dos(ofile));
else
fprintf(fp, "#%s\r\n", tu(Unix2Dos(ofile)));
} else {
fprintf(fp, "#%s\r\n", ofile);
}
break;
}
fclose(fp);
free(flofile);
return TRUE;
} }