JIRA FS-7412.

Added new LDAP schema (fsaccount.schema) with relevant attributes to match FS directory params and variables.
Changed mod_xml_ldap code to reflect new schema.
Updated xml_ldap.conf.xml as well to reflect mapping of new attributes.
This commit is contained in:
Ognjen Seslija 2015-04-05 16:21:38 +02:00
parent 6eb59c7119
commit f5e0a879b2
3 changed files with 435 additions and 30 deletions

View File

@ -0,0 +1,54 @@
<configuration name="xml_ldap.conf" description=" XML LDAP Gateway">
<bindings>
<binding name="directory">
<!--%s is populated with the extension -->
<!--filter example with custom objectClass -->
<param name="filter" value="(&amp;(objectClass=FSAccount)(fsuid=%s))" bindings="directory"/>
<!--basedn for the searches %s is replaced with domain-->
<param name="basedn" value="ou=%s,ou=customers,o=example" />
<param name="url" value="ldap://1.2.3.4" />
<param name="binddn" value="cn=admin,o=example" />
<param name="bindpass" value="secret" />
<trans>
<!-- mapping of ldap attrs into FS attrs - fsaccount.schema -->
<tran name="id" mapfrom="fsUid" />
<tran name="cidr" mapfrom="fsCIDR" />
<tran name="number-alias" mapfrom="fsNumberAlias" />
<tran name="dial-string" mapfrom="fsDialString" />
<tran name="password" mapfrom="fsPassword" />
<tran name="a1-hash" mapfrom="fsA1Hash" />
<tran name="reverse-auth-user" mapfrom="fsReverseAuthUser" />
<tran name="reverse-auth-pass" mapfrom="fsReverseAuthPass" />
<tran name="vm-enabled" mapfrom="fsVmEnabled" />
<tran name="vm-password" mapfrom="fsVmPassword" />
<tran name="vm-mailto" mapfrom="fsVmMailTo" />
<tran name="vm-notify-mailto" mapfrom="fsVmNotifyMailTo" />
<tran name="vm-attach-file" mapfrom="fsVmAttachFile" />
<tran name="vm-message-ext" mapfrom="fsVmMessageExt" />
<tran name="vm-email-all-messages" mapfrom="fsVmEmailAllMessages" />
<tran name="vm-keep-local-after-email" mapfrom="fsVmKeepLocalAfterEmail" />
<tran name="vm-notify-email-all-messages" mapfrom="fsVmNotifyEmailAllMessages" />
<tran name="vm-skip-instructions" mapfrom="fsVmSkipInstructions" />
<tran name="vm-cc" mapfrom="fsVmCc" />
<tran name="vm-disk-quota" mapfrom="fsVmDiskQuota" />
<tran name="accountcode" mapfrom="fsAccountCode" />
<tran name="user_context" mapfrom="fsUserContext" />
<tran name="vm_mailbox" mapfrom="fsVmMailbox" />
<tran name="callgroup" mapfrom="fsCallGroup" />
<tran name="toll_allow" mapfrom="fsTollAllow" />
<tran name="effective_caller_id_number" mapfrom="fsEffectiveCallerIDNumber" />
<tran name="effective_caller_id_name" mapfrom="fsEffectiveCallerIDName" />
<tran name="outbound_caller_id_number" mapfrom="fsOutboundCallerIDNumber" />
<tran name="outbound_caller_id_name" mapfrom="fsOutboundCallerIDName" />
</trans>
</binding>
<!-- <binding name="configuration">
<param name="filter" value="(%s=%s)" bindings="configuration"/>
<param name="basedn" value=",ou=config,o=example" />
<param name="url" value="ldap://ldapuri" />
<param name="binddn" value="cn=admin,o=example" />
<param name="bindpass" value="secret" />
</binding>
-->
</bindings>
</configuration>

View File

@ -0,0 +1,225 @@
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.1 NAME 'fsUid'
DESC 'FreeSWITCH directory user id'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.2 NAME 'fsCIDR'
DESC 'FreeSWITCH directory user id cidr'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.3 NAME 'fsNumberAlias'
DESC 'FreeSWITCH directory user id number-alias'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.4 NAME 'fsDialString'
DESC 'FreeSWITCH directory dial-string param'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.5 NAME 'fsPassword'
DESC 'FreeSWITCH directory password param'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.6 NAME 'fsReverseAuthUser'
DESC 'FreeSWITCH directory reverse-auth-user param'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.7 NAME 'fsReverseAuthPass'
DESC 'FreeSWITCH directory reverse-auth-pass param'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.8 NAME 'fsA1Hash'
DESC 'FreeSWITCH directory a1-hash param'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.9 NAME 'fsVmPassword'
DESC 'FreeSWITCH directory vm-password param'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.10 NAME 'fsVmEnabled'
DESC 'FreeSWITCH directory vm-enabled param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.11 NAME 'fsVmMailFrom'
DESC 'FreeSWITCH directory vm-mailfrom param'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.12 NAME 'fsVmMailTo'
DESC 'FreeSWITCH directory vm-mailto param'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.13 NAME 'fsVmNotifyMailTo'
DESC 'FreeSWITCH directory vm-notify-mailto param'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.14 NAME 'fsVmAttachFile'
DESC 'FreeSWITCH directory vm-attach-file param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.15 NAME 'fsVmMessageExt'
DESC 'FreeSWITCH directory vm-message-ext param'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.16 NAME 'fsVmEmailAllMessages'
DESC 'FreeSWITCH directory vm-email-all-messages param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.17 NAME 'fsVmKeepLocalAfterEmail'
DESC 'FreeSWITCH directory vm-keep-local-after-email param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.18 NAME 'fsVmNotifyEmailAllMessages'
DESC 'FreeSWITCH directory vm-notify-email-all-messages param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.19 NAME 'fsVmSkipInstructions'
DESC 'FreeSWITCH directory vm-skip-instructions param'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.20 NAME 'fsVmCc'
DESC 'FreeSWITCH directory vm-cc param'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.21 NAME 'fsVmDiskQuota'
DESC 'FreeSWITCH directory vm-disk-quota param'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.22 NAME 'fsAccountCode'
DESC 'FreeSWITCH directory accountcode variable'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.23 NAME 'fsUserContext'
DESC 'FreeSWITCH directory user_context variable'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.24 NAME 'fsVmMailbox'
DESC 'FreeSWITCH directory vm_mailbox variable'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.25 NAME 'fsCallGroup'
DESC 'FreeSWITCH directory callgroup variable'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.26 NAME ('fsTollAllow' 'fsRuleSet')
DESC 'FreeSWITCH directory toll_allow variable'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.27 NAME 'fsEffectiveCallerIDNumber'
DESC 'FreeSWITCH directory effective_caller_id_number variable'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.28 NAME 'fsEffectiveCallerIDName'
DESC 'FreeSWITCH directory effective_caller_id_name variable'
EQUALITY caseExactMatch
SUBSTR caseExactSubstringsMatch
ORDERING caseExactOrderingMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.29 NAME 'fsOutboundCallerIDNumber'
DESC 'FreeSWITCH directory outbound_caller_id_number variable'
EQUALITY numericStringMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.30 NAME 'fsOutboundCallerIDName'
DESC 'FreeSWITCH directory outbound_caller_id_name variable'
EQUALITY caseExactMatch
SUBSTR caseExactSubstringsMatch
ORDERING caseExactOrderingMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.27880.1003.1.1.31 NAME 'fsDomainName'
DESC 'FreeSWITCH directory domain name'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
objectclass (1.3.6.1.4.1.27880.1003.2.1 NAME 'FSAccount'
SUP top AUXILIARY
DESC 'FreeSWITCH Directory Account (v1.1)'
MAY ( fsUid $ fsCIDR $ fsNumberAlias $ fsDialString $ fsPassword $
fsReverseAuthUser $ fsReverseAuthPass $ fsA1Hash $ fsVmMessageExt $
fsVmPassword $ fsVmEnabled $ fsVmMailFrom $ fsVmMailTo $
fsVmNotifyMailTo $ fsVmAttachFile $ fsVmMessageExt $
fsVmEmailAllMessages $ fsVmKeepLocalAfterEmail $ fsVmNotifyEmailAllMessages $
fsVmSkipInstructions $ fsVmCc $ fsVmDiskQuota $ fsAccountCode $
fsUserContext $ fsVmMailbox $ fsCallGroup $ fsTollAllow $
fsEffectiveCallerIDNumber $ fsEffectiveCallerIDName $
fsOutboundCallerIDNumber $ fsOutboundCallerIDName $ fsDomainName ))

View File

@ -65,19 +65,36 @@ typedef struct xml_binding {
typedef enum exten_types { typedef enum exten_types {
LDAP_EXTEN_ID = 0, LDAP_EXTEN_ID = 0,
LDAP_EXTEN_CIDR, LDAP_EXTEN_CIDR,
LDAP_EXTEN_NUMBER_ALIAS,
LDAP_EXTEN_DIAL_STRING,
LDAP_EXTEN_PASSWORD, LDAP_EXTEN_PASSWORD,
LDAP_EXTEN_VM_ENABLED, LDAP_EXTEN_REV_AUTH_USER,
LDAP_EXTEN_REV_AUTH_PASS,
LDAP_EXTEN_A1_HASH,
LDAP_EXTEN_VM_PASSWORD, LDAP_EXTEN_VM_PASSWORD,
LDAP_EXTEN_VM_ENABLED,
LDAP_EXTEN_VM_MAILFROM, LDAP_EXTEN_VM_MAILFROM,
LDAP_EXTEN_VM_MAILTO, LDAP_EXTEN_VM_MAILTO,
LDAP_EXTEN_VM_EMAILMSG, LDAP_EXTEN_VM_NOTIFY_MAILTO,
LDAP_EXTEN_VM_NOTEMAILMSG, LDAP_EXTEN_VM_ATTACH_FILE,
LDAP_EXTEN_VM_ATTACHFILE, LDAP_EXTEN_VM_MESSAGE_EXT,
LDAP_EXTEN_USER_CONTEXT, LDAP_EXTEN_VM_EMAIL_ALL_MSGS,
LDAP_EXTEN_EFF_CLIDNAME, LDAP_EXTEN_VM_KEEP_LOCAL_AFTER_MAIL,
LDAP_EXTEN_EFF_CLIDNUM, LDAP_EXTEN_VM_NOTIFY_EMAIL_ALL_MSGS,
LDAP_EXTEN_VM_SKIP_INSTRUCTIONS,
LDAP_EXTEN_VM_CC,
LDAP_EXTEN_VM_DISK_QUOTA,
LDAP_EXTEN_ACCOUNTCODE, LDAP_EXTEN_ACCOUNTCODE,
LDAP_EXTEN_RULESET, LDAP_EXTEN_USER_CONTEXT,
LDAP_EXTEN_VM_MAILBOX,
LDAP_EXTEN_CALLGROUP,
LDAP_EXTEN_TOLL_ALLOW,
LDAP_EXTEN_EFF_CLIDNUM,
LDAP_EXTEN_EFF_CLIDNAME,
LDAP_EXTEN_OUT_CLIDNUM,
LDAP_EXTEN_OUT_CLIDNAME,
LDAP_EXTEN_DOMAIN_NAME
/* not used now
LDAP_EXTEN_AREACODE, LDAP_EXTEN_AREACODE,
LDAP_EXTEN_CID_EXTNAME, LDAP_EXTEN_CID_EXTNAME,
LDAP_EXTEN_CID_EXTNUM, LDAP_EXTEN_CID_EXTNUM,
@ -99,6 +116,7 @@ typedef enum exten_types {
LDAP_EXTEN_HOTLINE_ACTIVE, LDAP_EXTEN_HOTLINE_ACTIVE,
LDAP_EXTEN_HOTLINE_DEST, LDAP_EXTEN_HOTLINE_DEST,
LDAP_EXTEN_CLASSOFSERVICE LDAP_EXTEN_CLASSOFSERVICE
*/
} exten_type_t; } exten_type_t;
struct xml_ldap_attribute { struct xml_ldap_attribute {
@ -236,6 +254,20 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("number-alias", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_NUMBER_ALIAS;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("dial-string", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_DIAL_STRING;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("password", n, strlen(n))) { } else if (!strncasecmp("password", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_PASSWORD; attr_list->type = LDAP_EXTEN_PASSWORD;
attr_list->len = strlen(m); attr_list->len = strlen(m);
@ -243,8 +275,22 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("vm-enabled", n, strlen(n))) { } else if (!strncasecmp("reverse-auth-user", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_ENABLED; attr_list->type = LDAP_EXTEN_REV_AUTH_USER;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("reverse-auth-pass", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_REV_AUTH_PASS;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("a1-hash", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_A1_HASH;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
@ -257,6 +303,13 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("vm-enabled", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_ENABLED;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-mailfrom", n, strlen(n))) { } else if (!strncasecmp("vm-mailfrom", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_MAILFROM; attr_list->type = LDAP_EXTEN_VM_MAILFROM;
attr_list->len = strlen(m); attr_list->len = strlen(m);
@ -271,28 +324,77 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("vm-email-all-messages", n, strlen(n))) { } else if (!strncasecmp("vm-notify-mailto", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_EMAILMSG; attr_list->type = LDAP_EXTEN_VM_NOTIFY_MAILTO;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-notify-email-all-messages", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_NOTEMAILMSG;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("vm-attach-file", n, strlen(n))) { } else if (!strncasecmp("vm-attach-file", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_ATTACHFILE; attr_list->type = LDAP_EXTEN_VM_ATTACH_FILE;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-message-ext", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_MESSAGE_EXT;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-email-all-messages", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_EMAIL_ALL_MSGS;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-keep-local-after-mail", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_KEEP_LOCAL_AFTER_MAIL;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-notify-email-all-messages", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_NOTIFY_EMAIL_ALL_MSGS;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-skip-instructions", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_SKIP_INSTRUCTIONS;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-cc", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_CC;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("vm-disk-quota", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_VM_DISK_QUOTA;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
/* Variables */ /* Variables */
} else if (!strncasecmp("accountcode", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_ACCOUNTCODE;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("user_context", n, strlen(n))) { } else if (!strncasecmp("user_context", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_USER_CONTEXT; attr_list->type = LDAP_EXTEN_USER_CONTEXT;
attr_list->len = strlen(m); attr_list->len = strlen(m);
@ -300,8 +402,22 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("effective_caller_id_name", n, strlen(n))) { } else if (!strncasecmp("vm_mailbox", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_EFF_CLIDNAME; attr_list->type = LDAP_EXTEN_VM_MAILBOX;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("callgroup", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_CALLGROUP;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("toll_allow", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_TOLL_ALLOW;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
@ -314,15 +430,22 @@ static switch_status_t do_config(void)
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("accountcode", n, strlen(n))) { } else if (!strncasecmp("effective_caller_id_name", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_ACCOUNTCODE; attr_list->type = LDAP_EXTEN_EFF_CLIDNAME;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next; attr_list = attr_list->next;
} else if (!strncasecmp("ruleset", n, strlen(n))) { } else if (!strncasecmp("outbound_caller_id_number", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_RULESET; attr_list->type = LDAP_EXTEN_OUT_CLIDNUM;
attr_list->len = strlen(m);
attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list));
attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
attr_list = attr_list->next;
} else if (!strncasecmp("outbound_caller_id_name", n, strlen(n))) {
attr_list->type = LDAP_EXTEN_OUT_CLIDNAME;
attr_list->len = strlen(m); attr_list->len = strlen(m);
attr_list->val = strdup(m); attr_list->val = strdup(m);
attr_list->next = malloc(sizeof(*attr_list)); attr_list->next = malloc(sizeof(*attr_list));
@ -365,10 +488,13 @@ static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP * ld, char *di
LDAPMessage *msg, *entry; LDAPMessage *msg, *entry;
xml_ldap_attribute_t *attr = NULL; xml_ldap_attribute_t *attr = NULL;
static char *fsattr[] = static char *fsattr[] =
{ "id", "cidr", "password", "vm-enabled", "vm-password", "vm-mailfrom", "vm-mailto", { "id", "cidr", "number-alias", "dial-string", "password", "reverse-auth-user",
"vm-email-all-messages", "vm-notify-email-all-messages", "vm-attach-file", "reverse-auth-pass", "a1-hash", "vm-password", "vm-enabled", "vm-mailfrom",
"user_context", "effective_caller_id_name", "effective_caller_id_number", "vm-mailto", "vm-notify-mailto", "vm-attach-file", "vm-message-ext",
"accountcode", "ruleset", NULL }; "vm-email-all-messages", "vm-keep-local-after-mail", "vm-notify-email-all-messages",
"vm-skip-instructions", "vm-cc", "vm-disk-quota", "accountcode", "user_context",
"vm_mailbox", "callgroup", "effective_caller_id_number", "effective_caller_id_name",
"outbound_caller_id_number", "outbound_caller_id_name", "toll_allow", NULL };
basedn = switch_mprintf(binding->basedn, dir_domain); basedn = switch_mprintf(binding->basedn, dir_domain);
filter = switch_mprintf(binding->filter, dir_exten); filter = switch_mprintf(binding->filter, dir_exten);