Changes to mbfile for symbolic links processing

This commit is contained in:
Michiel Broek 2002-12-09 19:58:18 +00:00
parent e957fac3c7
commit 996c87ab27
3 changed files with 27 additions and 8 deletions

View File

@ -4,6 +4,7 @@ NOTE: for previous 0.35.06 users, the hard links are now replaced with
symbolic links. Run mbfile check to update if you were running symbolic links. Run mbfile check to update if you were running
a pre 09-12-2002 version. Backup everything!! If all went well the a pre 09-12-2002 version. Backup everything!! If all went well the
backups should be in size back to normal. backups should be in size back to normal.
If you use web pages of the download areas, run mbfile index.
MBSEBBS History. MBSEBBS History.
@ -103,6 +104,11 @@ v0.35.06
files seem to exist under both names. files seem to exist under both names.
The delete and move functions can now use 8.3 or long The delete and move functions can now use 8.3 or long
filenames as argument. filenames as argument.
The index function now creates web pages with the uppercase
8.3 filename (including thumbnails) because webservers don't
allow downloads from symlinks and the LFN is a symlink. You
could allow your webserver to do this but this is a big
security hole.
mbsetup: mbsetup:
In filedatabase editor, if a file is deleted the name is In filedatabase editor, if a file is deleted the name is

View File

@ -325,6 +325,19 @@ void Check(void)
Syslog('!', "Weird problem, %s is no regular file", newdir); Syslog('!', "Weird problem, %s is no regular file", newdir);
} }
/*
* It could be that there is a thumbnail made of the LFN.
*/
tname = calloc(PATH_MAX, sizeof(char));
sprintf(tname, "%s/.%s", area.Path, file.LName);
if (file_exist(tname, R_OK) == 0) {
Syslog('+', "Removing thumbnail %s", tname);
iErrors++;
unlink(tname);
}
free(tname);
if (file_time(newdir) != file.FileDate) { if (file_time(newdir) != file.FileDate) {
Syslog('!', "Date mismatch area %d file %s", i, file.LName); Syslog('!', "Date mismatch area %d file %s", i, file.LName);
file.FileDate = file_time(newdir); file.FileDate = file_time(newdir);

View File

@ -566,25 +566,25 @@ void Index(void)
*/ */
if (strstr(file.LName, ".gif") || strstr(file.LName, ".jpg") || if (strstr(file.LName, ".gif") || strstr(file.LName, ".jpg") ||
strstr(file.LName, ".GIF") || strstr(file.LName, ".JPG")) { strstr(file.LName, ".GIF") || strstr(file.LName, ".JPG")) {
sprintf(linebuf, "%s/%s", area.Path, file.LName); sprintf(linebuf, "%s/%s", area.Path, file.Name);
sprintf(outbuf, "%s/.%s", area.Path, file.LName); sprintf(outbuf, "%s/.%s", area.Path, file.Name);
if (file_exist(outbuf, R_OK)) { if (file_exist(outbuf, R_OK)) {
if ((j = execute(CFG.www_convert, linebuf, outbuf, if ((j = execute(CFG.www_convert, linebuf, outbuf,
(char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) { (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) {
Syslog('+', "Failed to create thumbnail for %s, rc=% d", file.LName, j); Syslog('+', "Failed to create thumbnail for %s, rc=% d", file.Name, j);
} else { } else {
chmod(outbuf, 0644); chmod(outbuf, 0644);
} }
} }
sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp, sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp,
area.Path+strlen(CFG.ftp_base), file.LName); area.Path+strlen(CFG.ftp_base), file.Name);
sprintf(linebuf, "%s/%s%s/.%s", CFG.www_url, CFG.www_link2ftp, sprintf(linebuf, "%s/%s%s/.%s", CFG.www_url, CFG.www_link2ftp,
area.Path+strlen(CFG.ftp_base), file.LName); area.Path+strlen(CFG.ftp_base), file.Name);
MacroVars("fghi", "dsss", 1, outbuf, file.LName, linebuf); MacroVars("fghi", "dsss", 1, outbuf, file.Name, linebuf);
} else { } else {
sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp, sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp,
area.Path+strlen(CFG.ftp_base), file.LName); area.Path+strlen(CFG.ftp_base), file.Name);
MacroVars("fghi", "dsss", 0, outbuf, file.LName, ""); MacroVars("fghi", "dsss", 0, outbuf, file.Name, "");
} }
sprintf(outbuf, "%lu Kb.", (long)(file.Size / 1024)); sprintf(outbuf, "%lu Kb.", (long)(file.Size / 1024));
MacroVars("jkl", "ssd", StrDateDMY(file.FileDate), outbuf, file.TimesDL+file.TimesFTP+file.TimesReq); MacroVars("jkl", "ssd", StrDateDMY(file.FileDate), outbuf, file.TimesDL+file.TimesFTP+file.TimesReq);