sss_override.c revision cf3ba77997dfbd076a1f30fdbb33c7973766ac03
/*
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 <stdlib.h>
#include "util/crypto/sss_crypto.h"
#include "tools/common/sss_tools.h"
#include "tools/common/sss_colondb.h"
#define LOCALVIEW SYSDB_LOCAL_VIEW_NAME
#define ORIGNAME "originalName"
struct override_user {
const char *input_name;
const char *orig_name;
struct sss_domain_info *domain;
const char *name;
const char *home;
const char *shell;
const char *gecos;
const char *cert;
};
struct override_group {
const char *input_name;
const char *orig_name;
struct sss_domain_info *domain;
const char *name;
};
struct sss_tool_ctx *tool_ctx,
struct poptOption *options,
const char **_input_name,
const char **_orig_name,
struct sss_domain_info **_domain)
{
enum sss_tool_opt require;
const char *input_name;
const char *orig_name;
struct sss_domain_info *domain;
int ret;
if (ret != EXIT_SUCCESS) {
return ret;
}
return ret;
}
*_orig_name = orig_name;
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
struct override_user *user)
{
struct poptOption options[] = {
};
}
struct sss_tool_ctx *tool_ctx,
struct override_user *user)
{
}
struct sss_tool_ctx *tool_ctx,
struct override_user *user)
{
}
struct sss_tool_ctx *tool_ctx,
struct override_group *group)
{
struct poptOption options[] = {
};
}
struct sss_tool_ctx *tool_ctx,
struct override_group *group)
{
}
struct sss_tool_ctx *tool_ctx,
struct override_group *group)
{
}
struct sss_tool_ctx *tool_ctx,
struct sss_domain_info **_dom)
{
struct sss_domain_info *dom;
int ret;
struct poptOption options[] = {
};
if (ret != EXIT_SUCCESS) {
return ret;
}
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
const char **_file)
{
int ret;
_file);
if (ret != EXIT_SUCCESS) {
return ret;
}
return EXIT_SUCCESS;
}
const char **_file)
{
int ret;
_file);
if (ret != EXIT_SUCCESS) {
return ret;
}
return EXIT_SUCCESS;
}
{
return ret;
}
if (is_local_view(viewname)) {
goto done;
"Only one view is supported. Nothing to do.\n", viewname);
goto done;
}
}
printf("SSSD needs to be restarted for the changes to take effect.\n");
}
done:
return ret;
}
{
}
return ret;
}
{
char *anchor;
char *safe_dn;
return NULL;
}
return anchor;
}
const char *name,
const char *home,
const char *shell,
const char *gecos,
const char *cert)
{
struct sysdb_attrs *attrs;
return NULL;
}
goto done;
}
}
if (uid != 0) {
goto done;
}
}
if (gid != 0) {
goto done;
}
}
goto done;
}
}
goto done;
}
}
goto done;
}
}
goto done;
}
}
done:
return NULL;
}
return attrs;
}
struct override_user *user)
{
}
struct override_group *group)
{
}
struct sss_domain_info *domain,
const char *name)
{
char *fqname;
int fqlen;
int check;
char *dummy_domain = NULL;
int ret;
return NULL;
}
/* check if the name already contains domain part */
if (ret == ERR_REGEX_NOMATCH) {
"sss_parse_name could not parse domain from [%s]. "
"Assuming it is not FQDN.\n", name);
return NULL;
}
if (dummy_domain != NULL) {
return NULL;
}
return fqname;
}
/* Get length. */
if (fqlen > 0) {
fqlen++; /* \0 */
} else {
return NULL;
}
return NULL;
}
return NULL;
}
return fqname;
}
struct sss_domain_info *domain,
const char *name)
{
}
}
static struct sss_domain_info *
const char *name,
struct sss_domain_info *domain,
struct sss_domain_info *domains)
{
struct sss_domain_info *dom;
struct ldb_result *res;
const char *strtype;
char *sysname;
bool check_next;
return NULL;
}
goto done;
}
/* Ensure that the object is in cache. */
switch (type) {
case SYSDB_MEMBER_USER:
goto done;
}
break;
case SYSDB_MEMBER_GROUP:
goto done;
}
break;
default:
ret = ERR_INTERNAL;
goto done;
}
/* Find domain if it is unknown. */
check_next = true;
} else {
check_next = false;
}
do {
switch (type) {
case SYSDB_MEMBER_USER:
strtype = "user";
break;
case SYSDB_MEMBER_GROUP:
strtype = "group";
break;
default:
ret = ERR_INTERNAL;
goto done;
}
if (check_next) {
continue;
}
}
goto done;
ret = ERR_INTERNAL;
goto done;
}
check_next = false;
goto done;
}
done:
return NULL;
}
return dom;
}
struct override_user *user)
{
struct sss_domain_info *newdom;
const char *domname;
return ENOENT;
}
return EOK;
}
struct override_group *group)
{
struct sss_domain_info *newdom;
const char *domname;
return ENOENT;
}
return EOK;
}
struct sss_domain_info *domain,
enum sysdb_member_type type,
const char *name,
const char **_str_dn)
{
const char *str_dn;
struct ldb_result *res;
return ENOMEM;
}
switch (type) {
case SYSDB_MEMBER_USER:
break;
case SYSDB_MEMBER_GROUP:
break;
default:
ret = ERR_INTERNAL;
goto done;
}
"Failed to look up original object in cache.\n");
goto done;
}
goto done;
"There are multiple object with name [%s] in the cache.\n", name);
goto done;
}
goto done;
}
goto done;
}
}
}
done:
return ret;
}
enum sysdb_member_type type,
struct sysdb_attrs *attrs,
const char *name)
{
const char *anchor;
const char *str_dn;
return ENOMEM;
}
goto done;
}
goto done;
}
goto done;
}
done:
return ret;
}
struct sss_tool_ctx *tool_ctx,
struct sss_domain_info *domain,
const char *input,
const char **_name)
{
struct sss_domain_info *dom;
return EOK;
}
"fqn %s\n", input);
}
return ret;
}
struct override_user *input_user)
{
struct override_user user;
struct sysdb_attrs *attrs;
return ENOMEM;
}
user = *input_user;
/* We need to parse the name and ensure that domain did not change. */
goto done;
}
goto done;
}
goto done;
}
goto done;
}
done:
return ret;
}
struct override_group *input_group)
{
struct override_group group;
struct sysdb_attrs *attrs;
return ENOMEM;
}
group = *input_group;
/* We need to parse the name and ensure that domain did not change. */
goto done;
}
goto done;
}
goto done;
}
goto done;
}
done:
return ret;
}
enum sysdb_member_type type,
const char *name)
{
struct ldb_message *msg;
struct ldb_dn *override_dn;
const char *str_dn;
const char *anchor;
int sret;
bool in_transaction = false;
return ENOMEM;
}
goto done;
}
goto done;
}
if (override_dn == NULL) {
goto done;
}
goto done;
}
in_transaction = true;
goto done;
}
goto done;
}
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
"ldb_modify() failed: [%s](%d)[%s]\n",
goto done;
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
return ret;
}
struct ldb_message *override)
{
struct ldb_message **msgs;
const char *name;
const char *fqname;
return ENOMEM;
}
ret = ERR_INTERNAL;
goto done;
}
goto done;
} else if (count != 1) {
ret = ERR_INTERNAL;
goto done;
}
ret = ERR_INTERNAL;
goto done;
}
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
done:
return ret;
}
const char *base_filter,
const char *ext_filter,
const char **attrs,
struct sss_domain_info *domain,
struct ldb_message ***_msgs)
{
struct ldb_message **msgs;
const char *filter;
size_t i;
int ret;
return ENOMEM;
}
if (ext_filter != NULL) {
goto done;
}
}
/* Acquire list of override objects. */
goto done;
}
goto done;
}
/* Amend messages with original name. */
for (i = 0; i < count; i++) {
goto done;
}
}
done:
return ret;
}
static struct override_user *
struct sss_domain_info *domain,
const char *filter)
{
struct override_user *objs;
struct ldb_message **msgs;
size_t i;
const char *attrs[] = SYSDB_PW_ATTRS;
struct ldb_message_element *el;
return NULL;
}
goto done;
}
goto done;
}
for (i = 0; i < count; i++) {
NULL);
ret = ERR_INTERNAL;
goto done;
}
/* Currently we support only 1 certificate override */
ret = ERR_INTERNAL;
goto done;
}
} else {
}
}
done:
return NULL;
}
return objs;
}
static struct override_group *
struct sss_domain_info *domain,
const char *filter)
{
struct override_group *objs;
struct ldb_message **msgs;
size_t i;
const char *attrs[] = SYSDB_GRSRC_ATTRS;
return NULL;
}
goto done;
}
goto done;
}
for (i = 0; i < count; i++) {
NULL);
ret = ERR_INTERNAL;
goto done;
}
}
done:
return NULL;
}
return objs;
}
struct sss_domain_info *dom,
bool iterate,
const char *filter)
{
struct sss_colondb *db;
struct override_user *objs;
int i;
return ENOMEM;
}
goto done;
}
do {
goto done;
}
/**
* Format: orig_name:name:uid:gid:gecos:home:shell:certificate
*/
struct sss_colondb_write_field table[] = {
{SSS_COLONDB_SENTINEL, {0}}
};
goto done;
}
}
/* All overrides are under the same subtree, so we don't want to
* descent into subdomains. */
done:
return ret;
}
struct sss_domain_info *dom,
bool iterate,
const char *filter)
{
struct sss_colondb *db;
struct override_group *objs;
int i;
return ENOMEM;
}
goto done;
}
do {
goto done;
}
/**
* Format: orig_name:name:gid
*/
struct sss_colondb_write_field table[] = {
{SSS_COLONDB_SENTINEL, {0}}
};
goto done;
}
}
/* All overrides are under the same subtree, so we don't want to
* descent into subdomains. */
done:
return ret;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
int ret;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
int ret;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
struct sss_domain_info *dom;
bool iterate;
return EXIT_FAILURE;
}
iterate = true;
} else {
iterate = false;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
const char *dn;
char *anchor;
const char *filter;
int ret;
return EXIT_FAILURE;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
done:
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
struct sss_colondb *db;
const char *filename;
struct override_user obj;
int linenum = 1;
int rc;
return EXIT_FAILURE;
}
/**
* Format: orig_name:name:uid:gid:gecos:home:shell:certificate
*/
struct sss_colondb_read_field table[] = {
{SSS_COLONDB_SENTINEL, {0}}
};
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
linenum++;
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
}
"Use --debug option for more information.\n"), linenum);
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_SUCCESS;
done:
return rc;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
const char *filename;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
int ret;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
int ret;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
struct sss_domain_info *dom;
bool iterate;
return EXIT_FAILURE;
}
iterate = true;
} else {
iterate = false;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
const char *dn;
char *anchor;
const char *filter;
int ret;
return EXIT_FAILURE;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
done:
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
struct sss_colondb *db;
const char *filename;
struct override_group obj;
int linenum = 1;
int rc;
return EXIT_FAILURE;
}
/**
* Format: orig_name:name:gid
*/
struct sss_colondb_read_field table[] = {
{SSS_COLONDB_SENTINEL, {0}}
};
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
linenum++;
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_FAILURE;
goto done;
}
}
"Use --debug option for more information.\n"), linenum);
rc = EXIT_FAILURE;
goto done;
}
rc = EXIT_SUCCESS;
done:
return rc;
}
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
const char *filename;
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
{
struct sss_route_cmd commands[] = {
};
}