diff --git a/README.md b/README.md index dbc6df7..ec85e2a 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ You can also run the **smbfs** program in the background, like so: Run >NIL: smbfs user=PCGuest service=//sourcery/all` -**Note that this is not recommended**, though, because it becomes much harder to tell why the **smbfs** program did not work correctly (as it invariably will at some point). Any error messages which could help in figuring out what the problem may have been will be lost. +**Note that this is not recommended** because it becomes much harder to tell why the **smbfs** program did not work correctly (as it invariably will at some point). Any error messages which could help in figuring out what the problem may have been will be lost. If you have trouble setting up the **smbfs** program, first make sure that it works correctly without the `Run >NIL:` instructions and have a look at any error messages it may produce. @@ -174,6 +174,7 @@ PASSWORD/K PROTOCOL/K QUIET/S RAISEPRIORITY/S +READONLY/N/K READTHRESHOLD/N/K SERVER=SERVERNAME/K SERVICE/A @@ -201,9 +202,11 @@ The parameters relevant for this information are described below. #### 5.1.1. `SHARE=SERVICE/A` -This parameter takes the form of `//server-name/share-name` or `//server-name:port-number/share-name`. +This parameter takes the form of `//server-name/share-name` or `//server-name:port-number/share-name`. You can also use the SMB URI form +`smb://[[workgroup;]user-name[:password]@]server-name[:port-number]/share`. -For example `//sourcery/all`, `//192.168.0.1/all`, `//nas:445/files`, `//nas:microsoft-ds/files` would all be valid `SHARE` parameters. +For example `//sourcery/all`, `//192.168.0.1/all`, `//nas:445/files`, `//nas:microsoft-ds/files`, `smb://sourcery/all`, `smb://user@sourcery/all` +and `smb://user:password@sourcery/all` would all be valid `SHARE` parameters. In this example `server-name` must be either the IPv4 address of the file server to connect to, or the name of the server (**note that server names cannot be longer than 16 characters**). @@ -503,7 +506,15 @@ You can tell **smbfs** not to add a volume, which may be useful because the nati If you want to use a specific volume name, use the `VOLUME` option, e.g. `VOLUME=Sourcery:`. Otherwise a volume name derived from the share name will be used instead. -#### 5.6.2. `OMITHIDDEN/S` +#### 5.6.2. `READONLY/S` + +If you want to make sure that the contents of the file system mounted cannot +be modified or deleted by mistake, use the `READONLY` switch. This switch has +the same effect as using the `Lock` shell command. However, this protection +against modification will be enabled as soon as the file system has been +mounted and the protection cannot be removed with the `Lock` shell command. + +#### 5.6.3. `OMITHIDDEN/S` When requesting a directory listing, the file server may return some files and drawers tagged as being hidden. By default **smbfs** will not treat these "hidden" entries any different from the other directory entries, i.e. they are not hidden from view. @@ -511,14 +522,14 @@ You can request that the hidden entries should be omitted from directory listing Note that even though a file or drawer may be hidden, you should still be able to open and examine it. -#### 5.6.3. `QUIET/S` +#### 5.6.4. `QUIET/S` When started from shell, the **smbfs** program will print a message as soon as the connection to the file server has been established. If you do not want to see that message displayed, use the `QUIET` parameter. Please note that the **smbfs** program may still show error messages. -#### 5.6.4. `SETENV/S` +#### 5.6.5. `SETENV/S` You may want to stop or disable/re-enabled a currently running **smbfs** program through the shell `Break` command, but it may be impractical to figure out which CLI process number is involved. diff --git a/documentation/history.doc b/documentation/history.doc index 6c88f91..a5af14e 100644 --- a/documentation/history.doc +++ b/documentation/history.doc @@ -3043,3 +3043,15 @@ smbfs 2.21 (9.3.2019) you can now use "smbfs smb://workgroup;barney:secret@nas:445/share" instead. It is a bit shorter than the alternative and has an advantage in allowing you to reuse smb:// URLs which you know work well on other systems. + + +smbfs 2.22 (9.3.2019) + +- The memory pool initialization should have happened after having + initialized the command line argument data, not before it. + +- I broke the automatic device name ("smbfs0:" .. "smbfs99:") initialization + at some point. Ouch :-( The revised code now starts with "smbfs:", then + tries "smbfs0:" through "smbfs99:" until it has picked a unique file + system device name. This is consistent with the old behaviour of trying + to use "smbfs:" if no device specific name has been requested. diff --git a/documentation/smbfs.doc b/documentation/smbfs.doc index 07876e6..35dd55e 100644 --- a/documentation/smbfs.doc +++ b/documentation/smbfs.doc @@ -116,10 +116,11 @@ called sourcery and the shared "all" disk it provides, using the login name This would cause a new device by the name of "SMBFS:" to be mounted, showing all files and drawers the sourcery server makes available for sharing. -You can also run the smbfs program in the background, like so: "Run >NIL: -smbfs user=PCGuest service=//sourcery/all". +You can also run the smbfs program in the background, like so: -This is not recommended, though, because it becomes much harder to tell why + Run >NIL: smbfs user=PCGuest service=//sourcery/all + +Note that this is not recommended because it becomes much harder to tell why the smbfs program did not work correctly (as it invariably will at some point). Any error messages which could help in figuring out what the problem may have been will be lost. @@ -202,6 +203,8 @@ parameters): CLIENT=CLIENTNAME/K CP437/S CP850/S + DEBUGFILE/K + DEBUGLEVEL=DEBUG/N/K DEVICE=DEVICENAME/K DISABLEEXALL/S DOMAIN=WORKGROUP/K @@ -215,6 +218,8 @@ parameters): PROTOCOL/K QUIET/S RAISEPRIORITY/S + READONLY/N/K + READTHRESHOLD/N/K SERVER=SERVERNAME/K SERVICE/A SESSIONSETUP/K @@ -226,6 +231,7 @@ parameters): USER=USERNAME/K VOLUME=VOLUMENAME/K WRITEBEHIND/S + WRITETHRESHOLD/N/K 5.1. Server and authentication options @@ -244,10 +250,12 @@ The parameters relevant for this information are described below. 5.1.1. "SHARE=SERVICE/A" This parameter takes the form of "//server-name/share-name" or -"//server-name:port-number/share-name". +"//server-name:port-number/share-name". You can also use the SMB URI form +"smb://[[workgroup;]user-name[:password]@]server-name[:port-number]/share". For example "//sourcery/all", "//192.168.0.1/all", "//nas:445/files", -"//nas:microsoft-ds/files" would all be valid "SHARE" parameters. +"//nas:microsoft-ds/files", "smb://sourcery/all", "smb://user@sourcery/all" +and "smb://user:password@sourcery/all" would all be valid "SHARE" parameters. In this example "server-name" must be either the IPv4 address of the file server to connect to, or the name of the server (note that server names cannot @@ -771,7 +779,15 @@ If you want to use a specific volume name, use the "VOLUME" option, e.g. "VOLUME=Sourcery:". Otherwise a volume name derived from the share name will be used instead. -5.6.2. "OMITHIDDEN/S" +5.6.2. "READONLY/S" + +If you want to make sure that the contents of the file system mounted cannot +be modified or deleted by mistake, use the READONLY switch. This switch has +the same effect as using the "Lock" shell command. However, this protection +against modification will be enabled as soon as the file system has been +mounted and the protection cannot be removed with the "Lock" shell command. + +5.6.3. "OMITHIDDEN/S" When requesting a directory listing, the file server may return some files and drawers tagged as being hidden. By default smbfs will not treat these "hidden" @@ -784,7 +800,7 @@ listings by using the "OMITHIDDEN" switch. Note that even though a file or drawer may be hidden, you should still be able to open and examine it. -5.6.3. "QUIET/S" +5.6.4. "QUIET/S" When started from shell, the smbfs program will print a message as soon as the connection to the file server has been established. @@ -792,7 +808,7 @@ connection to the file server has been established. If you do not want to see that message displayed, use the "QUIET" parameter. Please note that the smbfs program may still show error messages. -5.6.4. "SETENV/S" +5.6.5. "SETENV/S" You may want to stop or disable/re-enabled a currently running smbfs program through the shell "Break" command, but it may be impractical to figure out diff --git a/source_code/main.c b/source_code/main.c index 49cde98..d5c6136 100644 --- a/source_code/main.c +++ b/source_code/main.c @@ -267,7 +267,7 @@ static LONG CVSPrintf(const TEXT * format_string, APTR args); static int LocalVSNPrintf(STRPTR buffer, int limit, const TEXT * formatString, APTR args); static void cleanup(void); static BOOL setup(const TEXT * program_name, const TEXT * service, const TEXT * workgroup, STRPTR username, STRPTR opt_password, BOOL opt_change_username_case, BOOL opt_change_password_case, const TEXT * opt_clientname, const TEXT * opt_servername, int opt_cachesize, int opt_cache_tables, int opt_max_transmit, int opt_timeout, LONG *opt_time_zone_offset, LONG *opt_dst_offset, BOOL opt_raw_smb, BOOL opt_unicode, BOOL opt_prefer_core_protocol, BOOL opt_session_setup_delay_unicode, BOOL opt_write_behind, int opt_smb_request_write_threshold, int opt_smb_request_read_threshold, BOOL scatter_gather, BOOL tcp_no_delay, int socket_receive_buffer_size, int socket_send_buffer_size, const TEXT * device_name, const TEXT * volume_name, BOOL add_volume, const TEXT * translation_file); -static void file_system_handler(BOOL raise_priority, const TEXT * device_name, const TEXT * volume_name, const TEXT * service_name); +static void file_system_handler(BOOL raise_priority, const TEXT * volume_name, const TEXT * service_name); /****************************************************************************/ @@ -886,6 +886,14 @@ main(void) */ NewList((struct List *)&ErrorList); + /* The command parameters will be filled in either from + * icon tool types or from the CLI command line arguments. + */ + memset(&args,0,sizeof(args)); + + /* Make sure that we can allocate memory from the + * local pool. + */ MemoryPool = CreatePool(MEMF_ANY|MEMF_PUBLIC, 4096, 4096); if(MemoryPool == NULL) { @@ -893,11 +901,6 @@ main(void) goto out; } - /* The command parameters will be filled in either from - * icon tool types or from the CLI command line arguments. - */ - memset(&args,0,sizeof(args)); - /* If this program was launched from Workbench, the * command parameters will have to be read from the * icon tool types. @@ -1541,14 +1544,6 @@ main(void) if(args.TCPDelay == NULL && args.TCPNoDelay) args.TCPDelay = "no"; - /* Use the default if no device or volume name is given. */ - if(args.DeviceName == NULL && args.VolumeName == NULL) - { - args.DeviceName = "SMBFS"; - - D(("no device/volume name given, using 'devicename=%s' instead.", args.DeviceName)); - } - if(args.VolumeName != NULL) args.AddVolume = "yes"; @@ -1912,7 +1907,7 @@ main(void) } } - file_system_handler(args.RaisePriority,args.DeviceName,args.VolumeName,args.Service); + file_system_handler(args.RaisePriority, args.VolumeName, args.Service); /* Clean up after the environment variable... */ if(setenv_name[0] != '\0') @@ -4495,17 +4490,20 @@ setup( if(FindDosEntry(dl,name,LDF_DEVICES) != NULL) device_exists = TRUE; } - /* Otherwise pick a device name of the form SMBFS0..SMBFS99, + /* Otherwise pick a device name of the form SMBFS, SMBFS0..SMBFS99, * which is not currently in use. */ else { dl = LockDosList(LDF_WRITE|LDF_VOLUMES|LDF_DEVICES); - /* Try to find a unique device name out of 100 possible options. */ - for(i = 0 ; i < 100 ; i++) + /* Try to find a unique device name out of 101 possible options. */ + for(i = -1 ; i < 100 ; i++) { - LocalSNPrintf(name,sizeof(name),"SMBFS%ld",i); + if(i == -1) + strlcpy(name,"SMBFS",sizeof(name)); + else + LocalSNPrintf(name,sizeof(name),"SMBFS%ld",i); device_exists = (BOOL)(FindDosEntry(dl,name,LDF_DEVICES) != NULL); if(NOT device_exists) @@ -10415,7 +10413,6 @@ Action_FilesystemAttr( static void file_system_handler( BOOL raise_priority, - const TEXT * device_name, const TEXT * volume_name, const TEXT * service_name) { @@ -10441,8 +10438,6 @@ file_system_handler( if(NOT cli->cli_Background) { - TEXT name[MAX_FILENAME_LEN+1]; - TEXT * dot; LONG max_cli; LONG which; LONG i; @@ -10465,22 +10460,8 @@ file_system_handler( Permit(); - if(volume_name == NULL) - strlcpy(name,device_name,sizeof(name)); - else - strlcpy(name,volume_name,sizeof(name)); - - /* If the device or volume name had a trailing - * colon character attached, remove it so that the - * output below will always show one colon - * character following the name, and not two. - */ - dot = (TEXT *)strchr(name, ':'); - if(dot != NULL) - (*dot) = '\0'; - - LocalFPrintf(ZERO, "Mounted '%s' as '%s:'; \"Break %ld\" or [Ctrl+C] to stop and unmount... ", - service_name,name,which); + LocalFPrintf(ZERO, "Mounted '%s' as '%b:'; \"Break %ld\" or [Ctrl+C] to stop and unmount... ", + service_name,(volume_name != NULL && VolumeNodeAdded) ? VolumeNode->dol_Name : DeviceNode->dol_Name,which); Flush(Output()); diff --git a/source_code/smbfs_rev.h b/source_code/smbfs_rev.h index 8e94e62..eb4ba23 100644 --- a/source_code/smbfs_rev.h +++ b/source_code/smbfs_rev.h @@ -1,6 +1,6 @@ #define VERSION 2 -#define REVISION 21 +#define REVISION 22 #define DATE "9.3.2019" -#define VERS "smbfs 2.21" -#define VSTRING "smbfs 2.21 (9.3.2019)\r\n" -#define VERSTAG "\0$VER: smbfs 2.21 (9.3.2019)" +#define VERS "smbfs 2.22" +#define VSTRING "smbfs 2.22 (9.3.2019)\r\n" +#define VERSTAG "\0$VER: smbfs 2.22 (9.3.2019)" diff --git a/source_code/smbfs_rev.rev b/source_code/smbfs_rev.rev index aabe6ec..2bd5a0a 100644 --- a/source_code/smbfs_rev.rev +++ b/source_code/smbfs_rev.rev @@ -1 +1 @@ -21 +22