1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-17 02:05:21 +03:00

26 Commits

Author SHA1 Message Date
Andrew Tridgell
e82aad1ce3 r5298: - got rid of pstring.h from includes.h. This at least makes it a bit
less likely that anyone will use pstring for new code

 - got rid of winbind_client.h from includes.h. This one triggered a
   huge change, as winbind_client.h was including system/filesys.h and
   defining the old uint32 and uint16 types, as well as its own
   pstring and fstring.
(This used to be commit 9db6c79e902ec538108d6b7d3324039aabe1704f)
2007-10-10 13:09:38 -05:00
Andrew Tridgell
e3aae721a7 r5297: ensure pstring is not in the generated prototypes
(This used to be commit b4103d9f2b809408572521f385d4e7a5ba412169)
2007-10-10 13:09:38 -05:00
Andrew Tridgell
11ce2cfd70 r4591: - converted the other _p talloc functions to not need _p
- added #if TALLOC_DEPRECATED around the _p functions

- fixes the code that broke from the above

while doing this I fixed quite a number of places that were
incorrectly using the non type-safe talloc functions to use the type
safe ones. Some were even doing multiplies for array allocation, which
is potentially unsafe.
(This used to be commit 6e7754abd0c225527fb38363996a6e241b87b37e)
2007-10-10 13:08:30 -05:00
Andrew Tridgell
60c69445f6 r4124: include locale.h to get LC_ALL in include/system/iconv.h
(This used to be commit 573230ea99136bd66d00bac18effd28b1e5ba76f)
2007-10-10 13:06:28 -05:00
Andrew Tridgell
06fbfade75 r4123: set locale to C to ensure ascii string functions work
thanks to Bjoern JACKE <samba@j3e.de> for pointing this out
(This used to be commit 53c4d0a7d83181afbe01bbbb0840cb2a086b45da)
2007-10-10 13:06:28 -05:00
Andrew Tridgell
396b5bdafe r3598: hopefully fix the build on stratos
(This used to be commit e6e8a9c7f014ddf7c92476a6713582303bb944a0)
2007-10-10 13:05:37 -05:00
Andrew Tridgell
343545a883 r3063: our default dos charset is CP850, but some systems don't have that, so
as a special case, automatically fall back to ASCII if its not found.
(This used to be commit 55aeb33343180929fbd7b3568b058b506aee7540)
2007-10-10 13:01:55 -05:00
Andrew Tridgell
23d3b714f1 r3061: change a debug to help track down a charset problem
(This used to be commit 4d2497b7f4cb6aa6fdf1e03b56f72b1022cb92b8)
2007-10-10 13:01:55 -05:00
Andrew Tridgell
925251ea59 r2907: auto destroy iconv memory handles on exit, to make valgrind leak
reports easier to read (less noisy)
(This used to be commit e3009492b85ac90836aa9341687df5869f4ea291)
2007-10-10 12:59:46 -05:00
Andrew Tridgell
4aebdb779a r2903: a considerably more efficient (both in terms of CPU and memory)
convert_string_talloc() implementation.

the previous version used a minimum of 512 bytes, which is way above the average
of what is needed.
(This used to be commit abcd841a8530ba3273d56c9001ea277611507be3)
2007-10-10 12:59:46 -05:00
Andrew Tridgell
7d32679e96 r2857: this commit gets rid of smb_ucs2_t, wpstring and fpstring, plus lots of associated functions.
The motivation for this change was to avoid having to convert to/from
ucs2 strings for so many operations. Doing that was slow, used many
static buffers, and was also incorrect as it didn't cope properly with
unicode codepoints above 65536 (which could not be represented
correctly as smb_ucs2_t chars)

The two core functions that allowed this change are next_codepoint()
and push_codepoint(). These functions allow you to correctly walk a
arbitrary multi-byte string a character at a time without converting
the whole string to ucs2.

While doing this cleanup I also fixed several ucs2 string handling
bugs. See the commit for details.

The following code (which counts the number of occuraces of 'c' in a
string) shows how to use the new interface:

size_t count_chars(const char *s, char c)
{
	size_t count = 0;

	while (*s) {
		size_t size;
		codepoint_t c2 = next_codepoint(s, &size);
		if (c2 == c) count++;
		s += size;
	}

	return count;
}
(This used to be commit 814881f0e50019196b3aa9fbe4aeadbb98172040)
2007-10-10 12:59:39 -05:00
Jelmer Vernooij
073e9af19b r2684: Free the right talloc context (don't panic when encountering illegal multibyte
sequences)
(This used to be commit b90da2337b83eb261a8072f9d0b13ec28caf3c4d)
2007-10-10 12:59:22 -05:00
Andrew Tridgell
5b44130afa r2671: we're getting too many errors caused by the talloc_realloc() API not
taking a context (so when you pass a NULL pointer you end up with
memory in a top level context). Fixed it by changing the API to take a
context. The context is only used if the pointer you are reallocing is
NULL.
(This used to be commit 8dc23821c9f54b2f13049b5e608a0cafb81aa540)
2007-10-10 12:59:20 -05:00
Andrew Tridgell
9cafc0d07e r2642: smb_iconv_t is a pointer, so checks against -1 errors should use a cast
(This used to be commit 28dcd2202948b003f8d13951395baa4a722593f4)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
4a1d53a07a r2638: do lazy initialisation of iconv handles, so we don't initialise a
handle unless we use it. This saves quite a bit of memory (libc chews
a lot loading a handle). Typically smbd now loads 3 handles, instead
of 36.
(This used to be commit 60e8d154fda548862cd6f8e8c1dadd64b3c4bd9c)
2007-10-10 12:59:15 -05:00
Andrew Bartlett
9a9dcc7250 r2552: Character set conversion and string handling updates.
The intial motivation for this commit was to merge in some of the
bugfixes present in Samba3's chrcnv and string handling code into
Samba4.  However, along the way I found a lot of unused functions, and
decided to do a bit more...

The strlen_m code now does not use a fixed buffer, but more work is
needed to finish off other functions in str_util.c.  These fixed
length buffers hav caused very nasty, hard to chase down bugs at some
sites.

The strupper_m() function has a strupper_talloc() to replace it (we
need to go around and fix more uses, but it's a start).  Use of these
new functions will avoid bugs where the upper or lowercase version of
a string is a different length.

I have removed the push_*_allocate functions, which are replaced by
calls to push_*_talloc.  Likewise, pstring and other 'fixed length'
wrappers are removed, where possible.

I have removed the first ('base pointer') argument, used by push_ucs2,
as the Samba4 way of doing things ensures that this is always on an
even boundary anyway.  (It was used in only one place, in any case).
(This used to be commit dfecb0150627b500cb026b8a4932fe87902ca392)
2007-10-10 12:59:05 -05:00
Andrew Tridgell
66f1e8d020 r2380: nicer error reporting in convert_string()
(This used to be commit 6807d336c2365e4e7f45605d75667dbf05715b34)
2007-10-10 12:58:46 -05:00
Andrew Tridgell
31c1c7846f r2159: converted samba4 over to UTF-16.
I had previously thought this was unnecessary, as windows doesn't use
standards compliant UTF-16, and for filesystem operations treats bytes
as UCS-2, but Bjoern Jacke has pointed out to me that this means we
don't correctly store extended UTF-16 characters as UTF-8 on
disk. This can be seen with (for example) the gothic characters with
codepoints above 64k.

This commit also adds a LOCAL-ICONV torture test that tests the first
1 million codepoints against the system iconv library, and tests 5
million random UTF-16LE buffers for identical error handling to the
system iconv library.

the lib/iconv.c changes need backporting to samba3
(This used to be commit 756f28ac95feaa84b42402723d5f7286865c78db)
2007-10-10 12:58:27 -05:00
Andrew Tridgell
2de9ce9499 r2106: try to cope with a wider range of UTF-16 characters when we are using
an external libiconv library.
(This used to be commit 168be7fbd7ae876ded39f73a7835e91b35e67244)
2007-10-10 12:58:25 -05:00
Andrew Bartlett
aba5a2df32 r1196: Remove unused pstring/fstring functions.
Andrew Bartlett
(This used to be commit 4f06bf4ab8cc61aec730f84766306119eb976c57)
2007-10-10 12:56:44 -05:00
Andrew Tridgell
7cd74a596e r934: on ascii strings STR_TERMINATE_ASCII should trigger STR_TERMINATE behaviour
(This used to be commit b7935c96742a3c09ee4bf69f708b19095f497be1)
2007-10-10 12:56:20 -05:00
Andrew Bartlett
5b5e793d16 r831: These functions duplicate the push/pull charcnv interfaces that we use
everywhere else in the Samba code, so remove them for clarity.

(ok, so  also just never liked the names  ;-)

Andrew Bartlett
(This used to be commit 5f5786ad5ff6cc133a143476e8968b00ed057a62)
2007-10-10 12:53:53 -05:00
Andrew Tridgell
7779b1e000 added support for big-endian ucs2 strings (as used by big-endian
msrpc).

this was easier than I expected!
(This used to be commit a0a51af6b746b1f82faaa49d33c17fea9d708fb0)
2003-12-16 09:20:34 +00:00
Andrew Tridgell
de10237719 more fixes from the IRIX compiler (thanks herb!)
(This used to be commit 02d068ba7d81d6db25122144981c63f74ad44025)
2003-08-15 18:54:44 +00:00
Andrew Tridgell
cc38992e3f fixed some places where we don't brace (flags & STR_UNICODE)
this fixes the samba4 server with ascii clients
(This used to be commit c770603ac6c3331a4ac79a650cbbbeb21c778137)
2003-08-15 16:19:48 +00:00
Andrew Tridgell
ef2e26c91b first public release of samba4 code
(This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f)
2003-08-13 01:53:07 +00:00