mirror of
https://github.com/obarthel/amiga-smbfs.git
synced 2025-12-08 14:58:35 +00:00
Updated to version 1.163
Please keep in mind that this is still a development version and might surprise you (not necessarily in a good way). Do not let me discourage you to build and test this version, although there will be some risks involved such as data corruption or loss of data.
This commit is contained in:
+25
-3
@@ -241,6 +241,8 @@ static BOOL TranslateNames;
|
||||
static TEXT map_amiga_to_smb_name[256];
|
||||
static TEXT map_smb_to_amiga_name[256];
|
||||
|
||||
static LONG MaxNameLen;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
@@ -552,6 +554,7 @@ main(void)
|
||||
KEY ServerName;
|
||||
KEY DeviceName;
|
||||
KEY VolumeName;
|
||||
NUMBER MaxNameLen;
|
||||
NUMBER CacheSize;
|
||||
NUMBER MaxTransmit;
|
||||
NUMBER Timeout;
|
||||
@@ -587,6 +590,7 @@ main(void)
|
||||
"SERVER=SERVERNAME/K,"
|
||||
"DEVICE=DEVICENAME/K,"
|
||||
"VOLUME=VOLUMENAME/K,"
|
||||
"MAXNAMELEN/N/K,"
|
||||
"CACHE=CACHESIZE/N/K,"
|
||||
"MAXTRANSMIT/N/K,"
|
||||
"TIMEOUT/N/K,"
|
||||
@@ -613,7 +617,7 @@ main(void)
|
||||
TEXT program_name[MAX_FILENAME_LEN+1];
|
||||
LONG result = RETURN_FAIL;
|
||||
LONG number;
|
||||
LONG tz_number, dst_number;
|
||||
LONG tz_number, dst_number, debug_number;
|
||||
LONG cache_size = 0;
|
||||
LONG max_transmit = -1;
|
||||
LONG timeout = 0;
|
||||
@@ -787,19 +791,31 @@ main(void)
|
||||
SPrintf(NewProgramName,"%s '%s'",WBStartup->sm_ArgList[0].wa_Name,str);
|
||||
}
|
||||
|
||||
str = FindToolType(Icon->do_ToolTypes,"MAXNAMELEN");
|
||||
if(str != NULL)
|
||||
{
|
||||
if(StrToLong(str,&number) == -1)
|
||||
{
|
||||
report_error("Invalid number '%s' for 'MAXNAMELEN' parameter.",str);
|
||||
goto out;
|
||||
}
|
||||
|
||||
MaxNameLen = number;
|
||||
}
|
||||
|
||||
str = FindToolType(Icon->do_ToolTypes,"DEBUG");
|
||||
if(str == NULL)
|
||||
str = FindToolType(Icon->do_ToolTypes,"DEBUGLEVEL");
|
||||
|
||||
if(str != NULL)
|
||||
{
|
||||
if(StrToLong(str,&number) == -1)
|
||||
if(StrToLong(str,&debug_number) == -1)
|
||||
{
|
||||
report_error("Invalid number '%s' for 'DEBUG' parameter.",str);
|
||||
goto out;
|
||||
}
|
||||
|
||||
args.DebugLevel = &number;
|
||||
args.DebugLevel = &debug_number;
|
||||
}
|
||||
|
||||
str = FindToolType(Icon->do_ToolTypes,"DEBUGFILE");
|
||||
@@ -977,6 +993,9 @@ main(void)
|
||||
SPrintf(NewProgramName,"%s '%s'",name,args.Service);
|
||||
}
|
||||
|
||||
if(args.MaxNameLen != NULL)
|
||||
MaxNameLen = (*args.MaxNameLen);
|
||||
|
||||
if(args.CacheSize != NULL)
|
||||
cache_size = (*args.CacheSize);
|
||||
|
||||
@@ -2437,6 +2456,9 @@ validate_amigados_file_name(const TEXT * name,int len)
|
||||
if(len <= 0 || len > 255)
|
||||
goto out;
|
||||
|
||||
if(MaxNameLen > 0 && len > MaxNameLen)
|
||||
goto out;
|
||||
|
||||
for(i = 0 ; i < len ; i++)
|
||||
{
|
||||
c = name[i];
|
||||
|
||||
@@ -42,6 +42,7 @@ static int
|
||||
smba_connect (
|
||||
smba_connect_parameters_t * p,
|
||||
in_addr_t ip_addr,
|
||||
const char * tcp_service_name,
|
||||
int use_E,
|
||||
const char * workgroup_name,
|
||||
int cache_size,
|
||||
@@ -146,7 +147,42 @@ smba_connect (
|
||||
data.addr.sin_family = AF_INET;
|
||||
data.addr.sin_addr.s_addr = ip_addr;
|
||||
|
||||
if(res->server.raw_smb)
|
||||
/* Override the default TCP service name or port
|
||||
* number which smbfs should connect to on the
|
||||
* server?
|
||||
*/
|
||||
if(tcp_service_name[0] != '\0')
|
||||
{
|
||||
/* Try to find a service whose name matches. */
|
||||
servent = getservbyname((char *)tcp_service_name,"tcp");
|
||||
if(servent != NULL)
|
||||
{
|
||||
data.addr.sin_port = servent->s_port;
|
||||
}
|
||||
else
|
||||
{
|
||||
long int n;
|
||||
char * s;
|
||||
|
||||
/* Try again, this time converting what's
|
||||
* hopefully a number in the range
|
||||
* valid for a TCP service.
|
||||
*/
|
||||
n = strtol(tcp_service_name,&s,10);
|
||||
if(s != tcp_service_name && (*s) == '\0' && 0 < n && n < 65536)
|
||||
{
|
||||
data.addr.sin_port = htons (n);
|
||||
}
|
||||
else
|
||||
{
|
||||
report_error("Invalid service '%s'.", tcp_service_name);
|
||||
|
||||
(*error_ptr) = EINVAL;
|
||||
goto error_occured;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (res->server.raw_smb)
|
||||
{
|
||||
servent = getservbyname("microsoft-ds","tcp");
|
||||
if(servent != NULL)
|
||||
@@ -1629,12 +1665,21 @@ smba_setup_dircache (struct smba_server * server,int cache_size, int * error_ptr
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
extract_service (const char *service, char *server, size_t server_size, char *share, size_t share_size,int * error_ptr)
|
||||
extract_service (
|
||||
const char * service,
|
||||
char * server,
|
||||
size_t server_size,
|
||||
char * tcp_service_name,
|
||||
size_t tcp_service_name_size,
|
||||
char * share,
|
||||
size_t share_size,
|
||||
int * error_ptr)
|
||||
{
|
||||
char * share_start;
|
||||
char * root_start;
|
||||
char * complete_service;
|
||||
char * service_copy;
|
||||
char * service_name = NULL;
|
||||
int result = -1;
|
||||
|
||||
service_copy = malloc(strlen(service)+1);
|
||||
@@ -1687,6 +1732,28 @@ extract_service (const char *service, char *server, size_t server_size, char *sh
|
||||
if (root_start != NULL)
|
||||
(*root_start) = '\0';
|
||||
|
||||
/* Check if there's a port number encoded in the service name. */
|
||||
service_name = strchr(complete_service,':');
|
||||
if(service_name != NULL)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* Cut off the TCP service name, but remember where
|
||||
* the name starts.
|
||||
*/
|
||||
(*service_name++) = '\0';
|
||||
|
||||
/* Skip leading and trailing blank spaces, just to be safe. */
|
||||
while((*service_name) == ' ')
|
||||
service_name++;
|
||||
|
||||
len = strlen(service_name);
|
||||
while(len > 0 && (*service_name) == ' ')
|
||||
len--;
|
||||
|
||||
service_name[len] = '\0';
|
||||
}
|
||||
|
||||
if (strlen (complete_service) > 63)
|
||||
{
|
||||
report_error("Server name is too long in '%s' (max %ld characters).",service,63);
|
||||
@@ -1707,6 +1774,7 @@ extract_service (const char *service, char *server, size_t server_size, char *sh
|
||||
|
||||
strlcpy (server, complete_service, server_size);
|
||||
strlcpy (share, share_start, share_size);
|
||||
strlcpy (tcp_service_name, service_name != NULL ? service_name : "", tcp_service_name_size);
|
||||
|
||||
result = 0;
|
||||
|
||||
@@ -1748,7 +1816,7 @@ smba_start(
|
||||
char server_name[17], client_name[17]; /* Maximum length appears to be 16 characters for NetBIOS */
|
||||
char username[64], password[64];
|
||||
char workgroup[64]; /* Maximum length appears to be 15 characters */
|
||||
char server[64], share[256];
|
||||
char server[64], share[256], tcp_service_name[40];
|
||||
in_addr_t server_ip_address;
|
||||
int result = -1;
|
||||
|
||||
@@ -1760,7 +1828,7 @@ smba_start(
|
||||
(*smba_server_ptr) = NULL;
|
||||
(*username) = (*password) = (*server_name) = (*client_name) = '\0';
|
||||
|
||||
if(extract_service (service, server, sizeof(server), share, sizeof(share), error_ptr) < 0)
|
||||
if(extract_service (service, server, sizeof(server), tcp_service_name, sizeof(tcp_service_name), share, sizeof(share), error_ptr) < 0)
|
||||
goto out;
|
||||
|
||||
server_ip_address = inet_addr (server);
|
||||
@@ -1918,6 +1986,7 @@ smba_start(
|
||||
if(smba_connect (
|
||||
&par,
|
||||
server_ip_address,
|
||||
tcp_service_name,
|
||||
use_extended,
|
||||
workgroup,
|
||||
opt_cachesize,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 162
|
||||
#define DATE "7.7.2018"
|
||||
#define VERS "smbfs 1.162"
|
||||
#define VSTRING "smbfs 1.162 (7.7.2018)\r\n"
|
||||
#define VERSTAG "\0$VER: smbfs 1.162 (7.7.2018)"
|
||||
#define REVISION 163
|
||||
#define DATE "15.7.2018"
|
||||
#define VERS "smbfs 1.163"
|
||||
#define VSTRING "smbfs 1.163 (15.7.2018)\r\n"
|
||||
#define VERSTAG "\0$VER: smbfs 1.163 (15.7.2018)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
162
|
||||
163
|
||||
|
||||
Reference in New Issue
Block a user