krb5_ccache.c revision e693e9c67e0b4c5b38ba7ce7d04f718b2da2e2d0
/*
SSSD
Kerberos 5 Backend Module -- ccache related utilities
Authors:
Sumit Bose <sbose@redhat.com>
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2014 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/>.
*/
#ifdef HAVE_KRB5_KRB5_H
#else
#include <krb5.h>
#endif
#include "providers/krb5/krb5_ccache.h"
#include "util/sss_krb5.h"
struct string_list {
struct string_list *next;
struct string_list *prev;
char *s;
};
const char *ccdirname,
struct stat *parent_stat,
struct string_list **missing_parents)
{
char *end;
struct string_list *li;
"[%s] is not a directory.\n", ccdirname);
return EINVAL;
}
return EOK;
} else {
return ret;
}
}
"talloc_zero failed.\n");
return ENOMEM;
}
"talloc_strdup failed.\n");
return ENOMEM;
}
"talloc_strdup failed.\n");
return ENOMEM;
}
/* We'll remove all trailing slashes from the back so that
do {
"Cannot find parent directory of [%s], / is not allowed.\n",
goto done;
}
*end = '\0';
done:
return ret;
}
{
"Private directory can only be created below a directory "
return EINVAL;
}
"Parent directory does not have the search bit set for "
"the owner.\n");
return EINVAL;
}
} else {
"Parent directory does not have the search bit set for "
"others.\n");
return EINVAL;
}
}
return EOK;
}
{
struct stat parent_stat;
"talloc_new failed.\n");
return ENOMEM;
}
if (*ccdirname != '/') {
"Only absolute paths are allowed, not [%s] .\n", ccdirname);
goto done;
}
"find_ccdir_parent_data failed.\n");
goto done;
}
"Check the ownership and permissions of krb5_ccachedir: [%s].\n",
goto done;
}
"Creating directory [%s].\n", li->s);
new_dir_mode = 0700;
goto done;
}
goto done;
}
}
done:
return ret;
}
{
const char *filename;
char *ccdirname;
char *end;
if (ccname[0] == '/') {
} else {
/* only FILE and DIR types need precreation so far, we ignore any
* other type */
return EOK;
}
goto done;
}
/* We'll remove all trailing slashes from the back so that
do {
"/ is not allowed.\n", ccdirname);
goto done;
}
*end = '\0';
done:
return ret;
}
struct sss_krb5_ccache {
};
static int sss_free_krb5_ccache(void *mem)
{
}
return 0;
}
const char *ccname,
struct sss_krb5_ccache **ccache)
{
struct sss_krb5_ccache *cc;
if (!cc) {
return ENOMEM;
}
if (ret) {
goto done;
}
if (kerr) {
goto done;
}
ret = ERR_NOT_FOUND;
goto done;
} else if (kerr != 0) {
ret = ERR_INTERNAL;
goto done;
}
done:
if (ret) {
} else {
}
return ret;
}
{
if (kerr) {
} else {
}
/* krb5_cc_destroy frees cc->ccache in all events */
return ret;
}
{
/* nothing to remove */
return EOK;
}
return ENOMEM;
}
if (ret) {
goto done;
}
done:
return ret;
}
/* This function is called only as a way to validate that we have the
* right cache */
const char *ccname,
{
const char *cc_type;
if (kerr) {
ret = ERR_INTERNAL;
goto done;
}
if (kerr != 0) {
}
if (ccprinc) {
/* found in the primary ccache */
goto done;
}
}
#ifdef HAVE_KRB5_CC_COLLECTION
if (kerr != 0) {
/* try to continue despite failure */
}
if (kerr == 0) {
goto done;
}
}
#endif /* HAVE_KRB5_CC_COLLECTION */
ret = ERR_NOT_FOUND;
done:
if (ccprinc) {
}
if (kcc) {
}
return ret;
}
{
const char *filename;
int ret;
if (ccname[0] == '/') {
} else {
/* only FILE and DIR types need file checks so far, we ignore any
* other type */
return EOK;
}
return EOK;
}
{
char *tgt_name;
krb5_creds mcred = { 0 };
krb5_creds cred = { 0 };
* exists bail out immediately otherwise a following krb5_cc_resolve()
* call may actually create paths and files we do not want to have
* around */
if (ret) {
return ret;
}
return ENOMEM;
}
if (ret) {
goto done;
}
if (!tgt_name) {
goto done;
}
if (kerr) {
else ret = ERR_INTERNAL;
goto done;
}
if (kerr) {
else ret = ERR_INTERNAL;
goto done;
}
if (kerr) {
} else {
ret = ERR_INTERNAL;
}
}
done:
return ret;
}
{
char *server_name;
const char *realm_name;
int realm_length;
if (kerr != 0) {
goto done;
}
if (kerr != 0) {
goto done;
}
if (realm_length == 0) {
goto done;
}
if (server_name == NULL) {
goto done;
}
if (kerr != 0) {
goto done;
}
if (kerr != 0) {
goto done;
}
if (kerr != 0) {
goto done;
}
if (kerr != 0) {
goto done;
}
kerr = 0;
done:
}
if (client_princ != NULL) {
}
if (server_princ != NULL) {
}
}
if (kerr != 0) {
return EIO;
}
return EOK;
}
const char *new_ccache,
{
if ((old_ccache == new_ccache)
|| (old_ccache && new_ccache
"none will be deleted.\n");
return EOK;
}
}
const char *ccache_file,
char **_mem_name)
{
char *ccache_name = NULL;
char *sep;
if (kerr != 0) {
return kerr;
}
if (kerr != 0) {
goto done;
}
"Ccache name [%s] does not have delimiter[:] .\n", ccache_name);
goto done;
}
goto done;
}
kerr = 0;
goto done;
}
goto done;
}
} else {
"currently only FILE is supported.\n",
goto done;
}
if (kerr != 0) {
goto done;
}
if (kerr != 0) {
"error reading principal from ccache [%s].\n", ccache_name);
goto done;
}
if (kerr != 0) {
"Failed to initialize ccache [%s].\n", mem_name);
goto done;
}
if (kerr != 0) {
goto done;
}
kerr = 0;
done:
if (kerr != 0) {
}
}
}
return kerr;
}