summaryrefslogtreecommitdiff
path: root/lib/util
AgeCommit message (Collapse)AuthorFilesLines
2011-07-19Second part of fix for bug 8310 - toupper_ascii() is broken on big-endian ↵Jeremy Allison2-0/+12
systems. Re-add: smb_ucs2_t toupper_w(smb_ucs2_t v); and ensure it is called whenever we are operating on smb_ucs2_t variables. I'd like to make the definition of smb_ucs2_t incompatible with int and codepoint_t so they can't be mixed, but that's a patch for another time. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Jul 19 23:48:05 CEST 2011 on sn-devel-104
2011-07-19First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systemsJeremy Allison3-43/+1
Remove int toupper_ascii(int c); int tolower_ascii(int c); int isupper_ascii(int c); int islower_ascii(int c); and replace with their _m equivalents, as they are identical.
2011-07-14lib/util/attr: add _UNUSED_ marcoStefan Metzmacher1-2/+7
metze
2011-07-13s4-fault: changed to use %d for PID, instead of %PID%Andrew Tridgell1-1/+1
this matches the s3 behaviour Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-08s3-param use common struct parmlist_entry to hold parametric optionsAndrew Bartlett1-0/+1
This will allow struct loadparm_service to be shared in future. Andrew Bartlett
2011-07-08lib/util Move bitmap.c to lib/utilAndrew Bartlett3-1/+176
2011-07-07s3:libsmb: remove unused clistr_push_fn()Stefan Metzmacher1-6/+0
metze
2011-07-07s3:libsmb: remove unused clistr_pull_fn()Stefan Metzmacher1-6/+0
metze
2011-07-06libcli/smb move enum protocol_types to a common headerAndrew Bartlett2-15/+1
2011-07-03S3: Fix some nonempty blank linesVolker Lendecke1-3/+3
2011-06-30lib/util/string_wrappers: move everything into one ↵Stefan Metzmacher1-18/+8
HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS block metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu Jun 30 14:29:41 CEST 2011 on sn-devel-104
2011-06-24lib: Allow NULL converted_size in convert_string_tallocVolker Lendecke1-2/+6
2011-06-23lib/util/charset: Remove autodetection of charset from LOCALEAndrew Bartlett1-31/+0
In the past, our LOCALE would set the display charset of Samba. The display charset has now been removed. This patch removes the support code that detected the locale from the environment. We cannot safely have 'unix charset' follow the locale (at it creates files on disk and entries in databases that must not vary), so this code is unused. As an example, imagine a database is manipulated in the administrator's locale, and then read by smbd starting up in the system default locale. Or smbd restarted by the administrator rather than a startup script. Both of these situations could corrupt databases or filenames on disk. Andrew Bartlett
2011-06-23lib/util/charset: Remove 'display charset'Andrew Bartlett5-103/+61
As discussed in 'CH_DISPLAY and gettext' on the samba-technical list: http://lists.samba.org/archive/samba-technical/2011-June/078190.html Setting this to a value other than 'unix charset' does not make sense, as any system where the filesytem charset does not equal the terminal charset will already have problems with programs as simple as 'ls'. It also means that our output could not be pasted as our input in interactive programs or onto our command line, as we never did translate in the DISPLAY -> UNIX direction. The d_printf() calls are retained in case we need to revisit this, and to support display_set_stderr(). Andrew Bartlett
2011-06-21lib/util: Restore CH_UNIX as source charset for d_printf()Andrew Bartlett1-1/+1
I'm changed this during the change to use the d_printf() code in common, but should not have. However, there is a puzzle: What is the right source charset? Translated strings in our .mo and .msg files are in UTF8, but strings such as file names on remote servers are in UNIX (whatever that is). I can't see how this actually works properly when either CH_DISPLAY or CH_UNIX are other than UTF8! Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-06-21lib/util Remove display_cd from d_printf()Andrew Bartlett1-7/+0
The setting of the display charset is now done by convert_string_talloc() selecting the right charset based on CH_DISPLAY. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-06-21lib/util Remove samba-util-common!Andrew Bartlett1-44/+12
All of this code is now in common, so we don't need the second '-common' library any more! Andrew Bartlett
2011-06-21lib/util: allow parmlist.c to compile under s3 includes.hAndrew Bartlett1-0/+2
2011-06-21lib/util: Use common d_printf() in the whole codebaseAndrew Bartlett3-26/+25
This removes the lang_tdb based varient, the only user of the lang_tdb code is SWAT, which calls that directly. 'net' and 'pam_winbind' are internationalised using gettext. Andrew Bartlett
2011-06-21lib/util Make unused d_vfprintf() staticAndrew Bartlett2-2/+1
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 Russell2-12/+12
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 Russell4-6/+4
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-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-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-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