sysdb_ranges.c revision a3c8390d19593b1e5277d95bfb4ab206d4785150
/*
SSSD
System Database - ID ranges related calls
Copyright (C) 2012 Sumit Bose <sbose@redhat.com>
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 "db/sysdb_private.h"
{
if (val == UINT64_MAX) {
return ENOENT;
} else if (val >= UINT32_MAX) {
return EINVAL;
}
return EOK;
}
struct range_info ***range_list)
{
size_t c;
struct ldb_result *res;
const char *attrs[] = {SYSDB_NAME,
NULL};
struct range_info **list;
const char *tmp_str;
goto done;
}
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
NULL);
goto done;
}
}
goto done;
}
&list[c]->id_range_size);
goto done;
}
goto done;
}
&list[c]->secondary_base_rid);
goto done;
}
NULL);
goto done;
}
}
}
done:
return ret;
}
{
struct ldb_message *msg;
int ret;
/* if both or none are set, skip */
"either the secondary base RID or the SID of the trusted "
"domain is set, but not both or none of them.\n");
return EOK;
}
if (!tmp_ctx) {
return ENOMEM;
}
if (!msg) {
goto done;
}
goto done;
}
(unsigned long) range->secondary_base_rid);
range->secondary_base_rid == 0) {
}
(unsigned long) range->id_range_size);
range->range_type);
done:
if (ret) {
}
return ret;
}
struct range_info **ranges)
{
int ret;
int sret;
size_t c;
size_t d;
struct range_info **cur_ranges;
bool in_transaction = false;
bool *keep_range;
goto done;
}
/* Retrieve all ranges that are currently in sysdb */
&cur_ranges);
goto done;
}
if (keep_range == NULL) {
goto done;
}
goto done;
}
in_transaction = true;
/* Go through a list of retrieved ranges and:
* - if a range already exists in sysdb, mark it for preservation
* - if the range doesn't exist in sysdb, create it
*/
for (d = 0; d < cur_range_count; d++) {
keep_range[d] = true;
/* range already in cache, nothing to do */
break;
}
}
if (d == cur_range_count) {
goto done;
}
}
}
/* Now delete all ranges that have been in sysdb prior to
* refreshing the list and are not marked for preservation
* (i.e. they are not in the new list of ranges)
*/
for (d = 0; d < cur_range_count; d++) {
if (!keep_range[d]) {
cur_ranges[d]->name);
goto done;
}
goto done;
}
}
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
return ret;
}