summaryrefslogtreecommitdiff
path: root/lib/util
AgeCommit message (Collapse)AuthorFilesLines
2011-06-06ipv6: always try to convert as a numeric address firstAndrew Tridgell1-0/+9
This avoids unnecessary name lookups, plus it fixes a problem with using interpret_string_addr*() with the wildcard IPv6 address
2011-06-02Fix warning messages on Freebsd 4.6.2.Herb Lewis1-0/+2
Signed-off-by: Jeremy Allison <jra@samba.org>
2011-06-01lib/util/time.c: timeval_current_ofs_usecRusty Russell2-0/+14
Several places want "microseconds from current time", and several were simply handing "usecs" values which could be over a million. Using a helper to do this is safer and more readable. I didn't replace any obviously correct callers (ie. constants). I also renamed wait_nsec in source3/lib/util_sock.c; it's actually microseconds not nanoseconds (introduced with this code in Volker's 19b783cc Async wrapper for open_socket_out_send/recv). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-01lib/util/time.c: timeval_current_ofs_msecRusty Russell2-0/+14
Several places want "milliseconds from current time", and several were simply doing "msec * 1000" which can (and does in one place) result in a usec value over 1 a million. Using a helper to do this is safer and more readable. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-05-31lib/util Move sys_memalign into lib/util/system.cAndrew Bartlett2-0/+41
2011-05-25Fix numerous missing dependencies in WAF build scriptsSean Finney2-4/+4
With the recent consolidation of code between s3 and s4, a number of new dependencies have been implicitly introduced. For example, previous s3 code gained an implicit dependency on talloc after the charset related consolidation (lib/util/charset/charset.h now includes talloc.h). When building against the embedded version of talloc this isn't a problem since the paths are automatically added to the search path, but when building against the external libraries build failures will occur for all components that don't directly or indirectly include talloc as a dependency. Since charset.h is included from util.h, which in turn is included from includes.h, this means most of the codebase (s3 and s4) has such an undeclared dependency. Therefore, samba-util-common and samba-util have been added as dependencies to the s3 and s4 code respectively, for all cases where the source would otherwise fail to build. Additionally, a few other dependencies are added in specific wscript_build files to address similar dependency-related problems. https://bugzilla.samba.org/show_bug.cgi?id=8128 Signed-off-by: Sean Finney <seanius@seanius.net> Signed-off-by: Matthias Dieter Wallnöfer <mdw@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Wed May 25 19:22:13 CEST 2011 on sn-devel-104
2011-05-24Fix our asn.1 parser to handle negative numbers.Jeremy Allison1-0/+9
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue May 24 22:57:16 CEST 2011 on sn-devel-104
2011-05-24lib/util Add Volker's asn1_Integer test into code that runs in 'make test'Andrew Bartlett1-0/+94
The comfychair test harness isn't hooked up, and with the current infrustructure C code is better tested directly here. Andrew Bartlett
2011-05-18lib/util/charset: Remove unused strcasecmp_w and strncasecmp_wAndrew Bartlett1-32/+0
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed May 18 17:22:15 CEST 2011 on sn-devel-104
2011-05-18lib/util/charset use talloc_stackframe() rather than talloc_tos()Andrew Bartlett1-12/+12
This is common code, and we can't assume a talloc_stackframe() so we must create it. Andrew Bartlett
2011-05-18lib/util/charset Don't allow invalid 'dos charset = utf8'Andrew Bartlett1-0/+5
No DOS client used UTF8, and this creates subtle, difficult to disagnose breakage of schannel (domain membership). Andrew Bartlett
2011-05-17Don't evaluate the src argument to fstrcpy/fstrcat/nstrcpy/unstrcpy twice. ↵Jeremy Allison1-5/+25
Prevents side-effects when src is a function call.
2011-05-17lib/util/charset: fix the toplevel MacOS X build.Günther Deschner1-2/+3
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Tue May 17 16:16:59 CEST 2011 on sn-devel-104
2011-05-14Use ZERO_STRUCTP in util_netVolker Lendecke1-2/+2
2011-05-13lib/util/charset Move built-in charset modules to the top levelAndrew Bartlett6-1/+1028
This removes the 'charset' subsystem and allows these modules to be used across the whole of Samba. Andrew Bartlett
2011-05-13lib/util/ Fix crash bug caused by gfree_debug()Andrew Bartlett1-1/+1
The issue is that we should reset the debug_num_classes to 0 when we un-initialise the debug system. Andrew Bartlett
2011-05-10tdb_wrap.h: not a public header.Rusty Russell1-1/+0
It is a private library, and OpenChange has their own which they use, so it's not for them either. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Tue May 10 05:21:19 CEST 2011 on sn-devel-104
2011-05-08Improve debug messages when creating socket directoriesAndrew Bartlett1-1/+2
This makes clear what the permissions error and directory name actually is Andrew Bartlett
2011-05-06lib/util don't use enum protocol_types in ms_fnmatch_protocolAndrew Bartlett2-2/+2
This makes it easier to compile this in the top level with s3 and s4 headers. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri May 6 08:50:52 CEST 2011 on sn-devel-104
2011-05-06lib/util Use lib/util/ms_fnmatch.c in common for gen_fnmatch()Andrew Bartlett1-2/+2
gen_fnmatch was a duplicate symbol in the top level build. gen_fnmatch() used for simple non-CIFS pattern matching, so selecting the lib/util implementation should not be a concern. Andrew Bartlett
2011-05-06lib/util Rename ms_fnmatch() to ms_fnmatch_protocol() to avoid dup symbolAndrew Bartlett2-5/+6
This verison of the function takes a protcol as argument to determine matching rules. Andrew Bartlett
2011-05-06lib/util Move source3 tdb_wrap_open() into the common code.Andrew Bartlett4-1/+246
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in the top level build, these options are not available for these databases. However, having two different tdb_wrap lists is a worse fate, so this will do for now. Andrew Bartlett
2011-05-05Fix many const compiler warnings.Jeremy Allison2-4/+4
2011-05-05Clean up some const and other compiler warnings.Jeremy Allison3-7/+7
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu May 5 00:59:40 CEST 2011 on sn-devel-104
2011-05-04I added them, so I get to kill them :-). Finally remove all uses of ↵Jeremy Allison3-99/+0
safe_strcpy and safe_strcat. Change to strlcpy, strlcat. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed May 4 22:14:14 CEST 2011 on sn-devel-104
2011-05-04Tidy up some missing checks for NULL in strlcpy.Jeremy Allison1-1/+1
2011-05-04Remove overmalloc_safe_strcpy - can be simple strlcpy.Jeremy Allison1-8/+0
2011-05-04Change safe_strcpy_base to strlcpy_base. Note the size doesn't change here ↵Jeremy Allison1-2/+2
as the original macro auto-added the -1.
2011-05-04Fix simple uses of safe_strcpy -> strlcpy. Easy ones where we just remove -1.Jeremy Allison3-10/+10
2011-05-03lib/util make string_wrappers.h a public headerAndrew Bartlett1-1/+1
This isn't a very good public header, but util.h includes it, so we don't have much choice in the short term. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue May 3 08:37:22 CEST 2011 on sn-devel-104
2011-05-03lib/util Use lib/util/util_str.c in common, including strequal()Andrew Bartlett2-3/+3
strequal() is now implemented in terms of strcasecmp_m() which is tested in smbtorture and which does not talloc() for ASCII or non-ASCII comparions, and has an ASCII fast-path. Andrew Bartlett
2011-05-03lib/util Use compiler-checked safe string macros in top level code.Andrew Bartlett2-35/+27
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-03s4: fix arguments to safe_strcpy()Andrew Bartlett1-5/+5
Found by the s3-derivied safe_strcpy() macro. Andrew Bartlett
2011-05-03lib/util/charset Use push_string and talloc_strupper/strlower from common codeAndrew Bartlett2-17/+10
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-03Remove strlower_m() and strupper_m() from source4 and common code.Andrew Bartlett2-86/+0
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-03lib/util Move set_socket_options() into common code.Andrew Bartlett2-0/+163
2011-05-03lib/util Move more network utility functions from source3 into lib/utilAndrew Bartlett4-1/+275
This will help with the merge of the interfaces layer. Andrew Bartlett
2011-04-30lib/util Rename conv_str_size() -> conv_str_size_error()Andrew Bartlett2-4/+2
2011-04-29lib/util Re-merge the string_sub() and all_string_sub() from source3Andrew Bartlett3-15/+46
Andrew Bartlett
2011-04-29lib/util/charset Move strstr_m() to the top levelAndrew Bartlett2-0/+84
2011-04-28lib/util/charset Merge talloc-based pull and push charset functionsAndrew Bartlett3-95/+151
These were copied from source3/lib/charcnv.c Andrew Bartlett
2011-04-28lib/util/charset Add copyright headersAndrew Bartlett1-1/+2
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Apr 28 04:13:44 CEST 2011 on sn-devel-104
2011-04-28lib/util/charset Make fast path from UTF16 to '8 bit' charsets clearerAndrew Tridgell1-14/+28
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-28lib/util/charset Add tests for srclen=-1 behaviour.Andrew Bartlett1-0/+443
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-28lib/util/charset use convert_string.c in commonAndrew Bartlett4-204/+5
This brings another layer of the charcnv library in common. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-28lib/util/charset Fix string termination conditions for UTF16 stringsAndrew Bartlett1-4/+4
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-27dynconfig: Have only one dynconfig.o in the common code.Andrew Bartlett1-1/+1
2011-04-26lib/util Define samba-util-common only for s3-wafAndrew Bartlett1-24/+11
It causes too much trouble in the top level build. Andrew Bartlett
2011-04-24lib/util: add RBVAL, RBVALS, RSBVAL and RSRBVALS macrosStefan Metzmacher1-6/+11
They pull and push [u]int64_t values in big endian. metze
2011-04-23Fix case of libUTIL_LDB.Jelmer Vernooij1-6/+6
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Apr 23 18:52:06 CEST 2011 on sn-devel-104