From 996c87ab27a4d74220098f296e06e3d4a4358673 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 9 Dec 2002 19:58:18 +0000 Subject: [PATCH] Changes to mbfile for symbolic links processing --- ChangeLog | 6 ++++++ mbfido/mbfcheck.c | 13 +++++++++++++ mbfido/mbfindex.c | 16 ++++++++-------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cbb383e..fa5fac72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 a pre 09-12-2002 version. Backup everything!! If all went well the backups should be in size back to normal. + If you use web pages of the download areas, run mbfile index. MBSEBBS History. @@ -103,6 +104,11 @@ v0.35.06 files seem to exist under both names. The delete and move functions can now use 8.3 or long 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: In filedatabase editor, if a file is deleted the name is diff --git a/mbfido/mbfcheck.c b/mbfido/mbfcheck.c index 0d7304b5..84e9b356 100644 --- a/mbfido/mbfcheck.c +++ b/mbfido/mbfcheck.c @@ -325,6 +325,19 @@ void Check(void) 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) { Syslog('!', "Date mismatch area %d file %s", i, file.LName); file.FileDate = file_time(newdir); diff --git a/mbfido/mbfindex.c b/mbfido/mbfindex.c index a698a349..7c8a594c 100644 --- a/mbfido/mbfindex.c +++ b/mbfido/mbfindex.c @@ -566,25 +566,25 @@ void Index(void) */ if (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(outbuf, "%s/.%s", area.Path, file.LName); + sprintf(linebuf, "%s/%s", area.Path, file.Name); + sprintf(outbuf, "%s/.%s", area.Path, file.Name); if (file_exist(outbuf, R_OK)) { if ((j = execute(CFG.www_convert, linebuf, outbuf, (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 { chmod(outbuf, 0644); } } 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, - area.Path+strlen(CFG.ftp_base), file.LName); - MacroVars("fghi", "dsss", 1, outbuf, file.LName, linebuf); + area.Path+strlen(CFG.ftp_base), file.Name); + MacroVars("fghi", "dsss", 1, outbuf, file.Name, linebuf); } else { sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp, - area.Path+strlen(CFG.ftp_base), file.LName); - MacroVars("fghi", "dsss", 0, outbuf, file.LName, ""); + area.Path+strlen(CFG.ftp_base), file.Name); + MacroVars("fghi", "dsss", 0, outbuf, file.Name, ""); } sprintf(outbuf, "%lu Kb.", (long)(file.Size / 1024)); MacroVars("jkl", "ssd", StrDateDMY(file.FileDate), outbuf, file.TimesDL+file.TimesFTP+file.TimesReq);