1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

106 Commits

Author SHA1 Message Date
Jeremy Allison
4c182d3220 Fixup the allocate version of the function to do "crap" conversions too.
Embarrassing number of goto's in this :-(. Fixes #830 I think.
Jeremy.
-
Jeremy Allison
6a7919f254 Working on #830. Cope with bad conversions better - don't just memcpy but
try a crap conversion instead. Next this needs to be done to the convert_alloc
function.
Actually fixes some valgrind warnings as well - cool !
Jeremy.
-
Andrew Tridgell
8b8f0c5279 the conversion from int to size_t in charcnv did not take into account
one place where we checked "if (src_len > 0)".

I actually would greatly prefer to switch back to int for src_len. The
type *can* be negative, which means an unsigned type is
inappropriate. There is absolutely no reason why "int" should not be
used for a parameter like this.

I didn't change back to int as we are close to a release and I wanted
a mininal change, but please don't go changing types like this in
future without very careful testing and a damn good reason.

this bug broke pull_ucs2(), I would not be surprised if it caused all
sorts of nastiness. Thanks to vl for noticing the symptoms!
-
Gerald Carter
79fe75dcdf * BUG 446
- setup_logging() in smbclient to be interactive (remove the timestamps)
  - Fix bad return value in pull_ucs2( needs more testing to make sure this
    didn't break something else) that caused clistr_pull() to always read
    the same string from the buffer (pull_usc2() could return -1 if the original
    source length was given as -1)
  - increment some debugging messages to avoid printing them out so often
-
Andrew Bartlett
494781f628 auth/auth_util.c:
- Fill in the 'backup' idea of a domain, if the DC didn't supply one.  This
   doesn't seem to occour in reality, hence why we missed the typo.

lib/charcnv.c:
lib/smbldap.c:
libads/ldap.c:
libsmb/libsmbclient.c:
printing/nt_printing.c:
 - all the callers to pull_utf8_allocate() pass a char ** as the first
   parammeter, so don't make them all cast it to a void **

nsswitch/winbind_util.c:
 - Allow for a more 'correct' view of when usernames should be qualified
   in winbindd.  If we are a PDC, or have 'winbind trusted domains only',
   then for the authentication returns stip the domain portion.
 - Fix valgrind warning about use of free()ed name when looking up our
   local domain.  lp_workgroup() is maniplated inside a procedure that
   uses it's former value.  Instead, use the fact that our local domain is
   always the first in the list.

Andrew Bartlett
-
Jeremy Allison
cd2075580b Get a little paranoid about memfree use in convert_string_allocate..
Looking at crash bugs #809 and others.
Jeremy.
-
Richard Sharpe
58d7a51c57 Fix a couple of warnings with casts. -
Jeremy Allison
d7e35dfb92 Put strcasecmp/strncasecmp on the banned list (except for needed calls
in iconv.c and nsswitch/). Using them means you're not thinking about multibyte at
all and I really want to discourage that.
Jeremy.
-
Jeremy Allison
f23acb4ca5 Fix for MacOS/X which uses STUPID BROKEN UNICODE COMPOSE CHARACTERS !
(rant off :-). Inspired by work from Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>.
Also add MacOSX/Darwin configure fixes.
Jerry - can we put this in 3.0 release ? :-).
Jeremy.
-
Jeremy Allison
035f595995 Fix mb bug in fast path code. strlen_w() returns number of *characters*
not number of bytes. Reproduce this by trying to rename the file named :
sibrseau -> sibrseaU
from Windows 2000 explorer.
Jeremy.
-
Jeremy Allison
6fc0e529f7 Fix valgrind-found read of uninit variable (ensure length is right).
Jeremy.
-
Jeremy Allison
8cb9ec5d53 More cachegrind tuning, plus fix an error message.
Jeremy.
-
Jeremy Allison
f35e9a8b90 More tuning from cachegrind. Change most trim_string() calls to trim_char(0,
as that's what they do. Fix string_replace() to fast-path ascii.
Jeremy.
-
Jeremy Allison
467cafdb1f More hand-tuning of the fastpath. Don't do strlen() when we're doing
to walk to the end anyway.
Jeremy.
-
Jeremy Allison
e98fbfaf38 Remove convert_string_internal completely from fast path when processing
NBENCH calls. Requires fixed buffer size for strdup_upper().
Jeremy.
-
Jeremy Allison
ef140d15ea Used cachegrind to track down some bottlenecks.
Removed calls to clobber_region when not compiling with developer as
they were hiding speed problems.
Added fast path to convert_string() when dealing with ascii -> ascii,
ucs2-le to ascii and ascii to ucs2-le with values <= 0x7F. This
gives a speedup of 22% on my nbench tests.
Next I will do this on convert_string_allocate.
Jeremy.
-
Jeremy Allison
236d6adadf Half-way though the big conversion of all nmbd access to wire elements being
converted to pull/push_ascii. This will not work right at the moment for non
English codepages, but compiles - I will finish the work over the weekend.
Then nmbd should be completely codepage correct.
Jeremy.
-
Jeremy Allison
94d0f888c9 Shut conversion errors up when initialising tables.
Jeremy.
-
Jeremy Allison
cfde7477fd Attempt to fix the charcnv issues causing nmbd to crash. If we get a failed
conversion simply copy as is. Also fixed the horrid malloc-twice-copy code
in the convert alloc path.
Jeremy.
-
Andrew Bartlett
6c9056029b Use push_ucs2_allocate(), rather than convert_string_allocate() directly.
Remove strdup_upper/strdup_lower from their old file, now that they have
been moved to charcnv.c

Note that string_replace assumes that s is a pstring.  (doco change only)

Andrew Bartlett
-
Andrew Bartlett
912035af11 Some small fixes to our charset conversion code:
- Treat the NMB names in the 'session request' packet as 'ASCII'.  This means
   that we do not get invalid multibyte from the wire, even if we truncate
   in the conversion.  (Otherwise we panic when we try to strupper_m it).

 - Remove acnv_uxu2(), as it was duplicated by push_ucs2_allocate()
 - Remove acnv_dosu2(), as it is not used.

 - In push_ucs2(), with the STR_UPPER flag, do the case conversion *after*
   the UCS2 conversion, when it we know that the length can't change.  Also
   faster, as we don't need to do another 2 UCS2 conversions.

Andrew Bartlett
-
Tim Potter
59dae1da66 More printf portability fixes. Got caught out by some gcc'isms last
time.  )-:
-
Tim Potter
ba4d334b82 More printf fixes - size_t is long on some architectures. -
Jeremy Allison
ff222716a0 Removed strupper/strlower macros that automatically map to strupper_m/strlower_m.
I really want people to think about when they're using multibyte strings.
Jeremy.
-
Andrew Tridgell
53bfcd478a - added LOCALE patch from vorlon@debian.org (Steve Langasek) (bug #122)
- changed --enable-developer debug to use -gstabs as it makes the
  samba binaries about 10x smaller and is still quite functional for
  samba debugging
-
Andrew Tridgell
382b9b806b reverted locale patch put in by jht (originally from vorlon).
There are lots of things wrong with this patch, including:

1) it overrides a user chosen configuration option

2) it adds lots of complexity inside a loop when a tiny piece of code
   outside the loop would do the same thing

3) it does no error checking, and is sure to crash on some systems

If you want this functionality then try something like this at the end
of charset_name():

#ifdef HAVE_NL_LANGINFO
	if (strcasecmp(ret, "LOCALE") == 0) {
		const char *ln = nl_langinfo(CODESET);
		if (ln) {
			DEBUG(5,("Substituting charset '%s' for LOCALE\n", ln));
			return ln;
		}
	}
#endif

then users can set 'display charset = LOCALE' to get the locale based
charset. You could even make that the default for systems that have
nl_langinfo().
-
John Terpstra
1e445fb422 Patch from vorlon@debian.org, see bugzilal #122
Samba should preferentially use the locale information from the native system,
and only fall back on 'display charset' if this is unavailable or unsupported.
-
Jeremy Allison
8aa5f7a65c Fix for valgrind - when doing a srvstr_push we must zero fill
any extra bytes, not clobber region them - otherwise valgrind
thinks they are invalid on send() or write().
Jeremy.
-
Andrew Tridgell
791a4cc7cf - the 8.3 name in BOTH_DIRECTORY_INFO is supposed to be always unicode
(to match win2003 behaviour)

- added the STR_TERMINATE_ASCII flag from samba4 so we can get the
  string termination right for the case where it is supposed to be
  non-terminated for UCS2 and terminated when ASCII
-
Gerald Carter
83bb84f131 fixed bug #75; add check for non-zero destlen -
Tim Potter
05a684b3be Another attempt at undoing my bogus patch 1.55.2.19 -
Tim Potter
42d0414ed2 Whoops - that wasn't a whitespace syncup after all. -
Tim Potter
7fd7af121e Whitespace syncup. -
Andrew Bartlett
df10aee451 Patch by Metze to ensure that we always at least initialize our output string
for rpc_pull_string.  If we had a NULL or zero-length string, we would use
uninitialised data in the result string.

Andrew Bartlett
-
Andrew Bartlett
341d6affa4 Merge (HEAD->3.0) mbp's fixes to our charcnv code - don't use a staic buffer,
which can restrict things like unix_strupper() to 512 byte strings.

Andrew Bartlett
-
Jeremy Allison
df214d1881 Merge across tridge's Realloc fix.
Jeremy.
-
Martin Pool
d0b2c5d7ba Export lazy_initialize_conv so that it can be called from
check_dos_char.

init_iconv: Call init_doschar_table when reinitializing conversions.
-
Martin Pool
0ee80a9018 lazy_initialize_conv: Remove redundant call to init_valid_table,
because init_iconv calls it for us.

init_iconv: Add documentation about how this is reintialized when
configuration is reloaded.
-
Jelmer Vernooij
5310447ec6 Patch from Samuel Thibault to convert messages from dos to unix charset
when sending(and vice versa when receiving).
-
Jeremy Allison
86e3eddac6 Merge in the developer string options from HEAD. We need to ensure 3.0
is as stable as possible in the string department and some pain now
will help later :-).
Jeremy.
-
Martin Pool
3761f8ebe3 Merge documentation from HEAD -
Andrew Bartlett
9ef0d40c3f Merge doxygen, signed/unsigned, const and other small fixes from HEAD to 3.0.
Andrew Bartlett
-
Martin Pool
822f6c2f38 Add comment about Samba character sets, from explanation by abartlet. -
Jeremy Allison
81437e2ad0 Merge from HEAD - pull_ucs2_talloc() should pull to a char**, not a void**
Jeremy.
-
Andrew Bartlett
e9f56a157b Merge of signed/unsigned fixes from HEAD. -
Andrew Bartlett
3a7458f947 Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings.  (Adds a lot of const).

Andrew Bartlett
-
Jeremy Allison
9a6c694619 Fix all returns to be size_t (they are all unsigned). Fixup strlen being
done on ucs2 strings.
Jeremy.
-
Gerald Carter
3de09e5cf1 syncing up with HEAD. Seems to be a lot of differences creeping in
(i ignored the new SAMBA stuff, but the rest of this looks like it should
have been merged already).
-
Gerald Carter
65e7b5273b sync'ing up for 3.0alpha20 release -
Jelmer Vernooij
3928578b52 sync 3.0 branch with head -