summaryrefslogtreecommitdiffstats
path: root/lib/util
Commit message (Collapse)AuthorAgeFilesLines
* lib: Fix CID 1273073 Assign instead of compareVolker Lendecke2015-03-031-1/+1
| | | | | | | This is a brown paper bag thingy, right? Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib/util: Build iov_buf library only when building sambaAmitay Isaacs2015-02-271-5/+8
| | | | | | | | | | | | | lib/util can be built with SAMBA_UTIL_CORE_ONLY for building standalone ctdb. Any new libraries if not required by ctdb should be built only when SAMBA_UTIL_CORE_ONLY is not specified. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Feb 27 09:06:01 CET 2015 on sn-devel-104
* lib: Simplify pidfile.cVolker Lendecke2015-02-261-13/+6
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Feb 26 18:28:31 CET 2015 on sn-devel-104
* Fix whitespaceVolker Lendecke2015-02-261-11/+11
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* iov_buf: Add an explaining commentVolker Lendecke2015-02-241-0/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Move "iov_buf.[ch]" to lib/utilVolker Lendecke2015-02-243-0/+125
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* debug: Set close-on-exec for the main log file FDAndrew Bartlett2015-02-162-1/+4
| | | | | | | | | | | | | | | | This does not change the properties of dup2() of the fd as STDERR, however this is closed before we start smbd or winbindd as child processes. This is needed otherwise the logfile remains open in the child process, and logfile rotation can mean this old log remains on disk indefinatly. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11100 Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Feb 16 11:42:47 CET 2015 on sn-devel-104
* lib: Add talloc_report_str()Volker Lendecke2015-02-133-0/+208
| | | | | | | | This creates a talloc report into a string and will replace the code used in source3/lib/tallocmsg.c Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib: Add server_id marshallingVolker Lendecke2015-02-132-0/+19
| | | | | | | | Will be used soon to make source3 and source4 messaging-protocol compatible. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib/util: add missing commas to statfs_typesRalph Boehme2015-01-161-2/+2
| | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Jan 16 13:24:16 CET 2015 on sn-devel-104
* lib/util: Avoid collision which alread defined consumer DEBUG macro.Andreas Schneider2015-01-082-3/+8
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11033 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Jan 8 21:41:30 CET 2015 on sn-devel-104
* lib: Simplify check_log_sizeVolker Lendecke2014-12-281-5/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use talloc_zero_array instead of memsetVolker Lendecke2014-12-271-3/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Sat Dec 27 01:27:08 CET 2014 on sn-devel-104
* lib/util: provide a dbgtext_va() function which takes va_listStefan Metzmacher2014-12-172-5/+20
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* lib: Add server_id_dbVolker Lendecke2014-12-163-0/+360
| | | | | | | | This is a mapping from names to server_ids. In the future, this will replace the namedb in source4/messaging. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add "strv" string handling routinesVolker Lendecke2014-12-163-0/+178
| | | | | | | | | | | | This is a little set of routines designed after the glibc argz routines. It is supposed to eventually replace our inefficient string_list routines. A talloc blob is an array of strings separated by the \0 character. See argz(3) on a Linux system for the ideas where this came from. Based on talloc strv is simpler because talloc knows about the size of the blob, so we don't have to explicitly maintain it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add tdb_fetch_tallocVolker Lendecke2014-12-162-0/+36
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add map_unix_error_from_tdbVolker Lendecke2014-12-162-1/+63
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Fix incorrect month in timestampsMartin Schwenke2014-12-121-1/+1
| | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11003 Reported-by: Youzhong Yang <Youzhong.Yang@mathworks.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Dec 12 05:02:32 CET 2014 on sn-devel-104
* lib: Fix blank line endingsVolker Lendecke2014-12-093-55/+55
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Fix a typoVolker Lendecke2014-12-091-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Simplify load_case_tables_library()Volker Lendecke2014-12-081-8/+9
| | | | | | | We don't really need a talloc context here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Fix signed/unsigned comparisonsVolker Lendecke2014-12-072-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Fix signed/unsigned comparisonsVolker Lendecke2014-12-052-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add proper {} to tcopy_passwdVolker Lendecke2014-11-181-1/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Nov 18 21:45:40 CET 2014 on sn-devel-104
* lib: Use talloc_pooled_object in tcopy_passwdVolker Lendecke2014-11-181-1/+10
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: use size_t for add_string_to_array().Günther Deschner2014-11-172-2/+2
| | | | | | | Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib/util/tests: avoid some compiler warningsStefan Metzmacher2014-11-143-33/+61
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: add str_list_make_v3_const()Stefan Metzmacher2014-11-142-0/+11
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* data_blob.h: Add space between literal and string constant.Jelmer Vernooij2014-11-101-3/+3
| | | | | | | | | | C++11 compilers warn if there is a missing space: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] Change-Id: Ib7e11c72c09de588ec558cfbf9dded8c625bf49b Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add tevent_req_simple_recv_unixVolker Lendecke2014-11-102-0/+14
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Protect time_basic.h against multiple inclusionMartin Schwenke2014-10-161-0/+5
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Oct 16 16:35:59 CEST 2014 on sn-devel-104
* lib/util: Add RFC3339 timestamp support to timeval_str_buf()Martin Schwenke2014-10-134-7/+33
| | | | | | | | | | | | Note that this can't be done more simply or portably with strftime(3) since "%z" isn't portable. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Oct 13 12:27:04 CEST 2014 on sn-devel-104
* lib/util: Use snprintf() instead of strftime() in timeval_str_buf()Martin Schwenke2014-10-132-10/+6
| | | | | | | | | This removes conditional code and ensures that the output is always as expected. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib/util: Use charset_compat.h if SAMBA_UTIL_CORE_ONLYMartin Schwenke2014-10-044-0/+20
| | | | | | | | | | | | | | | | | When doing a CTDB standalone build we don't want to use dynconfig, since this introduces a lot of unwanted complexity. To avoid this, either: * charset needs to be nobbled to avoid loading the case tables, since this depends on dynconfig; or * charset needs to be avoid completely, so some functions need to be replaced with their ASCII counterparts. The 2nd options seems more honest and less error-prone. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Factor out subsystem samba-util-core from samba-utilMartin Schwenke2014-10-041-79/+90
| | | | | | | | | | | | | | | | samba-util depends on Samba-specific code. Exclude this code from samba-util-core. When told to, via SAMBA_UTIL_CORE_ONLY, only build samba-util-core and dependencies. When SAMBA_UTIL_CORE_ONLY is not defined then the behaviour should be unchanged. Standalone builds of CTDB will be done against samba-util-core to avoid pulling in Samba-specific code. An alternative would be to remove the Samba-dependent code from samba-util. However, some of it is used by OpenChange. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for util.cMartin Schwenke2014-10-041-1/+6
| | | | | | | Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for fault.cMartin Schwenke2014-10-044-24/+64
| | | | | | | Add fault.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for substitute.cMartin Schwenke2014-10-044-28/+62
| | | | | | | | Add substitute.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Replace an SMB_ASSERT()Martin Schwenke2014-10-041-1/+5
| | | | | | | Avoid a cyclic dependency. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for signal.cMartin Schwenke2014-10-044-27/+54
| | | | | | | Add signal.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for time.[ch]Martin Schwenke2014-10-042-2/+8
| | | | | | | Allows standalone compile without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for data_blob.[ch]Martin Schwenke2014-10-042-1/+4
| | | | | | | Allows standalone compile without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for xfile.[ch]Martin Schwenke2014-10-042-1/+8
| | | | | | | | | | | | The include files added to xfile.h are already included unconditionally elsewhere (replace.h, samba_util.h, ...) so Samba can't be built without them. To minimise dependencies, only include specific util headers instead of samba_util.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for blocking.cMartin Schwenke2014-10-044-14/+36
| | | | | | | | Add blocking.h. Allows standalone compile without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: util [ctdb]: Signal handling - change CatchChild() and ↵Jeremy Allison2014-09-302-6/+6
| | | | | | | | | | | CatchChildLeaveStatus() to return the previous handler. Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc. https://bugzilla.samba.org/show_bug.cgi?id=10831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* lib: util: asn1 tests. Check every asn1 return.Jeremy Allison2014-09-261-5/+9
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
* lib/util: Drop unnecessary use of talloc_tos()Volker Lendecke2014-09-201-6/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* lib/util: Return some functions to util_str.cMartin Schwenke2014-09-192-55/+55
| | | | | | | | | | | These were moved in commit 8e704e4107b284bfc1e43f4c698ac0e6c5ae1800 when util_str.c was not shared. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Sep 19 20:34:05 CEST 2014 on sn-devel-104
* lib/util: Move next_token* functions to util_str.cMartin Schwenke2014-09-192-146/+145
| | | | | | | | | | | | | | | This is part of an attempt to untangle charset from util.c. Most of this was moved from util_str.c in commit 55903e6f9120f1ec58a8554813229975c3028a09. next_token() was moved from charset to util.c in commit 4be643d4ce33d5ce2bf9deacc3f6d0fde90cf626 so that it would be alongside next_token_talloc(). Now that util_str.c is in shared lib/util it is no longer necessary to have these in util.c. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>