You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.6 KiB
110 lines
2.6 KiB
|
18 years ago
|
Index: Makefile
|
||
|
|
--- Makefile.orig 2008-03-23 12:12:17 +0100
|
||
|
|
+++ Makefile 2008-03-23 12:11:59 +0100
|
||
|
|
@@ -9,29 +9,20 @@
|
||
|
|
NAME=app_ldap
|
||
|
|
CONF=ldap.conf
|
||
|
|
|
||
|
|
-CFLAGS=$(shell ./cflags.sh)
|
||
|
|
-LIBS=-llber -lldap
|
||
|
|
+CFLAGS=-Wall -D_REENTRANT -D_GNU_SOURCE -fPIC -DNEW_CONFIG=1 -DCHANNEL_HAS_CID=1
|
||
|
|
+LIBS=-liconv -lldap -llber -lssl -lcrypto -lcrypt -lm
|
||
|
|
RES=$(NAME).so
|
||
|
|
|
||
|
|
-CC=gcc
|
||
|
|
+CC=gcc
|
||
|
|
+CPPFLAGS=
|
||
|
|
+LDFLAGS=
|
||
|
|
|
||
|
|
-OSARCH=$(shell uname -s)
|
||
|
|
-
|
||
|
|
-ifeq ($(OSARCH),Darwin)
|
||
|
|
- CFLAGS+= -D__Darwin__
|
||
|
|
- SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace -liconv
|
||
|
|
- TESTLINK=-undefined suppress -force_flat_namespace
|
||
|
|
- MODULES_DIR=/Library/Asterisk/modules
|
||
|
|
- CONF_DIR=/Library/Asterisk/conf
|
||
|
|
- CC=gcc -arch ppc -arch i386
|
||
|
|
-else
|
||
|
|
SOLINK=-shared -Xlinker -x
|
||
|
|
MODULES_DIR=/usr/lib/asterisk/modules
|
||
|
|
CONF_DIR=/etc/asterisk
|
||
|
|
-endif
|
||
|
|
|
||
|
|
%.so : %.o
|
||
|
|
- $(CC) $(SOLINK) -o $@ $(LIBS) $<
|
||
|
|
+ $(CC) $(LDFLAGS) $(SOLINK) -o $@ $< $(LIBS)
|
||
|
|
|
||
|
|
all: $(RES)
|
||
|
|
|
||
|
|
Index: app_ldap.c
|
||
|
|
--- app_ldap.c.orig 2007-01-31 22:23:05 +0100
|
||
|
|
+++ app_ldap.c 2008-03-23 12:07:21 +0100
|
||
|
|
@@ -9,6 +9,8 @@
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
+#include <asterisk.h>
|
||
|
|
+
|
||
|
|
#include <stdlib.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <string.h>
|
||
|
|
@@ -26,23 +28,21 @@
|
||
|
|
#include <asterisk/config.h>
|
||
|
|
#include <asterisk/utils.h>
|
||
|
|
#include <asterisk/callerid.h>
|
||
|
|
+#include <asterisk/config.h>
|
||
|
|
|
||
|
|
#include <ctype.h>
|
||
|
|
#include <errno.h>
|
||
|
|
#include <iconv.h>
|
||
|
|
+#define LDAP_DEPRECATED 1
|
||
|
|
#include <ldap.h>
|
||
|
|
|
||
|
|
-#define AST_MODULE "app_notify"
|
||
|
|
+#define AST_MODULE "app_ldap"
|
||
|
|
|
||
|
|
#define LDAP_CONFIG "ldap.conf"
|
||
|
|
|
||
|
|
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);
|
||
|
|
int strconvert(const char *incharset, const char *outcharset,
|
||
|
|
-#ifdef __Darwin__
|
||
|
|
const char *in,
|
||
|
|
-#else
|
||
|
|
- char *in,
|
||
|
|
-#endif
|
||
|
|
char *out);
|
||
|
|
|
||
|
|
static char *app = "LDAPget";
|
||
|
|
@@ -61,6 +61,9 @@
|
||
|
|
char result[2048];
|
||
|
|
char *result_conv;
|
||
|
|
struct ast_config *cfg;
|
||
|
|
+#ifdef NEW_CONFIG
|
||
|
|
+ struct ast_flags config_flags = { 0 };
|
||
|
|
+#endif
|
||
|
|
|
||
|
|
int port = LDAP_PORT, version = LDAP_VERSION2, timeout = 10;
|
||
|
|
const char *temp, *host, *user, *pass, *_base, *scope, *_filter, *attribute;
|
||
|
|
@@ -101,7 +104,7 @@
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifdef NEW_CONFIG
|
||
|
|
- cfg = ast_config_load(LDAP_CONFIG);
|
||
|
|
+ cfg = ast_config_load(LDAP_CONFIG, config_flags);
|
||
|
|
#else
|
||
|
|
cfg = ast_load(LDAP_CONFIG);
|
||
|
|
#endif
|
||
|
|
@@ -303,11 +306,7 @@
|
||
|
|
}
|
||
|
|
|
||
|
|
int strconvert(const char *incharset, const char *outcharset,
|
||
|
|
-#ifdef __Darwin__
|
||
|
|
const char *in,
|
||
|
|
-#else
|
||
|
|
- char *in,
|
||
|
|
-#endif
|
||
|
|
char *out) {
|
||
|
|
iconv_t cd;
|
||
|
|
size_t incount = strlen(in), outcount = strlen(in)*2, result;
|