confdb.c revision 8b2a31634764168183506925a4b9f461afdba6f3
f2d4040444c202e2b4451de0a977fa4060fa2c86lgentis SSSD Configuration DB
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor This program is free software; you can redistribute it and/or modify
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor it under the terms of the GNU General Public License as published by
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor the Free Software Foundation; either version 3 of the License, or
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor (at your option) any later version.
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor This program is distributed in the hope that it will be useful,
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor but WITHOUT ANY WARRANTY; without even the implied warranty of
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor GNU General Public License for more details.
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor You should have received a copy of the GNU General Public License
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor along with this program. If not, see <http://www.gnu.org/licenses/>.
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor#define CONFDB_ZERO_CHECK_OR_JUMP(var, ret, err, label) do { \
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor/* Warning messages */
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor#define SAME_DOMAINS_ERROR_MSG "Domain '%s' is the same as or differs only "\
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor "in case from domain '%s'.\n"
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzorstatic char *prepend_cn(char *str, int *slen, const char *comp, int clen)
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor ret = talloc_realloc(NULL, str, char, *slen + 4 + clen + 1);
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor /* move current string to the end */
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor memmove(&ret[clen +4], ret, *slen+1); /* includes termination */
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzorint parse_section(TALLOC_CTX *mem_ctx, const char *section,
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor const char *s;
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor /* section must be a non null string and must not start with '/' */
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor if (!section || !*section || *section == '/') return EINVAL;
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor if (l == 0) {
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor l = 3 + (p-s);
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor if (*p == '\0') {
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor break; /* reached end */
eacd4e6ae9f4f2740b3d3b3c315067d8a0da71e3lgentis const char *section,
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor const char *attribute,
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor const char **values)
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor const char *rdn_name;
594b4dd7639cd01b2200bd0774bc50952ceffcbegryzor ret = parse_section(tmp_ctx, section, &secdn, &rdn_name);
c3a2738228cb6ba4a48c425711e728d3410a458elgentis CONFDB_ZERO_CHECK_OR_JUMP(msg->dn, ret, ENOMEM, done);
c3a2738228cb6ba4a48c425711e728d3410a458elgentis /* cn first */
goto done;
for (i = 0; values[i]; i++) {
goto done;
goto done;
int optype;
errno = 0;
goto done;
for (i = 0; values[i]; i++) {
goto done;
goto done;
done:
return ret;
const char *section,
const char *attribute,
char ***values)
char *secdn;
char **vals;
int ret, i;
if (!tmp_ctx)
return ENOMEM;
goto done;
if (!dn) {
goto done;
goto done;
goto done;
if (!vals) {
goto done;
if (!vals[i]) {
goto done;
done:
return ret;
const char *section,
const char *attribute,
const char *val)
char *secdn;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!dn) {
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
done:
return ret;
char *restr;
int ret;
goto failed;
if (values[0]) {
goto failed;
return EOK;
if (!restr) {
goto failed;
return EOK;
return ret;
long val;
int ret;
goto failed;
goto failed;
if (values[0]) {
goto failed;
errno = 0;
if (errno) {
goto failed;
goto failed;
return EOK;
return ret;
long val;
int ret;
goto failed;
goto failed;
if (values[0]) {
goto failed;
errno = 0;
if (errno) {
goto failed;
return EOK;
return ret;
bool val;
int ret;
goto failed;
goto failed;
if (values[0]) {
goto failed;
val = false;
val = true;
goto failed;
return EOK;
return ret;
char ***result)
int ret;
goto done;
goto done;
goto done;
done:
return ret;
const char *confdb_location)
if (!cdb)
return ENOMEM;
return EIO;
return EIO;
return EIO;
return EIO;
return EOK;
const char *entry,
char *endptr;
*return_value = 0;
return EFAULT;
return EOK;
return EINVAL;
if (errno) {
return errno;
return EINVAL;
return EOK;
bool *return_value,
const char *entry,
bool default_value)
*return_value = 0;
return EFAULT;
return EOK;
*return_value = 0;
return EINVAL;
return EOK;
return defval;
int cred_expiration;
int id_timeout;
goto done;
goto done;
if (cred_expiration != 0 &&
&id_timeout);
done:
return ret;
const char *name,
const char *tmp;
char *default_domain;
bool fqnames_default = false;
int memcache_timeout;
if (!dn) {
goto done;
goto done;
goto done;
goto done;
if (!domain) {
goto done;
if (!tmp) {
goto done;
goto done;
NULL);
if (tmp) {
goto done;
goto done;
goto done;
NULL);
goto done;
NULL);
goto done;
NULL);
goto done;
goto done;
goto done;
fqnames_default = true;
goto done;
goto done;
goto done;
goto done;
CONFDB_DOMAIN_MAXID, 0);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (val >= 0) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (ret != 0) {
goto done;
NULL);
if (ret != 0) {
goto done;
goto done;
goto done;
done:
return ret;
char **domlist;
int ret, i;
return EOK;
&domlist);
goto done;
goto done;
for (i = 0; domlist[i]; i++) {
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name,
int ret;
return ret;
return EOK;
return ENOENT;
char ***_names)
int ret;
return ENOMEM;
goto done;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;