Buglets and booby-traps in Samba 2.2.0 beta 3
David Collier-Brown
davecb at canada.sun.com
Wed Apr 11 19:19:43 GMT 2001
The use of MAXPATHLEN in fullpath():
The function wants a buffer of MAX_PATH bytes,
and we provide one of MAXPATHLEN bytes.
Alas...
File Line
1 param.h 163 #define MAXPATHLEN 1024
2 includes.h 763 #define MAXPATHLEN 256
I think we get the right value, but I'd suggest
destroying/renaming the wrong one, lest we
have an unintended truncation (:-))
There are lots of duplicated definitions, some between nterr.h
and smb.h, which have to be kept in sync or mysterious errors will
occur, the very thing one used defines to avoid!
For example:
./include/smb.h:#define Auto (2)
./nsswitch/winbind_nss_config.h:#define Auto (2)
./include/nterr.h:#define ERROR_INSUFFICIENT_BUFFER (122)
./include/smb.h:#define ERROR_INSUFFICIENT_BUFFER (122)
./include/nterr.h:#define ERROR_INVALID_PARAMETER (87)
./include/smb.h:#define ERROR_INVALID_PARAMETER (87)
There are more among aparser, nsswitch and samba. For example:
./aparser/parser.h:#define _PSTRING
./include/smb.h:#define _PSTRING
./nsswitch/winbind_nss_config.h:#define _PSTRING
./aparser/parser.h:#define FSTRING_LEN 256
./include/smb.h:#define FSTRING_LEN 256
and some between ntdomain and aparser:
./aparser/parser.h:#define MARSHALL 0
./include/ntdomain.h:#define MARSHALL 0
./aparser/parser.h:#define MARSHALLING(ps) (!(ps)->io)
./include/ntdomain.h:#define MARSHALLING(ps) (!(ps)->io)
./aparser/parser.h:#define MAX(a,b) ((a)>(b)?(a):(b))
./include/includes.h:#define MAX(a,b) ((a)>(b)?(a):(b))
./include/smb_macros.h:#define MAX(a,b) ((a)>(b)?(a):(b))
./aparser/parser.h:#define MAX_BUFFERLEN 512
./include/rpc_misc.h:#define MAX_BUFFERLEN 512
./aparser/parser.h:#define MIN(a,b) ((a)<(b)?(a):(b))
./include/includes.h:#define MIN(a,b) ((a)<(b)?(a):(b))
./include/smb_macros.h:#define MIN(a,b) ((a)<(b)?(a):(b))
./aparser/parser.h:#define PSTRING_LEN 1024
./include/smb.h:#define PSTRING_LEN 1024
./include/smb_macros.h:#define ZERO_STRUCT(x) memset((char *)&(x), 0,
sizeof(x!
./nsswitch/winbind_nss_config.h:#define ZERO_STRUCT(x) memset((char
*)&(x), 0,!
./aparser/parser.h:#define ZERO_STRUCTP(x) { if ((x) != NULL)
memset((char *)(!
.
And two that make me wonder...
./aparser/parser.h:#define MAX_STRINGLEN 256
./include/rpc_misc.h:#define MAX_STRINGLEN 256
./aparser/parser.h:#define MAX_UNISTRLEN 256
./include/rpc_misc.h:#define MAX_UNISTRLEN 256
I'd fix the dangerous ones now and see if we can drop the
duplicates for 2.2.x
--dave
--
David Collier-Brown, | Always do right. This will gratify
Performance & Engineering Team | some people and astonish the rest.
Americas Customer Engineering | -- Mark Twain
(905) 415-2849 | davecb at canada.sun.com
More information about the samba-technical
mailing list