summaryrefslogtreecommitdiffstats
path: root/src/util/util.c
Commit message (Collapse)AuthorAgeFilesLines
* UTIL: Sanitize whitespaces.Lukas Slebodnik2014-02-261-0/+10
| | | | | | | | | | | | Original patches submitted by: mpesari(Thanks!!) It can cause problems if user will hit spaces before entering username. (e.g in gdm). Spaces are ignored by LDAP; it's better to escape them. Resolves: https://fedorahosted.org/sssd/ticket/1955 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Update DEBUG* invocations to use new levelsNikolai Kondrashov2014-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Make DEBUG macro invocations variadicNikolai Kondrashov2014-02-121-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Include external headers with #include <foo.h>Jakub Hrozek2013-10-221-2/+2
| | | | | | I find it more readable to include headers from outside the sssd tree with <foo.h>, not "foo.h". The latter should be used for in-tree headers only.
* util: Add functions to check if IP addresses is specialMichal Zidek2013-10-171-0/+57
| | | | | Added functions to check if given IP address is a special address (broadcast, multicast...).
* utils: add is_host_in_domain()Pavel Březina2013-09-051-0/+15
|
* UTIL: Explicitly include header file sys/socket.hLukas Slebodnik2013-08-281-0/+1
| | | | | | | We use constant AF_INET6 in util.c, but we do not explicitly include header file sys/socket.h. This header file was indirectly incuded by another header file netdb.h (netdb.h -> netinet/in.h -> sys/socket.h), but other platform can have other dependencies among header files.
* Move domain_to_basedn outside IPA subtreeJakub Hrozek2013-06-071-0/+35
| | | | | The utility function will be reused to guess search base from the base DN of AD trusted domains.
* Add function to safely wipe memory.Simo Sorce2013-01-101-0/+9
| | | | | This is useful for wiping passwords, as it prevents the compiler from optimizing out a memset to zero before a free()
* failover: Protect against empty host namesMichal Zidek2013-01-021-91/+70
| | | | | | | | | | Added new parameter to split_on_separator that allows to skip empty values. The whole function was rewritten. Unit test case was added to check the new implementation. https://fedorahosted.org/sssd/ticket/1484
* MONITOR: Fix off-by-one error in add_string_to_listJakub Hrozek2012-11-211-1/+4
| | | | | We need to allocate num_services+2 - one extra space for the new service and one for NULL.
* Add string_in_list() and add_string_to_list() with testsSumit Bose2012-11-141-0/+63
| | | | | | | | string_in_list() and add_string_to_list() are two utilities for NULL terminated strings arrays. add_string_to_list() adds a new string to an existing list or creates a new one with the strings as only item if there is not list. string_in_list() checks if a given string is in the list. It can be used case sensitive or in-sensitive.
* Fix: IPv6 address with square brackets doesn't work.Michal Zidek2012-08-231-0/+23
| | | | https://fedorahosted.org/sssd/ticket/1365
* Move atomic io function to a separate moduleJakub Hrozek2012-04-201-38/+0
| | | | | | We'll be using it on various places of the SSSD. The function is in its own file to allow using just the one piece without having to drag in the whole util.c module.
* sss_atomic_io: Do not fail reads with EPIPE if there is not enough data to readJakub Hrozek2012-04-201-1/+2
| | | | Also adds a unit test for sss_atomic_io()
* UTIL: Add function for atomic I/OJan Cholasta2012-02-261-0/+39
|
* Move sized_string declaration to utilsStephen Gallagher2012-01-231-0/+11
|
* sss_utf8_tolower utility function+unit testsJakub Hrozek2011-12-161-0/+1
|
* Fix size return for split_on_separator()Stephen Gallagher2011-11-021-1/+1
| | | | | | | It was returning the size of the array, rather than the number of elements. (The array was NULL-terminated). This argument was only used in one place that was actually working around this odd return value.
* Move IP adress escaping from the LDAP namespaceJakub Hrozek2011-07-111-0/+8
|
* Make parse_args skip extra spacesJakub Hrozek2011-06-151-16/+24
| | | | https://fedorahosted.org/sssd/ticket/871
* Introduce sss_hash_create_ex()Sumit Bose2010-12-201-6/+19
|
* Add missing break statement to sss_hash_createStephen Gallagher2010-12-141-0/+1
| | | | https://fedorahosted.org/sssd/ticket/720
* Add utility function to sanitize LDAP/LDB filtersStephen Gallagher2010-11-151-0/+52
| | | | Also adds a unit test.
* Add common hash table setupStephen Gallagher2010-10-081-0/+53
| | | | | sss_hash_create() produces a dhash table living in the talloc hierarchy.
* Add dup_string_list() utility functionStephen Gallagher2010-08-031-0/+31
|
* Add diff_string_lists utility functionStephen Gallagher2010-08-031-0/+196
| | | | Includes a unit test
* Move parse_args() to utilSumit Bose2010-05-271-0/+99
|
* Rename server/ directory to src/Stephen Gallagher2010-02-181-0/+138
Also update BUILD.txt