Diffstat (limited to 'net-im/jabberd/files/jabberd-2.1.11-r1.patch') (more/less context) (show whitespace changes)
-rw-r--r-- | net-im/jabberd/files/jabberd-2.1.11-r1.patch | 20 |
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 | |||
@@ -48,191 +48,207 @@ index 099aec9..29dca26 100644 | |||
48 | - if test "x-$PGSQL_LIBDIR" != "x-"; then | 48 | - if test "x-$PGSQL_LIBDIR" != "x-"; then |
49 | - PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" | 49 | - PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" |
50 | - fi | 50 | - fi |
51 | - AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) | 51 | - AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) |
52 | - ]) | 52 | - ]) |
53 | - if test "x-$have_pgsql" != "x-yes" ; then | 53 | - if test "x-$have_pgsql" != "x-yes" ; then |
54 | - AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) | 54 | - AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) |
55 | - fi | 55 | - fi |
56 | +if test "x-$enable_pgsql" != "x-no" ; then | 56 | +if test "x-$enable_pgsql" != "x-no" ; then |
57 | +if test -x "$enable_pgsql" ; then | 57 | +if test -x "$enable_pgsql" ; then |
58 | + PGSQL_INCLUDE="$($enable_pgsql --includedir)" | 58 | + PGSQL_INCLUDE="$($enable_pgsql --includedir)" |
59 | + PGSQL_LIBDIR="$($enable_pgsql --libdir)" | 59 | + PGSQL_LIBDIR="$($enable_pgsql --libdir)" |
60 | + PGSQL_CFLAGS="-I$PGSQL_INCLUDE" | 60 | + PGSQL_CFLAGS="-I$PGSQL_INCLUDE" |
61 | + PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" | 61 | + PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" |
62 | + have_pgsql=yes | 62 | + have_pgsql=yes |
63 | + AC_DEFINE([STORAGE_POSTGRES],[1],[Define to 1 if you want to use PostgreSQL for storage.]) | 63 | + AC_DEFINE([STORAGE_POSTGRES],[1],[Define to 1 if you want to use PostgreSQL for storage.]) |
64 | + else# leave legacy detection intact for now | 64 | + else# leave legacy detection intact for now |
65 | + for i in /usr /usr/local /usr/local/pgsql ; do | 65 | + for i in /usr /usr/local /usr/local/pgsql ; do |
66 | + for j in include include/pgsql include/postgres include/postgresql "" ; do | 66 | + for j in include include/pgsql include/postgres include/postgresql "" ; do |
67 | + if test -r "$i/$j/libpq-fe.h" ; then | 67 | + if test -r "$i/$j/libpq-fe.h" ; then |
68 | + PGSQL_INCLUDE=$i/$j | 68 | + PGSQL_INCLUDE=$i/$j |
69 | + fi | 69 | + fi |
70 | + done | 70 | + done |
71 | + for lib in lib lib64 ; do | 71 | + for lib in lib lib64 ; do |
72 | + for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do | 72 | + for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do |
73 | + if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then | 73 | + if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then |
74 | + PGSQL_LIBDIR=$i/$j | 74 | + PGSQL_LIBDIR=$i/$j |
75 | + fi | 75 | + fi |
76 | + done | 76 | + done |
77 | + done | 77 | + done |
78 | + done | 78 | + done |
79 | + AC_CHECK_LIB([pq], [PQsetdbLogin], [ | 79 | + AC_CHECK_LIB([pq], [PQsetdbLogin], [ |
80 | + have_pgsql=yes | 80 | + have_pgsql=yes |
81 | + if test "x-$PGSQL_INCLUDE" != "x-"; then | 81 | + if test "x-$PGSQL_INCLUDE" != "x-"; then |
82 | + PGSQL_CFLAGS="-I $PGSQL_INCLUDE" | 82 | + PGSQL_CFLAGS="-I $PGSQL_INCLUDE" |
83 | + fi | 83 | + fi |
84 | + if test "x-$PGSQL_LIBDIR" != "x-"; then | 84 | + if test "x-$PGSQL_LIBDIR" != "x-"; then |
85 | + PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" | 85 | + PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" |
86 | + fi | 86 | + fi |
87 | + AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) | 87 | + AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) |
88 | + ]) | 88 | + ]) |
89 | + if test "x-$have_pgsql" != "x-yes" ; then | 89 | + if test "x-$have_pgsql" != "x-yes" ; then |
90 | + AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) | 90 | + AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) |
91 | + fi | 91 | + fi |
92 | +fi | 92 | +fi |
93 | fi | 93 | fi |
94 | AC_SUBST(PGSQL_CFLAGS) | 94 | AC_SUBST(PGSQL_CFLAGS) |
95 | AC_SUBST(PGSQL_LIBS) | 95 | AC_SUBST(PGSQL_LIBS) |
96 | diff --git a/etc/c2s.xml.dist.in b/etc/c2s.xml.dist.in | ||
97 | index 873a133..0589ada 100644 | ||
98 | --- a/etc/c2s.xml.dist.in | ||
99 | +++ b/etc/c2s.xml.dist.in | ||
100 | @@ -325,6 +325,11 @@ | ||
101 | |||
102 | <!-- PostgreSQL module configuration --> | ||
103 | <pgsql> | ||
104 | + <!-- PostgreSQL connection info --> | ||
105 | + <conninfo>dbname=jabberd2 user=jabberd2 password=secret</conninfo> | ||
106 | + | ||
107 | + <!-- The rest of connection settings are used only in absence of 'conninfo' --> | ||
108 | + | ||
109 | <!-- Database server host and port --> | ||
110 | <host>localhost</host> | ||
111 | <port>5432</port> | ||
96 | diff --git a/mio/mio_impl.h b/mio/mio_impl.h | 112 | diff --git a/mio/mio_impl.h b/mio/mio_impl.h |
97 | index 6f72a5c..cabdc67 100644 | 113 | index 6f72a5c..cabdc67 100644 |
98 | --- a/mio/mio_impl.h | 114 | --- a/mio/mio_impl.h |
99 | +++ b/mio/mio_impl.h | 115 | +++ b/mio/mio_impl.h |
100 | @@ -226,8 +226,12 @@ static void _mio_run(mio_t m, int timeout) | 116 | @@ -226,8 +226,12 @@ static void _mio_run(mio_t m, int timeout) |
101 | { | 117 | { |
102 | mio_fd_t fd = MIO_ITERATOR_FD(m,iter); | 118 | mio_fd_t fd = MIO_ITERATOR_FD(m,iter); |
103 | 119 | ||
104 | - /* skip dead slots */ | 120 | - /* skip dead slots */ |
105 | - if(FD(m,fd)->type == type_CLOSED) continue; | 121 | - if(FD(m,fd)->type == type_CLOSED) continue; |
106 | + /* deferred closing fd */ | 122 | + /* deferred closing fd */ |
107 | + if(FD(m,fd)->type == type_CLOSED) | 123 | + if(FD(m,fd)->type == type_CLOSED) |
108 | + { | 124 | + { |
109 | + MIO_FREE_FD(m, fd); | 125 | + MIO_FREE_FD(m, fd); |
110 | + continue; | 126 | + continue; |
111 | + } | 127 | + } |
112 | 128 | ||
113 | /* new conns on a listen socket */ | 129 | /* new conns on a listen socket */ |
114 | if(FD(m,fd)->type == type_LISTEN && MIO_CAN_READ(m,iter)) | 130 | if(FD(m,fd)->type == type_LISTEN && MIO_CAN_READ(m,iter)) |
115 | @@ -259,12 +263,6 @@ static void _mio_run(mio_t m, int timeout) | 131 | @@ -259,12 +263,6 @@ static void _mio_run(mio_t m, int timeout) |
116 | if(ACT(m, fd, action_WRITE, NULL) == 0) | 132 | if(ACT(m, fd, action_WRITE, NULL) == 0) |
117 | MIO_UNSET_WRITE(m, FD(m,fd)); | 133 | MIO_UNSET_WRITE(m, FD(m,fd)); |
118 | } | 134 | } |
119 | - | 135 | - |
120 | - /* deferred closing fd */ | 136 | - /* deferred closing fd */ |
121 | - if(FD(m,fd)->type == type_CLOSED) | 137 | - if(FD(m,fd)->type == type_CLOSED) |
122 | - { | 138 | - { |
123 | - MIO_FREE_FD(m, fd); | 139 | - MIO_FREE_FD(m, fd); |
124 | - } | 140 | - } |
125 | } | 141 | } |
126 | } | 142 | } |
127 | 143 | ||
128 | diff --git a/sm/main.c b/sm/main.c | 144 | diff --git a/sm/main.c b/sm/main.c |
129 | index 2f1439d..9f27829 100644 | 145 | index 2f1439d..9f27829 100644 |
130 | --- a/sm/main.c | 146 | --- a/sm/main.c |
131 | +++ b/sm/main.c | 147 | +++ b/sm/main.c |
132 | @@ -392,6 +392,7 @@ JABBER_MAIN("jabberd2sm", "Jabber 2 Session Manager", "Jabber Open Source Server | 148 | @@ -392,6 +392,7 @@ JABBER_MAIN("jabberd2sm", "Jabber 2 Session Manager", "Jabber Open Source Server |
133 | xhash_free(sm->acls); | 149 | xhash_free(sm->acls); |
134 | xhash_free(sm->features); | 150 | xhash_free(sm->features); |
135 | xhash_free(sm->xmlns); | 151 | xhash_free(sm->xmlns); |
136 | + xhash_free(sm->xmlns_refcount); | 152 | + xhash_free(sm->xmlns_refcount); |
137 | xhash_free(sm->users); | 153 | xhash_free(sm->users); |
138 | 154 | ||
139 | sx_free(sm->router); | 155 | sx_free(sm->router); |
140 | diff --git a/sm/mod_privacy.c b/sm/mod_privacy.c | 156 | diff --git a/sm/mod_privacy.c b/sm/mod_privacy.c |
141 | index 06f9e6e..5abf065 100644 | 157 | index 06f9e6e..5abf065 100644 |
142 | --- a/sm/mod_privacy.c | 158 | --- a/sm/mod_privacy.c |
143 | +++ b/sm/mod_privacy.c | 159 | +++ b/sm/mod_privacy.c |
144 | @@ -205,7 +205,7 @@ static int _privacy_user_load(mod_instance_t mi, user_t user) { | 160 | @@ -205,7 +205,7 @@ static int _privacy_user_load(mod_instance_t mi, user_t user) { |
145 | continue; | 161 | continue; |
146 | } | 162 | } |
147 | 163 | ||
148 | - pool_cleanup(zlist->p, free, zitem->jid); | 164 | - pool_cleanup(zlist->p, free, zitem->jid); |
149 | + pool_cleanup(zlist->p, jid_free, zitem->jid); | 165 | + pool_cleanup(zlist->p, jid_free, zitem->jid); |
150 | 166 | ||
151 | log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid)); | 167 | log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid)); |
152 | 168 | ||
153 | @@ -696,7 +696,7 @@ static mod_ret_t _privacy_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt) { | 169 | @@ -696,7 +696,7 @@ static mod_ret_t _privacy_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt) { |
154 | return -stanza_err_BAD_REQUEST; | 170 | return -stanza_err_BAD_REQUEST; |
155 | } | 171 | } |
156 | 172 | ||
157 | - pool_cleanup(p, free, zitem->jid); | 173 | - pool_cleanup(p, free, zitem->jid); |
158 | + pool_cleanup(p, jid_free, zitem->jid); | 174 | + pool_cleanup(p, jid_free, zitem->jid); |
159 | 175 | ||
160 | log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid)); | 176 | log_debug(ZONE, "jid item with value '%s'", jid_full(zitem->jid)); |
161 | 177 | ||
162 | diff --git a/storage/authreg_pgsql.c b/storage/authreg_pgsql.c | 178 | diff --git a/storage/authreg_pgsql.c b/storage/authreg_pgsql.c |
163 | index 1f15e83..8d3cf88 100644 | 179 | index 1f15e83..cb68e7d 100644 |
164 | --- a/storage/authreg_pgsql.c | 180 | --- a/storage/authreg_pgsql.c |
165 | +++ b/storage/authreg_pgsql.c | 181 | +++ b/storage/authreg_pgsql.c |
166 | @@ -304,7 +304,7 @@ int _ar_pgsql_check_sql( authreg_t ar, char * sql, char * types ) { | 182 | @@ -304,7 +304,7 @@ int _ar_pgsql_check_sql( authreg_t ar, char * sql, char * types ) { |
167 | 183 | ||
168 | /** start me up */ | 184 | /** start me up */ |
169 | int ar_init(authreg_t ar) { | 185 | int ar_init(authreg_t ar) { |
170 | - char *host, *port, *dbname, *user, *pass; | 186 | - char *host, *port, *dbname, *user, *pass; |
171 | + char *host, *port, *dbname, *user, *pass, *conninfo; | 187 | + char *host, *port, *dbname, *user, *pass, *conninfo; |
172 | char *create, *select, *setpassword, *delete; | 188 | char *create, *select, *setpassword, *delete; |
173 | char *table, *username, *realm; | 189 | char *table, *username, *realm; |
174 | char *template; | 190 | char *template; |
175 | @@ -391,15 +391,22 @@ int ar_init(authreg_t ar) { | 191 | @@ -391,15 +391,22 @@ int ar_init(authreg_t ar) { |
176 | free(setpassword); | 192 | free(setpassword); |
177 | free(delete); | 193 | free(delete); |
178 | 194 | ||
179 | - host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0); | 195 | - host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0); |
180 | - port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0); | 196 | - port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0); |
181 | - dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0); | 197 | - dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0); |
182 | - user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0); | 198 | - user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0); |
183 | - pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0); | 199 | - pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0); |
184 | - | 200 | - |
185 | - log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port ); | 201 | - log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port ); |
186 | + conninfo = config_get_one(ar->c2s->config,"authreg.pgsql.conninfo",0); | 202 | + conninfo = config_get_one(ar->c2s->config,"authreg.pgsql.conninfo",0); |
187 | + if(conninfo) { | 203 | + if(conninfo) { |
188 | +conn = PQconnect(conninfo); | ||
189 | +/* don't log connection info for it can contain password */ | 204 | +/* don't log connection info for it can contain password */ |
190 | +log_debug( ZONE, "pgsql connecting to the databse"); | 205 | +log_debug( ZONE, "pgsql connecting to the databse"); |
206 | +conn = PQconnectdb(conninfo); | ||
191 | + }else{ | 207 | + }else{ |
192 | +/* compatibility settings */ | 208 | +/* compatibility settings */ |
193 | +host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0); | 209 | +host = config_get_one(ar->c2s->config, "authreg.pgsql.host", 0); |
194 | +port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0); | 210 | +port = config_get_one(ar->c2s->config, "authreg.pgsql.port", 0); |
195 | +dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0); | 211 | +dbname = config_get_one(ar->c2s->config, "authreg.pgsql.dbname", 0); |
196 | +user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0); | 212 | +user = config_get_one(ar->c2s->config, "authreg.pgsql.user", 0); |
197 | +pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0); | 213 | +pass = config_get_one(ar->c2s->config, "authreg.pgsql.pass", 0); |
198 | +log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port ); | 214 | +log_debug( ZONE, "pgsql connecting as '%s' to database '%s' on %s:%s", user, dbname, host, port ); |
199 | +conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass); | 215 | +conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass); |
200 | + } | 216 | + } |
201 | 217 | ||
202 | - conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass); | 218 | - conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, pass); |
203 | if(conn == NULL) { | 219 | if(conn == NULL) { |
204 | log_write(ar->c2s->log, LOG_ERR, "pgsql: unable to allocate database connection state"); | 220 | log_write(ar->c2s->log, LOG_ERR, "pgsql: unable to allocate database connection state"); |
205 | return 1; | 221 | return 1; |
206 | diff --git a/sx/sasl_gsasl.c b/sx/sasl_gsasl.c | 222 | diff --git a/sx/sasl_gsasl.c b/sx/sasl_gsasl.c |
207 | index 69eeec2..0036c0f 100644 | 223 | index 69eeec2..0036c0f 100644 |
208 | --- a/sx/sasl_gsasl.c | 224 | --- a/sx/sasl_gsasl.c |
209 | +++ b/sx/sasl_gsasl.c | 225 | +++ b/sx/sasl_gsasl.c |
210 | @@ -338,6 +338,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, ch | 226 | @@ -338,6 +338,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, ch |
211 | if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) { | 227 | if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) { |
212 | _sx_debug(ZONE, "gsasl_step failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); | 228 | _sx_debug(ZONE, "gsasl_step failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); |
213 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); | 229 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); |
214 | + if(buf != NULL) free(buf); | 230 | + if(buf != NULL) free(buf); |
215 | return; | 231 | return; |
216 | } | 232 | } |
217 | } | 233 | } |
218 | @@ -350,6 +351,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, ch | 234 | @@ -350,6 +351,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, ch |
219 | if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) { | 235 | if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) { |
220 | _sx_debug(ZONE, "gsasl_step failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); | 236 | _sx_debug(ZONE, "gsasl_step failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); |
221 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); | 237 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); |
222 | + if(buf != NULL) free(buf); | 238 | + if(buf != NULL) free(buf); |
223 | return; | 239 | return; |
224 | } | 240 | } |
225 | 241 | ||
226 | diff --git a/util/jid.c b/util/jid.c | 242 | diff --git a/util/jid.c b/util/jid.c |
227 | index 695b15f..f4b0021 100644 | 243 | index 695b15f..f4b0021 100644 |
228 | --- a/util/jid.c | 244 | --- a/util/jid.c |
229 | +++ b/util/jid.c | 245 | +++ b/util/jid.c |
230 | @@ -332,7 +332,7 @@ static jid_t jid_reset_components_internal(jid_t jid, const unsigned char *node, | 246 | @@ -332,7 +332,7 @@ static jid_t jid_reset_components_internal(jid_t jid, const unsigned char *node, |
231 | else { | 247 | else { |
232 | /* allocate new data buffer */ | 248 | /* allocate new data buffer */ |
233 | jid->jid_data_len = node_l+domain_l+resource_l+3; | 249 | jid->jid_data_len = node_l+domain_l+resource_l+3; |
234 | - jid->jid_data = malloc(jid->jid_data_len); | 250 | - jid->jid_data = malloc(jid->jid_data_len); |
235 | + jid->jid_data = realloc(jid->jid_data, jid->jid_data_len); | 251 | + jid->jid_data = realloc(jid->jid_data, jid->jid_data_len); |
236 | } | 252 | } |
237 | 253 | ||
238 | /* copy to buffer */ | 254 | /* copy to buffer */ |