confdb.c revision e7cc651468ab8b1462a6a39e712e7b8d36a3a166
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder NSS Configuratoin DB
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder This program is free software; you can redistribute it and/or modify
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder it under the terms of the GNU General Public License as published by
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder the Free Software Foundation; either version 3 of the License, or
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder (at your option) any later version.
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder This program is distributed in the hope that it will be useful,
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder but WITHOUT ANY WARRANTY; without even the implied warranty of
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder GNU General Public License for more details.
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder You should have received a copy of the GNU General Public License
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
3d10e93f6c8a8467cc8f8bdcbacf228600cca856Christian Maeder#define CONFDB_ZERO_CHECK_OR_JUMP(var, ret, err, label) do { \
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder/* Warning messages */
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder#define SAME_DOMAINS_ERROR_MSG "Domain '%s' is the same as or differs only "\
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder "in case from domain '%s'.\n"
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maederstatic char *prepend_cn(char *str, int *slen, const char *comp, int clen)
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder ret = talloc_realloc(NULL, str, char, *slen + 4 + clen + 1);
33e57f95ad297df25f3873a8e1446acde262ce1bChristian Maeder /* move current string to the end */
cb6d5bbb36150e28e40794320773e779e0c25d7bChristian Maeder memmove(&ret[clen +4], ret, *slen+1); /* includes termination */
50dc4ddf772893ad09019b3b39d2e4feb8486638Christian Maederint parse_section(TALLOC_CTX *mem_ctx, const char *section,
33e57f95ad297df25f3873a8e1446acde262ce1bChristian Maeder const char *s;
b6728819add93c157d17f1719d6bf94c462f7b0fChristian Maeder /* section must be a non null string and must not start with '/' */
b6728819add93c157d17f1719d6bf94c462f7b0fChristian Maeder if (!section || !*section || *section == '/') return EINVAL;
s = section;
if (!dn) {
goto done;
goto done;
done:
return ret;
bool replace,
const char *section,
const char *attribute,
const char **values)
char *secdn;
const char *rdn_name;
int ret, i;
if (!tmp_ctx) {
goto done;
goto done;
goto done;
errno = 0;
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,
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;
const char *name,
const char *tmp;
if (!dn) {
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;
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;
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;
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;