diff --git a/README.md b/README.md index a6f1791..f7ad82b 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ DEVICE=DEVICENAME/K DISABLEEXALL/S DOMAIN=WORKGROUP/K DST=DSTOFFSET/N/K +ERROROUTPUT/K MAXNAMELEN/N/K MAXTRANSMIT/N/K NETBIOS/S @@ -418,13 +419,19 @@ To avoid problems with such software, the **smbfs** program can be made to prete Please note that if the `DISABLEEXALL` switch is used, the **smbfs** program will make files and drawers appear to be "hidden" if their names are longer than 107 characters. -#### 5.4.3. `MAXNAMELEN/N/K` +#### 5.4.3. `ERROROUTPUT/K` + +The **smbfs** program will try to print error messages in the shell window in a manner which bypasses output redirection. This means that if you decide to discard all the output by sending it to `NIL:`, then smbfs will still be able to show you error messages. + +Where this is not a useful feature, you can tell the smbfs program to print both normal output and error messages in the same manner: use the `ERROROUTPUT=stdout` option. + +#### 5.4.4. `MAXNAMELEN/N/K` Some Amiga programs struggle with file and drawer names longer than 30 characters. They may malfunction and even crash when the **smbfs** program delivers them. You can tell the **smbfs** program not to deliver any file or drawer names which are longer than a certain number of characters using the `MAXNAMELEN` option. For example, `MAXNAMELEN=30` would make files and drawers appear to be "hidden" if their names are longer than 30 characters. -#### 5.4.4. `MAXTRANSMIT/N/K` +#### 5.4.5. `MAXTRANSMIT/N/K` You can fine-tune the size of the transmission buffer which the **smbfs** program uses when reading and writing files. The server may not have picked a buffer size which suits **smbfs** well. You can choose a smaller buffer size, if needed. @@ -432,7 +439,7 @@ The minimum transmission buffer size is 8000 bytes (this is also the default buf Please note that the transmission buffer size you asked for need not be accepted by the file server, which may choose to use a much smaller buffer. -#### 5.4.5. `PROTOCOL/K` +#### 5.4.6. `PROTOCOL/K` The **smbfs** program talks to the file server using a protocol called **SMBv1**, using commands and data structures described by the **Common Internet File System** documentation. @@ -444,7 +451,7 @@ The alternative is `PROTOCOL=nt1` which might provide better compatibility and p When in doubt, stick with `PROTOCOL=core`. -#### 5.4.6. `SESSIONSETUP/K` +#### 5.4.7. `SESSIONSETUP/K` If the `UNICODE=ON` option is in effect, the **smbfs** program may not be able to connect to the server because it expects Unicode text to be used only after the server session has been established. diff --git a/documentation/history.doc b/documentation/history.doc index da59e9b..0243b12 100644 --- a/documentation/history.doc +++ b/documentation/history.doc @@ -2863,3 +2863,25 @@ smbfs 2.12 (5.1.2019) "keep alive" handling are scheduled regularly every 10 seconds. That way the "keep alive" messages are dealt with without spending too much time with WaitSelect(). + + +smbfs 2.13 (9.2.2019) + +- The ACTION_CREATE_DIR, ACTION_DELETE_OBJECT, ACTION_FINDOUTPUT, + ACTION_RENAME_OBJECT, ACTION_SET_DATE, ACTION_SET_FILE_SIZE, + ACTION_SET_PROTECT and ACTION_WRITE operations now set use more + appropriate error codes instead of always translating an unspecific + "access denied" error into "ERROR_READ_PROTECTED". For example, for + ACTION_DELETE_OBJECT the new translation of "access denied" will be + "ERROR_DELETE_PROTECTED". + +- Added the ErrorOutput option, which can be either "stderr" (default) + or "stdout". Its purpose is to allow error messages written by + smbfs to be redirected to a file, which will not work for AmigaDOS + shell versions 36-40 if smbfs uses "stderr". Use ErrorOutput=stdout + to be able to redirect all smbfs output, including any error messages, + to a file. + +- Updated the copyright text. + +- Output to console or log files is now line-buffered. diff --git a/documentation/smbfs.doc b/documentation/smbfs.doc index cab7afa..b0a1f11 100644 --- a/documentation/smbfs.doc +++ b/documentation/smbfs.doc @@ -205,6 +205,7 @@ parameters): DISABLEEXALL/S DOMAIN=WORKGROUP/K DST=DSTOFFSET/N/K + ERROROUTPUT/K MAXNAMELEN/N/K MAXTRANSMIT/N/K NETBIOS/S @@ -620,7 +621,18 @@ Please note that if the "DISABLEEXALL" switch is used, the smbfs program will make files and drawers appear to be "hidden" if their names are longer than 107 characters. -5.4.3. "MAXNAMELEN/N/K" +5.4.3. "ERROROUTPUT/K" + +The smbfs program will try to print error messages in the shell window in a +manner which bypasses output redirection. This means that if you decide to +discard all the output by sending it to NIL:, then smbfs will still be able +to show you error messages. + +Where this is not a useful feature, you can tell the smbfs program to print +both normal output and error messages in the same manner: use the +ERROROUTPUT=stdout option. + +5.4.4. "MAXNAMELEN/N/K" Some Amiga programs struggle with file and drawer names longer than 30 characters. They may malfunction and even crash when the smbfs program @@ -631,7 +643,7 @@ are longer than a certain number of characters using the "MAXNAMELEN" option. For example, "MAXNAMELEN=30" would make files and drawers appear to be "hidden" if their names are longer than 30 characters. -5.4.4. "MAXTRANSMIT/N/K" +5.4.5. "MAXTRANSMIT/N/K" You can fine-tune the size of the transmission buffer which the smbfs program uses when reading and writing files. The server may not have picked a buffer @@ -643,7 +655,7 @@ buffer size), and the maximum permitted size is 65535 bytes. Please note that the transmission buffer size you asked for need not be accepted by the file server, which may choose to use a much smaller buffer. -5.4.5. "PROTOCOL/K" +5.4.6. "PROTOCOL/K" The smbfs program talks to the file server using a protocol called SMBv1, using commands and data structures described by the Common Internet File @@ -664,7 +676,7 @@ performance with Microsoft Windows systems. When in doubt, stick with "PROTOCOL=core". -5.4.6. "SESSIONSETUP/K" +5.4.7. "SESSIONSETUP/K" If the UNICODE=ON option is in effect, the smbfs program may not be able to connect to the server because it expects Unicode text to be used only after diff --git a/source_code/GNUmakefile.68k b/source_code/GNUmakefile.68k index 7bb6f6a..874c9d6 100644 --- a/source_code/GNUmakefile.68k +++ b/source_code/GNUmakefile.68k @@ -3,7 +3,7 @@ # # SMB file system wrapper for AmigaOS, using the AmiTCP V3 API # -# Copyright (C) 2000-2018 by Olaf `Olsen' Barthel +# Copyright (C) 2000-2019 by Olaf `Olsen' Barthel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/source_code/GNUmakefile.os4 b/source_code/GNUmakefile.os4 index f27aaba..1eabe78 100644 --- a/source_code/GNUmakefile.os4 +++ b/source_code/GNUmakefile.os4 @@ -3,7 +3,7 @@ # # SMB file system wrapper for AmigaOS, using the AmiTCP V3 API # -# Copyright (C) 2000-2018 by Olaf `Olsen' Barthel +# Copyright (C) 2000-2019 by Olaf `Olsen' Barthel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/source_code/assert.c b/source_code/assert.c index 5bb3419..adc912f 100644 --- a/source_code/assert.c +++ b/source_code/assert.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/assert.h b/source_code/assert.h index 9b194ea..be6c662 100644 --- a/source_code/assert.h +++ b/source_code/assert.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/cp437.c b/source_code/cp437.c index d5c1bf1..e9ef0af 100644 --- a/source_code/cp437.c +++ b/source_code/cp437.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/cp437.h b/source_code/cp437.h index eb79a8a..eebd866 100644 --- a/source_code/cp437.h +++ b/source_code/cp437.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/cp850.c b/source_code/cp850.c index 49b7f23..72768ea 100644 --- a/source_code/cp850.c +++ b/source_code/cp850.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/cp850.h b/source_code/cp850.h index 0e3e42d..5e65081 100644 --- a/source_code/cp850.h +++ b/source_code/cp850.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/dump_smb.c b/source_code/dump_smb.c index 1c733b1..560ef99 100644 --- a/source_code/dump_smb.c +++ b/source_code/dump_smb.c @@ -3,7 +3,7 @@ * * dump_smb.c * - * Copyright (C) 2016-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2016-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/dump_smb.h b/source_code/dump_smb.h index 5f2b55c..90d069c 100644 --- a/source_code/dump_smb.h +++ b/source_code/dump_smb.h @@ -3,7 +3,7 @@ * * dump_smb.h * - * Copyright (C) 2016-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2016-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/errors.h b/source_code/errors.h index 57a326a..a178037 100644 --- a/source_code/errors.h +++ b/source_code/errors.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/main.c b/source_code/main.c index d339e4a..2833596 100644 --- a/source_code/main.c +++ b/source_code/main.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -325,6 +325,8 @@ static struct MsgPort * FileSystemPort; static smba_server_t * ServerData; +static const TEXT * ErrorOutput; + static BOOL Quit; static BOOL Quiet; static BOOL CaseSensitive; @@ -779,6 +781,7 @@ main(void) NUMBER Timeout; NUMBER TimeZoneOffset; NUMBER DSTOffset; + KEY ErrorOutput; KEY Protocol; SWITCH NetBIOSTransport; SWITCH WriteBehind; @@ -826,6 +829,7 @@ main(void) "TIMEOUT/N/K," "TZ=TIMEZONEOFFSET/N/K," "DST=DSTOFFSET/N/K," + "ERROROUTPUT/K," "PROTOCOL/K," "NETBIOS/S," "WRITEBEHIND/S," @@ -880,8 +884,8 @@ main(void) memset(&args,0,sizeof(args)); /* If this program was launched from Workbench, the - * command parameters will have to be from the icon - * tool types. + * command parameters will have to be read from the + * icon tool types. */ if(WBStartup != NULL) { @@ -978,6 +982,8 @@ main(void) { D_S(struct FileInfoBlock, fib); + SetVBuf(debug_file, NULL, BUF_LINE, 512); + Seek(debug_file,0,OFFSET_END); close_debug_file = TRUE; @@ -1224,6 +1230,8 @@ main(void) { D_S(struct FileInfoBlock, fib); + SetVBuf(debug_file, NULL, BUF_LINE, 512); + Seek(debug_file,0,OFFSET_END); close_debug_file = TRUE; @@ -1370,6 +1378,23 @@ main(void) if(args.VolumeName != NULL) args.AddVolume = "yes"; + /* Where do we send error messages to if started from shell? */ + if(WBStartup == NULL) + { + if(args.Protocol != NULL && Stricmp(args.Protocol,"stderr") == SAME) + args.Protocol = NULL; + + if(args.Protocol != NULL && Stricmp(args.Protocol,"stdout") != SAME) + { + report_error("'ERROROUTPUT' parameter must be either 'STDERR' or 'STDOUT'."); + goto out; + } + + D(("using 'erroroutput=%s'.", (args.ErrorOutput != NULL) ? "stderr" : "stdout")); + + ErrorOutput = args.ErrorOutput; + } + /* Restrict the command set which smbfs uses? */ if(args.Protocol == NULL) { @@ -2098,39 +2123,68 @@ report_error(const TEXT * fmt,...) GetProgramName(program_name,sizeof(program_name)); - if(this_process->pr_CES != ZERO) + /* Print the error message on the standard error output + * stream? + */ + if(ErrorOutput == NULL) { - output = this_process->pr_CES; + /* Do we have a valid error output stream? This + * likely won't work with the V36-V40 shell, but + * we check this anyway. + */ + if(this_process->pr_CES != ZERO) + { + output = this_process->pr_CES; + } + /* So we need to try to write straight to the + * output window. + */ + else + { + /* Can we write straight to the output window? */ + output = Open("CONSOLE:", MODE_NEWFILE); + if(output != ZERO) + { + SetVBuf(output, NULL, BUF_LINE, 512); + + close_output = TRUE; + } + /* Fall back to using the standard output stream. */ + else + { + output = Output(); + } + } } + /* No, we use the standard output stream. */ else { - output = Open("CONSOLE:", MODE_NEWFILE); - if(output != ZERO) - close_output = TRUE; - else - output = Output(); + output = Output(); } - LocalFPrintf(output, "%s: ",FilePart(program_name)); - - #if defined(__amigaos4__) + if(output != ZERO) { - va_startlinear(args,fmt); - VFPrintf(output, fmt, va_getlinearva(args,APTR)); - va_end(args); - } - #else - { - va_start(args,fmt); - VFPrintf(output,fmt,args); - va_end(args); - } - #endif /* __amigaos4__ */ + LocalFPrintf(output, "%s: ",FilePart(program_name)); - LocalFPrintf(output, "\n"); + #if defined(__amigaos4__) + { + va_startlinear(args,fmt); + VFPrintf(output, fmt, va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,fmt); + VFPrintf(output,fmt,args); + va_end(args); + } + #endif /* __amigaos4__ */ - if(close_output) - Close(output); + LocalFPrintf(output, "\n"); + + if(close_output) + Close(output); + } } } } @@ -5953,6 +6007,10 @@ Action_DeleteObject( free_memory(full_name); free_memory(full_parent_name); + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_DELETE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -6088,6 +6146,10 @@ Action_CreateDir( free_memory(full_name); free_memory(ln); + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -6634,6 +6696,10 @@ Action_SetProtect( free_memory(full_name); + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -6798,6 +6864,10 @@ Action_RenameObject( free_memory(parent_source_name); free_memory(parent_destination_name); + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -8439,6 +8509,12 @@ Action_Find( free_memory(fn); free_memory(parent_path); + /* This can never be a read protection error (EACCES) for + * ACTION_FINDOUTPUT. + */ + if(error == ERROR_READ_PROTECTED && action == ACTION_FINDOUTPUT) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -8547,6 +8623,10 @@ Action_Write( out: + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -8903,6 +8983,10 @@ Action_SetFileSize( out: + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); @@ -9054,6 +9138,10 @@ Action_SetDate( free_memory(full_name); + /* This can never be a read protection error (EACCES). */ + if(error == ERROR_READ_PROTECTED) + error = ERROR_WRITE_PROTECTED; + (*error_ptr) = error; RETURN(result); diff --git a/source_code/quad_math.c b/source_code/quad_math.c index d6d4650..5bb6a92 100644 --- a/source_code/quad_math.c +++ b/source_code/quad_math.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/quad_math.h b/source_code/quad_math.h index 9bae470..ee16222 100644 --- a/source_code/quad_math.h +++ b/source_code/quad_math.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/smakefile b/source_code/smakefile index af1472c..36b7b20 100644 --- a/source_code/smakefile +++ b/source_code/smakefile @@ -3,7 +3,7 @@ # # SMB file system wrapper for AmigaOS, using the AmiTCP V3 API # -# Copyright (C) 2000-2018 by Olaf `Olsen' Barthel +# Copyright (C) 2000-2019 by Olaf `Olsen' Barthel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/source_code/smbfs.h b/source_code/smbfs.h index 0666769..f0d252d 100644 --- a/source_code/smbfs.h +++ b/source_code/smbfs.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/smbfs_rev.h b/source_code/smbfs_rev.h index d0c584d..2a51211 100644 --- a/source_code/smbfs_rev.h +++ b/source_code/smbfs_rev.h @@ -1,6 +1,6 @@ #define VERSION 2 -#define REVISION 12 -#define DATE "5.1.2019" -#define VERS "smbfs 2.12" -#define VSTRING "smbfs 2.12 (5.1.2019)\r\n" -#define VERSTAG "\0$VER: smbfs 2.12 (5.1.2019)" +#define REVISION 13 +#define DATE "9.2.2019" +#define VERS "smbfs 2.13" +#define VSTRING "smbfs 2.13 (9.2.2019)\r\n" +#define VERSTAG "\0$VER: smbfs 2.13 (9.2.2019)" diff --git a/source_code/smbfs_rev.rev b/source_code/smbfs_rev.rev index 48082f7..b1bd38b 100644 --- a/source_code/smbfs_rev.rev +++ b/source_code/smbfs_rev.rev @@ -1 +1 @@ -12 +13 diff --git a/source_code/splay.c b/source_code/splay.c index adfa61f..f445aa6 100644 --- a/source_code/splay.c +++ b/source_code/splay.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/splay.h b/source_code/splay.h index 082e89f..e334eea 100644 --- a/source_code/splay.h +++ b/source_code/splay.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/system_headers.c b/source_code/system_headers.c index 4fa3a69..c7efd3e 100644 --- a/source_code/system_headers.c +++ b/source_code/system_headers.c @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/source_code/system_headers.h b/source_code/system_headers.h index 512443c..aade30d 100644 --- a/source_code/system_headers.h +++ b/source_code/system_headers.h @@ -3,7 +3,7 @@ * * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API * - * Copyright (C) 2000-2018 by Olaf `Olsen' Barthel + * Copyright (C) 2000-2019 by Olaf `Olsen' Barthel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,6 +59,7 @@ #include #include #include +#include #if defined(__amigaos4__) #include