usertools.c revision 1542b85f13d72329685bdd97aa879c36d11f81be
/*
SSSD
User tools
Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pwd.h>
#include <pcre.h>
#include <errno.h>
#include <talloc.h>
#ifdef HAVE_LIBPCRE_LESSER_THAN_7
#define NAME_DOMAIN_PATTERN_OPTIONS (PCRE_EXTENDED)
#else
#endif
{
char *username;
return username;
}
/* Function returns given realm name as new uppercase string */
{
char *realm;
char *c;
if (!realm) {
return NULL;
}
c = realm;
while(*c != '\0') {
*c = toupper(*c);
c++;
}
return realm;
}
{
}
return 0;
}
#define IPA_AD_DEFAULT_RE "(((?P<domain>[^\\\\]+)\\\\(?P<name>.+$))|" \
"((?P<name>[^@]+)@(?P<domain>.+$))|" \
"(^(?P<name>[^@\\\\]+)$))"
struct confdb_ctx *cdb,
const char *conf_path,
char **re_pattern)
{
int ret;
size_t c;
char *id_provider = NULL;
struct provider_default_re {
const char *name;
const char *re;
{"ad", IPA_AD_DEFAULT_RE},
NULL, &id_provider);
"from conf db.\n"));
goto done;
}
if (id_provider == NULL) {
*re_pattern = NULL;
} else {
if (*re_pattern == NULL) {
goto done;
}
break;
}
}
}
done:
return ret;
}
{
struct sss_names_ctx *ctx;
const char *errstr;
char *conf_path;
int errval;
int errpos;
int ret;
goto done;
}
goto done;
}
/* If not found in the domain, look in globals */
}
"expression for domain [%s].\n", domain));
goto done;
}
}
if (!ctx->re_pattern) {
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)");
if (!ctx->re_pattern) {
goto done;
}
#ifdef HAVE_LIBPCRE_LESSER_THAN_7
} else {
"not support non-unique named subpatterns.\n"));
"subpatterns with a unique name and uses "
#endif
}
/* If not found in the domain, look in globals */
}
goto done;
}
}
goto done;
}
done:
}
return ret;
}
struct sss_names_ctx *snctx,
{
const char *result;
int ovec[30];
int origlen;
if (ret == PCRE_ERROR_NOMATCH) {
return EINVAL;
} else if (ret < 0) {
return EINVAL;
}
if (ret == 0) {
}
return EINVAL;
}
} else {
/* ignore "" string */
if (*result) {
} else {
}
}
return EOK;
}
static struct sss_domain_info * match_any_domain_or_subdomain_name (
{
uint32_t i;
return dom;
for (i = 0; i < dom->subdomain_count; i++) {
return dom->subdomains[i];
}
}
return NULL;
}
struct sss_domain_info *domains,
const char *default_domain,
{
char *candidate_name = NULL;
char *candidate_domain = NULL;
bool name_mismatch = false;
int ret;
return ENOMEM;
/*
* If the name matched without the domain part, make note of it.
* All the other domain expressions must agree on the domain-less
* name.
*/
if (candidate_name == NULL) {
name_mismatch = true;
}
/*
* If a domain was returned, then it must match the name of the
* domain that this expression was found on, or one of the
* subdomains.
*/
} else {
"domain '%s', user is %s\n",
break;
} else if (candidate_name == NULL) {
}
}
/* EINVAL is returned when name doesn't match */
goto done;
}
}
if (candidate_name && !name_mismatch) {
if (default_domain != NULL) {
if (default_domain == NULL) {
goto done;
}
break;
}
}
"not know, trying to look it up.\n",
rdomain));
goto done;
}
}
} else if (candidate_domain) {
goto done;
}
}
("name '%s' did not match any domain's expression\n", orig));
goto done;
}
}
}
done:
return ret;
}
char *
const char *orig_name,
bool case_sensitive)
{
}
bool case_sensitive, const char ***_cased)
{
const char **out;
return EOK;
}
if (num == 0) {
return EOK;
}
return ENOMEM;
}
for (i = 0; i < num; i++) {
return ENOMEM;
}
}
return EOK;
}