Date: Tue, 17 Apr 2007 18:34:57 +0200 From: Matthias Fechner <idefix@fechner.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/111774: Update for port net/asterisk-app-ldap Message-ID: <E1Hdqdt-000LhY-7R@server.idefix.lan> Resent-Message-ID: <200704171710.l3HHA7Yq089203@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 111774 >Category: ports >Synopsis: Update for port net/asterisk-app-ldap >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Apr 17 17:10:07 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Matthias Fechner >Release: FreeBSD 6.2-PRERELEASE i386 >Organization: >Environment: System: FreeBSD server.idefix.lan 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #19: Sat Nov 18 22:18:39 CET 2006 root@server.idefix.loc:/usr/obj/usr/src/sys/SERVER2 i386 >Description: Update for port net/asterisk-app-ldap. The new version runs now with asterisk 1.4. >How-To-Repeat: >Fix: please rename the old port asterisk-app-ldap to asterisk12-app-ldap and commit this port as asterisk-app-ldap --- asterisk-app-ldap.shar begins here --- # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # asterisk-app-ldap # asterisk-app-ldap/files # asterisk-app-ldap/files/patch-Makefile # asterisk-app-ldap/files/patch-app_ldap.c # asterisk-app-ldap/files/patch-cflags.sh # asterisk-app-ldap/pkg-descr # asterisk-app-ldap/distinfo # asterisk-app-ldap/Makefile # echo c - asterisk-app-ldap mkdir -p asterisk-app-ldap > /dev/null 2>&1 echo c - asterisk-app-ldap/files mkdir -p asterisk-app-ldap/files > /dev/null 2>&1 echo x - asterisk-app-ldap/files/patch-Makefile sed 's/^X//' >asterisk-app-ldap/files/patch-Makefile << 'END-of-asterisk-app-ldap/files/patch-Makefile' X--- Makefile.orig Tue Apr 17 13:55:00 2007 X+++ Makefile Tue Apr 17 18:19:37 2007 X@@ -30,6 +30,14 @@ X CONF_DIR=/etc/asterisk X endif X X+ifeq ($(OSARCH),FreeBSD) X+# CFLAGS+= -D__FreeBSD__ X+ SOLINK=-shared -Xlinker -x -L/usr/local/lib X+ LIBS=-llber -lldap -liconv X+ MODULES_DIR=/usr/local/lib/asterisk/modules X+ CONF_DIR=/usr/local/etc/asterisk X+endif X+ X %.so : %.o X $(CC) $(SOLINK) -o $@ $(LIBS) $< X X@@ -39,13 +47,13 @@ X rm -f $(NAME).o $(NAME).so X X install: all X- if ! [ -f $(CONF_DIR)/$(CONF) ]; then \ X- install -m 644 $(CONF).sample $(CONF_DIR)/$(CONF) ; \ X+ if ! [ -f $(CONF_DIR)/$(CONF).sample ]; then \ X+ install -m 644 $(CONF).sample $(CONF_DIR)/$(CONF).sample ; \ X fi X if [ -f $(NAME).so ]; then \ X install -m 755 $(NAME).so $(MODULES_DIR) ; \ X fi X X reload: install X- asterisk -rx "unload ${RES}" X- asterisk -rx "load ${RES}" X+ asterisk -rx "module unload ${RES}" X+ asterisk -rx "module load ${RES}" END-of-asterisk-app-ldap/files/patch-Makefile echo x - asterisk-app-ldap/files/patch-app_ldap.c sed 's/^X//' >asterisk-app-ldap/files/patch-app_ldap.c << 'END-of-asterisk-app-ldap/files/patch-app_ldap.c' X--- app_ldap.c.orig Tue Apr 17 14:14:56 2007 X+++ app_ldap.c Tue Apr 17 17:06:42 2007 X@@ -9,6 +9,8 @@ X * X */ X X+/*#define LDAP_DEPRECATED 1*/ X+ X #include <stdlib.h> X #include <stdio.h> X #include <string.h> X@@ -33,36 +35,43 @@ X #include <ldap.h> X X #define AST_MODULE "app_notify" X- X #define LDAP_CONFIG "ldap.conf" X+#define SIZELIMIT 2048 X X-int ldap_lookup(const char *host, int port, int version, int timeout, const char *user, const char *pass, const char *base, const char *scope, const char *filter, const char *attribute, char *result); X-int strconvert(const char *incharset, const char *outcharset, X-#ifdef __Darwin__ X- const char *in, X-#else X- char *in, X-#endif X- char *out); X+char *replace_ast_vars(struct ast_channel *chan, const char *string); X+LDAP* ldap_open_connection(const char *host, int port, int version); X+int ldap_bind_connection(LDAP *ld, const char *user, const char *pass); X+int ldap_search_in_connection(LDAP *ld, const char *base, const char *scope, const char *filter, const char *attribute, char *result); X+int ldap_lookup(const char *host, int port, int version, int timeout, const char *user, const char *pass, X+ const char *base, const char *scope, const char *filter, const char *attribute, char *result); X+int strconvert(const char *incharset, const char *outcharset, const char *in, char *out); X+char *strtrim (char *string); X X static char *app = "LDAPget"; X static char *synopsis = "Retrieve a value from an ldap directory"; X X static char *descrip = X- " LDAPget(varname=config-file-section/key): Retrieves a value from an LDAP\n" X- "directory and stores it in the given variable. Always returns 0. If the\n" X- "requested key is not found, jumps to priority n+101 if available.\n"; X+" LDAPget(varname=config-file-section/key): Retrieves a value from an LDAP\n" X+"directory and stores it in the given variable. Always returns 0. If the\n" X+"requested key is not found, jumps to priority n+101 if available.\n"; X+ X X static int ldap_exec (struct ast_channel *chan, void *data) X { X int arglen; X struct ast_module_user *u; X char *argv, *varname, *config, *keys = NULL, *key = NULL, *tail = NULL; X+#ifdef __FreeBSD__ X+ char result[SIZELIMIT+1]; X+#else X char result[2048]; X+#endif X+ memset(result,0,sizeof(result)); X+ X char *result_conv; X struct ast_config *cfg; X X- int port = LDAP_PORT, version = LDAP_VERSION2, timeout = 10; X+ int port = LDAP_PORT, version = LDAP_VERSION3, timeout = 10; X const char *temp, *host, *user, *pass, *_base, *scope, *_filter, *attribute; X char *convert, *convert_from = NULL, *convert_to = NULL, *filter, *base; X X@@ -127,8 +136,8 @@ static int ldap_exec (struct ast_channel X if (!(scope = ast_variable_retrieve(cfg, config, "scope"))) { X scope = "sub"; X } X- if(!(_base = ast_variable_retrieve(cfg, config, "base"))) { X- _base = ""; X+ if(!(_base = ast_variable_retrieve(cfg, config, "base"))){ X+ _base = ""; X } X if(!(_filter = ast_variable_retrieve(cfg, config, "filter"))) { X _filter = "(&(objectClass=*)(telephoneNumber=${CALLERID(number)}))"; X@@ -136,7 +145,7 @@ static int ldap_exec (struct ast_channel X if(!(attribute = ast_variable_retrieve(cfg, config, "attribute"))) { X attribute = "cn"; X } X- X+ X if((temp = ast_variable_retrieve(cfg, config, "convert"))) { X convert = ast_strdupa(temp); X if(strchr(convert, ',')) { X@@ -146,7 +155,7 @@ static int ldap_exec (struct ast_channel X ast_log(LOG_WARNING, "syntax error: convert = <source-charset>,<destination charset>\n"); X } X } X- X+ X if(option_verbose > 3) X ast_verbose (VERBOSE_PREFIX_4 "LDAPget: ldap://%s/%s?%s?%s?%s\n", host, _base, attribute, scope, _filter); X X@@ -160,12 +169,16 @@ static int ldap_exec (struct ast_channel X memset(base, 0, slen); X pbx_substitute_variables_helper(chan, _base, base, slen); X X+// ast_log(LOG_WARNING, "LDAPget: filter: after replace_ast_vars in main: -%s-\n", filter); X+ if(option_verbose > 3) X+ ast_verbose (VERBOSE_PREFIX_4 "LDAPget: replaced string: %s\n", filter); X+ X if(keys && strstr(filter, "%s") != NULL) { X filter = (char *)ast_realloc(filter, (strlen(filter)+strlen(keys)+1)*sizeof(char)); X while((key = strsep(&keys, "|")) != NULL) { X if((tail = strstr(filter, "%s")) != NULL) { X- memmove(tail+strlen(key), tail+2, strlen(tail+2)+1); X- memcpy(tail, key, strlen(key)); X+ memmove(tail+strlen(key), tail+2, strlen(tail+2)+1); X+ memcpy(tail, key, strlen(key)); X } X } X } X@@ -173,86 +186,146 @@ static int ldap_exec (struct ast_channel X if(option_verbose > 2) X ast_verbose (VERBOSE_PREFIX_3 "LDAPget: ldap://%s/%s?%s?%s?%s\n", host, base, attribute, scope, filter); X X+// ast_log(LOG_WARNING, "LDAPget: filter before ldap_lookup: -%s-\n", filter); X if(ldap_lookup(host, port, version, timeout, user, pass, base, scope, filter, attribute, result)) { X X- if(convert_from) { X+ if(convert_from && strlen(result)>0) { X if(option_verbose > 2) X- ast_verbose(VERBOSE_PREFIX_3 "LDAPget: convert: %s -> %s\n", convert_from, convert_to); X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: convert: %s -> %s\n", convert_from, convert_to); X result_conv = alloca(strlen(result) * 2); X- strconvert(convert_from, convert_to, result, result_conv); X+ strconvert(convert_from, convert_to, (const char*)result, result_conv); X strcpy(result, result_conv); X } X- X- X+ X if(strcmp("CALLERIDNAME", varname)==0 || strcmp("CALLERID(name)", varname)==0) { X #ifdef CHANNEL_HAS_CID X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: set callerid with HAS_CID ast_set_callerid\n"); X ast_set_callerid(chan, NULL, result, NULL); X #else X char *cidnum, *cidname, newcid[512] = ""; X ast_callerid_parse(chan->callerid, &cidname, &cidnum); X snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", result, cidnum); X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: set callerid with NO HAS_CID ast_set_callerid\n"); X ast_set_callerid(chan, newcid, 0); X #endif X } else { X pbx_builtin_setvar_helper(chan, varname, result); X } X- if(option_verbose > 2) X- ast_verbose (VERBOSE_PREFIX_3 "LDAPget: set %s='%s'\n", varname, result); X+ if(option_verbose > 2) X+ ast_verbose (VERBOSE_PREFIX_3 "LDAPget: set %s='%s'\n", varname, result); X+ X } else { X /* Send the call to n+101 priority, where n is the current priority */ X if(ast_exists_extension (chan, chan->context, chan->exten, chan->priority + 101, X #ifdef CHANNEL_HAS_CID X- chan->cid.cid_num X+ chan->cid.cid_num X #else X- chan->callerid X+ chan->callerid X #endif X- )) X+ )) X chan->priority += 100; X } X- X #ifdef NEW_CONFIG X ast_config_destroy(cfg); X #else X ast_destroy(cfg); X #endif X- X ast_module_user_remove(u); X+ X return 0; X } X X- X-int ldap_lookup(const char *host, int port, int version, int timeout, const char *user, const char *pass, X- const char *base, const char *scope, const char *filter, const char *attribute, char *result) { X- char *attrs[] = { NULL }; X- char **values; X- LDAP *ld; X- LDAPMessage *res, *entry; X- int ret, ldap_scope = LDAP_SCOPE_SUBTREE; X- X- ld = ldap_init(host, port); X- if(!ld) { X- ast_log(LOG_WARNING, "LDAPget: unable to initialize ldap connection to %s:%d\n", host, port); X+LDAP* ldap_open_connection(const char *host, int port, int version) X+{ X+ LDAP *ld=NULL; X+ LDAPURLDesc url; X+ char *ldapuri=NULL; X+ int ret; X+// int ldap_debug=0xffff; X+ int ldap_debug=0; X+ X+ // Open connection to the LDAP server X+ memset(&url, 0, sizeof(url)); X+ url.lud_host=host; X+ url.lud_port=port; X+ url.lud_scope=LDAP_SCOPE_DEFAULT; X+ url.lud_scheme="ldap"; X+ X+ ldapuri=ldap_url_desc2str(&url); X+ (void) ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug); X+ X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: open connection to %s with version: %d\n", ldapuri, version); X+ ret = ldap_initialize(&ld, ldapuri); X+ if(ret != LDAP_SUCCESS) { X+ ast_log(LOG_WARNING, "LDAPget: unable to initialize ldap connection to %s(%d)\n", ldap_err2string(ret),ret); X return 0; X } X+ X+ // Disable option referrals X+ if(ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF) != LDAP_OPT_SUCCESS) X+ { X+ ast_log(LOG_WARNING, "LDAPget: unable to disable LDAP_OPT_REFERRALS\n"); X+ return 0; X+ } X X- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timeout); X- ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); X- X- if(user) { X- if (option_verbose > 2) X- ast_verbose(VERBOSE_PREFIX_3 "LDAPget: bind to %s as %s\n", host, user); X- ret = ldap_simple_bind_s(ld, user, pass); X- } else { X- if (option_verbose > 2) X- ast_verbose(VERBOSE_PREFIX_3 "LDAPget: bind to %s anonymously\n", host); X- ret = ldap_simple_bind_s(ld, NULL, NULL); X- } X- if(ret) { X- ast_log(LOG_WARNING, "LDAPget: bind failed: %s\n", ldap_err2string(ret)); X- ldap_unbind(ld); X- return 0; X+ // set protocol to version X+ if(ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version)!= LDAP_OPT_SUCCESS) X+ { X+ ast_log(LOG_WARNING, "LDAPget: unable to set LDAP_OPT_PROTOCOL_VERSION %d\n",version); X+ return 0; X } X+ return ld; X+} X X+int ldap_bind_connection(LDAP *ld, const char *user, const char *pass) X+{ X+ int rc; X+ char *sasl_secprops=NULL; X+ X+ if( sasl_secprops != NULL) X+ { X+ rc= ldap_set_option( ld, LDAP_OPT_X_SASL_SECPROPS, (void *) sasl_secprops); X+ if(rc != LDAP_OPT_SUCCESS) X+ { X+ ast_log(LOG_WARNING, "LDAPget: Could not set LDAP_OPT_X_SASL_SECPROPS: %s\n", sasl_secprops); X+ return 0; X+ } X+ } X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: bind as %s\n", user); X+ X+ struct berval passwd= {0, NULL}; X+ passwd.bv_val=ber_strdup(pass); X+ passwd.bv_len=strlen(passwd.bv_val); X+ X+ rc=ldap_sasl_bind_s(ld, user, NULL, &passwd, NULL, NULL, NULL); X+ X+ if(rc != LDAP_SUCCESS) X+ { X+ ast_log(LOG_WARNING, "LDAPget: ldap_sasl_interactive_bind_s failed: %s (%d)\n", ldap_err2string(rc),rc); X+ return 0; X+ } X+ X+ return 1; X+} X+ X+ X+int ldap_search_in_connection(LDAP *ld, const char *base, const char *scope, const char *filter, const char *attribute, char *result) X+{ X+ char *attrs[] = { NULL }; X+ int ret, ldap_scope = LDAP_SCOPE_SUBTREE; X+ LDAPMessage *msg, *res; X+ int num_entries=0; X+ int msgtype; X+ char *dn, *a; X+ BerElement *ber=NULL; X+ struct berval **vals; X+ struct berval val; X+ X+// ast_log(LOG_WARNING, "LDAPget: filter start of ldap_search_in_connections: -%s-\n", filter); X if(strncmp(scope,"sub",3)==0) { X ldap_scope = LDAP_SCOPE_SUBTREE; X } else if(strncmp(scope,"base",4)==0) { X@@ -261,82 +334,146 @@ int ldap_lookup(const char *host, int po X ldap_scope = LDAP_SCOPE_ONELEVEL; X } X X- ret = ldap_search_s(ld, base, ldap_scope, filter, attrs, 0, &res); X- if(ret) { X- ast_log(LOG_WARNING, "LDAPget: search failed: %s\n", ldap_err2string(ret)); X- if(version==2) X- ast_log(LOG_WARNING, "LDAPget: you may try version=3 in your asterisk ldap.conf file.\n"); X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: send search command to LDAP server\n"); X+ ret = ldap_search_ext_s(ld, base, ldap_scope, filter, attrs, 0, NULL, NULL, NULL, SIZELIMIT, &res); X+ if(ret != LDAP_SUCCESS) { X+ ast_log(LOG_WARNING, "LDAPget: search failed: %s (%d)\n", ldap_err2string(ret),ret); X+ ast_log(LOG_WARNING, "LDAPget: filter: %s\n", filter); X+// XXXX need to check X ldap_msgfree(res); X- ldap_unbind(ld); X+ ldap_unbind_ext_s(ld,NULL,NULL); X+ ast_log(LOG_WARNING, "LDAPget: search failed resourceses released, cancel search\n"); X return 0; X } X+ num_entries=ldap_count_entries(ld, res); X+ msg=ldap_first_message(ld, res); X+ msgtype=ldap_msgtype(msg); X X- entry = ldap_first_entry(ld, res); X- if(!entry) { X- if(option_verbose > 2) X- ast_verbose (VERBOSE_PREFIX_3 "LDAPget: Value not found in directory.\n"); X- ldap_msgfree(res); X- ldap_unbind(ld); X- return 0; X- } X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: found %d entry in LDAP server\n", num_entries); X X- values = ldap_get_values(ld, entry, attribute); X- if(values && values[0]) { X- memset(result, 0, strlen(values[0])); X- strncpy(result, values[0], strlen(values[0])); X- result[strlen(values[0])] = '\0'; X- if (option_verbose > 2) X- ast_verbose(VERBOSE_PREFIX_3 "LDAPget: %s=%s\n", attribute, result); X- } else { X- if (option_verbose > 2) X- ast_verbose (VERBOSE_PREFIX_3 "LDAPget: %s not found.\n", attribute); X- ldap_msgfree(res); X- ldap_unbind(ld); X- return 0; X+ for ( msg = ldap_first_message( ld, res ); msg != NULL; msg = ldap_next_message( ld, msg ) ) { X+ /* Determine what type of message was sent from the server. */ X+ X+ msgtype = ldap_msgtype( msg ); X+ switch( msgtype ) { X+ /* If the result was an entry found by the search, get and print the X+ attributes and values of the entry. */ X+ case LDAP_RES_SEARCH_ENTRY: X+ /* Get and print the DN of the entry. */ X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "Found a LDAP_RES_SEARCH_ENTRY\n"); X+ ret=ldap_get_dn_ber(ld,msg,&ber,&val); X+ X+ if (( dn = ldap_get_dn( ld, res )) != NULL ) { X+ ldap_memfree( dn ); X+ } X+ /* Iterate through each attribute in the entry. */ X+ for ( a = ldap_first_attribute( ld, res, &ber ); X+ a != NULL; a = ldap_next_attribute( ld, res, ber ) ) { X+ /* Get the searched attribute and value */ X+ if(!strcmp(a,attribute)) X+ { X+ X+ if (( vals = ldap_get_values_len( ld, res, a )) != NULL ) { X+ val=*vals[0]; X+ // remove space at end of string X+ if(val.bv_val[val.bv_len-1]==' ') X+ { X+ val.bv_len--; X+// val.bv_val[val.bv_len]=NULL; X+ } X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "Found <%s>: <%s>\n", a, val.bv_val); X+ memcpy(result,val.bv_val,val.bv_len); X+ ldap_value_free_len( vals ); X+ ldap_memfree(a); X+ break; X+ } X+ } X+ ldap_memfree( a ); X+ } X+ if ( ber != NULL ) { X+ ber_free( ber, 0 ); X+ } X+ break; X+ case LDAP_RES_SEARCH_REFERENCE: X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAP_RES_SEARCH_REFERENCE\n"); X+ break; X+ case LDAP_RES_SEARCH_RESULT: X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPRES_SERCH_RESULT\n"); X+ break; X+ default: X+ break; X+ } X } X- ldap_value_free(values); X- X- ldap_msgfree(res); X- ldap_unbind_s(ld); X- X return 1; X } X X-int strconvert(const char *incharset, const char *outcharset, X-#ifdef __Darwin__ X- const char *in, X-#else X- char *in, X-#endif X- char *out) { X+int ldap_lookup(const char *host, int port, int version, int timeout, const char *user, const char *pass, X+ const char *base, const char *scope, const char *filter, const char *attribute, char *result) { X+ LDAP *ld=NULL; X+ X+// ast_log(LOG_WARNING, "LDAPget: filter in ldap_lookup: -%s-\n", filter); X+ // open connection to LDAP server X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: Initialize connection to LDAP server\n"); X+ ld=ldap_open_connection(host, port, version); X+ if(ld==0) X+ return 0; X+ X+ // authenticate to the LDAP-Server X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: bind to LDAP server\n"); X+ if(ldap_bind_connection(ld, user, pass) == 0) X+ return 0; X+ X+ // Search in the LDAP directory X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: search attribute %s in LDAP directory\n", attribute); X+ if(ldap_search_in_connection(ld, base, scope, filter, attribute, result)==0) X+ return 0; X+ X+ // Close connection to the LDAP server X+ int err = ldap_set_option(ld, LDAP_OPT_SERVER_CONTROLS, NULL); X+ if(err != LDAP_OPT_SUCCESS) X+ { X+ ast_log(LOG_WARNING, "LDAPget: Could not unset controls\n"); X+ } X+ X+ ldap_unbind_ext_s(ld, NULL, NULL); X+ return 1; X+} X+ X+ X+int strconvert(const char *incharset, const char *outcharset, const char *in, char *out) X+{ X iconv_t cd; X- size_t incount = strlen(in), outcount = strlen(in)*2, result; X- cd = iconv_open(outcharset, incharset); X- if(cd == (iconv_t) -1) { X- ast_log(LOG_ERROR, "conversion from '%s' to '%s' not available. type 'iconv -l' in a shell to list the supported charsets.\n", incharset, outcharset); X- memcpy(out, in, strlen(in)+1); X+ size_t incount, outcount, result; X+ incount = outcount = strlen(in) * 2; X+ if((cd = iconv_open(outcharset, incharset)) == (iconv_t)-1) { X+ if(errno == EINVAL) ast_log(LOG_DEBUG, "conversion from '%s' to '%s' not available", incharset, outcharset); X+ *out = L'\0'; X return -1; X } X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: convert: now with icon string: %s\n", in); X result = iconv(cd, &in, &incount, &out, &outcount); X- if(result == (size_t)-1) { X- if(errno == E2BIG) { X- ast_log(LOG_WARNING, "Iconv: output buffer too small.\n"); X- } else if(errno == EILSEQ) { X- ast_log(LOG_WARNING, "Iconv: illegal character.\n"); X- } else if(errno == EINVAL) { X- ast_log(LOG_WARNING, "Iconv: incomplete character sequence.\n"); X- } else { X- ast_log(LOG_WARNING, "Iconv: error.\n"); X- } X- } X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: convert: close inconv %d\n",result); X iconv_close(cd); X- *out = '\0'; X+ if(option_verbose > 2) X+ ast_verbose(VERBOSE_PREFIX_3 "LDAPget: result with icon\n"); X+ out[strlen(out)] = '\0'; X return 1; X } X X static int load_module(void) X { X- return ast_register_application(app, ldap_exec, synopsis, descrip); X+ return ast_register_application(app, ldap_exec, synopsis, descrip); X } X X static int unload_module(void) END-of-asterisk-app-ldap/files/patch-app_ldap.c echo x - asterisk-app-ldap/files/patch-cflags.sh sed 's/^X//' >asterisk-app-ldap/files/patch-cflags.sh << 'END-of-asterisk-app-ldap/files/patch-cflags.sh' X--- cflags.sh.orig Tue Apr 17 14:11:19 2007 X+++ cflags.sh Tue Apr 17 14:13:40 2007 X@@ -11,6 +11,11 @@ else X INCDIR=/usr/include/asterisk X fi X X+if [ ${OSARCH} = "FreeBSD" ]; then X+ INCDIR=/usr/local/include/asterisk X+ CFLAGS="${CFLAGS} -I/usr/local/include -L/usr/local/lib" X+fi X+ X CHANNEL_H=${INCDIR}/channel.h X if [ "`grep 'struct ast_callerid cid' ${CHANNEL_H}`" != "" ]; then X CFLAGS="${CFLAGS} -DCHANNEL_HAS_CID" END-of-asterisk-app-ldap/files/patch-cflags.sh echo x - asterisk-app-ldap/pkg-descr sed 's/^X//' >asterisk-app-ldap/pkg-descr << 'END-of-asterisk-app-ldap/pkg-descr' XLDAPget is an Asterisk application for data retrieval from LDAP Xdirectories (e.g. OpenLDAP or ActiveDirectory). This version works Xwith asterisk 1.4. X XWWW: http://www.mezzo.net/asterisk/app_ldap.html END-of-asterisk-app-ldap/pkg-descr echo x - asterisk-app-ldap/distinfo sed 's/^X//' >asterisk-app-ldap/distinfo << 'END-of-asterisk-app-ldap/distinfo' XMD5 (app_ldap-2.0rc1.tgz) = b5e42d027f5272dff2b248e7e056b803 XSHA256 (app_ldap-2.0rc1.tgz) = 7dbafad5c711de18bb57585f0ac9cf8e06a82761f43228db4ead88631dfafadc XSIZE (app_ldap-2.0rc1.tgz) = 6280 END-of-asterisk-app-ldap/distinfo echo x - asterisk-app-ldap/Makefile sed 's/^X//' >asterisk-app-ldap/Makefile << 'END-of-asterisk-app-ldap/Makefile' X# New ports collection makefile for: app_ldap X# Date created: 15 April 2007 X# Whom: Matthias Fechner <idefix@fechner.net> X# X# $FreeBSD$ X# X XPORTNAME= app_ldap XDISTVERSION= 2.0rc1 XCATEGORIES= net XMASTER_SITES= http://www.mezzo.net/asterisk/ XEXTRACT_SUFX= .tgz X XMAINTAINER= idefix@fechner.net XCOMMENT= LDAPget application module for the Asterisk PBX 1.4 X XBUILD_DEPENDS= asterisk:${PORTSDIR}/net/asterisk \ X ${LOCALBASE}/lib/libldap.so:${PORTSDIR}/net/openldap23-client \ X ${LOCALBASE}/lib/libiconv.so:${PORTSDIR}/converters/libiconv X XUSE_GMAKE= yes X XPLIST_FILES= lib/asterisk/modules/app_ldap.so \ X etc/asterisk/ldap.conf.sample X X.include <bsd.port.mk> END-of-asterisk-app-ldap/Makefile exit --- asterisk-app-ldap.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1Hdqdt-000LhY-7R>