/*
SSSD
Kerberos 5 Backend Module -- Utilities
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
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 <string.h>
#include <stdlib.h>
#include <libgen.h>
#include "providers/krb5/krb5_utils.h"
#include "providers/krb5/krb5_ccache.h"
#include "providers/krb5/krb5_auth.h"
#include "src/util/find_uid.h"
{
int ret;
return EINVAL;
}
goto done;
}
goto done;
}
}
return ret;
}
done:
return ENOMEM;
}
}
return ret;
}
struct sss_domain_info *domain,
const char *user,
const char *upn)
{
int ret;
int sret;
bool in_transaction = false;
const char *cached_upn;
const char *cached_canonical_upn;
return EINVAL;
}
return ENOMEM;
}
goto done;
}
goto done;
}
"nothing to do.\n");
goto done;
}
NULL);
if (cached_canonical_upn != NULL
"nothing to do.\n");
goto done;
}
"for user [%s].\n",
cached_canonical_upn == NULL ?
"empty" : cached_canonical_upn,
goto done;
}
goto done;
}
goto done;
}
in_transaction = true;
goto done;
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
return ret;
}
static errno_t
{
0, 0, NULL, 0);
if (ret == 0) {
"Illegal pattern in ccache directory name [%s].\n", filename);
return EINVAL;
} else if (ret == PCRE_ERROR_NOMATCH) {
"Ccache directory name [%s] does not contain "
"illegal patterns.\n", filename);
return EOK;
}
return EFAULT;
}
bool file_mode, bool case_sensitive)
{
char *copy;
char *p;
char *n;
char *dummy;
char *name;
const char *cache_dir_tmpl;
char action;
bool rerun;
int ret;
return NULL;
}
goto done;
}
goto done;
}
p = copy;
*n = '\0';
n++;
if ( *n == '\0' ) {
"format error, single %% at the end of the template.\n");
goto done;
}
rerun = true;
action = *n;
while (rerun) {
rerun = false;
switch (action) {
case 'u':
"Cannot expand user name template "
"because user name is empty.\n");
goto done;
}
"sss_get_cased_name failed\n");
goto done;
}
name);
break;
case 'U':
"because uid is invalid.\n");
goto done;
}
break;
case 'p':
"Cannot expand user principal name template "
"because upn is empty.\n");
goto done;
}
break;
case '%':
break;
case 'r':
goto done;
}
break;
case 'h':
"Cannot expand home directory template "
"because the path is not available.\n");
goto done;
}
break;
case 'd':
if (file_mode) {
if (cache_dir_tmpl == NULL) {
"Missing credential cache directory.\n");
goto done;
}
illegal_re, false, case_sensitive);
"Expanding credential cache directory "
"template failed.\n");
goto done;
}
} else {
"'%%d' is not allowed in this template.\n");
goto done;
}
break;
case 'P':
if (!file_mode) {
"'%%P' is not allowed in this template.\n");
goto done;
}
"because PID is not available.\n");
goto done;
}
break;
/* Additional syntax from krb5.conf default_ccache_name */
case '{':
action = 'U';
n += L_EXP_UID - 1;
rerun = true;
continue;
action = 'U';
n += L_EXP_USERID - 1;
rerun = true;
continue;
/* SSSD does not distinguish between uid and euid,
* so we treat both the same way */
action = 'U';
n += L_EXP_EUID - 1;
rerun = true;
continue;
action = 'u';
n += L_EXP_USERNAME - 1;
rerun = true;
continue;
} else {
/* ignore any expansion variable we do not understand and
* let libkrb5 hndle it or fail */
name = n;
if (!n) {
"Invalid substitution sequence in cache "
"template. Missing closing '}' in [%s].\n",
template);
goto done;
}
}
break;
default:
"format error, unknown template [%%%c].\n", *n);
goto done;
}
}
goto done;
}
p = n + 1;
}
goto done;
}
if (illegal_re != NULL) {
goto done;
}
}
done:
return res;
}
char *domain_name,
struct sss_domain_info **dom)
{
if (domain_name != NULL &&
return ENOMEM;
}
} else {
}
return EOK;
}
{
char **list;
int n;
"split_on_separator failed - %s:[%d]\n",
goto done;
} else if (n != 2) {
"split_on_separator failed - Expected format is: "
"'username:primary' but got: '%s'.\n", tuple);
goto done;
}
done:
return ret;
}
static errno_t
{
int i;
for (i = 0; i < size; i++) {
&name_to_primary[i].id_name,
&name_to_primary[i].krb_primary);
goto done;
}
}
done:
return ret;
}
const char *krb5_map_user,
const char *dom_name,
struct map_id_name_to_krb_primary **_name_to_primary)
{
int size;
char **map;
goto done;
}
size = 0;
} else {
goto done;
}
}
struct map_id_name_to_krb_primary,
size + 1);
if (name_to_primary == NULL) {
goto done;
}
/* sentinel */
if (size > 0) {
size);
"fill_name_to_primary_map failed: %s:[%d]\n",
goto done;
}
}
/* conversion names to fully-qualified names */
for (int i = 0; i < size; i++) {
dom_name);
goto done;
}
dom_name);
goto done;
}
}
done:
}
return ret;
}