mirror of
https://github.com/obarthel/amiga-smbfs.git
synced 2025-12-08 14:58:35 +00:00
Added the ADDVOLUME option, which defaults to "yes". If no volume name is provided, smbfs will use the service name as the template, e.g. if you connect to //server-name/pictures then the default volume name will be "pictures". The idea is that if the file server allows this, you should not need to start the smbfs program with any parameter other than the service/share name and it should work out of the box. Preparations for showing error messages when running as a Workbench program would corrupt memory once the message was ready for display, but this only happened in the AmigaOS4 build. As far as I can tell this never worked correctly on AmigaOS4. Thanks go to Matthew Kille who reported the problem! Simplified the icon parameter processing used when running smbfs as a Workbench program. The reworked code is now basically limited to processing and setting up the same configuration data which the shell command use employs. Both paths share the same configuration data checking and handling. Turns out that the ACTION_CURRENT_VOLUME function does need to return the volume node, not the device node. Note to self: a 'struct DeviceList' refers to a volume (DLT_VOLUME), whereas a 'struct DeviceNode' refers to a device (DLT_DEVICE). See? This could have been easily been avoided :-/ Added more code documentation, especially for the various constants and data structures defined and used in "main.c". Reading from the file name translation file now performs better error detection and reporting. If read errors should crop up, the error message will now say so. If the file is shorter than required the error message will reflect this. Reworked the smb_proc_reconnect() function so that it does not end up truncating the password before it is encrypted. This means that up to 63 characters of the password can be used to produce the encrypted form, resolving problems with longer server passwords not quite matching what you entered. However, since this long encrypted password is still accompanied by the legacy encrypted form which truncates the password to 14 characters (which are converted to all-upper-case letters) there is no actual gain in terms of security...
192 lines
5.7 KiB
C
192 lines
5.7 KiB
C
/*
|
|
* :ts=4
|
|
*
|
|
* SMB file system wrapper for AmigaOS, using the AmiTCP V3 API
|
|
*
|
|
* Copyright (C) 2000-2018 by Olaf `Olsen' Barthel <obarthel -at- gmx -dot- net>
|
|
*
|
|
* 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
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#ifndef _SMBFS_H
|
|
#define _SMBFS_H 1
|
|
|
|
/****************************************************************************/
|
|
|
|
#ifndef _SYSTEM_HEADERS_H
|
|
#include "system_headers.h"
|
|
#endif /* _SYSTEM_HEADERS_H */
|
|
|
|
#ifndef _ASSERT_H
|
|
#include "assert.h"
|
|
#endif /* _ASSERT_H */
|
|
|
|
#ifndef _QUAD_MATH_H
|
|
#include "quad_math.h"
|
|
#endif /* _QUAD_MATH_H */
|
|
|
|
/****************************************************************************/
|
|
|
|
#define SAME (0)
|
|
#define OK (0)
|
|
#define CANNOT !
|
|
#define NOT !
|
|
#define NO !
|
|
#define NOTHING ((void)0)
|
|
|
|
/****************************************************************************/
|
|
|
|
#ifndef ZERO
|
|
#define ZERO ((BPTR)NULL)
|
|
#endif /* ZERO */
|
|
|
|
/****************************************************************************/
|
|
|
|
#ifndef AMIGA_COMPILER_H
|
|
|
|
/****************************************************************************/
|
|
|
|
#if defined(__SASC)
|
|
#define FAR __far
|
|
#define ASM __asm
|
|
#define REG(r,p) register __##r p
|
|
#define INLINE __inline
|
|
#define STDARGS __stdargs
|
|
#endif /* __SASC */
|
|
|
|
#if defined(__GNUC__)
|
|
#define FAR
|
|
#define ASM
|
|
#define REG(r,p) p __asm(#r)
|
|
#define INLINE __inline__
|
|
#define STDARGS
|
|
#endif /* __GNUC__ */
|
|
|
|
/****************************************************************************/
|
|
|
|
#ifndef VARARGS68K
|
|
#define VARARGS68K
|
|
#endif /* VARARGS68K */
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif /* AMIGA_COMPILER_H */
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* smbfs file system signature (SMB\0), as suggested by Chris Handley
|
|
* and Chris Young.
|
|
*/
|
|
#define ID_SMB_DISK 0x534D4200
|
|
|
|
/*****************************************************************************/
|
|
|
|
#ifndef min
|
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
#endif /* min */
|
|
|
|
#ifndef max
|
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
|
#endif /* max */
|
|
|
|
/****************************************************************************/
|
|
|
|
#if defined(__SASC)
|
|
extern struct Library * FAR AbsExecBase;
|
|
#else
|
|
#ifndef AbsExecBase
|
|
#define AbsExecBase (*(struct Library **)4)
|
|
#endif /* AbsExecBase */
|
|
#endif /* __SASC */
|
|
|
|
/****************************************************************************/
|
|
|
|
extern struct Library * SocketBase;
|
|
extern struct Library * SysBase;
|
|
extern struct Library * DOSBase;
|
|
|
|
/****************************************************************************/
|
|
|
|
#if defined(__amigaos4__)
|
|
|
|
/****************************************************************************/
|
|
|
|
extern struct ExecIFace * IExec;
|
|
extern struct DOSIFace * IDOS;
|
|
extern struct SocketIFace * ISocket;
|
|
|
|
/****************************************************************************/
|
|
|
|
#endif /* __amigaos4__ */
|
|
|
|
/****************************************************************************/
|
|
|
|
extern int h_errno;
|
|
|
|
/****************************************************************************/
|
|
|
|
extern int BroadcastNameQuery(const char *name, const char *scope, UBYTE *address);
|
|
extern int SendNetBIOSStatusQuery(struct sockaddr_in sox,char * server_name,int server_name_size,char * workgroup_name,int workgroup_name_size);
|
|
extern LONG compare_names(const TEXT * a,const TEXT * b);
|
|
extern LONG get_time_zone_delta(void);
|
|
extern STRPTR posix_strerror(int error);
|
|
extern STRPTR host_strerror(int error);
|
|
extern time_t tm_to_seconds(const struct tm * const tm);
|
|
extern ULONG get_current_time(void);
|
|
extern void seconds_to_tm(time_t seconds,struct tm * tm);
|
|
extern void VARARGS68K report_error(const TEXT * fmt,...);
|
|
extern void string_toupper(STRPTR s);
|
|
extern void VARARGS68K LocalSNPrintf(STRPTR buffer, int limit, const TEXT * formatString,...);
|
|
extern TEXT * escape_name(const TEXT * name);
|
|
extern const char * convert_quad_to_string(const QUAD * const number);
|
|
|
|
/****************************************************************************/
|
|
|
|
size_t strlcpy(char *dst, const char *src, size_t siz);
|
|
size_t strlcat(char *dst, const char *src, size_t siz);
|
|
|
|
/****************************************************************************/
|
|
|
|
extern void smb_encrypt(unsigned char *passwd, const unsigned char *c8, unsigned char *p24);
|
|
extern void smb_nt_encrypt(const unsigned char *passwd, const unsigned char *c8, unsigned char *p24);
|
|
|
|
/****************************************************************************/
|
|
|
|
extern void free_memory(APTR address);
|
|
extern APTR allocate_memory(LONG size);
|
|
|
|
#define malloc(s) allocate_memory(s)
|
|
#define free(m) free_memory(m)
|
|
|
|
/****************************************************************************/
|
|
|
|
#undef memcpy
|
|
|
|
#if defined (DEBUG)
|
|
#define memcpy(to,from,size) \
|
|
do \
|
|
{ \
|
|
ASSERT(((const char *)(to)) >= ((const char *)(from))+(size) || ((const char *)(from)) >= ((const char*)(to))+(size)); \
|
|
CopyMem((APTR)(from),(APTR)(to),(ULONG)(size)); \
|
|
} \
|
|
while(0)
|
|
#else
|
|
#define memcpy(to,from,size) ((void)CopyMem((APTR)(from),(APTR)(to),(ULONG)(size)))
|
|
#endif /* DEBUG */
|
|
|
|
/****************************************************************************/
|
|
|
|
#endif /* _SMBFS_H */
|