summaryrefslogtreecommitdiffstats
path: root/src/util/usertools.c
Commit message (Collapse)AuthorAgeFilesLines
* Minor fixes for sss_parse_name_for_domainsJakub Hrozek2014-04-171-6/+11
| | | | | | | | | | | | - use brackets after an if - use the right variable name (candidate_domain instead of candidate_name). - fix a typo in a debug message - only print a debug message about using a default domain when using a default domain - add a comment explaning when is a codepath executed Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* Update DEBUG* invocations to use new levelsNikolai Kondrashov2014-02-121-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* utils: handling NULL params in sss_parse_namePavel Reichl2014-01-281-25/+29
|
* NSS: Don't use printf(3) on user provided strings.Stef Walter2014-01-121-77/+37
| | | | | | | | | | | | | | | | | | | | This also fixes several corner cases and crashers. It's not prudent to pass user input to (even admin) input as a format string to printf, and various distros now check for this. This can cause accessing memory incorrectly, and various also various libc abort()'s. In addition various assumptions were made about full_name_format that aren't necessarily the case if the user uses a more complex format. Use safe-printf.c implementation for formatting full_name_format. Adapt the NSS resolver so it doesn't barf on formatted strings that are shorter than expected given a full_name_format. Tests added and updated appropriately.
* Add sss_tc_fqname2()Sumit Bose2013-11-151-0/+13
| | | | | sss_tc_fqname2() is similar to sss_tc_fqname() but expects domain and flat domain name as string arguments instead of a domain struct.
* sss_names_init: allow empty domain nameSumit Bose2013-11-151-15/+19
| | | | | If no domain name is specified the global name pattern and regular expression will be returned.
* Include header file in implementation module.Lukas Slebodnik2013-09-241-0/+1
| | | | | Declarations of public functions was in header files, but header files was not included in implementation file.
* Fix warnings: uninitialized variableLukas Slebodnik2013-07-221-1/+1
|
* IPA: warn if full_name_format is customized in server modeJakub Hrozek2013-07-191-1/+1
| | | | | | | | | | | | | | | | | | | https://fedorahosted.org/sssd/ticket/2009 If the IPA server mode is on and the SSSD is running on the IPA server, then the server's extdom plugin calls getpwnam_r to read info about trusted users from the AD server and return them to the clients that called the extended operation. The SSSD returns the subdomain users fully-qualified, ie "user@domain" by default. The format of the fully qualified name is configurable. However, the extdom plugin returns the user name without the domain component. With this patch, when ipa_server_mode is on, warn if the full_name_format is set to a non-default value. That would prompt the admin to change the format if he changed it to something exotic.
* New utility function sss_get_domain_nameJakub Hrozek2013-06-071-0/+17
| | | | | Instead of copying a block of code that checks whether domain is a subdomain and uses only name of FQDN as appropriate, wrap the logic into a function.
* Allow flat name in the FQname formatJakub Hrozek2013-05-301-11/+66
| | | | | | | https://fedorahosted.org/sssd/ticket/1648 Adds another expansion in the printf format that allows the user to use the domain flat name in the format.
* Check the validity of FQname format prior to using itJakub Hrozek2013-05-301-3/+43
| | | | | | Adds a sanity check of the fqname pattern. Fails if the username pattern is not specified at all and warns if the domain pattern is not specified.
* Add utility functions for formatting fully-qualified namesJakub Hrozek2013-05-301-0/+25
| | | | | | Instead of using printf-like functions directly, provide two wrappers that would encapsulate formatting the fully-qualified names. No functional change is present in this patch.
* UTIL: Add function sss_names_init_from_argsJan Cholasta2013-05-071-41/+66
| | | | | This function allows initializing sss_names_ctx using a regular expression and fully qualified format string specified in its arguments.
* Check for correct variable nameJakub Hrozek2013-04-031-1/+1
| | | | https://fedorahosted.org/sssd/ticket/1864
* Change the way domains are linked.Simo Sorce2013-02-101-14/+6
| | | | | | | | | | | | | | | | | | | - Use a double-linked list for domains and subdomains. - Never remove a subdomain, simply mark it as disabled if it becomes unused. - Rework the way subdomains are refreshed. Now sysdb_update_subdomains() actually updates the current subdomains and marks as disabled the ones not found in the sysdb or add new ones found. It never removes them. Removal of missing domains from sysdb is deferred to the providers, which will perform it at refresh time, for the ipa provider that is done by ipa_subdomains_write_mappings() now. sysdb_update_subdomains() is then used to update the memory hierarchy of the subdomains. - Removes sysdb_get_subdomains() - Removes copy_subdomain() - Add sysdb_subdomain_delete()
* Add function get_next_domain()Simo Sorce2013-02-101-2/+2
| | | | | | | Use this function instead of explicitly calling domain->next This function allows to get the next primary domain or to descend into the subdomains and replaces also get_next_dom_or_subdom()
* Handle compiling FQDN regular expression with old pcre gracefullyJakub Hrozek2012-11-221-0/+9
| | | | https://fedorahosted.org/sssd/ticket/1661
* sss_parse_name_for_domains: always return the canonical domain nameSumit Bose2012-10-261-2/+7
| | | | | | Domains may have a flat or short name to save some keystrokes when typing fully qualified user names. Internally sssd will always use the canonical name to allow consistent processing.
* Use flat name for master domain as wellSumit Bose2012-10-011-1/+2
|
* Add new option default_domain_suffixSumit Bose2012-10-011-11/+41
|
* Add provider specific default regular expressionsSumit Bose2012-09-201-0/+62
| | | | Fixes https://fedorahosted.org/sssd/ticket/1524
* Check flat names when searching for sub-domains as wellSumit Bose2012-09-041-1/+3
|
* Consolidation of functions that make realm upper-caseOndrej Kos2012-08-231-0/+21
|
* Fix re_expression matching with subdomainsJan Zeleny2012-06-211-15/+19
| | | | | | | | | | | This patch fixes an issue which resulted in a need to initialize responder with data from local domain, otherwise it would not correctly detect requests for subdomains. Similar situation can occur if new subdomain is added at runtime. The solution is to ask for a list of subdomains in case there is a candidate domain identified in the process of matching re_expressions with given name.
* UTILS: Fix segfault due to sss_parse_name_for_domainsStephen Gallagher2012-06-211-7/+10
| | | | | | | | The recent fixes for per-domain parsing can cause a segfault in the netgroup processing if the domain isn't set to NULL when it's parsed as "any domain". https://fedorahosted.org/sssd/ticket/1383
* sss_names_init: Report correct error code if allocation failedJakub Hrozek2012-06-131-1/+4
|
* Make re_expression and full_name_format per domain optionsStef Walter2012-06-121-7/+138
| | | | | | | | | | | * Allows different user/domain qualified names for different domains. For example Domain\User or user@domain. * The global re_expression and full_name_format options remain as defaults for the domains. * Subdomains get the re_expression and full_name_format of their parent domain. https://bugzilla.redhat.com/show_bug.cgi?id=811663
* Add sss_get_cased_name_list utility functionJakub Hrozek2012-03-291-0/+37
|
* sss_get_cased_name utility functionJakub Hrozek2011-12-211-0/+9
|
* Rename server/ directory to src/Stephen Gallagher2010-02-181-0/+175
Also update BUILD.txt