1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

1884 Commits

Author SHA1 Message Date
Andrew Bartlett
86a62ab434 lib/util Use compiler-checked safe string macros in top level code.
This brings the 'safe' macros to the top level code, and removes
duplication of the safe_strcpy() and safe_strcat() functions.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Andrew Bartlett
d01f318179 s4: fix arguments to safe_strcpy()
Found by the s3-derivied safe_strcpy() macro.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Andrew Bartlett
80f1d49b61 lib/util/charset Use push_string and talloc_strupper/strlower from common code
The only caller of push_string() (not to be confused with
push_string_check()) in the common code was encode_pw_buffer(), and it
didn't use the alignment or STR_UPPER flags.

The talloc_strupper() and talloc_strlower() functions are tested in
smbtorture, and are next_codepoint() based.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Andrew Bartlett
2742ec0e34 Remove strlower_m() and strupper_m() from source4 and common code.
This function is problematic because a string may expand in size when
changed into upper or lower case.  This will then push characters off
the end of the string in the s3 implementation, or panic in the former
s4 implementation.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Andrew Bartlett
eea783e04c lib/util Move set_socket_options() into common code. 2011-05-03 07:37:07 +02:00
Andrew Bartlett
fbea52f74a lib/util Move more network utility functions from source3 into lib/util
This will help with the merge of the interfaces layer.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Stefan Metzmacher
f0f5ac18e5 talloc: use TC_UNDEFINE_SHRINK_CHUNK() instead of TC_INVALIDATE_SHRINK_CHUNK() for realloc path
If we optimize on top of raw realloc() we need
TC_INVALIDATE_SHRINK_CHUNK together with TC_UNDEFINE_GROW_CHUNK
(with was missing and caused false positive valgrind warnings).

But that is really slow, as we do a lot of talloc_realloc calls in samba.

That's why we only to TC_UNDEFINE_SHRINK_CHUNK() for now.

metze
2011-05-02 13:58:22 +02:00
Andrew Bartlett
bcd68837ee lib/util Rename conv_str_size() -> conv_str_size_error() 2011-04-30 10:38:25 +02:00
Andrew Bartlett
e1eae82285 kerberos: Only include gssapi/gssapi_krb5.h when available 2011-04-30 04:58:04 +02:00
Andrew Bartlett
93ace5cc24 lib/util Re-merge the string_sub() and all_string_sub() from source3
Andrew Bartlett
2011-04-29 16:38:15 +10:00
Andrew Bartlett
9a9124b087 lib/util/charset Move strstr_m() to the top level 2011-04-29 16:38:14 +10:00
Andrew Bartlett
0df4061cff lib/util/charset Merge talloc-based pull and push charset functions
These were copied from source3/lib/charcnv.c

Andrew Bartlett
2011-04-28 05:30:20 +02:00
Andrew Bartlett
790ab3e0db lib/util/charset Add copyright headers
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Thu Apr 28 04:13:44 CEST 2011 on sn-devel-104
2011-04-28 04:13:44 +02:00
Andrew Tridgell
d17f4352fe lib/util/charset Make fast path from UTF16 to '8 bit' charsets clearer
This breaks the fast path into handling for -1 and handling for
specified lenghts, avoding branch operations on each character.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-28 03:24:06 +02:00
Andrew Bartlett
eee1ff2fb5 lib/util/charset Add tests for srclen=-1 behaviour.
This confirms that we do include a null terminator in all non-failed
conversions.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-28 03:24:05 +02:00
Andrew Bartlett
4081ea5b49 lib/util/charset use convert_string.c in common
This brings another layer of the charcnv library in common.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-28 03:24:05 +02:00
Andrew Bartlett
75d5ba4109 lib/util/charset Fix string termination conditions for UTF16 strings
This punts partial UTF16 strings to iconv() to deal with, as it's not
a fast path any longer if it's got an odd length.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-28 03:24:05 +02:00
Andrew Bartlett
3e85b960fa dynconfig: Have only one dynconfig.o in the common code. 2011-04-27 22:22:26 +10:00
Andrew Bartlett
e04bab4a19 libcli/auth Move Samba4's gssapi_error_string from GENSEC to libcli/auth
This will allow the GSSAPI PAC fetch code to use it.

Andrew Bartlett
2011-04-27 11:21:37 +10:00
Andrew Bartlett
26a0ba7ee9 lib/util Define samba-util-common only for s3-waf
It causes too much trouble in the top level build.

Andrew Bartlett
2011-04-26 11:37:46 +10:00
Stefan Metzmacher
c0441b17e6 lib/util: add RBVAL, RBVALS, RSBVAL and RSRBVALS macros
They pull and push [u]int64_t values in big endian.

metze
2011-04-24 09:48:51 +02:00
Jelmer Vernooij
fb05e82c99 Fix license info for talloc in manpage.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Apr 24 03:27:54 CEST 2011 on sn-devel-104
2011-04-24 03:27:54 +02:00
Jelmer Vernooij
0645c01b85 Fix case of libUTIL_LDB.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Apr 23 18:52:06 CEST 2011 on sn-devel-104
2011-04-23 18:52:06 +02:00
Jelmer Vernooij
bf3b2e2aee Support the 'PYTHON' environment variable.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Apr 23 04:19:05 CEST 2011 on sn-devel-104
2011-04-23 04:19:04 +02:00
Volker Lendecke
4981adcca3 asn1: Fix Coverity ID 2299, CHECKED_RETURN 2011-04-22 10:06:36 +02:00
Andrew Bartlett
6f846ddf32 lib/util/charset Always set *converted_size even on failure
The caller may wish to inspect the partially converted string.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Apr 20 05:17:48 CEST 2011 on sn-devel-104
2011-04-20 05:17:48 +02:00
Andrew Bartlett
79e6fea774 lib/util/charset create _handle functions for convert_string() et al
This is now API compatible with the existing code in lib/util/charset

lazy_initialize_conv() is no longer called as init_iconv() is called
when the smb.conf is processed, and get_conv_handle() will auto-init
with defaults if required.

load_case_tables_library() is no longer requried as all binaries and
libraries already load these in their entry points, as otherwise all
the other string functions would fail.

Andrew Bartlett
2011-04-20 04:31:07 +02:00
Simo Sorce
1804d9a646 tdb_backup: avoid transaction on backup file, use lockall
Transactions have the side effect of generating bigger files.
By removing the transaction files get as much as 30% smaller.

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Tue Apr 19 23:34:37 CEST 2011 on sn-devel-104
2011-04-19 23:34:37 +02:00
Rusty Russell
36cfa7b79e tdb: make sure we skip over recovery area correctly.
If it's really the recovery area, we can trust the rec_len field, and
don't have to go groping for bitpatterns.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Apr 19 14:15:22 CEST 2011 on sn-devel-104
2011-04-19 14:15:22 +02:00
Simo Sorce
cb884186a5 tdb_expand: limit the expansion with huge records
ldb can create huge records when saving indexes.
Limit the tdb expansion to avoid consuming a lot of memory for
no good reason if the record being saved is huge.
2011-04-18 22:15:11 +09:30
Rusty Russell
094ab60053 tdb: tdb_repack() only when it's worthwhile.
tdb_repack() is expensive and consumes memory, so we can spend some
effort to see if it's worthwhile.  In particular, tdbbackup doesn't
need to repack: it started with an empty database!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-04-18 22:15:11 +09:30
Rusty Russell
6aa72dae8f tdb: fix transaction recovery area for converted tdbs.
This is why macros are dangerous; these were converting the pointers, not the
things pointed to!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-04-18 22:15:11 +09:30
Andrew Bartlett
29d8c597fc lib/socket_wrapper: allow up to 32 interfaces for a bigger 'make test'
The combined s3/s4 'make test' needs more interfaces.

Andrew Bartlett
2011-04-19 10:03:49 +10:00
Brad Hards
2c55a995fe util: Build samba-util without unresolved symbols.
This is useful for the Samba4 case where external users otherwise need to link to
(private) libsamba-util-common.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sat Apr 16 12:29:33 CEST 2011 on sn-devel-104
2011-04-16 12:29:33 +02:00
Andrew Bartlett
e1078b87de lib/util Move alpha_strcpy() from s3 into common code
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Thu Apr 14 09:21:59 CEST 2011 on sn-devel-104
2011-04-14 09:21:59 +02:00
Andrew Bartlett
4ba1375526 libcli/auth Move krb5 wrapper functions from s3 into common
This requires a small rework of the build system to ensure that the
correct #define statements are made in both the s3 and top level
builds.  We now define the various HAVE_ macros in config.h at all
times, using heimdal_build/wscript_configure when that is in use.

Andrew Bartlett
2011-04-14 16:38:26 +10:00
Günther Deschner
b4e4b60719 s3-includes: include lib/util/debug.h headers in includes.h not smb.h
Guenther
2011-04-14 00:47:57 +02:00
Volker Lendecke
4be643d4ce lib: Move next_token next to next_token_talloc
Signed-off-by: Jeremy Allison <jra@samba.org>
2011-04-13 14:13:25 -07:00
Stefan Metzmacher
94a97bf64c talloc: fix compiler warnings with -Wc++-compat
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Apr 13 14:33:23 CEST 2011 on sn-devel-104
2011-04-13 14:33:23 +02:00
Andrew Bartlett
53e0bada43 build: Bring DYNCONFIG into samba-util library to avoid symbol duplication
When this was depended on directly as a subsystem, it ended up in
multiple libraries.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Apr 13 08:39:35 CEST 2011 on sn-devel-104
2011-04-13 08:39:35 +02:00
Andrew Bartlett
4158e9a7e5 s3-charcnv: Move convert_string() et al to lib/util/charset
This is the first step to this being the common convert_string
implementation.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
d335b635c2 lib/util/charset Add many more charset tests
This confirms that the behaviour of the convert_string() API (with the
process-wide iconv handle).

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
748c31dc5d lib/util/charset Add convert_string_error()
This adds an interface that matches the source3/ convert string code.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
8db1648f66 lib/util/charset Make ASCII conversion validate it's input
We should not just strip the high bits off unicode strings being
converted to ASCII, we need to actually fail the conversion.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
a2c691ab9a lib/util/charset Rename convert_string test to allow a 'non_handle' test
A future commit will test (with a subset of tests) the varient of this
function without _handle.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
7bbd701a13 lib/util/charset Add more tests for convert_string_error_handle()
This helps define the semantics of this function very clearly,
particularly for partial and invalid inputs.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
93463829af lib/util/charset Preserve 'pull' errors even when converting via UTF16
When we do not have a direct iconv handle between any two charsets, we
must go iva UTF16.  However, we should still return the same buffer
and error code as if we were able to go direct - including the partial
conversion and the error code.

This is important for locating the invalid multibyte character in the
stream, for example.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
1efa600144 lib/util/charset Add tests for convert_string_error_handle
These confirm that the errno is set correctly and that we stop on a
partial multibyte character

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
b21129ae20 lib/util/charset Add expected values for upper/lower case tests
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:07 +10:00
Andrew Bartlett
cd63c9205e lib/util/charset Fix and add public interface for convert_string_error_handle
It makes much more sense for this to match the source3/ interface and
return a bool.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:07 +10:00