View | Details | Raw Unified | Return to bug 58061
Collapse All | Expand All

(-)VERSION (-1 / +1 lines)
Lines 19-25 Link Here
19
########################################################
19
########################################################
20
SAMBA_VERSION_MAJOR=3
20
SAMBA_VERSION_MAJOR=3
21
SAMBA_VERSION_MINOR=0
21
SAMBA_VERSION_MINOR=0
22
SAMBA_VERSION_RELEASE=4
22
SAMBA_VERSION_RELEASE=5
23
23
24
########################################################
24
########################################################
25
# If a official release has a serious bug              #
25
# If a official release has a serious bug              #
(-)smbd/mangle_hash.c (-5 / +5 lines)
Lines 569-575 Link Here
569
 * Check for a name on the mangled name stack
569
 * Check for a name on the mangled name stack
570
 *
570
 *
571
 *  Input:  s - Input *and* output string buffer.
571
 *  Input:  s - Input *and* output string buffer.
572
 *
572
 *	    maxlen - space in i/o string buffer.
573
 *  Output: True if the name was found in the cache, else False.
573
 *  Output: True if the name was found in the cache, else False.
574
 *
574
 *
575
 *  Notes:  If a reverse map is found, the function will overwrite the string
575
 *  Notes:  If a reverse map is found, the function will overwrite the string
Lines 580-586 Link Here
580
 * ************************************************************************** **
580
 * ************************************************************************** **
581
 */
581
 */
582
582
583
static BOOL check_cache( char *s )
583
static BOOL check_cache( char *s, size_t maxlen )
584
{
584
{
585
	ubi_cacheEntryPtr FoundPtr;
585
	ubi_cacheEntryPtr FoundPtr;
586
	char             *ext_start = NULL;
586
	char             *ext_start = NULL;
Lines 614-620 Link Here
614
	if( !FoundPtr ) {
614
	if( !FoundPtr ) {
615
		if(saved_ext) {
615
		if(saved_ext) {
616
			/* Replace the saved_ext as it was truncated. */
616
			/* Replace the saved_ext as it was truncated. */
617
			(void)pstrcat( s, saved_ext );
617
			(void)safe_strcat( s, saved_ext, maxlen );
618
			SAFE_FREE(saved_ext);
618
			SAFE_FREE(saved_ext);
619
		}
619
		}
620
		return( False );
620
		return( False );
Lines 624-633 Link Here
624
	found_name = (char *)(FoundPtr + 1);
624
	found_name = (char *)(FoundPtr + 1);
625
	found_name += (strlen( found_name ) + 1);
625
	found_name += (strlen( found_name ) + 1);
626
626
627
	(void)pstrcpy( s, found_name );
627
	(void)safe_strcpy( s, found_name, maxlen );
628
	if( saved_ext ) {
628
	if( saved_ext ) {
629
		/* Replace the saved_ext as it was truncated. */
629
		/* Replace the saved_ext as it was truncated. */
630
		(void)pstrcat( s, saved_ext );
630
		(void)safe_strcat( s, saved_ext, maxlen );
631
		SAFE_FREE(saved_ext);
631
		SAFE_FREE(saved_ext);
632
	}
632
	}
633
633
(-)smbd/mangle_hash2.c (-5 / +3 lines)
Lines 362-371 Link Here
362
/*
362
/*
363
  try to find a 8.3 name in the cache, and if found then
363
  try to find a 8.3 name in the cache, and if found then
364
  replace the string with the original long name. 
364
  replace the string with the original long name. 
365
366
  The filename must be able to hold at least sizeof(fstring) 
367
*/
365
*/
368
static BOOL check_cache(char *name)
366
static BOOL check_cache(char *name, size_t maxlen)
369
{
367
{
370
	u32 hash, multiplier;
368
	u32 hash, multiplier;
371
	unsigned int i;
369
	unsigned int i;
Lines 403-412 Link Here
403
401
404
	if (extension[0]) {
402
	if (extension[0]) {
405
		M_DEBUG(10,("check_cache: %s -> %s.%s\n", name, prefix, extension));
403
		M_DEBUG(10,("check_cache: %s -> %s.%s\n", name, prefix, extension));
406
		slprintf(name, sizeof(fstring), "%s.%s", prefix, extension);
404
		slprintf(name, maxlen, "%s.%s", prefix, extension);
407
	} else {
405
	} else {
408
		M_DEBUG(10,("check_cache: %s -> %s\n", name, prefix));
406
		M_DEBUG(10,("check_cache: %s -> %s\n", name, prefix));
409
		fstrcpy(name, prefix);
407
		safe_strcpy(name, prefix, maxlen);
410
	}
408
	}
411
409
412
	return True;
410
	return True;
(-)smbd/reply.c (-3 / +3 lines)
Lines 1524-1530 Link Here
1524
	 */
1524
	 */
1525
	
1525
	
1526
	if (!rc && mangle_is_mangled(mask))
1526
	if (!rc && mangle_is_mangled(mask))
1527
		mangle_check_cache( mask );
1527
		mangle_check_cache( mask, sizeof(pstring)-1 );
1528
	
1528
	
1529
	if (!has_wild) {
1529
	if (!has_wild) {
1530
		pstrcat(directory,"/");
1530
		pstrcat(directory,"/");
Lines 3664-3670 Link Here
3664
	 */
3664
	 */
3665
3665
3666
	if (!rc && mangle_is_mangled(mask))
3666
	if (!rc && mangle_is_mangled(mask))
3667
		mangle_check_cache( mask );
3667
		mangle_check_cache( mask, sizeof(pstring)-1 );
3668
3668
3669
	has_wild = ms_has_wild(mask);
3669
	has_wild = ms_has_wild(mask);
3670
3670
Lines 4136-4142 Link Here
4136
	 */
4136
	 */
4137
4137
4138
	if (!rc && mangle_is_mangled(mask))
4138
	if (!rc && mangle_is_mangled(mask))
4139
		mangle_check_cache( mask );
4139
		mangle_check_cache( mask, sizeof(pstring)-1 );
4140
4140
4141
	has_wild = ms_has_wild(mask);
4141
	has_wild = ms_has_wild(mask);
4142
4142
(-)smbd/mangle.c (-2 / +2 lines)
Lines 98-106 Link Here
98
  looking for a matching name if it doesn't. It should succeed most of the time
98
  looking for a matching name if it doesn't. It should succeed most of the time
99
  or there will be a huge performance penalty
99
  or there will be a huge performance penalty
100
*/
100
*/
101
BOOL mangle_check_cache(char *s)
101
BOOL mangle_check_cache(char *s, size_t maxlen)
102
{
102
{
103
	return mangle_fns->check_cache(s);
103
	return mangle_fns->check_cache(s, maxlen);
104
}
104
}
105
105
106
/* 
106
/* 
(-)smbd/filename.c (-2 / +2 lines)
Lines 306-312 Link Here
306
				 */
306
				 */
307
307
308
				if (mangle_is_mangled(start)) {
308
				if (mangle_is_mangled(start)) {
309
					mangle_check_cache( start );
309
					mangle_check_cache( start, sizeof(pstring) - 1 - (start - name) );
310
				}
310
				}
311
311
312
				DEBUG(5,("New file %s\n",start));
312
				DEBUG(5,("New file %s\n",start));
Lines 455-461 Link Here
455
	 * (JRA).
455
	 * (JRA).
456
	 */
456
	 */
457
	if (mangled)
457
	if (mangled)
458
		mangled = !mangle_check_cache( name );
458
		mangled = !mangle_check_cache( name, maxlength );
459
459
460
	/* open the directory */
460
	/* open the directory */
461
	if (!(cur_dir = OpenDir(conn, path, True))) {
461
	if (!(cur_dir = OpenDir(conn, path, True))) {
(-)lib/util_str.c (-4 / +12 lines)
Lines 1951-1957 Link Here
1951
		s++; i++;
1951
		s++; i++;
1952
	}
1952
	}
1953
1953
1954
	if (*s == '=') n -= 1;
1954
	if ((n > 0) && (*s == '=')) {
1955
		n -= 1;
1956
	}
1955
1957
1956
	/* fix up length */
1958
	/* fix up length */
1957
	decoded.length = n;
1959
	decoded.length = n;
Lines 1964-1973 Link Here
1964
void base64_decode_inplace(char *s)
1966
void base64_decode_inplace(char *s)
1965
{
1967
{
1966
	DATA_BLOB decoded = base64_decode_data_blob(s);
1968
	DATA_BLOB decoded = base64_decode_data_blob(s);
1967
	memcpy(s, decoded.data, decoded.length);
1968
	/* null terminate */
1969
	s[decoded.length] = '\0';
1970
1969
1970
	if ( decoded.length != 0 ) {
1971
		memcpy(s, decoded.data, decoded.length);
1972
1973
		/* null terminate */
1974
		s[decoded.length] = '\0';
1975
	} else {
1976
		*s = '\0';
1977
	}
1978
1971
	data_blob_free(&decoded);
1979
	data_blob_free(&decoded);
1972
}
1980
}
1973
1981
(-)include/mangle.h (-1 / +1 lines)
Lines 8-14 Link Here
8
	BOOL (*is_mangled)(const char *s);
8
	BOOL (*is_mangled)(const char *s);
9
	BOOL (*is_8_3)(const char *fname, BOOL check_case, BOOL allow_wildcards);
9
	BOOL (*is_8_3)(const char *fname, BOOL check_case, BOOL allow_wildcards);
10
	void (*reset)(void);
10
	void (*reset)(void);
11
	BOOL (*check_cache)(char *s);
11
	BOOL (*check_cache)(char *s, size_t maxlen);
12
	void (*name_map)(char *OutName, BOOL need83, BOOL cache83);
12
	void (*name_map)(char *OutName, BOOL need83, BOOL cache83);
13
};
13
};
14
#endif /* _MANGLE_H_ */
14
#endif /* _MANGLE_H_ */

Return to bug 58061