68#define RES_CONFIG_LDAP_CONF "res_ldap.conf"
69#define RES_CONFIG_LDAP_DEFAULT_BASEDN "asterisk"
156 if (!strcasecmp(
name,
var->name))
173 for (; *somestr; somestr++) {
205 const char *attribute_name,
const char *attribute_value)
235 if (
c->additional_filter) {
253 const char *attribute_name)
265 attribute =
configs[i]->attributes;
266 for (; attribute; attribute = attribute->
next) {
267 if (!strcasecmp(attribute_name, attribute->
name)) {
268 return attribute->
value;
273 return attribute_name;
281 const char *attribute_name)
293 attribute =
configs[i]->attributes;
294 for (; attribute; attribute = attribute->
next) {
295 if (strcasecmp(attribute_name, attribute->
value) == 0) {
296 return attribute->
name;
301 return attribute_name;
309 LDAPMessage *ldap_entry)
311 BerElement *ber =
NULL;
315 int is_delimited = 0;
318 char *ldap_attribute_name;
319 struct berval *
value;
322 ldap_attribute_name = ldap_first_attribute(
ldapConn, ldap_entry, &ber);
324 while (ldap_attribute_name) {
325 struct berval **values =
NULL;
327 int is_realmed_password_attribute = strcasecmp(attribute_name,
"md5secret") == 0;
329 values = ldap_get_values_len(
ldapConn, ldap_entry, ldap_attribute_name);
334 for (v = values; *v; v++) {
336 valptr =
value->bv_val;
337 ast_debug(2,
"attribute_name: %s LDAP value: %s\n", attribute_name, valptr);
338 if (is_realmed_password_attribute) {
339 if (!strncasecmp(valptr,
"{md5}", 5)) {
351 if (valptr[i] ==
';') {
378 ldap_value_free_len(values);
380 ldap_memfree(ldap_attribute_name);
381 ldap_attribute_name = ldap_next_attribute(
ldapConn, ldap_entry, ber);
395 LDAPMessage *ldap_result_msg,
unsigned int *entries_count_ptr)
401 LDAPMessage *ldap_entry =
NULL;
402 BerElement *ber =
NULL;
405 int is_delimited = 0;
406 char *delim_value =
NULL;
407 int delim_tot_count = 0;
412 ldap_entry = ldap_first_entry(
ldapConn, ldap_result_msg);
414 for (tot_count = 0; ldap_entry; tot_count++) {
417 ldap_entry = ldap_next_entry(
ldapConn, ldap_entry);
421 if (entries_count_ptr) {
422 *entries_count_ptr = tot_count;
433 ldap_entry = ldap_first_entry(
ldapConn, ldap_result_msg);
439 for (entry_index = 0; ldap_entry; ) {
448 char *ldap_attribute_name = ldap_first_attribute(
ldapConn, ldap_entry, &ber);
449 struct berval *
value;
450 while (ldap_attribute_name) {
452 int is_realmed_password_attribute = strcasecmp(attribute_name,
"md5secret") == 0;
453 struct berval **values =
NULL;
455 values = ldap_get_values_len(
ldapConn, ldap_entry, ldap_attribute_name);
460 for (v = values; *v; v++) {
462 valptr =
value->bv_val;
463 if (is_realmed_password_attribute) {
464 if (strncasecmp(valptr,
"{md5}", 5) == 0) {
470 if (delim_value ==
NULL && !is_realmed_password_attribute
471 && (
static_table_config != table_config || strcmp(attribute_name,
"variable_value") == 0)) {
476 ast_debug(4,
"is delimited %d times: %s\n", delim_tot_count, delim_value);
481 if (is_delimited != 0 && !is_realmed_password_attribute
482 && (
static_table_config != table_config || strcmp(attribute_name,
"variable_value") == 0) ) {
486 ast_debug(4,
"DELIM pos: %d i: %d\n", pos, i);
487 if (delim_value[i] ==
';') {
488 delim_value[i] =
'\0';
490 ast_debug(2,
"DELIM - attribute_name: %s value: %s pos: %d\n", attribute_name, &delim_value[pos], pos);
508 ast_debug(4,
"DELIM pos: %d i: %d delim_count: %d\n", pos, i, delim_count);
510 ast_debug(4,
"DELIM - attribute_name: %s value: %s pos: %d\n", attribute_name, &delim_value[pos], pos);
526 ast_debug(4,
"DELIM pos: %d i: %d\n", pos, i);
533 ast_debug(2,
"attribute_name: %s value: %s\n", attribute_name, valptr);
546 ldap_value_free_len(values);
548 ldap_memfree(ldap_attribute_name);
549 ldap_attribute_name = ldap_next_attribute(
ldapConn, ldap_entry, ber);
556 if (tmpdebug && tmpdebug2) {
560 vars[entry_index++] =
var;
568 ast_debug(3,
"Added to vars - non static\n");
570 vars[entry_index++] =
var;
573 ldap_entry = ldap_next_entry(
ldapConn, ldap_entry);
584 return (err == LDAP_SERVER_DOWN || err == LDAP_TIMEOUT || err == LDAP_CONNECT_ERROR);
604 LDAPMessage *ldap_result_msg =
NULL;
607 ast_debug(2,
"ldap_loadentry dn=%s\n", dn);
611 "(objectclass=*)",
NULL, 0,
NULL,
NULL,
NULL, LDAP_NO_LIMIT, &ldap_result_msg);
616 usleep(500000L * tries);
628 if (
result != LDAP_SUCCESS) {
635 unsigned int *entries_count_ptr =
NULL;
637 if ((num_entry = ldap_count_entries(
ldapConn, ldap_result_msg)) > 0) {
638 ast_debug(3,
"num_entry: %d\n", num_entry);
645 ast_debug(2,
"Could not find any entry dn=%s.\n", dn);
648 ldap_msgfree(ldap_result_msg);
672#define MAXRESULT 2048
673 char *ret_string =
NULL;
679 ast_debug(2,
"substituted: string: '%s' => '%s' \n",
string, ret_string);
687 char *cbasedn =
NULL;
691 if (*cbasedn ==
'"') {
694 int len = strlen(cbasedn);
695 if (cbasedn[
len - 1] ==
'"')
696 cbasedn[
len - 1] =
'\0';
707 ast_debug(2,
"basedn: '%s' => '%s' \n", basedn, cbasedn);
716 int search_len = strlen(search);
717 int by_len = strlen(by);
719 char *p = strstr(
string, search);
724 if (by_len == search_len) {
725 memcpy(p, by, by_len);
727 memmove(p + by_len, p + search_len, strlen(p + search_len) + 1);
728 memcpy(p, by, by_len);
730 p = strstr(p + by_len, search);
776 char *new_name =
NULL;
777 char *new_value =
NULL;
778 const char *like_pos = strstr(
name,
" LIKE");
784 if (!escaped_value) {
792 new_name[
len] =
'\0';
845 for (field = fields; field; field = field->
next) {
862 const char *basedn,
const char *table_name,
const struct ast_variable *fields)
871 LDAPMessage *ldap_result_msg =
NULL;
881 " and 1 value to search on.\n");
916 ast_debug(1,
"Failed to query directory. Try %d/10\n", tries + 1);
930 if (
result != LDAP_SUCCESS) {
936 if (ldap_count_entries(
ldapConn, ldap_result_msg) > 0) {
943 ldap_msgfree(ldap_result_msg);
953 if (strcasecmp(tmp->
name,
"accountBaseDN") == 0) {
960 int base_var_found = 0;
964 if (strcasecmp(test_var->
name, base_var->
name) == 0) {
968 test_var = test_var->
next;
971 if (base_var_found) {
982 base_var->
next = append_var;
986 append_var = base_var;
991 if (!tmp->
next && append_var) {
992 tmp->
next = append_var;
1014 const char *newparam, *newval;
1016 while ((newparam = va_arg(ap,
const char *))) {
1019 newval = va_arg(ap,
const char *);
1025 field->
next = fields;
1035 const char *basedn,
const char *table_name, ...)
1041 va_start(ap, table_name);
1055 const char *table_name,
const struct ast_variable *fields)
1067 while (last_var->
next) {
1068 last_var = last_var->
next;
1070 last_var->
next = *p;
1090 const char *table_name,
const struct ast_variable *fields)
1093 char *initfield =
NULL;
1099 ast_log(
LOG_WARNING,
"realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
1103 if ((op = strchr(initfield,
' '))) {
1122 if (initfield && !strcmp(initfield,
var->name)) {
1155 }
else if (as->
metric >
bs->metric) {
1157 }
else if (as->
metric ==
bs->metric && strcmp(as->
name,
bs->name) != 0) {
1158 return strcmp(as->
name,
bs->name);
1178 const char *file,
struct ast_config *cfg,
struct ast_flags config_flags,
const char *sugg_incl,
const char *who_asked)
1180 unsigned int vars_count = 0;
1185 const char *last_category =
NULL;
1186 int last_category_metric = 0;
1210 for (vars_count = 0, p = vars; *p; p++) {
1221 }
else if (!cat_metric) {
1222 ast_log(
LOG_ERROR,
"No category metric in entry '%s'(category: %s) for file '%s'.\n",
1224 }
else if (!var_metric) {
1225 ast_log(
LOG_ERROR,
"No variable metric in entry '%s'(category: %s) for file '%s'.\n",
1227 }
else if (!var_name) {
1228 ast_log(
LOG_ERROR,
"No variable name in entry '%s' (category: %s metric: %s) for file '%s'.\n",
1231 }
else if (!var_val) {
1232 ast_log(
LOG_ERROR,
"No variable value in entry '%s' (category: %s metric: %s variable: %s) for file '%s'.\n",
1253 for (i = 0; i < vars_count; i++) {
1254 if (!strcmp(
categories[i].variable_name,
"#include")) {
1262 if (!last_category || strcmp(last_category,
categories[i].
name) ||
1263 last_category_metric !=
categories[i].metric) {
1301 mod = ldap_memcalloc(1,
sizeof(LDAPMod));
1302 type = ldap_strdup(attribute);
1304 if (!(mod &&
type)) {
1305 ast_log(
LOG_ERROR,
"Memory allocation failure creating LDAP modification\n");
1311 mod->mod_type =
type;
1313 if (strlen(new_value)) {
1314 char **values, *
value;
1315 values = ldap_memcalloc(2,
sizeof(
char *));
1316 value = ldap_strdup(new_value);
1318 if (!(values &&
value)) {
1319 ast_log(
LOG_ERROR,
"Memory allocation failure creating LDAP modification\n");
1320 ldap_memfree(
value);
1321 ldap_memfree(values);
1327 mod->mod_op = LDAP_MOD_REPLACE;
1328 mod->mod_values = values;
1329 mod->mod_values[0] =
value;
1331 mod->mod_op = LDAP_MOD_DELETE;
1350 if (src->mod_op != LDAP_MOD_REPLACE) {
1354 new_buffer = ldap_memrealloc(
1356 strlen(src->mod_values[0]) + strlen(new_value) +
sizeof(
";"));
1359 ast_log(
LOG_ERROR,
"Memory allocation failure creating LDAP modification\n");
1363 strcat(new_buffer,
";");
1364 strcat(new_buffer, new_value);
1366 src->mod_values[0] = new_buffer;
1384 mod = ldap_memcalloc(1,
sizeof(LDAPMod));
1385 type = ldap_strdup(src->mod_type);
1387 if (!(mod &&
type)) {
1388 ast_log(
LOG_ERROR,
"Memory allocation failure creating LDAP modification\n");
1394 if (src->mod_op == LDAP_MOD_REPLACE) {
1397 values = ldap_memcalloc(2,
sizeof(
char *));
1398 value = ldap_strdup(src->mod_values[0]);
1400 if (!(values &&
value)) {
1401 ast_log(
LOG_ERROR,
"Memory allocation failure creating LDAP modification\n");
1402 ldap_memfree(
value);
1403 ldap_memfree(values);
1412 mod->mod_op = src->mod_op;
1413 mod->mod_type =
type;
1414 mod->mod_values = values;
1430 for (i = 0; modifications[i]; i++) {
1431 if (modifications[i]->mod_op == LDAP_MOD_REPLACE &&
1432 !strcasecmp(modifications[i]->mod_type, lookup)) {
1433 return modifications[i];
1450 BerElement *ber =
NULL;
1453 attribute = ldap_first_attribute(
ldapConn, entry, &ber);
1455 if (!strcasecmp(attribute, lookup)) {
1456 ldap_memfree(attribute);
1460 ldap_memfree(attribute);
1461 attribute = ldap_next_attribute(
ldapConn, entry, ber);
1485 size_t k, i, remove_count;
1488 for (i = remove_count = 0; mods[i]; i++) {
1489 if (mods[i]->mod_op == LDAP_MOD_DELETE
1495 if (!remove_count) {
1499 copies = ldap_memcalloc(i - remove_count + 1,
sizeof(LDAPMod *));
1501 ast_log(
LOG_ERROR,
"Memory allocation failure massaging LDAP modification\n");
1505 for (i = k = 0; mods[i]; i++) {
1506 if (mods[i]->mod_op != LDAP_MOD_DELETE
1510 ast_log(
LOG_ERROR,
"Memory allocation failure massaging LDAP modification\n");
1511 ldap_mods_free(copies, 1);
1516 ast_debug(3,
"Skipping %s deletion because it doesn't exist\n",
1546 char *clean_basedn =
NULL;
1548 int search_result = 0;
1551 size_t update_count, update_index, entry_count;
1553 LDAPMessage *ldap_entry =
NULL;
1554 LDAPMod **modifications;
1555 LDAPMessage *ldap_result_msg =
NULL;
1563 if (!update_count) {
1577 if (!table_config) {
1598 search_result = ldap_search_ext_s(
1610 usleep(500000L * tries);
1622 if (search_result != LDAP_SUCCESS) {
1623 ast_log(
LOG_WARNING,
"Failed to query directory. Error: %s.\n", ldap_err2string(search_result));
1628 entry_count = ldap_count_entries(
ldapConn, ldap_result_msg);
1636 modifications = ldap_memcalloc(update_count + 1,
sizeof(LDAPMod *));
1637 if (!modifications) {
1647 for (field = update_fields, update_index = 0; field; field = field->
next) {
1666 modifications[update_index++] = mod;
1671 ast_debug(3,
"Modifying %zu matched entries\n", entry_count);
1674 for (i = 0; modifications[i]; i++) {
1675 if (modifications[i]->mod_op != LDAP_MOD_DELETE) {
1677 modifications[i]->mod_values[0]);
1684 for (ldap_entry = ldap_first_entry(
ldapConn, ldap_result_msg);
1686 ldap_entry = ldap_next_entry(
ldapConn, ldap_entry)) {
1688 LDAPMod **massaged, **working;
1690 char *dn = ldap_get_dn(
ldapConn, ldap_entry);
1696 working = modifications;
1702 ast_debug(3,
"Nothing left to modify - skipping\n");
1703 ldap_mods_free(massaged, 1);
1715 ldap_mods_free(massaged, 1);
1724 ldap_mods_free(modifications, 1);
1727 ldap_msgfree(ldap_result_msg);
1735static int update_ldap(
const char *basedn,
const char *table_name,
const char *attribute,
const char *lookup,
const struct ast_variable *fields)
1739 res =
update2_ldap(basedn, table_name, lookup_fields, fields);
1776 ast_log(
LOG_WARNING,
"Couldn't establish connection to LDAP directory. Check debug.\n");
1780 ast_verb(1,
"LDAP RealTime driver loaded.\n");
1804 ast_verb(1,
"LDAP RealTime driver unloaded.\n");
1831 ast_log(
LOG_WARNING,
"Couldn't establish connection to your directory server. Check debug.\n");
1834 ast_verb(2,
"LDAP RealTime driver reloaded.\n");
1845 static const char *
const config[] = {
1846 "basedn",
"host",
"pass",
"port",
"protocol",
"url",
"user",
"version",
NULL
1849 for (i = 0;
config[i]; i++) {
1850 if (!strcasecmp(key,
config[i])) {
1863 const char *s, *host;
1865 char *category_name =
NULL;
1881 ast_log(
LOG_NOTICE,
"No directory user found, anonymous binding as default.\n");
1905 snprintf(
url,
sizeof(
url),
"ldap://%s:%d", host, port);
1920 }
else if (sscanf(s,
"%30d", &
version) != 1 || version < 1 || version > 6) {
1928 int is_general = (strcasecmp(category_name,
"_general") == 0);
1929 int is_config = (strcasecmp(category_name,
"config") == 0);
1935 if (!table_config) {
1944 if (!strcasecmp(
var->name,
"additionalFilter")) {
1963 int bind_result = 0;
1967 ast_debug(2,
"Everything seems fine.\n");
1972 ast_log(
LOG_ERROR,
"Not enough parameters to connect to ldap directory\n");
1976 if (LDAP_SUCCESS != ldap_initialize(&
ldapConn,
url)) {
1977 ast_log(
LOG_ERROR,
"Failed to init ldap connection to '%s'. Check debug for more info.\n",
url);
1981 if (LDAP_OPT_SUCCESS != ldap_set_option(
ldapConn, LDAP_OPT_PROTOCOL_VERSION, &
version)) {
1987 cred.bv_val = (
char *)
pass;
1988 cred.bv_len = strlen(
pass);
1996 if (bind_result == LDAP_SUCCESS) {
1997 ast_debug(2,
"Successfully connected to directory.\n");
2018 e->
command =
"realtime show ldap status";
2020 "Usage: realtime show ldap status\n"
2021 " Shows connection information for the LDAP RealTime driver\n";
2055 .
requires =
"extconfig",
void ast_cli_unregister_multiple(void)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
static const char config[]
General Asterisk PBX channel definitions.
Standard Command Line Interface.
void ast_cli_print_timestr_fromseconds(int fd, int seconds, const char *prefix)
Print on cli a duration in seconds in format s year(s), s week(s), s day(s), s hour(s),...
#define AST_CLI_DEFINE(fn, txt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
void ast_category_rename(struct ast_category *cat, const char *name)
#define CONFIG_STATUS_FILEMISSING
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
void ast_category_append(struct ast_config *config, struct ast_category *category)
Appends a category to a config.
void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
#define ast_category_new_anonymous()
Create a nameless category that is not backed by a file.
#define ast_variable_new(name, value, filename)
int ast_config_engine_deregister(struct ast_config_engine *del)
Deregister config engine.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
struct ast_config * ast_config_internal_load(const char *configfile, struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl_file, const char *who_asked)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
#define ast_category_new_dynamic(name)
Create a category that is not backed by a file.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
int ast_config_engine_register(struct ast_config_engine *newconfig)
Register config engine.
Support for logging to various files, console and syslog Configuration in file logger....
#define DEBUG_ATLEAST(level)
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
A set of macros to manage forward-linked lists.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Asterisk locking-related definitions:
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define realtime_arguments_to_fields(ap, result)
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_REALTIME_DRIVER
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
Options provided by main asterisk program.
Core PBX routines and definitions.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static int config_can_be_inherited(const char *key)
static LDAPMod * ldap_mod_find(LDAPMod **modifications, const char *lookup)
static struct ast_variable * realtime_ldap_entry_to_var(struct ldap_table_config *table_config, LDAPMessage *ldap_entry)
Get variables from ldap entry attributes.
static void append_var_and_value_to_filter(struct ast_str **filter, struct ldap_table_config *table_config, const char *name, const char *value)
Append a name=value filter string. The filter string can grow.
static LDAPMod ** massage_mods_for_entry(LDAPMessage *entry, LDAPMod **mods)
static struct ast_config * realtime_multi_ldap(const char *basedn, const char *table_name, const struct ast_variable *fields)
See Asterisk doc.
static int replace_string_in_string(char *string, const char *search, const char *by)
Replace <search> by <by> in string.
static struct ldap_table_config * base_table_config
static struct ldap_table_config * static_table_config
static struct ast_variable ** realtime_ldap_base_ap(unsigned int *entries_count_ptr, const char *basedn, const char *table_name, const struct ast_variable *fields)
LDAP base function.
static ast_mutex_t ldap_lock
static struct ast_cli_entry ldap_cli[]
static void ldap_filter_escape_value(const char *value, struct ast_str **escaped)
static int compare_categories(const void *a, const void *b)
Sorting alogrithm for qsort to find the order of the variables a and b.
static const char * convert_attribute_name_from_ldap(struct ldap_table_config *table_config, const char *attribute_name)
Convert ldap attribute name to variable name.
static size_t variables_count(const struct ast_variable *vars)
static struct ast_config_engine ldap_engine
static int semicolon_count_var(struct ast_variable *var)
Count semicolons in variables.
static int ldap_reconnect(void)
static int is_ldap_connect_error(int err)
Check if we have a connection error.
static void table_configs_free(void)
Free table_config.
static struct ldap_table_config * table_config_new(const char *table_name)
Create a new table_config.
static int ldap_entry_has_attribute(LDAPMessage *entry, const char *lookup)
static LDAPMod * ldap_mod_duplicate(const LDAPMod *src)
static struct ast_variable * realtime_ldap(const char *basedn, const char *table_name, const struct ast_variable *fields)
See Asterisk doc.
static struct ast_variable ** realtime_ldap_result_to_vars(struct ldap_table_config *table_config, LDAPMessage *ldap_result_msg, unsigned int *entries_count_ptr)
Get variables from ldap entry attributes - Should be locked before using it.
static struct ast_variable ** realtime_ldap_base(unsigned int *entries_count_ptr, const char *basedn, const char *table_name,...)
same as realtime_ldap_base_ap but take variable arguments count list
static LDAPMod * ldap_mod_append(LDAPMod *src, const char *new_value)
static struct ldap_table_config * table_config_for_table_name(const char *table_name)
Find a table_config.
static const char * convert_attribute_name_to_ldap(struct ldap_table_config *table_config, const char *attribute_name)
Convert variable name to ldap attribute name.
static int load_module(void)
Load the module.
static time_t connect_time
#define RES_CONFIG_LDAP_DEFAULT_BASEDN
static int semicolon_count_str(const char *somestr)
Count semicolons in string.
static struct ast_config * config_ldap(const char *basedn, const char *table_name, const char *file, struct ast_config *cfg, struct ast_flags config_flags, const char *sugg_incl, const char *who_asked)
See Asterisk Realtime Documentation.
static char base_distinguished_name[512]
static void ldap_table_config_add_attribute(struct ldap_table_config *table_config, const char *attribute_name, const char *attribute_value)
add attribute to table config
static int unload_module(void)
Unload Module.
static int reload(void)
Reload Module.
static char * cleaned_basedn(struct ast_channel *channel, const char *basedn)
static char * realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Realtime Status.
static int parse_config(void)
parse the configuration file
static char * substituted(struct ast_channel *channel, const char *string)
static int update_ldap(const char *basedn, const char *table_name, const char *attribute, const char *lookup, const struct ast_variable *fields)
static struct ast_str * create_lookup_filter(struct ldap_table_config *config, const struct ast_variable *fields)
static struct ast_variable * ldap_loadentry(struct ldap_table_config *table_config, const char *dn)
Get LDAP entry by dn and return attributes as variables.
static struct ast_variable * variable_named(struct ast_variable *var, const char *name)
Find variable by name.
static LDAPMod * ldap_mod_create(const char *attribute, const char *new_value)
static int update2_ldap(const char *basedn, const char *table_name, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
#define RES_CONFIG_LDAP_CONF
String manipulation functions.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
descriptor for a cli entry.
Configuration engine structure, used to define realtime drivers.
Structure used to handle boolean flags.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
const char * variable_value
const char * variable_name
struct ast_variable * attributes
struct ast_variable * delimiters
struct ldap_table_config::@460 entry
Should be locked before using it.
structure to hold users read from phoneprov_users.conf
struct association categories[]
int error(const char *format,...)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.