sdap_range.c revision ae8d047122c7ba8123f72b2eac68944868ac37d4
/*
SSSD
Authors:
Stephen Gallagher <sgallagh@redhat.com>
Copyright (C) 2012 Red Hat
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 "providers/ldap/sdap_range.h"
#include "util/strtonum.h"
#define SDAP_RANGE_STRING "range="
const char *attr_desc,
char **base_attr,
{
char *endptr;
char *end_range;
char *base;
*range_offset = 0;
/* The base_attr is the portion before the semicolon (if it exists) */
/* Not a ranged attribute. Just copy the attribute desc */
if (!*base_attr) {
} else {
}
("No sub-attributes for [%s]\n", attr_desc));
goto done;
}
/* This is a complex attribute. First get the base attribute name */
if (!base) {
goto done;
}
("Base attribute of [%s] is [%s]\n",
/* Next, determine if this is a ranged attribute */
/* This is some other sub-attribute. We'll just return the whole
* thing in case it's dealt with elsewhere.
*/
if (!*base_attr) {
} else {
}
("[%s] contains sub-attribute other than a range, returning whole\n",
attr_desc));
goto done;
}
/* Get the end of the range */
if (!end_range) {
("Cannot find hyphen in [%s]\n",
goto done;
}
end_range++; /* advance past the hyphen */
if (*end_range == '*') {
/* this was the last iteration of range retrievals */
*range_offset = 0;
("[%s] contained the last set of values for this attribute\n",
attr_desc));
return EOK;
}
if (*endptr != '\0') {
*range_offset = 0;
("[%s] did not parse as an unsigned integer: [%s]\n",
goto done;
}
(*range_offset)++;
("Parsed range values: [%s][%d]\n",
base, *range_offset));
done:
return ret;
}