/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2015 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 <talloc.h>
#include <tevent.h>
#include <string.h>
#include "util/strtonum.h"
#include "sbus/sssd_dbus_errors.h"
#include "responder/common/responder.h"
#include "responder/common/cache_req/cache_req.h"
#include "responder/ifp/ifp_users.h"
#include "responder/ifp/ifp_groups.h"
#include "responder/ifp/ifp_cache.h"
struct sss_domain_info *domain,
struct ldb_message *msg)
{
case DOM_TYPE_APPLICATION:
break;
case DOM_TYPE_POSIX:
break;
}
return NULL;
}
}
struct sss_domain_info *domains,
const char *path,
struct sss_domain_info **_domain,
char **_key)
{
return ret;
}
goto done;
}
done:
return ret;
}
void *data,
const char *name)
{
return ERR_INTERNAL;
}
return ENOMEM;
}
return EOK;
}
static void
{
char *object_path;
"User not found");
goto done;
goto done;
}
if (object_path == NULL) {
"Failed to compose object path");
goto done;
}
done:
return;
}
return;
}
void *data,
{
return ERR_INTERNAL;
}
return ENOMEM;
}
return EOK;
}
static void
{
char *object_path;
"User not found");
goto done;
goto done;
}
if (object_path == NULL) {
"Failed to compose object path");
goto done;
}
done:
return;
}
return;
}
const char *pem_cert)
{
int ret;
char *derb64;
return ERR_INTERNAL;
}
return ret;
}
"Invalid certificate format");
/* the connection is already terminated with an error message, hence
* we have to return EOK to not terminate the connection twice. */
return EOK;
}
derb64);
return ENOMEM;
}
return EOK;
}
{
char *object_path;
"User not found");
goto done;
goto done;
}
"More than one user found. "
"Use ListByCertificate to get all.");
goto done;
}
if (object_path == NULL) {
"Failed to compose object path");
goto done;
}
done:
return;
}
return;
}
struct ldb_result *result);
{
char *derb64;
int ret;
return ret;
}
"Invalid certificate format");
/* the connection is already terminated with an error message, hence
* we have to return EOK to not terminate the connection twice. */
return EOK;
}
return ERR_INTERNAL;
}
return ENOMEM;
}
return ifp_users_list_by_cert_step(list_ctx);
}
{
0,
return ENOMEM;
}
return EOK;
}
{
"Failed to fetch user [%d]: %s\n",
return;
}
"Failed to copy domain result");
return;
}
}
return ifp_users_list_by_name_reply(list_ctx);
}
"Failed to start next-domain search");
return;
}
return;
}
struct ldb_result *result)
{
goto done;
}
for (i = 0; i < copy_count; i++) {
goto done;
}
}
done:
return ret;
}
struct name_and_cert_ctx {
const char *name;
char *derb64;
char *user_opath;
};
static int ifp_users_find_by_name_and_cert_step(
struct name_and_cert_ctx *name_and_cert_ctx);
static void ifp_users_find_by_name_and_cert_reply(
struct name_and_cert_ctx *name_and_cert_ctx);
{
int ret;
return ERR_INTERNAL;
}
"Missing input");
/* the connection is already terminated with an error message, hence
* we have to return EOK to not terminate the connection twice. */
return EOK;
}
if (name_and_cert_ctx == NULL) {
return ENOMEM;
}
return ENOMEM;
}
}
&(name_and_cert_ctx->derb64));
return ret;
}
"Invalid certificate format");
/* the connection is already terminated with an error message, hence
* we have to return EOK to not terminate the connection twice. */
return EOK;
}
/* FIXME: if unlimted searches with limit=0 will work please replace
* 100 with 0. */
100);
return ENOMEM;
}
}
NULL,
return ENOMEM;
}
} else {
return ret;
}
}
return EOK;
}
{
"User not found");
goto fail;
"Failed to fetch user [%d]: %s\n",
goto fail;
}
"Failed to compose object path");
goto fail;
}
"Failed to fetch certificate [%d]: %s\n",
goto fail;
}
} else {
}
return;
fail:
return;
}
static int ifp_users_find_by_name_and_cert_step(
struct name_and_cert_ctx *name_and_cert_ctx)
{
0,
return ENOMEM;
}
return EOK;
}
{
"Failed to fetch user [%d]: %s\n",
return;
}
"Failed to copy domain result");
return;
}
}
}
"Failed to start next-domain search");
return;
}
return;
}
static void ifp_users_find_by_name_and_cert_reply(
struct name_and_cert_ctx *name_and_cert_ctx)
{
size_t c;
/* If no name was given check if there is only one user mapped to the
* certificate and return its object path. Either no or more than one
* mapped users are errors in this case.
* The case where a given name could not be found is already handled in
* ifp_users_find_by_name_and_cert_name_done(). */
"User not found");
} else {
"More than one user found. "
"Use ListByCertificate to get all.");
}
return;
}
/* If there was no certficate given just return the object path of the
* user found by name. If a certificate was given an no mapped user was
* found return an error. */
} else {
"No user matching name and certificate "
"found");
}
return;
}
/* Check if the user found by name is one of the users mapped to the
* certificate. */
for (c = 0; c < list_ctx->path_count; c++) {
return;
}
}
/* A user was found by name but the certificate is mapped to one or more
* different users. */
"No user matching name and certificate found");
/* name_and_cert_ctx is already freed because sbus_req (the parent) is
* already freed by the DBus finish calls */
return;
}
void *data,
const char *filter,
{
return ERR_INTERNAL;
}
return ENOMEM;
}
return ifp_users_list_by_name_step(list_ctx);
}
{
return ENOMEM;
}
return EOK;
}
{
return;
}
"Failed to copy domain result");
return;
}
}
return ifp_users_list_by_name_reply(list_ctx);
}
"Failed to start next-domain search");
return;
}
}
{
}
void *data,
const char *domain,
const char *filter,
{
return ERR_INTERNAL;
}
return ENOMEM;
}
return ENOMEM;
}
return EOK;
}
{
"User not found by filter");
goto done;
goto done;
}
"Failed to get the list remaining capacity\n");
goto done;
}
for (i = 0; i < copy_count; i++) {
"Failed to compose object path");
goto done;
}
}
done:
return;
}
return;
}
static errno_t
struct sss_domain_info *domain,
const char *key,
struct ldb_message **_user)
{
case DOM_TYPE_POSIX:
return ret;
}
return ENOENT;
return ret;
}
break;
case DOM_TYPE_APPLICATION:
return ENOENT;
return ret;
}
break;
}
return EIO;
}
return EOK;
}
static errno_t
struct sss_domain_info **_domain,
struct ldb_message **_user)
{
char *key;
return ret;
}
}
}
}
return ret;
}
void *data,
const char *attr,
const char **_out)
{
return;
}
return;
}
return;
}
return;
}
void *data,
const char *attr,
const char **_out)
{
const char *in_name;
return;
}
return;
}
return;
}
return;
}
return;
}
void *data,
const char *attr,
{
*_out = 0;
return;
}
return;
}
return;
}
return;
}
void *data)
{
const char *username;
return ERR_INTERNAL;
}
return ret;
}
return ERR_INTERNAL;
}
username);
return ENOMEM;
}
sbus_req);
return EOK;
}
{
"User not found");
goto done;
goto done;
}
done:
return;
}
return;
}
void *data,
const char **_out)
{
}
void *data,
{
}
void *data,
{
}
void *data,
const char **_out)
{
}
void *data,
const char **_out)
{
}
void *data,
const char **_out)
{
}
void *data,
const char **_out)
{
}
void *data,
const char ***_out,
int *_size)
{
const char *username;
const char **out;
int num_groups;
int i;
*_size = 0;
return;
}
return;
}
return;
}
return;
}
/* Run initgroups. */
return;
}
return;
}
return;
}
num_groups = 0;
SYSDB_GIDNUM, 0);
continue;
}
return;
}
num_groups++;
}
*_size = num_groups;
}
void *data,
const char **_out)
{
const char *domainname;
if (domainname == NULL) {
return;
}
}
void *data,
const char **_out)
{
return;
}
return;
}
return;
}
}
void *data,
hash_table_t **_out)
{
const char *name;
const char *filter;
const char **extra;
const char **values;
int hret;
int i;
return;
}
return;
}
return;
}
return;
}
return;
}
SYSDB_NAME, name);
return;
}
return;
}
if (count == 0) {
return;
} else if (count > 1) {
return;
}
return;
}
/* Read each extra attribute. */
extra[i]);
continue;
}
return;
}
return;
}
if (hret != HASH_SUCCESS) {
"into hash table: %d\n", hret);
return;
}
}
}
void *data)
{
}
void *data,
const char *domain)
{
}
void *data)
{
}
/* The request is finished inside. */
}
void *data)
{
}
/* The request is finished inside. */
}