summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--net-im/jabberd/files/jabberd-2.1.11-r1.patch20
1 files changed, 18 insertions, 2 deletions
diff --git a/net-im/jabberd/files/jabberd-2.1.11-r1.patch b/net-im/jabberd/files/jabberd-2.1.11-r1.patch
index 441163c..6eba147 100644
--- a/net-im/jabberd/files/jabberd-2.1.11-r1.patch
+++ b/net-im/jabberd/files/jabberd-2.1.11-r1.patch
@@ -72,48 +72,64 @@ index 099aec9..29dca26 100644
+ for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do
+ if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then
+ PGSQL_LIBDIR=$i/$j
+ fi
+ done
+ done
+ done
+ AC_CHECK_LIB([pq], [PQsetdbLogin], [
+ have_pgsql=yes
+ if test "x-$PGSQL_INCLUDE" != "x-"; then
+ PGSQL_CFLAGS="-I $PGSQL_INCLUDE"
+ fi
+ if test "x-$PGSQL_LIBDIR" != "x-"; then
+ PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq"
+ fi
+ AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.])
+ ])
+ if test "x-$have_pgsql" != "x-yes" ; then
+ AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.])
+ fi
+ fi
fi
AC_SUBST(PGSQL_CFLAGS)
AC_SUBST(PGSQL_LIBS)
+diff --git a/etc/c2s.xml.dist.in b/etc/c2s.xml.dist.in
+index 873a133..0589ada 100644
+--- a/etc/c2s.xml.dist.in
++++ b/etc/c2s.xml.dist.in
+@@ -325,6 +325,11 @@
+
+ <!-- PostgreSQL module configuration -->
+ <pgsql>
++ <!-- PostgreSQL connection info -->
++ <conninfo>dbname=jabberd2 user=jabberd2 password=secret</conninfo>
++
++ <!-- The rest of connection settings are used only in absence of 'conninfo' -->
++
+ <!-- Database server host and port -->
+ <host>localhost</host>
+ <port>5432</port>
diff --git a/mio/mio_impl.h b/mio/mio_impl.h
index 6f72a5c..cabdc67 100644
--- a/mio/mio_impl.h
+++ b/mio/mio_impl.h
@@ -226,8 +226,12 @@ static void _mio_run(mio_t m, int timeout)
{
mio_fd_t fd = MIO_ITERATOR_FD(m,iter);
- /* skip dead slots */
- if(FD(m,fd)->type == type_CLOSED) continue;
+ /* deferred closing fd */
+ if(FD(m,fd)->type == type_CLOSED)
+ {
+ MIO_FREE_FD(m, fd);
+ continue;
+ }
/* new conns on a listen socket */
if(FD(m,fd)->type == type_LISTEN && MIO_CAN_READ(m,iter))
@@ -259,12 +263,6 @@ static void _mio_run(mio_t m, int timeout)
if(ACT(m, fd, action_WRITE, NULL) == 0)
MIO_UNSET_WRITE(m, FD(m,fd));
}
-
@@ -139,76 +155,76 @@ index 2f1439d..9f27829 100644
sx_free(sm->router);
diff --git a/sm/mod_privacy.c b/sm/mod_privacy.c
index 06f9e6e..5abf065 100644
--- a/sm/mod_privacy.c
+++ b/sm/mod_privacy.c
@@ -205,7 +205,7 @@ static int _privacy_user_load(mod_instance_t mi, user_t user) {
continue;
}
- pool_cleanup(zlist->p, free, zitem->jid);
+ pool_cleanup(zlist->p, jid_free, zitem->jid);
log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid));
@@ -696,7 +696,7 @@ static mod_ret_t _privacy_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt) {
return -stanza_err_BAD_REQUEST;
}
- pool_cleanup(p, free, zitem->jid);
+ pool_cleanup(p, jid_free, zitem->jid);
log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid));
diff --git a/storage/authreg_pgsql.c b/storage/authreg_pgsql.c
-index 1f15e83..8d3cf88 100644
+index 1f15e83..cb68e7d 100644
--- a/storage/authreg_pgsql.c
+++ b/storage/authreg_pgsql.c
@@ -304,7 +304,7 @@ int _ar_pgsql_check_sql( authreg_t ar, char * sql, char * types ) {
/** start me up */
int ar_init(authreg_t ar) {
- char *host, *port, *dbname, *user, *pass;
+ char *host, *port, *dbname, *user, *pass, *conninfo;
char *create, *select, *setpassword, *delete;
char *table, *username, *realm;
char *template;
@@ -391,15 +391,22 @@ int ar_init(authreg_t ar) {
free(setpassword);
free(delete);
- host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0);
- port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0);
- dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0);
- user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0);
- pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0);
-
- log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port );
+ conninfo = config_get_one(ar->c2s->config,"authreg.pgsql.conninfo",0);
+ if(conninfo) {
-+ conn = PQconnect(conninfo);
+ /* don't log connection info for it can contain password */
+ log_debug( ZONE, "pgsql connecting to the databse");
++ conn = PQconnectdb(conninfo);
+ }else{
+ /* compatibility settings */
+ host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0);
+ port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0);
+ dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0);
+ user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0);
+ pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0);
+ log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port );
+ conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass);
+ }
- conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass);
if(conn == NULL) {
log_write(ar->c2s->log, LOG_ERR, "pgsql: unable to allocate database connection state");
return 1;
diff --git a/sx/sasl_gsasl.c b/sx/sasl_gsasl.c
index 69eeec2..0036c0f 100644
--- a/sx/sasl_gsasl.c
+++ b/sx/sasl_gsasl.c
@@ -338,6 +338,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, ch
if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) {
_sx_debug(ZONE, "gsasl_step failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret));
_sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0);
+ if(buf != NULL) free(buf);