0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch System Database
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch This program is free software; you can redistribute it and/or modify
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch it under the terms of the GNU General Public License as published by
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch the Free Software Foundation; either version 3 of the License, or
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch (at your option) any later version.
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch This program is distributed in the hope that it will be useful,
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch but WITHOUT ANY WARRANTY; without even the implied warranty of
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch GNU General Public License for more details.
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch You should have received a copy of the GNU General Public License
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch along with this program. If not, see <http://www.gnu.org/licenses/>.
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Boschstatic errno_t merge_ts_attr(struct ldb_message *ts_msg,
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch const char *want_attrs[])
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch bool include = true;
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch /* Otherwise merge all ts attrs */
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch include = string_in_list(ts_attr, discard_const(want_attrs), true);
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch if (include == false) {
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch ts_el = ldb_msg_find_element(ts_msg, ts_attr);
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch if (ts_el == NULL || ts_el->num_values == 0) {
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch sysdb_el = ldb_msg_find_element(sysdb_msg, ts_attr);
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch if (sysdb_el == NULL || sysdb_el->num_values == 0) {
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch ret = ldb_msg_add_steal_value(sysdb_msg, ts_attr, &ts_el->values[0]);
d01c7c7dfbcbb350ac9e23c3434ef85a7de6b7dfStephan Bosch /* Assumes the timestamps cache only holds single-valued
d01c7c7dfbcbb350ac9e23c3434ef85a7de6b7dfStephan Bosch * attributes */
d01c7c7dfbcbb350ac9e23c3434ef85a7de6b7dfStephan Bosch sysdb_el->values = talloc_steal(sysdb_el->values, ts_el->values);
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Boschstatic errno_t merge_msg_ts_attrs(struct sysdb_ctx *sysdb,
0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7Stephan Bosch const char *attrs[])
if (ts_dn == false) {
return ERR_NO_TS;
return ENOMEM;
NULL,
&ts_msgs);
goto done;
goto done;
return EIO;
* objectclass/objectcategory and avoid breaking MPGs where the OC might
goto done;
done:
return ret;
const char *attrs[])
return EOK;
return EOK;
const char *attrs[])
const char *name,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name,
return ENOMEM;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
if (ret) {
goto done;
done:
return ret;
return ENOMEM;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
const char *base_filter,
const char *name_filter,
const char *addtl_filter)
return NULL;
if (filter) {
return filter;
bool domain_scope,
const char *upn,
return ENOMEM;
goto done;
done:
return ret;
const char *attrs[],
const char *filter,
goto done;
return ENOMEM;
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name_filter,
char **_dn_filter)
goto done;
return ENOMEM;
goto done;
goto done;
goto done;
done:
return ret;
const char *name_filter,
const char *addtl_filter,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
&ts_res);
goto done;
goto done;
goto done;
goto done;
if (ret) {
goto done;
goto done;
done:
return ret;
const char *name_filter,
const char *addtl_filter,
size_t c;
return ENOMEM;
goto done;
NULL);
goto done;
done:
return ret;
return EOK;
if (ret) {
return ret;
return EOK;
const char *name,
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
const char *name,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
if (ret) {
goto done;
if (ret) {
goto done;
done:
return ret;
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
if (ret) {
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name_filter,
const char *addtl_filter,
return EINVAL;
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
&ts_res);
goto done;
goto done;
goto done;
goto done;
goto done;
if (ret) {
goto done;
goto done;
done:
return ret;
const char *name_filter,
const char *addtl_filter,
size_t c;
return ENOMEM;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
const char *name,
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
goto done;
if (!ctrl) {
goto done;
if (!ctrl[0]) {
goto done;
if (!control) {
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
const char *upn,
size_t i;
return ENOMEM;
goto done;
goto done;
return EINVAL;
return ret;
done:
return ret;
const char *name,
size_t c;
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
goto done;
if (!ctrl) {
goto done;
if (!ctrl[0]) {
goto done;
if (!control) {
goto done;
goto done;
NULL);
goto done;
goto done;
NULL);
goto done;
done:
return ret;
const char *name,
const char **attributes,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name,
const char **attributes,
NULL};
return ENOMEM;
goto done;
return ret;
return ret;
attrs);
return ret;
goto done;
done:
return ret;
const char *triple,
char **hostname,
char **username,
char **domainname)
const char *p = triple;
if (!tmp_ctx) {
return ENOMEM;
while (*p && isspace(*p)) p++;
goto done;
p_host = p;
goto done;
if (len > 0) {
if (!host) {
goto done;
p_user = p;
goto done;
if (len > 0) {
if (!user) {
goto done;
p_domain = p;
goto done;
if (len > 0) {
if (!domain) {
goto done;
while (*p && isspace(*p)) p++;
goto done;
if (host) {
if (user) {
if (domain) {
done:
return ret;
size_t c = 0;
return ENOENT;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (size != 0) {
if (!triple_str) {
goto done;
struct sysdb_netgroup_ctx);
if (!tmp_entry[c]) {
goto done;
struct sysdb_netgroup_ctx);
if (!tmp_entry[c]) {
goto done;
goto done;
*netgroup_count = c;
done:
return ret;
const char *netgroup,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
if (!netgroup_dn) {
goto done;
done:
return ret;
const char *netgrname,
const char **attributes,
if (!tmp_ctx) {
return ENOMEM;
if (!base_dn) {
goto done;
goto done;
if (ret) {
goto done;
done:
return ret;
const char *name,
char ***_direct_parents)
goto done;
if (!dn) {
goto done;
goto done;
if (!member_filter) {
goto done;
if (!basedn) {
goto done;
direct_sysdb_count = 0;
goto done;
if (!direct_parents) {
goto done;
pi = 0;
for(i = 0; i < direct_sysdb_count; i++) {
if (!tmp_str) {
goto done;
pi++;
done:
return ret;
const char *name_or_upn_or_sid,
const char **_cname)
if (!tmp_ctx) {
return ENOMEM;
goto done;
&res);
goto done;
goto done;
goto done;
if (!cname) {
goto done;
done:
return ret;
const char *cert,
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
NULL);
goto done;
goto done;
done:
return ret;
return sysdb_res;
struct ldb_message *,
total);
return NULL;
if (ret == 0) {
count++;
struct ldb_message *,
count);
return NULL;
return sysdb_res;
size_t i;
return NULL;
struct ldb_message_element,
return NULL;
ti++;
return ts_attrs;