Commit 0dabebbd authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix for renames where only the case has changed.

Detail:
 Added an extra check after the Xlate path resolution code so that
 the case of the path given to resolve is honoured. This now means that
 the strcmp() done in SMB_Rename fails and the rename is actually sent to
 the server. Before "*rename test Test" would have the path resolved and
 since 'test' already existed both names would be the same, in this example
 something like "*rename A:\test A:\test" would result.
Admin:
 Made the non LONGNAMES version compile again (not tested).
 Removed local definitions of FSControl reason codes, uses Interface header
 now.
 Made the case of #includes match CVS to allow future compilation on a case
 sensitive system.
 Deleted unused "Version" header.

Version 2.34. Tagged as 'LanManFS-2_34'
parent d1ca5496
/* (2.33)
/* (2.34)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.33
#define Module_MajorVersion_CMHG 2.34
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 Jul 2009
#define Module_Date_CMHG 01 Aug 2009
#define Module_MajorVersion "2.33"
#define Module_Version 233
#define Module_MajorVersion "2.34"
#define Module_Version 234
#define Module_MinorVersion ""
#define Module_Date "19 Jul 2009"
#define Module_Date "01 Aug 2009"
#define Module_ApplicationDate "19-Jul-09"
#define Module_ApplicationDate "01-Aug-09"
#define Module_ComponentName "LanManFS"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.33"
#define Module_HelpVersion "2.33 (19 Jul 2009)"
#define Module_LibraryVersionInfo "2:33"
#define Module_FullVersion "2.34"
#define Module_HelpVersion "2.34 (01 Aug 2009)"
#define Module_LibraryVersionInfo "2:34"
......@@ -35,10 +35,10 @@
#include "stdtypes.h"
#include "attr.h"
#include "smb.h"
#include "xlate.h"
#include "omni.h"
#include "Attr.h"
#include "SMB.h"
#include "Xlate.h"
#include "Omni.h"
#include "LanMan.h"
#include "LMVars.h"
......@@ -344,7 +344,7 @@ static err_t Attr_GetInfoX2 ( char *filename, char *leafname,
RISCOS_ATTRIBS *pRA )
{
char *lastcomma;
if (Xlt_SplitLeafnameX2 ( leafname?leafname:filename, pRA, &lastcomma ) != OK) {
if (Xlt_SplitLeafnameX2 ( (leafname != NULL) ? leafname : filename, pRA, &lastcomma ) != OK) {
/* Something asked using a RISC OS name. Need to do a lookup
* for the file.
*/
......@@ -507,7 +507,7 @@ extern err_t Attr_SetInfo ( char *pathname, RISCOS_ATTRIBS *pRA )
debug1("SetInfo for '%s'\n", pathname);
#ifdef LONGNAMES
/* Wonderfully ehough, we don't actually need an implementation
/* Wonderfully enough, we don't actually need an implementation
* of this at all!
*/
if (SMB_IsLongNameFS(pathname))
......
......@@ -28,12 +28,12 @@
#include "swis.h"
#include "stdtypes.h"
#include "lanman.h"
#include "LanMan.h"
#include "Params.h"
#include "corefn.h"
#include "xlate.h"
#include "attr.h"
#include "smb.h"
#include "CoreFn.h"
#include "Xlate.h"
#include "Attr.h"
#include "SMB.h"
#include "Omni.h"
#include "Transact.h"
#include "NameCache.h"
......@@ -360,8 +360,7 @@ _kernel_oserror *fsentry_func ( int *R )
case FSEntry_Func_Reason_RenameObject:
err = Xlt_ConvertPath( name_R(1), DOSnamebuf);
if ( err == OK )
err = Xlt_ConvertPath( name_R(2), DOSnamebuf+DOS_NAME_LEN );
if ( err == OK ) err = Xlt_ConvertPath( name_R(2), DOSnamebuf+DOS_NAME_LEN );
#ifdef LONGNAMES
{
DOS_ATTRIBS da;
......@@ -375,21 +374,24 @@ _kernel_oserror *fsentry_func ( int *R )
if ( err == OK )
{
(void) Xlt_CnvRenameX2 ( DOSnamebuf, DOSnamebuf + DOS_NAME_LEN );
}
if (da.attr & ATTR_DIR) // force strip RO extent from dir name
{
Xlt_CnvRenameX2 ( DOSnamebuf+DOS_NAME_LEN,DOSnamebuf+DOS_NAME_LEN);
/* Trim any RO extension and append the ones from the source instead */
Xlt_RemoveROType ( DOSnamebuf + DOS_NAME_LEN );
if ((da.attr & ATTR_DIR) == 0)
{
Xlt_AddROType ( DOSnamebuf + DOS_NAME_LEN, ra.loadaddr );
}
}
}
#endif
if ( err == OK ) {
if ( err == OK )
{
err = SMB_Rename ( DOSnamebuf, DOSnamebuf+DOS_NAME_LEN );
flushnames = true;
}
}
#ifdef LONGNAMES
if (SMB_IsLongNameFS(DOSnamebuf + DOS_NAME_LEN)) {
if (SMB_IsLongNameFS(DOSnamebuf + DOS_NAME_LEN))
{
if ( err == EBADRENAME )
{
R[1] = 1;
......@@ -681,7 +683,9 @@ _kernel_oserror *fsentry_file( int *R )
break;
case FSEntry_File_Reason_CreateDirectory:
Xlt_CnvRenameX2 ( DOSnamebuf, DOSnamebuf );
#ifdef LONGNAMES
Xlt_RemoveROType ( DOSnamebuf );
#endif
err = SMB_MkDir ( DOSnamebuf );
flushnames = true;
break;
......
......@@ -34,18 +34,16 @@
#include "kernel.h"
#include "os.h"
#include "swis.h"
#include "sys/dcistructs.h"
/* Our includes */
#include "stdtypes.h"
#include "mbuf.h"
#include "sys/dcistructs.h"
#include "buflib.h"
#include "llc.h"
#include "stats.h"
#include "lanman.h" /* For LM_pw value */
#include "Mbuf.h"
#include "BufLib.h"
#include "LLC.h"
#include "Stats.h"
#include "LanMan.h" /* For LM_pw value */
#include "LanMan_MH.h"
/* Private definitions ******************** */
......
......@@ -31,30 +31,28 @@
#include "kernel.h"
#include "swis.h"
#include "sys/dcistructs.h"
#include "sys/types.h"
#include "netinet/in.h"
#include "arpa/inet.h"
#include "Global/FileTypes.h"
#include "Interface/HighFSI.h"
#include "stdtypes.h"
#include "lanman.h"
#include "lmvars.h"
#include "LanMan.h"
#include "LMVars.h"
#include "Params.h"
#include "corefn.h"
#include "buflib.h"
#include "netbios.h"
#include "CoreFn.h"
#include "BufLib.h"
#include "NetBIOS.h"
#include "SMB.h"
#include "xlate.h"
#include "Xlate.h"
#include "VersionNum"
#include "omni.h"
#include "printers.h"
#include "Omni.h"
#include "Printers.h"
#include "RPC.h"
#include "stats.h"
#include "logon.h"
#include "sys/dcistructs.h"
#include "sys/types.h"
#include "netinet/in.h"
#include "arpa/inet.h"
#include "Stats.h"
#include "Logon.h"
#include "LanMan_MH.h"
static volatile int callbackflag = 0;
......@@ -196,7 +194,7 @@ static void LM_Undeclare ( void )
if ( LM_Declared )
{
r.r[0] = FSControl_RemoveFilingSystem;
r.r[0] = FSControl_RemoveFS;
r.r[1] = (int)FilingSystemName;
_kernel_swi( XOS_Bit | OS_FSControl, &r, &r );
......@@ -242,7 +240,7 @@ _kernel_oserror * LM_Finalise (int fatal, int podule, void *pw)
static _kernel_oserror *LM_Declare ( void )
{
_kernel_oserror *err;
int InfoBlk [ Information_Block_Size ];
int InfoBlk[12];
LM_Declared = false;
......@@ -259,10 +257,10 @@ static _kernel_oserror *LM_Declare ( void )
InfoBlk[10] = (int)veneer_fsentry_gbpb - (int)Image_RO_Base;
InfoBlk[11] = Information2_Word;
err = _swix(OS_FSControl, _INR(0,3), FSControl_AddFilingSystem, Image_RO_Base,
err = _swix(OS_FSControl, _INR(0,3), FSControl_AddFS, Image_RO_Base,
(int)InfoBlk - (int)Image_RO_Base, LM_pw);
if ( err == NULL )
LM_Declared=true;
LM_Declared = true;
return err;
}
......@@ -325,7 +323,7 @@ static _kernel_oserror *Cmd_LanMan ( const char *args )
_kernel_swi_regs r;
(void) args;
r.r[0] = FSControl_SelectFilingSystem;
r.r[0] = FSControl_SelectFS;
r.r[1] = (int)FilingSystemName;
return _kernel_swi( XOS_Bit | OS_FSControl, &r, &r );
......
......@@ -35,13 +35,12 @@
#include "swis.h"
#include "stdtypes.h"
#include "lanman.h"
#include "lmvars.h"
#include "omni.h"
#include "rpc.h"
#include "logon.h"
#include "xlate.h"
#include "LanMan.h"
#include "LMVars.h"
#include "Omni.h"
#include "RPC.h"
#include "Logon.h"
#include "Xlate.h"
#include "LanMan_MH.h"
/* ----------------------------------- */
......
......@@ -48,16 +48,14 @@
/* Our includes */
#include "stdtypes.h"
#include "lanman.h"
#include "buflib.h"
#include "tcpip.h"
#include "netbios.h"
#include "xlate.h" /* For string functions */
#include "stats.h"
#include "lmvars.h"
#include "nbip.h"
#include "LanMan.h"
#include "BufLib.h"
#include "TCPIP.h"
#include "NetBIOS.h"
#include "Xlate.h" /* For string functions */
#include "Stats.h"
#include "LMVars.h"
#include "NBIP.h"
#include "LanMan_MH.h"
#define EXPORT static
......
......@@ -24,7 +24,6 @@
/* Standard includes */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -35,13 +34,13 @@
#ifndef NO_NETBEUI
#include "LanMan.h"
#include "stdtypes.h"
#include "buflib.h"
#include "stats.h"
#include "llc.h"
#include "netbios.h"
#include "lmvars.h"
#include "BufLib.h"
#include "Stats.h"
#include "LLC.h"
#include "NetBIOS.h"
#include "LMVars.h"
#define EXPORT static
......
......@@ -47,17 +47,16 @@
#include "swis.h"
#include "stdtypes.h"
#include "smb.h"
#include "rpc.h"
#include "lanman.h"
#include "printers.h"
#include "SMB.h"
#include "RPC.h"
#include "LanMan.h"
#include "Printers.h"
#include "VersionNum"
#include "xlate.h"
#include "lmvars.h"
#include "stats.h"
#include "logon.h"
#include "omni.h"
#include "Xlate.h"
#include "LMVars.h"
#include "Stats.h"
#include "Logon.h"
#include "Omni.h"
#include "LanMan_MH.h"
#define INFO_STR_LEN 64
......
......@@ -18,6 +18,7 @@
* 16-12-94 INH Original
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -25,10 +26,9 @@
#include "kernel.h"
#include "swis.h"
#include "stdtypes.h"
#include "printers.h"
#include "smb.h"
#include "omni.h"
#include "Printers.h"
#include "SMB.h"
#include "Omni.h"
struct pjob_info /* Print job info */
{
......
......@@ -35,14 +35,15 @@
/* Our includes */
#include "LanMan.h"
#include "stdtypes.h"
#include "buflib.h"
#include "BufLib.h"
#include "NetBIOS.h"
#include "smb.h"
#include "xlate.h" /* For string functions */
#include "omni.h"
#include "lmvars.h"
#include "rpc.h"
#include "SMB.h"
#include "Xlate.h" /* For string functions */
#include "Omni.h"
#include "LMVars.h"
#include "RPC.h"
/* Globals ---------------------------- */
......
......@@ -82,18 +82,18 @@
/* Our includes */
#include "LanMan.h"
#include "stdtypes.h"
#include "buflib.h"
#include "netbios.h"
#include "smb.h"
#include "BufLib.h"
#include "NetBIOS.h"
#include "SMB.h"
#include "Transact.h"
#ifdef LONGNAMES
#include "Transact.h" /* for transaction structure building helpers */
#include "NameCache.h" /* for the directory entry cache */
#endif
#include "lmvars.h"
#include "attr.h" /* For InvalidateDrive */
#include "xlate.h" /* For string functions */
#include "LMVars.h"
#include "Attr.h" /* For InvalidateDrive */
#include "Xlate.h" /* For string functions */
/* Definitions ===================================================== */
......@@ -873,7 +873,7 @@ static err_t SMB_Negotiate( hSHARE hS )
if ( res != OK )
return res;
#ifdef DEBUG
#ifdef DEBUG
debug1("Data length on negprot is %d\n", ChainLen(pB));
{
static char buf[4096];
......@@ -883,7 +883,7 @@ static err_t SMB_Negotiate( hSHARE hS )
DumpBuffer(buf, len);
DumpStruct(ptr, (SMB_RxWords[0] >= DIALECT_NT) ? dvs_NTnegprot : dvs_negprot);
}
#endif
#endif
FreeChain(pB);
debug1("Negotiated protocol `%s'\n", SMB_Dialect(SMB_RxWords[0]));
......@@ -1403,9 +1403,10 @@ static hSHARE GetShareNoConn ( uint letter )
/* ---------------------------- */
/* SMB_IsLongNameFS() returns true if the path refers to a share which is using long
filenames. Xlate.c needs to know this in order to determine which set of file
mappings is to be used.
#ifdef LONGNAMES
/* SMB_IsLongNameFS() returns true if the path refers to a share which is
* using long filenames. Xlate.c needs to know this in order to determine
* which set of file mappings is to be used.
*/
bool SMB_IsLongNameFS( const char * path)
{
......@@ -1415,7 +1416,7 @@ bool SMB_IsLongNameFS( const char * path)
if (hS != NULL && (hS->hServer->t2flags & T2FLAGS_LONGNAMES)) return true;
return false;
}
#endif
/* --------------------- */
......@@ -1672,19 +1673,19 @@ fail:
err_t SMB_DeleteShare ( char drvlettr )
{
hSHARE hShare;
hSHARE hS;
hSERVER hSrv;
hShare = GetShareNoConn(drvlettr);
if ( hShare == NULL )
hS = GetShareNoConn(drvlettr);
if ( hS == NULL )
return EBADDRV;
hSrv = hShare->hServer;
hSrv = hS->hServer;
/* Do Tree disconnect */
DisconnectShare(hShare);
FreeShare(hShare);
DisconnectShare(hS);
FreeShare(hS);
/* If there are no shares left on this server, drop link */
......
......@@ -29,7 +29,7 @@
/* Our includes */
#include "stdtypes.h"
#include "stats.h"
#include "Stats.h"
int Stat_StatTable [STA_MAXSTATS];
int Stat_ClassMask;
......
......@@ -30,10 +30,9 @@
/* Our includes */
#include "LanMan.h"
#include "stdtypes.h"
#include "buflib.h"
#include "NetBIOS.h"
#include "smb.h"
#include "SMB.h"
#include "Transact.h"
/*
......
......@@ -22,18 +22,18 @@
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "LanMan.h"
#include "stdtypes.h"
#include "swis.h"
#include "Xlate.h"
#include "attr.h"
#include "omni.h"
#include "lmvars.h"
#include "Attr.h"
#include "Omni.h"
#include "LMVars.h"
#include "SMB.h"
#include "Transact.h"
#include "NameCache.h"
......@@ -795,6 +795,7 @@ static err_t Xlt_NameROtoDOSX2_sub ( char *dst, char *src, int level )
static Xlt_NXCX2_Data private;
static Transact_SearchContext con;
char *inptr;
int i;
err_t status;
private.matchbuf[0] = dst[0];
......@@ -906,6 +907,15 @@ static err_t Xlt_NameROtoDOSX2_sub ( char *dst, char *src, int level )
}
}
/* Go back and respect the case given regardless of the case on the
* server so that "*RENAME Test TEST" does something
*/
i = 0;
while (src[i]) {
if (isalpha(src[i])) dst[i + 2] = src[i];
i++;
}
return OK;
}
......@@ -1174,7 +1184,7 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
if (leafname == NULL)
{
/* Oh dear - don't understand this - just claim it's text */
pRA->loadaddr |= 0xFFFFFF00;
pRA->loadaddr = ENCODE_FILETYPE(pRA->loadaddr, 0xFFF);
return res;
}
......@@ -1192,8 +1202,7 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
if (stricmp(leafname+1, FileString_UntypedFile) == 0)
{
debug0("File is untyped (,lxa)\n");
pRA->loadaddr = LM_Vars.untyped_address;
pRA->execaddr = LM_Vars.untyped_address;
pRA->loadaddr = pRA->execaddr = LM_Vars.untyped_address;
*terminator = leafname;
res = OK;
}
......@@ -1201,8 +1210,8 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
{
if (stricmp(leafname+1, FileString_DeadFile) == 0)
{
pRA->loadaddr = pRA->execaddr = deaddead;
debug0("File is DEADDEAD\n");
pRA->loadaddr = pRA->execaddr = deaddead;
*terminator = leafname;
res = OK;
}
......@@ -1272,31 +1281,22 @@ return res;
/* ------------------------------- */
#ifdef LONGNAMES
/* Copies the filetype information from one name to another.
* Called by "rename object" and "create directory", note
* thie routine can be called with src and dst the same
* to simply remove an extension. This must continue to function.
/* Trims the optional ",ttt" extension from 'name'
* and returns the updated string
*/
err_t Xlt_CnvRenameX2 ( char *src, char *dst )
err_t Xlt_RemoveROType ( char *name )
{
RISCOS_ATTRIBS RA;
char *terminator, *nterm;
int cnvq = strcmp( src, dst );
char *nterm;
if (Xlt_SplitLeafnameX2( dst, &RA, &nterm ) != OK) {
/* No type information - find end of string */
nterm = strchr(dst, '\0');
if (Xlt_SplitLeafnameX2( name, &RA, &nterm ) != OK) {
/* No type information - nothing to do */
}
else {
/* Strip destination's type information in case source didn't have any either */
/* Poke a terminator to get just the base name */
*nterm = '\0';
}
if (Xlt_SplitLeafnameX2( src, &RA, &terminator ) && cnvq) {
/* If dst and src names truly differ apply src's type to dst */
Xlt_AddROType(dst, RA.loadaddr);
}
return OK;
}
#endif
......
......@@ -26,19 +26,15 @@
#include <string.h>
#include <ctype.h>
/* RISCOS includes */
/* Our includes */
#include "kernel.h"
#include "os.h"
#include "swis.h"
/* Our includes */
#include "stdtypes.h"
#include "mbuf.h"
#include "stats.h"
#include "buflib.h"
#include "Mbuf.h"
#include "Stats.h"
#include "BufLib.h"
/* -------------- */
......