/*
SSSD
Library for rule based certificate to user mapping - LDAP mapping rules
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2017 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 <errno.h>
#include <stdbool.h>
#include <string.h>
#include <talloc.h>
#include "util/dlinklist.h"
#include "lib/certmap/sss_certmap.h"
#include "lib/certmap/sss_certmap_int.h"
struct template_table {
const char *name;
const char **attr_name;
const char **conversion;
};
struct parsed_template *parsed)
{
size_t n;
size_t a;
size_t c;
bool attr_name_valid = false;
bool conversion_valid = false;
continue;
}
attr_name_valid = true;
break;
}
}
} else {
attr_name_valid = true;
}
parsed->conversion) == 0) {
conversion_valid = true;
break;
}
}
} else {
conversion_valid = true;
}
if (attr_name_valid && conversion_valid) {
return 0;
}
}
return EINVAL;
}
const char *template,
struct parsed_template **parsed_template)
{
int ret;
const char *dot;
const char *excl;
const char *p;
goto done;
}
if (p != NULL) {
goto done;
}
goto done;
}
}
if (p != NULL) {
goto done;
}
goto done;
}
}
goto done;
}
}
} else {
}
goto done;
}
}
} else {
}
goto done;
}
if (ret != 0) {
goto done;
}
ret = 0;
done:
if (ret == 0) {
} else {
}
return ret;
}
{
int ret;
return ENOMEM;
}
return ENOMEM;
}
if (type == comp_template) {
if (ret != 0) {
return ret;
}
}
return 0;
}
{
}
{
}
const char *rule_start,
struct ldap_mapping_rule **mapping_rule)
{
size_t c;
const char *cur;
int ret;
bool in_template = false;
goto done;
}
if (tmp_string == NULL) {
goto done;
}
cur = rule_start;
c = 0;
while (*cur != '\0') {
if (c > tmp_string_size) {
goto done;
}
switch (*cur) {
case '{':
if (in_template) {
goto done;
}
/* Add only a single '{' to the output */
tmp_string[c] = '{';
c++;
cur += 2;
} else {
if (c != 0) {
if (ret != 0) {
goto done;
}
c = 0;
}
cur++;
in_template = true;
}
break;
case '}':
if (in_template) {
goto done;
} else {
/* Add only a single '}' to the output */
tmp_string[c] = '}';
c++;
cur += 2;
}
} else {
if (ret != 0) {
goto done;
}
c = 0;
cur++;
in_template = false;
}
break;
default:
tmp_string[c] = *cur;
c++;
cur++;
}
}
if (in_template) {
goto done;
}
if (c != 0) {
if (ret != 0) {
goto done;
}
}
ret = 0;
done:
if (ret == 0) {
*mapping_rule = rule;
} else {
}
return ret;
}