summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2011-06-20tdb2: create tdb2 versions of various testing TDBs.Rusty Russell2-22/+55
Soon, TDB2 will handle tdb1 files, but until then, we substitute. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: python wrapperRusty Russell1-0/+574
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: minor changes to SAMBIFY it.Rusty Russell3-4/+18
This is a bit messy, but it works. Kept as a separate patch so it's easier to merge back and forth with CCAN's tdb2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell84-0/+26504
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: Higher level API fixes.Rusty Russell2-6/+6
My previous patches fixed up all direct TDB callers, but there are a few utility functions and the db_context functions which are still using the old -1 / 0 return codes. It's clearer to fix up all the callers of these too, so everywhere is consistent: non-zero means an error. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: use tdb_open_compat.Rusty Russell1-5/+28
This is a helper for the common case of opening a tdb with a logging function, but it doesn't do all the work, since TDB1 and TDB2's log functions are different types. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_store: check returns for 0, not -1.Rusty Russell4-16/+16
TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_delete: check returns for 0, not -1.Rusty Russell1-1/+1
TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_fetch_compat: use instead of tdb_fetch.Rusty Russell1-3/+3
This is a noop for tdb1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat.h: divert every tdb build and includes to tdb_compatRusty Russell5-7/+14
We change all the headers and wscript files to use tdb_compat; this means we have one place to decide whether to use TDB1 or TDB2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20lib/tdb_compat: header for tdb1 vs tdb2.Rusty Russell3-0/+239
TDB2's API is slightly different from TDB1. In particular, all functions return 0 (TDB_SUCCESS) or a negative error number, rather than -1 or tdb_null and storing the error in tdb_error() (though TDB2 does that as well). The simplest fix is to replace all the different functions with a wrapper, and that is done here. Compatibility functions: tdb_null: not used as an error return, so not defined by tdb2. tdb_fetch_compat: TDB1-style data-returning tdb_fetch. tdb_firstkey_compat: TDB1-style data-returning tdb_firstkey tdb_nextkey_compat: TDB1-style data-returning tdb_nextkey, with TDB2-style free of old key. tdb_errorstr_compat: TDB1-style tdb_errorstr() which takes TDB instead of ecode. TDB_CONTEXT: TDB1-style typedef for struct tdb_context. tdb_open_compat: Simplified open routine which takes log function, sets TDB_ALLOW_NESTING as Samba expects, and adds TDB_CLEAR_IF_FIRST support. Things defined away in TDB2 wrappers: tdb_traverse_read: TDB2's tdb_traverse only uses read-locks anyway. tdb_reopen/tdb_reopen_all: TDB2 detects this error itself. TDB_INCOMPATIBLE_HASH: TDB2 uses the Jenkins hash already. TDB_VOLATILE: TDB2 shouldn't have freelist scaling issues. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20lib: import ccan modules for tdb2Rusty Russell129-0/+13867
Imported from git://git.ozlabs.org/~ccan/ccan init-1161-g661d41f Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbolAndrew Bartlett1-2/+2
The two error tables need to be combined, but for now seperate the names. (As the common parts of the tree now use the _common function, errmap_unix.c must be included in the s3 autoconf build). Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104
2011-06-17talloc: added talloc_stackframe_exists()Andrew Tridgell2-0/+25
This can be used to tell if a talloc stackframe is currently available. Callers can use this to decide if they will use talloc_tos() or instead use an alternative strategy. This gives us a way to safely have calls to talloc_tos() in common code that may end up in external libraries, as long as all talloc_tos() calls in these pieces of common code check first that a stackframe is available.
2011-06-11s3-param Remove 'time offset' from smb.confAndrew Bartlett3-24/+1
This strange parameter is apparently very rarely used, and it seems to me that on modern networks, if clients don't have correct clocks and DST offsets, that many other things (Kerberos) start to fail pretty quickly, and time and DST tables tend to be internet delivered anyway. Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Sat Jun 11 03:54:45 CEST 2011 on sn-devel-104
2011-06-10lib/util/wrap_xattr.h: fix licence/copyrightGünther Deschner1-0/+21
Guenther
2011-06-10lib/util/util_tdb.h: fix licence/copyrightGünther Deschner1-0/+21
Guenther
2011-06-10lib/util/util_ldb.h: fix licence/copyrightGünther Deschner1-0/+23
Guenther
2011-06-10lib/util/time.h: fix licence/copyrightGünther Deschner1-1/+6
Guenther
2011-06-10lib/util/data_blob.h: fix licence/copyrightGünther Deschner1-1/+4
Guenther
2011-06-09server_id: Change format to vnn:pid.task_id, pid.task_id or pidAndrew Bartlett1-1/+6
This helps ensure the string cannot be ambiguous, while also ensuring that it remains simple in the non-cluster case. The asymmetry of reading get_my_vnn() but writing based on NONCLUSTER_VNN is acceptable because in the non-clustered case, they are equal, and in the clustered case we will print the full string. Andrew Bartlett
2011-06-09lib/util Bring procid_str() into lib/util as server_id_string()Andrew Bartlett3-1/+40
This is needed for OpenChange, which prints Samba struct server_id values in debug messages. Andrew Bartlett
2011-06-09s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_MEMDUP isn't standard talloc.
2011-06-09s3-talloc Change TALLOC_ZERO_P() to talloc_zero()Andrew Bartlett4-6/+6
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc.
2011-06-09s3-talloc Change TALLOC_ARRAY() to talloc_array()Andrew Bartlett4-13/+13
Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc.
2011-06-09s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()Andrew Bartlett2-2/+2
Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett
2011-06-08tdb: enable VALGRIND to remove valgrind noise.Rusty Russell1-35/+0
Andrew Bartlett complained that valgrind needs --partial-loads-ok=yes otherwise the Jenkins hash makes it complain. My benchmarking here revealed that at least with modern gcc (4.5) and CPU (Intel i5 32 bit) there's no measurable performance penalty for the "correct" code, so rip out the optimized one. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Jun 8 11:05:47 CEST 2011 on sn-devel-104
2011-06-06Fix bug #8197 - winbind does not properly detect when a DC connection is dead.Jeremy Allison1-6/+32
Only waiting for writability doesn't get fd errors back with poll. So always begin by selecting for readability, and if we get it then see if bytes were available to read or it really is an error condition. If bytes were available, remove the select on read as we know we will retrieve the error when we've finished writing and start reading the reply (or the write will timeout or fail). Metze and Volker please check. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Jun 6 21:53:16 CEST 2011 on sn-devel-104
2011-06-06lib/util use modules_path(), data_path() and shlib_ext() from source3Andrew Bartlett3-1/+90
This brings these helpful utility functions in common, as they are not based on either loadparm system. (The 'modules dir' parameter from Samba4 will shortly be removed, so there is no loss in functionality) Andrew Bartlett
2011-06-06util-net: added is_ipaddress_v6()Andrew Tridgell2-3/+13
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-03Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a ↵Jeremy Allison1-1/+13
fd selected for TEVENT_FD_WRITE only. Don't trigger the write handler and remove the POLLOUT flag for this fd. Report errors on TEVENT_FD_READ requests only. Metze please check ! Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Jun 3 22:53:52 CEST 2011 on sn-devel-104
2011-06-02Fix warning messages on Freebsd 4.6.2.Herb Lewis1-0/+2
Signed-off-by: Jeremy Allison <jra@samba.org>
2011-06-02lib/tdb/python/tests/simple.py: don't assume TDB ordering.Rusty Russell1-1/+3
TDB2 can break this assumption. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Thu Jun 2 12:07:40 CEST 2011 on sn-devel-104
2011-06-01lib/tevent/tevent.h: minor documentation fix.Rusty Russell1-3/+3
The usecs arguments are (of course) microseconds, not milliseconds. This was added by Andreas Schneider in 6c1bcdc2 (tevent: Document the tevent helper functions.). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Jun 1 11:47:38 CEST 2011 on sn-devel-104
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-31replace: remove waring if IOV_MAX is not definedBjörn Jacke1-2/+0
as discussed on samba-techincal we currelty don't rely on it and we don't want to flood this warning message during compile. Autobuild-User: Björn Jacke <bj@sernet.de> Autobuild-Date: Tue May 31 18:36:53 CEST 2011 on sn-devel-104
2011-05-31lib/util Move sys_memalign into lib/util/system.cAndrew Bartlett2-0/+41
2011-05-30replace: fix build issues on GNU Hurd (#7998)Björn Jacke1-1/+1
Patch from Samuel Thibault <sthibault@debian.org> to fix Debian Bug 610678 resp. BSO #7998. IOV_MAX and UIO_MAXIOV are not defined on GNU Hurd. Autobuild-User: Björn Jacke <bj@sernet.de> Autobuild-Date: Mon May 30 00:53:59 CEST 2011 on sn-devel-104
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-19Fix bug found when building on an IPv6-only system by Kai Blin.Jeremy Allison1-3/+16
When building on IPv6-only, doing: hints.ai_family = AF_INET; getaddrinfo("0.0.0.0", NULL, &hints, &ppres) fails as AF_INET is unavailable on an IPv6-only system. This causes us to fallback to our replacement getaddrinfo code which is IPv4-only. As we're only trying to detect a specific AIX bug here, broaden the tests to find that bug, and also test for working getaddrinfo in an IPv6-only safe way. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu May 19 02:21:54 CEST 2011 on sn-devel-104
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-17talloc: splitout _talloc_free_children_internal()Stefan Metzmacher1-50/+27
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue May 17 10:49:13 CEST 2011 on sn-devel-104