diff --git a/src/sbbs3/scfg/scfgxfr1.c b/src/sbbs3/scfg/scfgxfr1.c index b15e6ca0da1ea0e8ea506ddf142fc57406c39b1e..62035568e0f4d360ee61fde983fa228178d8f5b4 100644 --- a/src/sbbs3/scfg/scfgxfr1.c +++ b/src/sbbs3/scfg/scfgxfr1.c @@ -19,6 +19,35 @@ #include "scfg.h" +char* testable_files_help = + "`Testable File Types:`\n" + "\n" + "These file types each have a command line that will be executed to test\n" + "the integrity of a file upon upload. These file types are specified by\n" + "file `extension` (suffix) and if one file extension is listed more than\n" + "once, each command line will be executed. A file extension of '`*`'\n" + "matches `all` files.\n" + "\n" + "The configured command lines must return an error code of 0 (no error)\n" + "to indicate that the file has passed each test. This method of file\n" + "testing upon upload is also known as an upload processing event.\n" + "\n" + "In the command line, `%f` represents the path to the file to be tested\n" + "while `%s` represents the path to the `sbbsfile.des` file that contains the\n" + "file's description (which may be modified by the testing command line).\n" + "\n" + "This test can do more than just test the file; it can perform any\n" + "function that the sysop wishes, such as adding comments to an archived\n" + "file, or extracting an archive and performing a virus scan. It's even\n" + "possible for a file tester to rename a file or change its description\n" + "by modifying the contents of the `sbbsfile.nam` or `sbbsfile.des` files in\n" + "the node directory.\n" + "\n" + "While the command line is executing, an optional text string may be\n" + "displayed to the user. This `working string` can be set uniquely\n" + "for each testable file type.\n" +; + void xfer_opts() { char str[128],done; @@ -431,22 +460,7 @@ void xfer_opts() i|=WIN_DEL|WIN_COPY|WIN_CUT; if(savftest.cmd[0]) i|=WIN_PASTE; - uifc.helpbuf= - "`Testable File Types:`\n" - "\n" - "This is a list of file types that will have a command line executed to\n" - "test the file integrity upon their upload. The file types are specified\n" - "by `extension` and if one file extension is listed more than once, each\n" - "command line will be executed. The command lines must return a error\n" - "code of 0 (no error) in order for the file to pass the test. This method\n" - "of file testing upon upload is also known as an upload event. This test\n" - "or event, can do more than just test the file, it can perform any\n" - "function that the sysop wishes. Such as adding comments to an archived\n" - "file, or extracting an archive and performing a virus scan. While the\n" - "external program is executing, a text string is displayed to the user.\n" - "This `working string` can be set for each file type and command line\n" - "listed.\n" - ; + uifc.helpbuf = testable_files_help; i=uifc.list(i,0,0,50,&ftest_dflt,&ftest_bar,"Testable File Types",opt); if(i==-1) break; @@ -525,6 +539,7 @@ void xfer_opts() sprintf(opt[j++],"%-22.22s%s","Access Requirements" ,cfg.ftest[i]->arstr); opt[j][0]=0; + uifc.helpbuf = testable_files_help; switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&ftest_opt,0 ,"Testable File Type",opt)) { case -1: diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp index 0efcbf330385c0640034cfa63e5e000fa1f6ae74..bbe7a8c97367acc5f459bba8a17d539cc10414bd 100644 --- a/src/sbbs3/upload.cpp +++ b/src/sbbs3/upload.cpp @@ -71,7 +71,8 @@ bool sbbs_t::uploadfile(file_t* f) fprintf(stream, "%s", f->desc); fclose(stream); } - int result = external(cmdstr(cfg.ftest[i]->cmd,path,f->desc,NULL),EX_OFFLINE); + // Note: str (%s) is path/to/sbbsfile.des (used to be the description itself) + int result = external(cmdstr(cfg.ftest[i]->cmd, path, str, NULL), EX_OFFLINE); clearline(); if(result != 0) { safe_snprintf(str,sizeof(str),"attempted to upload %s to %s %s (%s error code %d)" @@ -82,30 +83,24 @@ bool sbbs_t::uploadfile(file_t* f) bprintf(text[FileHadErrors],f->name,cfg.ftest[i]->ext); if(!SYSOP || yesno(text[DeleteFileQ])) remove(path); - return(0); - } else { -#if 0 // NFB-TODO - uploader tester changes filename or description - sprintf(str,"%ssbbsfile.nam",cfg.node_dir); - if((stream=fopen(str,"r"))!=NULL) { - if(fgets(str,128,stream)) { - truncsp(str); - padfname(str,f->name); - strcpy(tmp,f->name); - truncsp(tmp); - sprintf(path,"%s%s", cfg.dir[f->dir]->path - ,unpadfname(f->name,fname)); - } - fclose(stream); - } - sprintf(str,"%ssbbsfile.des",cfg.node_dir); - if((stream=fopen(str,"r"))!=NULL) { - if(fgets(str,128,stream)) { - truncsp(str); - sprintf(f->desc,"%.*s",LEN_FDESC,str); - } - fclose(stream); + return false; + } + SAFEPRINTF(str,"%ssbbsfile.nam",cfg.node_dir); + if((stream=fopen(str,"r"))!=NULL) { + if(fgets(str, sizeof(str), stream)) { + truncsp(str); + smb_new_hfield_str(f, SMB_FILENAME, str); + getfilepath(&cfg, f, path); } -#endif + fclose(stream); + } + SAFEPRINTF(str,"%ssbbsfile.des",cfg.node_dir); + if((stream=fopen(str,"r"))!=NULL) { + if(fgets(str, sizeof(str), stream)) { + truncsp(str); + smb_new_hfield_str(f, SMB_FILEDESC, str); + } + fclose(stream); } }