1
0
Fork 0

minor fixes for linux and dso loading

This commit is contained in:
bagyenda 2007-09-09 07:57:58 +00:00
parent 4308cb1446
commit e1f24fdeee
6 changed files with 18 additions and 40 deletions

View File

@ -32,6 +32,7 @@ AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_RANLIB
dnl add mmlib to the include path
INCLUDES='-I$(top_srcdir)/mmlib -I$(top_builddir)/mmlib'
@ -79,7 +80,7 @@ case "$host" in
CFLAGS="$CFLAGS -DDARWIN=1 -O4 -Wall"
LIB_EXT="dylib"
;;
*-linux-*)
*-linux*)
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -O4 -Wall"
LDFLAGS="$LDFLAGS -rdynamic"
;;

View File

@ -22,7 +22,7 @@ LIB = libmms_pgsql_queue.$(LIB_EXT)
ALL: $(LIB)
$(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:
rm -f *.o *~

View File

@ -2,7 +2,7 @@
-- (c) 2007 Digital Solutions
-- Licence: See http://mbuni.org/license.shtml
-- Author: P. A. Bagyenda <bagyenda@dsmagic.com>
-- Requires: PostgresQL v8.x
-- Requires: PostgresQL v8.2 and above
-- Master messages table
CREATE TABLE mms_messages (

View File

@ -26,10 +26,6 @@
#include "mms_queue.h"
#include "mms_uaprof.h"
#ifdef HAVE_LIBSSL
#include <openssl/md5.h>
#endif
Octstr *_mms_cfg_getx(mCfgGrp *grp, Octstr *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;
}
#define HASHLEN 16
static Octstr *make_url(HTTPURLParse *h);
/* 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;
int i, status = HTTP_UNAUTHORIZED, has_auth = 0, has_auth_int = 0;
HTTPURLParse *h = parse_url(url);
unsigned char mdbuf[1+HASHLEN*4], *xs;
char *m_qop = 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 ||
(algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0)) {
unsigned char *x = MD5((void *)&t, sizeof t, (void *)mdbuf);
cnonce = octstr_create_from_data((void *)x, 4);
cnonce = octstr_create("");
octstr_append_data(cnonce, (void *)&t, sizeof t);
octstr_binary_to_hex(cnonce,0);
}
/* Make A1 */
x = octstr_format("%S:%S:%S",
h->user, realm, h->pass ? h->pass : octstr_imm(""));
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
A1 = octstr_create_from_data((char *)xs, HASHLEN);
A1 = md5(x);
octstr_destroy(x);
if (algo != NULL && octstr_str_case_compare(algo, "MD5-sess") == 0) {
x = octstr_format("%S:%S:%S",
A1, nonce, cnonce);
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
octstr_destroy(A1);
A1 = octstr_create_from_data((char *)xs, HASHLEN);
A1 = md5(x);
octstr_destroy(x);
}
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;
m_qop = "auth-int";
xs = MD5((void *)octstr_get_cstr(body), octstr_len(body), (void *)mdbuf);
y = octstr_create_from_data((char *)xs, HASHLEN);
y = md5(body);
octstr_binary_to_hex(y,0);
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)
m_qop = "auth";
xs = MD5((void *)octstr_get_cstr(x), octstr_len(x), (void *)mdbuf);
A2 = octstr_create_from_data((char *)xs, HASHLEN);
A2 = md5(x);
octstr_destroy(x);
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
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);
rd = octstr_create_from_data((char *)xs, HASHLEN);
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);
/* Remove username, password, then remake URL */
if (h->user) octstr_destroy(h->user);
octstr_destroy(h->user);
h->user = NULL;
if (h->pass) octstr_destroy(h->pass);
octstr_destroy(h->pass);
h->pass = NULL;
xurl = make_url(h);
@ -1556,11 +1543,6 @@ static int fetch_url_with_auth(HTTPCaller *c, int method, Octstr *url, List *req
status = -1;
if (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:
octstr_destroy(xauth_value);
octstr_destroy(realm);

View File

@ -63,11 +63,8 @@ static void *load_module(mCfgGrp *grp, char *config_key,
#endif
))
panic(0,
"Error, unable to load dynamic libary (%s): "
"libhandle is %s, funcs is %s, err=%s",
octstr_get_cstr(s),
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
panic(0, "Unable to load dynamic libary (%s): %s",
octstr_get_cstr(s), dlerror());
else
retval = y;
octstr_destroy(s);

View File

@ -58,11 +58,9 @@ static void *load_module(mCfgGrp *grp, char *config_key, char *symbolname,
#endif
))
panic(0,
"Error, unable to load dynamic libary (%s): "
"libhandle is %s, funcs is %s, err=%s",
panic(0, "Unable to load dynamic libary (%s): %s",
octstr_get_cstr(s),
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
dlerror());
else
retval = y;
}