confdb.c revision f6dbb235373b122ae15643ef5dbbe821ee1307d9
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive NSS Configuratoin DB
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd This program is free software; you can redistribute it and/or modify
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd it under the terms of the GNU General Public License as published by
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd the Free Software Foundation; either version 3 of the License, or
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen (at your option) any later version.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen This program is distributed in the hope that it will be useful,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen but WITHOUT ANY WARRANTY; without even the implied warranty of
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd GNU General Public License for more details.
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd You should have received a copy of the GNU General Public License
3f08db06526d6901aa08c110b5bc7dde6bc39905nd along with this program. If not, see <http://www.gnu.org/licenses/>.
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung#define CONFDB_ZERO_CHECK_OR_JUMP(var, ret, err, label) do { \
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4ndstatic char *prepend_cn(char *str, int *slen, const char *comp, int clen)
97a9a944b5887e91042b019776c41d5dd74557aferikabele ret = talloc_realloc(NULL, str, char, *slen + 4 + clen + 1);
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd /* move current string to the end */
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd memmove(&ret[clen +4], ret, *slen+1); /* includes termination */
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4ndint parse_section(TALLOC_CTX *mem_ctx, const char *section,
62160b002faf84ed5427a5b4ad264031eba3f908nd const char *s;
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd /* section must be a non null string and must not start with '/' */
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd if (!section || !*section || *section == '/') return EINVAL;
20189240503ef2c8f5dc6e2248b57faab4b23b5and if (l == 0) {
20189240503ef2c8f5dc6e2248b57faab4b23b5and l = 3 + (p-s);
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic if (*p == '\0') {
06ba4a61654b3763ad65f52283832ebf058fdf1cslive break; /* reached end */
62160b002faf84ed5427a5b4ad264031eba3f908nd const char *section,
62160b002faf84ed5427a5b4ad264031eba3f908nd const char *attribute,
62160b002faf84ed5427a5b4ad264031eba3f908nd const char **values)
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic const char *rdn_name;
bdd978e5ecd8daa2542d4d4e1988c78a622cd7f4nd ret = parse_section(tmp_ctx, section, &secdn, &rdn_name);
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf /* cn first */
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic /* now the requested attribute */
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic for (i = 0; values[i]; i++) {
2c9e74eac9f72c14535dd65a520e4de2e664d9cdhumbedooh /* mark this as a replacement */
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen ret = ldb_msg_add_empty(msg, attribute, optype, NULL);
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;
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;
CONFDB_DOMAIN_MAXID, 0);
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;
CONFDB_DOMAIN_CASE_SENSITIVE, true);
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++) {
if (ret) {
goto done;
done:
return ret;
const char *name,
int ret;
return ret;
return EOK;
return ENOENT;