minor fixes for linux and dso loading
This commit is contained in:
parent
4308cb1446
commit
e1f24fdeee
|
@ -32,6 +32,7 @@ AC_CANONICAL_HOST
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
dnl add mmlib to the include path
|
dnl add mmlib to the include path
|
||||||
INCLUDES='-I$(top_srcdir)/mmlib -I$(top_builddir)/mmlib'
|
INCLUDES='-I$(top_srcdir)/mmlib -I$(top_builddir)/mmlib'
|
||||||
|
@ -79,7 +80,7 @@ case "$host" in
|
||||||
CFLAGS="$CFLAGS -DDARWIN=1 -O4 -Wall"
|
CFLAGS="$CFLAGS -DDARWIN=1 -O4 -Wall"
|
||||||
LIB_EXT="dylib"
|
LIB_EXT="dylib"
|
||||||
;;
|
;;
|
||||||
*-linux-*)
|
*-linux*)
|
||||||
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -O4 -Wall"
|
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -O4 -Wall"
|
||||||
LDFLAGS="$LDFLAGS -rdynamic"
|
LDFLAGS="$LDFLAGS -rdynamic"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -22,7 +22,7 @@ LIB = libmms_pgsql_queue.$(LIB_EXT)
|
||||||
ALL: $(LIB)
|
ALL: $(LIB)
|
||||||
|
|
||||||
$(LIB): mms_pgsql_queue.o
|
$(LIB): mms_pgsql_queue.o
|
||||||
$(CC) $(XLDFLAGS) -o $@ $? -L$(MBUNIDIR)/mmlib -lmms `$(KANNELCONF) --libs` -L`$(PGCONF) --libdir` -lpq
|
$(CC) $(XLDFLAGS) -o $@ $? -L$(MBUNIDIR)/mmlib -L`$(PGCONF) --libdir` -lpq
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *~
|
rm -f *.o *~
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- (c) 2007 Digital Solutions
|
-- (c) 2007 Digital Solutions
|
||||||
-- Licence: See http://mbuni.org/license.shtml
|
-- Licence: See http://mbuni.org/license.shtml
|
||||||
-- Author: P. A. Bagyenda <bagyenda@dsmagic.com>
|
-- Author: P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
-- Requires: PostgresQL v8.x
|
-- Requires: PostgresQL v8.2 and above
|
||||||
|
|
||||||
-- Master messages table
|
-- Master messages table
|
||||||
CREATE TABLE mms_messages (
|
CREATE TABLE mms_messages (
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
#include "mms_uaprof.h"
|
#include "mms_uaprof.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBSSL
|
|
||||||
#include <openssl/md5.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Octstr *_mms_cfg_getx(mCfgGrp *grp, Octstr *item)
|
Octstr *_mms_cfg_getx(mCfgGrp *grp, Octstr *item)
|
||||||
{
|
{
|
||||||
Octstr *v = mms_cfg_get(grp, item);
|
Octstr *v = mms_cfg_get(grp, item);
|
||||||
|
@ -1386,7 +1382,7 @@ int mms_url_fetch_content(int method, Octstr *url, List *request_headers,
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HASHLEN 16
|
|
||||||
static Octstr *make_url(HTTPURLParse *h);
|
static Octstr *make_url(HTTPURLParse *h);
|
||||||
|
|
||||||
/* Fetch a url with authentication as necessary. */
|
/* Fetch a url with authentication as necessary. */
|
||||||
|
@ -1402,7 +1398,6 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
List *qop = NULL, *l = NULL;
|
List *qop = NULL, *l = NULL;
|
||||||
int i, status = HTTP_UNAUTHORIZED, has_auth = 0, has_auth_int = 0;
|
int i, status = HTTP_UNAUTHORIZED, has_auth = 0, has_auth_int = 0;
|
||||||
HTTPURLParse *h = parse_url(url);
|
HTTPURLParse *h = parse_url(url);
|
||||||
unsigned char mdbuf[1+HASHLEN*4], *xs;
|
|
||||||
char *m_qop = NULL;
|
char *m_qop = NULL;
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
|
|
||||||
|
@ -1459,28 +1454,24 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from here on, libssl is required. */
|
|
||||||
#ifdef HAVE_LIBSSL
|
|
||||||
if (qop ||
|
if (qop ||
|
||||||
(algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0)) {
|
(algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0)) {
|
||||||
unsigned char *x = MD5((void *)&t, sizeof t, (void *)mdbuf);
|
cnonce = octstr_create("");
|
||||||
cnonce = octstr_create_from_data((void *)x, 4);
|
octstr_append_data(cnonce, (void *)&t, sizeof t);
|
||||||
octstr_binary_to_hex(cnonce,0);
|
octstr_binary_to_hex(cnonce,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make A1 */
|
/* Make A1 */
|
||||||
x = octstr_format("%S:%S:%S",
|
x = octstr_format("%S:%S:%S",
|
||||||
h->user, realm, h->pass ? h->pass : octstr_imm(""));
|
h->user, realm, h->pass ? h->pass : octstr_imm(""));
|
||||||
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
|
A1 = md5(x);
|
||||||
A1 = octstr_create_from_data((char *)xs, HASHLEN);
|
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
|
|
||||||
if (algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0) {
|
if (algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0) {
|
||||||
x = octstr_format("%S:%S:%S",
|
x = octstr_format("%S:%S:%S",
|
||||||
A1, nonce, cnonce);
|
A1, nonce, cnonce);
|
||||||
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
|
|
||||||
octstr_destroy(A1);
|
octstr_destroy(A1);
|
||||||
A1 = octstr_create_from_data((char *)xs, HASHLEN);
|
A1 = md5(x);
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
}
|
}
|
||||||
octstr_binary_to_hex(A1,0);
|
octstr_binary_to_hex(A1,0);
|
||||||
|
@ -1493,8 +1484,7 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
Octstr *y;
|
Octstr *y;
|
||||||
m_qop = "auth-int";
|
m_qop = "auth-int";
|
||||||
|
|
||||||
xs = MD5((void *)octstr_get_cstr(body), octstr_len(body), (void *)mdbuf);
|
y = md5(body);
|
||||||
y = octstr_create_from_data((char *)xs, HASHLEN);
|
|
||||||
octstr_binary_to_hex(y,0);
|
octstr_binary_to_hex(y,0);
|
||||||
|
|
||||||
octstr_append_char(x, ':');
|
octstr_append_char(x, ':');
|
||||||
|
@ -1504,8 +1494,7 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
} else if (qop)
|
} else if (qop)
|
||||||
m_qop = "auth";
|
m_qop = "auth";
|
||||||
|
|
||||||
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
|
A2 = md5(x);
|
||||||
A2 = octstr_create_from_data((char *)xs, HASHLEN);
|
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
octstr_binary_to_hex(A2,0);
|
octstr_binary_to_hex(A2,0);
|
||||||
|
|
||||||
|
@ -1517,10 +1506,8 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
else
|
else
|
||||||
x = octstr_format("%S:%S:%S", A1, nonce, A2);
|
x = octstr_format("%S:%S:%S", A1, nonce, A2);
|
||||||
|
|
||||||
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
|
rd = md5(x);
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
|
|
||||||
rd = octstr_create_from_data((char *)xs, HASHLEN);
|
|
||||||
octstr_binary_to_hex(rd, 0);
|
octstr_binary_to_hex(rd, 0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1543,10 +1530,10 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
|
|
||||||
/* Remove username, password, then remake URL */
|
/* Remove username, password, then remake URL */
|
||||||
if (h->user) octstr_destroy(h->user);
|
octstr_destroy(h->user);
|
||||||
h->user = NULL;
|
h->user = NULL;
|
||||||
|
|
||||||
if (h->pass) octstr_destroy(h->pass);
|
octstr_destroy(h->pass);
|
||||||
h->pass = NULL;
|
h->pass = NULL;
|
||||||
|
|
||||||
xurl = make_url(h);
|
xurl = make_url(h);
|
||||||
|
@ -1556,11 +1543,6 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
|
||||||
status = -1;
|
status = -1;
|
||||||
if (x)
|
if (x)
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
#else
|
|
||||||
mdbuf[0] = 0; /* keep the compiler quiet. */
|
|
||||||
error(0, "Digest authentication requested on url (%s), but SSL not compiled!",
|
|
||||||
octstr_get_cstr(url));
|
|
||||||
#endif
|
|
||||||
done:
|
done:
|
||||||
octstr_destroy(xauth_value);
|
octstr_destroy(xauth_value);
|
||||||
octstr_destroy(realm);
|
octstr_destroy(realm);
|
||||||
|
|
|
@ -63,11 +63,8 @@ static void *load_module(mCfgGrp *grp, char *config_key,
|
||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
|
|
||||||
panic(0,
|
panic(0, "Unable to load dynamic libary (%s): %s",
|
||||||
"Error, unable to load dynamic libary (%s): "
|
octstr_get_cstr(s), dlerror());
|
||||||
"libhandle is %s, funcs is %s, err=%s",
|
|
||||||
octstr_get_cstr(s),
|
|
||||||
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
|
|
||||||
else
|
else
|
||||||
retval = y;
|
retval = y;
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
|
|
|
@ -58,11 +58,9 @@ static void *load_module(mCfgGrp *grp, char *config_key, char *symbolname,
|
||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
|
|
||||||
panic(0,
|
panic(0, "Unable to load dynamic libary (%s): %s",
|
||||||
"Error, unable to load dynamic libary (%s): "
|
|
||||||
"libhandle is %s, funcs is %s, err=%s",
|
|
||||||
octstr_get_cstr(s),
|
octstr_get_cstr(s),
|
||||||
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
|
dlerror());
|
||||||
else
|
else
|
||||||
retval = y;
|
retval = y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue