head 1.17; access; symbols OPENPKG_E1_MP_HEAD:1.7 OPENPKG_E1_MP:1.7 OPENPKG_E1_MP_2_STABLE:1.7 OPENPKG_E1_FP:1.7 OPENPKG_2_STABLE_MP:1.7 OPENPKG_2_STABLE_20061018:1.7 OPENPKG_2_STABLE_20060622:1.7 OPENPKG_2_STABLE:1.7.0.6 OPENPKG_2_STABLE_BP:1.7 OPENPKG_2_5_RELEASE:1.7 OPENPKG_2_5_SOLID:1.7.0.4 OPENPKG_2_5_SOLID_BP:1.7 OPENPKG_2_4_RELEASE:1.7 OPENPKG_2_4_SOLID:1.7.0.2 OPENPKG_2_4_SOLID_BP:1.7 OPENPKG_CW_FP:1.7 OPENPKG_2_3_RELEASE:1.6 OPENPKG_2_3_SOLID:1.6.0.2 OPENPKG_2_3_SOLID_BP:1.6 OPENPKG_2_2_RELEASE:1.3.2.1 OPENPKG_2_2_SOLID:1.3.0.2 OPENPKG_2_2_SOLID_BP:1.3; locks; strict; comment @# @; 1.17 date 2009.07.02.16.12.56; author rse; state Exp; branches; next 1.16; commitid xjD3VqgZgWJcE9Ut; 1.16 date 2008.05.23.11.01.35; author rse; state Exp; branches; next 1.15; commitid PIXd0BYL6TYvW44t; 1.15 date 2008.01.22.16.06.32; author rse; state Exp; branches; next 1.14; commitid uaAcvpHTcovgyqOs; 1.14 date 2007.12.28.09.34.45; author rse; state Exp; branches; next 1.13; commitid BC9uuBXpK7uGbbLs; 1.13 date 2007.10.18.07.28.06; author rse; state Exp; branches; next 1.12; commitid IVKL7UprQ0tJL2Cs; 1.12 date 2007.10.02.06.17.48; author rse; state Exp; branches; next 1.11; commitid L6t9sWIhK2JuTYzs; 1.11 date 2007.09.24.07.32.46; author rse; state Exp; branches; next 1.10; commitid 4sFR27czGn0XyXys; 1.10 date 2007.09.24.06.13.18; author rse; state Exp; branches; next 1.9; commitid o8UTJmzYF7ND7Xys; 1.9 date 2007.07.31.14.15.48; author cs; state Exp; branches; next 1.8; commitid 0opIIoKmjzk2zVrs; 1.8 date 2007.07.27.06.35.15; author rse; state Exp; branches; next 1.7; commitid 0kJLBFq443O09nrs; 1.7 date 2005.03.02.12.36.36; author ms; state Exp; branches; next 1.6; 1.6 date 2005.02.18.16.41.56; author rse; state Exp; branches 1.6.2.1; next 1.5; 1.5 date 2004.10.18.18.01.32; author rse; state Exp; branches; next 1.4; 1.4 date 2004.10.13.19.14.09; author rse; state Exp; branches; next 1.3; 1.3 date 2004.10.03.17.27.39; author rse; state Exp; branches 1.3.2.1; next 1.2; 1.2 date 2004.10.03.16.51.07; author rse; state Exp; branches; next 1.1; 1.1 date 2003.12.17.08.31.14; author rse; state Exp; branches; next ; 1.6.2.1 date 2005.03.25.18.58.32; author rse; state Exp; branches; next ; 1.3.2.1 date 2004.10.13.19.14.40; author rse; state Exp; branches; next ; desc @@ 1.17 log @upgrading package: jabberd 2.2.8 -> 2.2.8.91 @ text @Index: etc/c2s.xml.dist.in --- etc/c2s.xml.dist.in.orig 2009-06-30 11:38:16 +0200 +++ etc/c2s.xml.dist.in 2009-06-30 20:45:22 +0200 @@@@ -50,18 +50,16 @@@@ - + - jabberd/c2s + - local3 + - @@@@ -137,7 +135,7 @@@@ --> - 0.0.0.0 + 127.0.0.1 @@@@ -331,7 +329,7 @@@@ @@pkglibdir@@ - sqlite + db Index: etc/router.xml.dist.in --- etc/router.xml.dist.in.orig 2009-06-30 11:38:16 +0200 +++ etc/router.xml.dist.in 2009-06-30 20:45:06 +0200 @@@@ -8,24 +8,22 @@@@ @@localstatedir@@/jabberd/pid/router.pid - + - jabberd/router + - local3 + - - 0.0.0.0 + 127.0.0.1 5347 Index: etc/s2s.xml.dist.in --- etc/s2s.xml.dist.in.orig 2009-06-30 11:38:16 +0200 +++ etc/s2s.xml.dist.in 2009-06-30 20:45:06 +0200 @@@@ -60,25 +60,23 @@@@ - + - jabberd/s2s + - local3 + - - 0.0.0.0 + 127.0.0.1 5269 - + - jabberd/sm + - local3 + - sqlite + db Index: sm/mod_iq_time.c --- sm/mod_iq_time.c.orig 2009-06-30 11:38:15 +0200 +++ sm/mod_iq_time.c 2009-06-30 20:45:06 +0200 @@@@ -39,6 +39,7 @@@@ static mod_ret_t _iq_time_pkt_sm(mod_instance_t mi, pkt_t pkt) { time_t t; + time_t tzone; struct tm *tm; char buf[64]; char *c; @@@@ -78,7 +79,8 @@@@ datetime_out(t, dt_DATETIME, buf, 64); nad_insert_elem(pkt->nad, 2, NAD_ENS(pkt->nad, 1), "utc", buf); #ifdef HAVE_TZSET - snprintf(buf, 64, "%+03d:%02d", -((int)timezone)/(60*60), -((int)timezone)%(60*60)); + tzone = (time_t)((long)mktime(gmtime(&t)) - (long)t); + snprintf(buf, 64, "%+03d:%02d", (int) -tzone/(60*60), (int) -tzone%(60*60)); #else snprintf(buf, 64, "%+03d:%02d", (int) tm->tm_gmtoff/(60*60), (int) tm->tm_gmtoff%(60*60)); #endif Index: sm/mod_roster.c --- sm/mod_roster.c.orig 2009-06-30 11:38:15 +0200 +++ sm/mod_roster.c 2009-06-30 20:45:06 +0200 @@@@ -635,6 +635,9 @@@@ if(user->sessions == NULL) return mod_PASS; + /* We have to free old packet - Lemming's memory leak fix */ + pkt_free(pkt); + /* build a new packet to push out to everyone */ pkt = pkt_create(user->sm, "iq", "set", NULL, NULL); pkt_id_new(pkt); Index: util/util.h --- util/util.h.orig 2009-06-30 11:38:16 +0200 +++ util/util.h 2009-06-30 20:45:06 +0200 @@@@ -30,6 +30,8 @@@@ #include #include #include +#include +#include #include @ 1.16 log @upgrading package: jabberd 2.1.24.1 -> 2.2.0 @ text @d2 2 a3 2 --- etc/c2s.xml.dist.in.orig 2008-05-22 17:36:32 +0200 +++ etc/c2s.xml.dist.in 2008-05-23 08:29:23 +0200 d26 1 a26 1 @@@@ -130,7 +128,7 @@@@ d35 1 a35 1 @@@@ -294,7 +292,7 @@@@ d39 1 a39 1 - mysql d45 2 a46 2 --- etc/router.xml.dist.in.orig 2008-05-22 17:36:32 +0200 +++ etc/router.xml.dist.in 2008-05-23 08:29:23 +0200 d77 2 a78 2 --- etc/s2s.xml.dist.in.orig 2008-05-22 17:36:32 +0200 +++ etc/s2s.xml.dist.in 2008-05-23 08:29:23 +0200 d108 1 a108 1 - mysql d139 2 a140 2 --- sm/mod_iq_time.c.orig 2008-05-22 17:36:28 +0200 +++ sm/mod_iq_time.c 2008-05-23 08:29:23 +0200 d160 3 a162 3 --- sm/mod_roster.c.orig 2008-05-22 17:36:28 +0200 +++ sm/mod_roster.c 2008-05-23 08:29:23 +0200 @@@@ -639,6 +639,9 @@@@ d173 2 a174 2 --- util/util.h.orig 2008-05-22 17:36:32 +0200 +++ util/util.h 2008-05-23 08:29:23 +0200 @ 1.15 log @upgrading package: jabberd 2.1.21 -> 2.1.22 @ text @d2 2 a3 2 --- etc/c2s.xml.dist.in.orig 2008-01-21 16:17:03 +0100 +++ etc/c2s.xml.dist.in 2008-01-22 16:57:57 +0100 d26 1 a26 1 @@@@ -128,7 +126,7 @@@@ d35 1 a35 1 @@@@ -292,7 +290,7 @@@@ a43 25 Index: etc/resolver.xml.dist.in --- etc/resolver.xml.dist.in.orig 2008-01-21 16:17:03 +0100 +++ etc/resolver.xml.dist.in 2008-01-22 16:57:57 +0100 @@@@ -50,18 +50,16 @@@@ - + - jabberd/resolver + - local3 + - d56 1 a56 1 @@@@ -263,7 +261,7 @@@@ d67 1 a67 1 +++ etc/resolver.xml.dist.in 2007-07-27 08:15:22 +0200 d92 1 a92 1 +++ etc/router.xml.dist.in 2007-07-27 08:15:22 +0200 d123 2 a124 2 --- etc/s2s.xml.dist.in.orig 2007-04-09 16:19:52 +0200 +++ etc/s2s.xml.dist.in 2007-07-27 08:15:22 +0200 d156 2 a157 2 --- etc/sm.xml.dist.in.orig 2007-07-20 01:39:48 +0200 +++ etc/sm.xml.dist.in 2007-07-27 08:16:56 +0200 d184 21 d206 3 a208 3 --- sm/mod_roster.c.orig 2007-07-20 01:39:48 +0200 +++ sm/mod_roster.c 2007-07-27 08:15:22 +0200 @@@@ -628,6 +628,9 @@@@ d219 2 a220 2 --- util/util.h.orig 2007-07-20 21:23:33 +0200 +++ util/util.h 2007-07-27 08:15:22 +0200 @ 1.8 log @upgrading package: jabberd 2.0s11 -> 2.1.11 @ text @d1 21 @ 1.7 log @remove redundant patchcode affecting code block already handled in shtool(1) subst @ text @a0 43 Index: c2s/authreg_ldap.c --- c2s/authreg_ldap.c.orig 2004-04-26 07:47:19 +0200 +++ c2s/authreg_ldap.c 2004-10-18 19:57:24 +0200 @@@@ -70,6 +70,24 @@@@ return ld_errno; } +/** entry-point function to be called when following referrals. + this forces a re-bind, since Active Directory required you to + re-bind this makes it work with M$ Windows AD. + -- Juan F Arjona (jfarjona at jfarjona.com). */ +static int rebindProc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *mdata) +{ + moddata_t data = mdata; + data->ld = ld; + if (ldap_simple_bind_s(data->ld, data->binddn, data->bindpw)) { + log_write(data->ar->c2s->log, LOG_ERR, "ldap: bind failed(to %s): %s", + url, ldap_err2string(_ldap_get_lderrno(data->ld))); + ldap_unbind_s(data->ld); + data->ld = NULL; + return NULL; + } + return LDAP_SUCCESS; +} + /** connect to the ldap host */ static int _ldap_connect(moddata_t data) { @@@@ -151,6 +169,14 @@@@ snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); + if (ldap_set_rebind_proc(data->ld, &rebindProc,data) ) { + log_write(data->ar->c2s->log, LOG_ERR, "ldap: set_rebind_proc failed: %s", + ldap_err2string(_ldap_get_lderrno(data->ld))); + ldap_unbind_s(data->ld); + data->ld = NULL; + return NULL; + } + if(ldap_search_s(data->ld, basedn, LDAP_SCOPE_SUBTREE, filter, no_attrs, 0, &result)) { log_write(data->ar->c2s->log, LOG_ERR, "ldap: search %s failed: %s", filter, ldap_err2string(_ldap_get_lderrno(data->ld))); d2 3 a4 3 --- etc/c2s.xml.dist.in.orig 2004-04-26 07:47:21 +0200 +++ etc/c2s.xml.dist.in 2004-10-18 19:57:24 +0200 @@@@ -46,18 +46,16 @@@@ d26 2 a27 2 @@@@ -78,7 +76,7 @@@@ d35 3 a37 3 @@@@ -206,7 +204,7 @@@@ d42 2 a43 2 d45 3 a47 3 --- etc/resolver.xml.dist.in.orig 2003-10-30 00:30:06 +0100 +++ etc/resolver.xml.dist.in 2004-10-18 19:57:24 +0200 @@@@ -46,18 +46,16 @@@@ d70 2 a71 2 --- etc/router.xml.dist.in.orig 2003-10-23 02:43:56 +0200 +++ etc/router.xml.dist.in 2004-10-18 19:57:24 +0200 d102 3 a104 3 --- etc/s2s.xml.dist.in.orig 2004-04-25 12:28:29 +0200 +++ etc/s2s.xml.dist.in 2004-10-18 19:57:24 +0200 @@@@ -56,25 +56,23 @@@@ d135 3 a137 3 --- etc/sm.xml.dist.in.orig 2004-04-02 06:34:17 +0200 +++ etc/sm.xml.dist.in 2004-10-18 19:57:24 +0200 @@@@ -49,24 +49,22 @@@@ d153 3 a155 4 - a156 2 d164 5 a168 5 --- sm/mod_roster.c.orig 2004-10-05 06:34:10 +0200 +++ sm/mod_roster.c 2004-10-18 19:57:35 +0200 @@@@ -570,6 +570,9 @@@@ /* We have to free old packet - Lemming's memory leak fix */ pkt_free(pkt); d175 1 a175 1 ns = nad_add_namespace(pkt->nad, uri_ROSTER, NULL); d177 2 a178 2 --- util/util.h.orig 2004-10-05 06:27:50 +0200 +++ util/util.h 2004-10-18 19:57:24 +0200 d186 2 a187 2 #ifdef HAVE_NETINET_IN_H # include @ 1.6 log @try to workaround the build problems @ text @a233 12 Index: ltmain.sh --- ltmain.sh.orig Mon Nov 29 07:08:33 2004 +++ ltmain.sh Fri Feb 18 17:40:06 2005 @@@@ -561,7 +561,7 @@@@ # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" # user sometimes does CC=-gcc so we need to match that to 'gcc' - trimedcc="${CC/${host}-}" + trimedcc="${CC}" case "$base_compile " in "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*) tagname=CC @ 1.6.2.1 log @MFC: use rerolled vendor 2.0s6 tarball @ text @d234 12 @ 1.5 log @upgrading package: jabberd 2.0s3 -> 2.0s4 @ text @d234 12 @ 1.4 log @apply contributor patch set @ text @d1 6 a6 9 Index: util/util.h --- util/util.h.orig 2004-05-31 23:31:06 +0200 +++ util/util.h 2004-09-22 21:26:44 +0200 @@@@ -30,6 +30,8 @@@@ #include #include #include +#include +#include d8 20 a27 3 #ifdef HAVE_NETINET_IN_H # include @@@@ -107,6 +108,7 @@@@ d29 15 a43 6 int size; struct pfree *cleanup; + struct pfree *cleanup_tail; struct pheap *heap; #ifdef POOL_DEBUG char name[8], zone[32]; d45 2 a46 2 --- etc/c2s.xml.dist.in.orig 2004-04-26 07:42:53 +0200 +++ etc/c2s.xml.dist.in 2004-09-22 21:48:33 +0200 d88 2 a89 2 --- etc/resolver.xml.dist.in.orig 2004-04-01 06:56:55 +0200 +++ etc/resolver.xml.dist.in 2004-09-22 21:48:58 +0200 d113 2 a114 2 --- etc/router.xml.dist.in.orig 2004-04-01 06:56:55 +0200 +++ etc/router.xml.dist.in 2004-09-22 21:49:28 +0200 d145 2 a146 2 --- etc/s2s.xml.dist.in.orig 2004-04-21 15:29:27 +0200 +++ etc/s2s.xml.dist.in 2004-09-22 21:50:02 +0200 d178 2 a179 2 --- etc/sm.xml.dist.in.orig 2004-04-02 06:32:31 +0200 +++ etc/sm.xml.dist.in 2004-09-22 21:50:56 +0200 a208 115 Index: c2s/authreg_ldap.c --- c2s/authreg_ldap.c.orig 2004-05-31 23:31:05 +0200 +++ c2s/authreg_ldap.c 2004-10-03 18:56:15 +0200 @@@@ -70,6 +70,24 @@@@ return ld_errno; } +/** entry-point function to be called when following referrals. + this forces a re-bind, since Active Directory required you to + re-bind this makes it work with M$ Windows AD. + -- Juan F Arjona (jfarjona at jfarjona.com). */ +static int rebindProc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *mdata) +{ + moddata_t data = mdata; + data->ld = ld; + if (ldap_simple_bind_s(data->ld, data->binddn, data->bindpw)) { + log_write(data->ar->c2s->log, LOG_ERR, "ldap: bind failed(to %s): %s", + url, ldap_err2string(_ldap_get_lderrno(data->ld))); + ldap_unbind_s(data->ld); + data->ld = NULL; + return NULL; + } + return LDAP_SUCCESS; +} + /** connect to the ldap host */ static int _ldap_connect(moddata_t data) { @@@@ -151,6 +169,14 @@@@ snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); + if (ldap_set_rebind_proc(data->ld, &rebindProc,data) ) { + log_write(data->ar->c2s->log, LOG_ERR, "ldap: set_rebind_proc failed: %s", + ldap_err2string(_ldap_get_lderrno(data->ld))); + ldap_unbind_s(data->ld); + data->ld = NULL; + return NULL; + } + if(ldap_search_s(data->ld, basedn, LDAP_SCOPE_SUBTREE, filter, no_attrs, 0, &result)) { log_write(data->ar->c2s->log, LOG_ERR, "ldap: search %s failed: %s", filter, ldap_err2string(_ldap_get_lderrno(data->ld))); Index: s2s/main.c --- s2s/main.c.orig 2004-05-31 23:31:05 +0200 +++ s2s/main.c 2004-10-13 19:44:00 +0200 @@@@ -62,7 +62,7 @@@@ /** pull values out of the config file */ static void _s2s_config_expand(s2s_t s2s) { - char *str, secret[40]; + char *str, secret[41]; int i, r; s2s->id = config_get_one(s2s->config, "id", 0); Index: scod/mech_plain.c --- scod/mech_plain.c.orig 2004-05-31 23:31:06 +0200 +++ scod/mech_plain.c 2004-10-13 19:44:03 +0200 @@@@ -63,7 +63,7 @@@@ } c++; - pass = (char *) malloc(sizeof(char) * (resplen - ((int) (c - resp)))); + pass = (char *) malloc(sizeof(char) * (resplen - ((int) (c - resp)) + 1)); strncpy(pass, c, (resplen - ((int) (c - resp)))); pass[resplen - ((int) (c - resp))] = '\0'; Index: sm/mod_announce.c --- sm/mod_announce.c.orig 2004-05-31 23:31:05 +0200 +++ sm/mod_announce.c 2004-10-13 19:44:20 +0200 @@@@ -45,9 +45,13 @@@@ os_t os; os_object_t o; os_type_t ot; + nad_t nad; int ns, elem, attr; char timestamp[18], telem[5]; - struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + struct tm tm; + + /* struct tm can vary in size depending on platform */ + memset(&tm, 0, sizeof(struct tm)); data->loaded = 1; @@@@ -55,7 +59,9 @@@@ if((ret = storage_get(mod->mm->sm->st, "motd-message", mod->mm->sm->id, NULL, &os)) == st_SUCCESS) { os_iter_first(os); o = os_iter_object(os); - if(os_object_get(o, "xml", (void **) &data->nad, &ot)) { + if(os_object_get(o, "xml", (void **) &nad, &ot)) { + /* Copy the nad, as the original is freed when the os is freed below */ + data->nad = nad_copy(nad); if((ns = nad_find_scoped_namespace(data->nad, uri_DELAY, NULL)) >= 0 && (elem = nad_find_elem(data->nad, 1, ns, "x", 1)) >= 0 && (attr = nad_find_attr(data->nad, elem, -1, "stamp", NULL)) >= 0) { @@@@ -197,6 +203,9 @@@@ os_object_t o; st_ret_t ret; + /* time of this packet */ + t = time(NULL); + /* we want messages addressed to /announce */ if(pkt->type != pkt_MESSAGE || strlen(pkt->to->resource) < 8 || strncmp(pkt->to->resource, "announce", 8) != 0) return mod_PASS; @@@@ -212,7 +221,7 @@@@ store = pkt_dup(pkt, NULL, NULL); - pkt_delay(store, time(NULL), mod->mm->sm->id); + pkt_delay(store, t, mod->mm->sm->id); /* prepare for storage */ os = os_new(); d210 5 a214 5 --- sm/mod_roster.c.orig 2004-05-31 23:31:05 +0200 +++ sm/mod_roster.c 2004-10-13 19:44:09 +0200 @@@@ -567,6 +567,9 @@@@ if(user->sessions == NULL) return mod_PASS; d222 9 a230 14 Index: sm/pkt.c --- sm/pkt.c.orig 2004-05-31 23:31:05 +0200 +++ sm/pkt.c 2004-10-13 19:44:27 +0200 @@@@ -352,12 +352,24 @@@@ jid_free(pkt->rto); pkt->rto = jid_new(pkt->sm->pc, pkt->to->domain, 0); + if(pkt->rto == NULL) { + log_debug(ZONE, "invalid to address on packet, unable to route"); + pkt_free(pkt); + return; + } + nad_set_attr(pkt->nad, 0, -1, "to", pkt->rto->domain, 0); d232 2 a233 129 if(pkt->rfrom != NULL) jid_free(pkt->rfrom); pkt->rfrom = jid_new(pkt->sm->pc, pkt->sm->id, 0); + if(pkt->rfrom == NULL) { + log_debug(ZONE, "invalid from address on packet, unable to route"); + pkt_free(pkt); + return; + } + nad_set_attr(pkt->nad, 0, -1, "from", pkt->rfrom->domain, 0); ret = mm_out_router(pkt->sm->mm, pkt); Index: sx/io.c --- sx/io.c.orig 2004-05-31 23:31:05 +0200 +++ sx/io.c 2004-10-13 19:43:49 +0200 @@@@ -106,7 +106,7 @@@@ } /* hand it to the app */ - if(plugin_error == 0) + if ((plugin_error == 0) && (s->state < state_CLOSING)) _sx_event(s, event_PACKET, (void *) nad); } Index: sx/ssl.c --- sx/ssl.c.orig 2004-05-31 23:31:06 +0200 +++ sx/ssl.c 2004-10-13 19:44:30 +0200 @@@@ -347,7 +347,42 @@@@ _sx_buffer_alloc_margin(buf, 0, pending); ret = SSL_read(sc->ssl, &(buf->data[buf->len]), pending); - if(ret <= 0) { + + if (ret == 0) + { + /* ret will equal zero if the SSL stream was closed. + (See the SSL_read manpage.) */ + + /* If the SSL Shutdown happened properly, + (i.e. we got an SSL "close notify") + then proccess the last packet recieved. */ + if (SSL_get_shutdown(sc->ssl) == SSL_RECEIVED_SHUTDOWN) + { + _sx_close(s); + break; + } + + /* If the SSL stream was just closed and not shutdown, + drop the last packet recieved. + WARNING: This may cause clients that use SSLv2 and + earlier to not log out properly. */ + + err = SSL_get_error(sc->ssl, ret); + + _sx_buffer_clear(buf); + + + if(err == SSL_ERROR_ZERO_RETURN) { + /* ssl channel closed, we're done */ + _sx_close(s); + } + + return -1; + } + else if(ret < 0) { + /* ret will be negative if the SSL stream needs + more data, or if there was a SSL error. + (See the SSL_read manpage.) */ err = SSL_get_error(sc->ssl, ret); /* ssl block incomplete, need more */ @@@@ -360,11 +395,6 @@@@ /* something's wrong */ _sx_buffer_clear(buf); - if(err == SSL_ERROR_ZERO_RETURN) { - /* ssl channel closed, we're done */ - _sx_close(s); - return -1; - } /* !!! need checks for renegotiation */ Index: util/nad.c --- util/nad.c.orig 2004-10-13 19:43:53 +0200 +++ util/nad.c 2004-10-13 19:44:35 +0200 @@@@ -734,7 +734,7 @@@@ for(ns = nad->elems[elem].ns; ns >= 0; ns = nad->nss[ns].next) { /* never explicitly declare the implicit xml namespace */ - if(nad->nss[ns].lprefix == strlen(uri_XML) && strncmp(uri_XML, nad->cdata + nad->nss[ns].iprefix, nad->nss[ns].lprefix) == 0) + if(nad->nss[ns].luri == strlen(uri_XML) && strncmp(uri_XML, nad->cdata + nad->nss[ns].iuri, nad->nss[ns].luri) == 0) continue; /* make space */ Index: util/xhash.c --- util/xhash.c.orig 2004-05-31 23:31:06 +0200 +++ util/xhash.c 2004-10-13 19:44:38 +0200 @@@@ -71,7 +71,7 @@@@ xhn n; int i = index % h->prime; for(n = &h->zen[i]; n != NULL; n = n->next) - if(n->key != NULL && strncmp(key, n->key, len) == 0) + if(n->key != NULL && (strlen(n->key)==len) && (strncmp(key, n->key, len) == 0)) return n; return NULL; } Index: util/pool.c --- util/pool.c.orig 2004-05-31 23:31:06 +0200 +++ util/pool.c 2004-10-13 19:43:56 +0200 @@@@ -85,13 +85,14 @@@@ if(p->cleanup == NULL) { p->cleanup = pf; + p->cleanup_tail = pf; return; } - /* fast forward to end of list */ - for(cur = p->cleanup; cur->next != NULL; cur = cur->next); - + /* append at end of list */ + cur = p->cleanup_tail; cur->next = pf; + p->cleanup_tail = pf; } /** create a cleanup tracker */ @ 1.3 log @apply a contributed patch @ text @d13 8 d229 229 @ 1.3.2.1 log @MFC: apply contributor patch set @ text @a12 8 @@@@ -107,6 +108,7 @@@@ { int size; struct pfree *cleanup; + struct pfree *cleanup_tail; struct pheap *heap; #ifdef POOL_DEBUG char name[8], zone[32]; a220 229 Index: s2s/main.c --- s2s/main.c.orig 2004-05-31 23:31:05 +0200 +++ s2s/main.c 2004-10-13 19:44:00 +0200 @@@@ -62,7 +62,7 @@@@ /** pull values out of the config file */ static void _s2s_config_expand(s2s_t s2s) { - char *str, secret[40]; + char *str, secret[41]; int i, r; s2s->id = config_get_one(s2s->config, "id", 0); Index: scod/mech_plain.c --- scod/mech_plain.c.orig 2004-05-31 23:31:06 +0200 +++ scod/mech_plain.c 2004-10-13 19:44:03 +0200 @@@@ -63,7 +63,7 @@@@ } c++; - pass = (char *) malloc(sizeof(char) * (resplen - ((int) (c - resp)))); + pass = (char *) malloc(sizeof(char) * (resplen - ((int) (c - resp)) + 1)); strncpy(pass, c, (resplen - ((int) (c - resp)))); pass[resplen - ((int) (c - resp))] = '\0'; Index: sm/mod_announce.c --- sm/mod_announce.c.orig 2004-05-31 23:31:05 +0200 +++ sm/mod_announce.c 2004-10-13 19:44:20 +0200 @@@@ -45,9 +45,13 @@@@ os_t os; os_object_t o; os_type_t ot; + nad_t nad; int ns, elem, attr; char timestamp[18], telem[5]; - struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + struct tm tm; + + /* struct tm can vary in size depending on platform */ + memset(&tm, 0, sizeof(struct tm)); data->loaded = 1; @@@@ -55,7 +59,9 @@@@ if((ret = storage_get(mod->mm->sm->st, "motd-message", mod->mm->sm->id, NULL, &os)) == st_SUCCESS) { os_iter_first(os); o = os_iter_object(os); - if(os_object_get(o, "xml", (void **) &data->nad, &ot)) { + if(os_object_get(o, "xml", (void **) &nad, &ot)) { + /* Copy the nad, as the original is freed when the os is freed below */ + data->nad = nad_copy(nad); if((ns = nad_find_scoped_namespace(data->nad, uri_DELAY, NULL)) >= 0 && (elem = nad_find_elem(data->nad, 1, ns, "x", 1)) >= 0 && (attr = nad_find_attr(data->nad, elem, -1, "stamp", NULL)) >= 0) { @@@@ -197,6 +203,9 @@@@ os_object_t o; st_ret_t ret; + /* time of this packet */ + t = time(NULL); + /* we want messages addressed to /announce */ if(pkt->type != pkt_MESSAGE || strlen(pkt->to->resource) < 8 || strncmp(pkt->to->resource, "announce", 8) != 0) return mod_PASS; @@@@ -212,7 +221,7 @@@@ store = pkt_dup(pkt, NULL, NULL); - pkt_delay(store, time(NULL), mod->mm->sm->id); + pkt_delay(store, t, mod->mm->sm->id); /* prepare for storage */ os = os_new(); Index: sm/mod_roster.c --- sm/mod_roster.c.orig 2004-05-31 23:31:05 +0200 +++ sm/mod_roster.c 2004-10-13 19:44:09 +0200 @@@@ -567,6 +567,9 @@@@ if(user->sessions == NULL) return mod_PASS; + /* We have to free old packet - Lemming's memory leak fix */ + pkt_free(pkt); + /* build a new packet to push out to everyone */ pkt = pkt_create(user->sm, "iq", "set", NULL, NULL); ns = nad_add_namespace(pkt->nad, uri_ROSTER, NULL); Index: sm/pkt.c --- sm/pkt.c.orig 2004-05-31 23:31:05 +0200 +++ sm/pkt.c 2004-10-13 19:44:27 +0200 @@@@ -352,12 +352,24 @@@@ jid_free(pkt->rto); pkt->rto = jid_new(pkt->sm->pc, pkt->to->domain, 0); + if(pkt->rto == NULL) { + log_debug(ZONE, "invalid to address on packet, unable to route"); + pkt_free(pkt); + return; + } + nad_set_attr(pkt->nad, 0, -1, "to", pkt->rto->domain, 0); if(pkt->rfrom != NULL) jid_free(pkt->rfrom); pkt->rfrom = jid_new(pkt->sm->pc, pkt->sm->id, 0); + if(pkt->rfrom == NULL) { + log_debug(ZONE, "invalid from address on packet, unable to route"); + pkt_free(pkt); + return; + } + nad_set_attr(pkt->nad, 0, -1, "from", pkt->rfrom->domain, 0); ret = mm_out_router(pkt->sm->mm, pkt); Index: sx/io.c --- sx/io.c.orig 2004-05-31 23:31:05 +0200 +++ sx/io.c 2004-10-13 19:43:49 +0200 @@@@ -106,7 +106,7 @@@@ } /* hand it to the app */ - if(plugin_error == 0) + if ((plugin_error == 0) && (s->state < state_CLOSING)) _sx_event(s, event_PACKET, (void *) nad); } Index: sx/ssl.c --- sx/ssl.c.orig 2004-05-31 23:31:06 +0200 +++ sx/ssl.c 2004-10-13 19:44:30 +0200 @@@@ -347,7 +347,42 @@@@ _sx_buffer_alloc_margin(buf, 0, pending); ret = SSL_read(sc->ssl, &(buf->data[buf->len]), pending); - if(ret <= 0) { + + if (ret == 0) + { + /* ret will equal zero if the SSL stream was closed. + (See the SSL_read manpage.) */ + + /* If the SSL Shutdown happened properly, + (i.e. we got an SSL "close notify") + then proccess the last packet recieved. */ + if (SSL_get_shutdown(sc->ssl) == SSL_RECEIVED_SHUTDOWN) + { + _sx_close(s); + break; + } + + /* If the SSL stream was just closed and not shutdown, + drop the last packet recieved. + WARNING: This may cause clients that use SSLv2 and + earlier to not log out properly. */ + + err = SSL_get_error(sc->ssl, ret); + + _sx_buffer_clear(buf); + + + if(err == SSL_ERROR_ZERO_RETURN) { + /* ssl channel closed, we're done */ + _sx_close(s); + } + + return -1; + } + else if(ret < 0) { + /* ret will be negative if the SSL stream needs + more data, or if there was a SSL error. + (See the SSL_read manpage.) */ err = SSL_get_error(sc->ssl, ret); /* ssl block incomplete, need more */ @@@@ -360,11 +395,6 @@@@ /* something's wrong */ _sx_buffer_clear(buf); - if(err == SSL_ERROR_ZERO_RETURN) { - /* ssl channel closed, we're done */ - _sx_close(s); - return -1; - } /* !!! need checks for renegotiation */ Index: util/nad.c --- util/nad.c.orig 2004-10-13 19:43:53 +0200 +++ util/nad.c 2004-10-13 19:44:35 +0200 @@@@ -734,7 +734,7 @@@@ for(ns = nad->elems[elem].ns; ns >= 0; ns = nad->nss[ns].next) { /* never explicitly declare the implicit xml namespace */ - if(nad->nss[ns].lprefix == strlen(uri_XML) && strncmp(uri_XML, nad->cdata + nad->nss[ns].iprefix, nad->nss[ns].lprefix) == 0) + if(nad->nss[ns].luri == strlen(uri_XML) && strncmp(uri_XML, nad->cdata + nad->nss[ns].iuri, nad->nss[ns].luri) == 0) continue; /* make space */ Index: util/xhash.c --- util/xhash.c.orig 2004-05-31 23:31:06 +0200 +++ util/xhash.c 2004-10-13 19:44:38 +0200 @@@@ -71,7 +71,7 @@@@ xhn n; int i = index % h->prime; for(n = &h->zen[i]; n != NULL; n = n->next) - if(n->key != NULL && strncmp(key, n->key, len) == 0) + if(n->key != NULL && (strlen(n->key)==len) && (strncmp(key, n->key, len) == 0)) return n; return NULL; } Index: util/pool.c --- util/pool.c.orig 2004-05-31 23:31:06 +0200 +++ util/pool.c 2004-10-13 19:43:56 +0200 @@@@ -85,13 +85,14 @@@@ if(p->cleanup == NULL) { p->cleanup = pf; + p->cleanup_tail = pf; return; } - /* fast forward to end of list */ - for(cur = p->cleanup; cur->next != NULL; cur = cur->next); - + /* append at end of list */ + cur = p->cleanup_tail; cur->next = pf; + p->cleanup_tail = pf; } /** create a cleanup tracker */ @ 1.2 log @upgrade to JabberD 2.0 (hopefully this isn't totally broken ;-) @ text @d178 43 @ 1.1 log @upgrading package: jabberd 1.4.2 -> 1.4.3 @ text @d1 9 a9 34 Index: jabberd/jabberd.h --- jabberd/jabberd.h.orig 2003-11-13 12:22:42.000000000 +0100 +++ jabberd/jabberd.h 2003-12-17 09:29:41.000000000 +0100 @@@@ -30,7 +30,7 @@@@ #include "lib/lib.h" #include #ifdef HAVE_SSL -#include +#include #endif /* HAVE_SSL */ #define VERSION "1.4.3" Index: jabberd/mio_ssl.c --- jabberd/mio_ssl.c.orig 2003-11-08 01:09:50.000000000 +0100 +++ jabberd/mio_ssl.c 2003-12-17 09:29:28.000000000 +0100 @@@@ -1,6 +1,6 @@@@ #include "jabberd.h" #ifdef HAVE_SSL -#include +#include HASHTABLE ssl__ctxs; extern int mio__errno; Index: jsm/modules/mod_auth_crypt.c --- jsm/modules/mod_auth_crypt.c.orig 2003-10-27 20:16:50.000000000 +0100 +++ jsm/modules/mod_auth_crypt.c 2003-12-17 09:28:50.000000000 +0100 @@@@ -28,7 +28,9 @@@@ * * --------------------------------------------------------------------------*/ #include "jsm.h" -#include "crypt.h" +#ifndef __FreeBSD__ +#include +#endif d11 167 a177 2 #define HASH_CRYPT 1 #define HASH_SHA1 2 @