- Add svn diff from upstream (r67-r74)
- Add patch for GNA bug #16239 (Segfaults on reset connection due to double-freed memory) Reported by: Anton Yuzhaninov <citrin@citrin.ru>
This commit is contained in:
parent
6643223069
commit
7be8397b18
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=265393
3 changed files with 627 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
PORTNAME= mu-conference
|
PORTNAME= mu-conference
|
||||||
PORTVERSION= 0.8
|
PORTVERSION= 0.8
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= net-im
|
CATEGORIES= net-im
|
||||||
MASTER_SITES= http://download.gna.org/mu-conference/
|
MASTER_SITES= http://download.gna.org/mu-conference/
|
||||||
DISTNAME= ${PORTNAME}_${PORTVERSION}
|
DISTNAME= ${PORTNAME}_${PORTVERSION}
|
||||||
|
|
152
net-im/mu-conference/files/patch-bug-16239
Normal file
152
net-im/mu-conference/files/patch-bug-16239
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
--- src/jcomp/jcr_main_stream_error.c.orig 2010-11-25 19:20:57.000000000 +0300
|
||||||
|
+++ src/jcomp/jcr_main_stream_error.c 2010-11-25 19:22:05.000000000 +0300
|
||||||
|
@@ -60,7 +60,6 @@ void jcr_main_close_stream(void) {
|
||||||
|
g_source_remove(jcr->gmain_watch_source);
|
||||||
|
g_io_channel_shutdown(jcr->gio, TRUE, NULL);
|
||||||
|
g_io_channel_unref(jcr->gio);
|
||||||
|
- g_io_channel_unref(jcr->gio);
|
||||||
|
close(jcr->fd);
|
||||||
|
|
||||||
|
|
||||||
|
--- src/jcomp/jcr_deliver.c.orig 2010-11-26 16:16:52.000000000 +0300
|
||||||
|
+++ src/jcomp/jcr_deliver.c 2010-11-26 16:21:34.000000000 +0300
|
||||||
|
@@ -33,7 +33,7 @@ void deliver(dpacket d, void *a) {
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
- log_debug(JDBG, "queued %d bytes : >>> %s <<<", strlen(xmlnode2str(d->x)), xmlnode2str(d->x));
|
||||||
|
+ log_debug(JDBG, "queued %lu bytes : >>> %s <<<", strlen(xmlnode2str(d->x)), xmlnode2str(d->x));
|
||||||
|
g_async_queue_push(jcr->dqueue, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ void jcr_queue_deliver(void *a) {
|
||||||
|
log_warn(JDBG, "Send packet failed, dropping packet");
|
||||||
|
}
|
||||||
|
|
||||||
|
- log_debug(JDBG, "wrote %d packets of %d bytes", pkts, bytes);
|
||||||
|
+ log_debug(JDBG, "wrote %d packets of %lu bytes", pkts, bytes);
|
||||||
|
// fprintf(stderr, "wrote %d packets of %d bytes\n", pkts, bytes);
|
||||||
|
if (left==0){
|
||||||
|
//queue is empty, flushing the socket
|
||||||
|
@@ -99,7 +99,7 @@ void jcr_queue_deliver(void *a) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log_warn(JDBG, "packet delivery thread exiting.");
|
||||||
|
- log_warn(JDBG, " Last DvryQ Buffer='%.*s'", buffer->len, buffer->str);
|
||||||
|
+ log_warn(JDBG, " Last DvryQ Buffer='%.*s'", (int)buffer->len, buffer->str);
|
||||||
|
g_string_free(buffer, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- src/jcomp/jcr_log.c.orig 2010-11-26 14:40:12.000000000 +0300
|
||||||
|
+++ src/jcomp/jcr_log.c 2010-11-26 14:41:46.000000000 +0300
|
||||||
|
@@ -79,8 +79,8 @@ void log_alert(char *zone, const char *f
|
||||||
|
g_static_mutex_lock(&_jcr_log_lock);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(logmsg, 512, fmt, ap);
|
||||||
|
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "%s: %s", zone, logmsg);
|
||||||
|
va_end(ap);
|
||||||
|
+ g_log(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "%s: %s", zone, logmsg);
|
||||||
|
g_static_mutex_unlock(&_jcr_log_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -92,8 +92,8 @@ void log_error(char *zone, const char *f
|
||||||
|
g_static_mutex_lock(&_jcr_log_lock);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(logmsg, 512, fmt, ap);
|
||||||
|
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s: %s", zone, logmsg);
|
||||||
|
va_end(ap);
|
||||||
|
+ g_log(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s: %s", zone, logmsg);
|
||||||
|
g_static_mutex_unlock(&_jcr_log_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -105,8 +105,8 @@ void log_notice(char *zone, const char *
|
||||||
|
g_static_mutex_lock(&_jcr_log_lock);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(logmsg, 512, fmt, ap);
|
||||||
|
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, "%s: %s", zone, logmsg);
|
||||||
|
va_end(ap);
|
||||||
|
+ g_log(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, "%s: %s", zone, logmsg);
|
||||||
|
g_static_mutex_unlock(&_jcr_log_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -118,8 +118,8 @@ void log_warn(char *zone, const char *fm
|
||||||
|
g_static_mutex_lock(&_jcr_log_lock);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(logmsg, 512, fmt, ap);
|
||||||
|
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "%s: %s", zone, logmsg);
|
||||||
|
va_end(ap);
|
||||||
|
+ g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "%s: %s", zone, logmsg);
|
||||||
|
g_static_mutex_unlock(&_jcr_log_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@ void log_debug(char *zone, const char *f
|
||||||
|
g_static_mutex_lock(&_jcr_log_lock);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(logmsg, 512, fmt, ap);
|
||||||
|
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %s", zone, logmsg);
|
||||||
|
va_end(ap);
|
||||||
|
+ g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %s", zone, logmsg);
|
||||||
|
g_static_mutex_unlock(&_jcr_log_lock);
|
||||||
|
}
|
||||||
|
--- src/jcomp/jcr_elements.c.orig 2007-11-10 13:37:38.000000000 +0300
|
||||||
|
+++ src/jcomp/jcr_elements.c 2010-11-26 16:25:23.000000000 +0300
|
||||||
|
@@ -172,7 +172,7 @@ gboolean jcr_read_data(GIOChannel *src,
|
||||||
|
if (rc != G_IO_STATUS_NORMAL) {
|
||||||
|
if (gerr != NULL) {
|
||||||
|
log_warn(JDBG, "Main Channel Error: rc=%d, %d '%s' '%s'", rc,
|
||||||
|
- gerr->code, gerr->domain, gerr->message);
|
||||||
|
+ gerr->code, g_quark_to_string(gerr->domain), gerr->message);
|
||||||
|
g_error_free(gerr);
|
||||||
|
} else {
|
||||||
|
log_warn(JDBG, "Main Channel Error: rc=%d", rc);
|
||||||
|
@@ -186,7 +186,7 @@ gboolean jcr_read_data(GIOChannel *src,
|
||||||
|
|
||||||
|
if (XML_Parse(jcr->parser, jcr->recv_buffer, bytes_read, 0) == 0) {
|
||||||
|
log_warn(JDBG, "XML Parsing Error: '%s'", (char *)XML_ErrorString(XML_GetErrorCode(jcr->parser)));
|
||||||
|
- log_warn(JDBG, " Last Rcvd Buffer='%.*s'", bytes_read, jcr->recv_buffer);
|
||||||
|
+ log_warn(JDBG, " Last Rcvd Buffer='%.*s'", (int)bytes_read, jcr->recv_buffer);
|
||||||
|
jcr_main_close_stream();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
--- ./src/jcomp/jcr_base_connect.c.orig 2010-11-26 16:40:01.000000000 +0300
|
||||||
|
+++ ./src/jcomp/jcr_base_connect.c 2010-11-26 16:40:15.000000000 +0300
|
||||||
|
@@ -84,7 +84,7 @@ void jcr_send_start_stream(void) {
|
||||||
|
if (rc != G_IO_STATUS_NORMAL) {
|
||||||
|
log_warn(JDBG, "Opening XML stream failed, rc=%d", rc);
|
||||||
|
} else {
|
||||||
|
- log_debug(JDBG, "Opening XML stream: sent %d bytes", bytes);
|
||||||
|
+ log_debug(JDBG, "Opening XML stream: sent %lu bytes", bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
--- ./src/conference.c.orig 2010-11-26 16:41:33.000000000 +0300
|
||||||
|
+++ ./src/conference.c 2010-11-26 16:42:53.000000000 +0300
|
||||||
|
@@ -1079,7 +1079,7 @@ void conference(instance i, xmlnode x)
|
||||||
|
tp = pool_new();
|
||||||
|
|
||||||
|
/* Allocate space for cni struct and link to instance */
|
||||||
|
- log_debug(NAME, "[%s] Malloc: _cni=%d", FZONE, sizeof(_cni));
|
||||||
|
+ log_debug(NAME, "[%s] Malloc: _cni=%lu", FZONE, sizeof(_cni));
|
||||||
|
master = pmalloco(i->p, sizeof(_cni));
|
||||||
|
|
||||||
|
master->i = i;
|
||||||
|
--- ./src/conference_room.c.orig 2010-11-26 16:44:18.000000000 +0300
|
||||||
|
+++ ./src/conference_room.c 2010-11-26 16:44:37.000000000 +0300
|
||||||
|
@@ -1426,7 +1426,7 @@ cnr con_room_new(cni master, jid roomid,
|
||||||
|
/* Create pool for room struct */
|
||||||
|
p = pool_new();
|
||||||
|
room = pmalloco(p, sizeof(_cnr));
|
||||||
|
- log_debug(NAME, "[%s] Malloc: _cnr = %d", FZONE, sizeof(_cnr));
|
||||||
|
+ log_debug(NAME, "[%s] Malloc: _cnr = %lu", FZONE, sizeof(_cnr));
|
||||||
|
room->p = p;
|
||||||
|
room->master = master;
|
||||||
|
|
||||||
|
@@ -1448,7 +1448,7 @@ cnr con_room_new(cni master, jid roomid,
|
||||||
|
|
||||||
|
/* Initialise room history */
|
||||||
|
room->history = pmalloco(p, sizeof(_cnh) * master->history); /* make array of xmlnodes */
|
||||||
|
- log_debug(NAME, "[%s] Malloc: history = %d", FZONE, sizeof(_cnh) * master->history);
|
||||||
|
+ log_debug(NAME, "[%s] Malloc: history = %lu", FZONE, sizeof(_cnh) * master->history);
|
||||||
|
|
||||||
|
/* Room time */
|
||||||
|
room->start = now;
|
474
net-im/mu-conference/files/patch-svn-67-74
Normal file
474
net-im/mu-conference/files/patch-svn-67-74
Normal file
|
@ -0,0 +1,474 @@
|
||||||
|
Index: include/lib.h
|
||||||
|
===================================================================
|
||||||
|
--- include/lib.h (revision 67)
|
||||||
|
+++ include/lib.h (working copy)
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
@@ -101,6 +102,7 @@
|
||||||
|
char *j_strdup(const char *str); /* provides NULL safe strdup wrapper */
|
||||||
|
char *j_strcat(char *dest, char *txt); /* strcpy() clone */
|
||||||
|
int j_strcmp(const char *a, const char *b); /* provides NULL safe strcmp wrapper */
|
||||||
|
+int j_strcasecmp(const char *a, const char *b); /* provides NULL safe strcasecmp wrapper */
|
||||||
|
int j_strncmp(const char *a, const char *b, int i); /* provides NULL safe strncmp wrapper */
|
||||||
|
int j_strncasecmp(const char *a, const char *b, int i); /* provides NULL safe strncasecmp wrapper */
|
||||||
|
int j_strlen(const char *a); /* provides NULL safe strlen wrapper */
|
||||||
|
@@ -299,10 +301,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
- unsigned long H[5];
|
||||||
|
- unsigned long W[80];
|
||||||
|
+ uint32_t H[5];
|
||||||
|
+ uint32_t W[80];
|
||||||
|
int lenW;
|
||||||
|
- unsigned long sizeHi,sizeLo;
|
||||||
|
+ uint32_t sizeHi,sizeLo;
|
||||||
|
} j_SHA_CTX;
|
||||||
|
|
||||||
|
|
||||||
|
Index: include/conference.h
|
||||||
|
===================================================================
|
||||||
|
--- include/conference.h (revision 67)
|
||||||
|
+++ include/conference.h (working copy)
|
||||||
|
@@ -258,6 +258,7 @@
|
||||||
|
/* Adds extended presence info to a presence packet */
|
||||||
|
void add_status_code(xmlnode presence, char *status); /* add a muc status code to a presence stanza */
|
||||||
|
void add_room_status_codes(xmlnode presence, cnr room); /* add room specific status codes (logging, anonymous, ...) */
|
||||||
|
+int check_affiliation(GHashTable * ght, jid user, char * affiliation_name); /* Check if user as a particular affiliation */
|
||||||
|
int is_sadmin(cni master, jid user); /* Check if user is server admin */
|
||||||
|
int is_owner(cnr room, jid user); /* Check if user is room owner */
|
||||||
|
int is_admin(cnr room, jid user); /* Check if user is room admin */
|
||||||
|
Index: src/utils.c
|
||||||
|
===================================================================
|
||||||
|
--- src/utils.c (revision 67)
|
||||||
|
+++ src/utils.c (working copy)
|
||||||
|
@@ -136,6 +136,45 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Generic function to check if an user as a particular affiliation */
|
||||||
|
+int check_affiliation(GHashTable * ght, jid user, char * affiliation_name)
|
||||||
|
+{
|
||||||
|
+ char ujid[3072];
|
||||||
|
+
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s", user->user, user->server);
|
||||||
|
+
|
||||||
|
+ if(g_hash_table_lookup(ght, ujid) != NULL )
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is %s? >%s< - Yes (case 1)", FZONE, affiliation_name, jid_full(user));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if(g_hash_table_lookup(ght, user->server) != NULL )
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is %s? >%s< - Yes (case 2)", FZONE, affiliation_name, jid_full(user));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s/%s", user->user, user->server, user->resource);
|
||||||
|
+
|
||||||
|
+ if(g_hash_table_lookup(ght, ujid) != NULL )
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is %s? >%s< - Yes (case 3)", FZONE, affiliation_name, jid_full(user));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s/%s", user->server, user->resource);
|
||||||
|
+
|
||||||
|
+ if(g_hash_table_lookup(ght, ujid) != NULL )
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is %s? >%s< - Yes (case 4)", FZONE, affiliation_name, jid_full(user));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ log_debug(NAME, "[%s] Is %s? >%s< - No", FZONE, affiliation_name, jid_full(user));
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Is the user a Service Admin? */
|
||||||
|
int is_sadmin(cni master, jid user)
|
||||||
|
{
|
||||||
|
@@ -159,62 +198,46 @@
|
||||||
|
/* Is the user an owner for that room */
|
||||||
|
int is_owner(cnr room, jid user)
|
||||||
|
{
|
||||||
|
- char ujid[2048];
|
||||||
|
- char cjid[2048];
|
||||||
|
-
|
||||||
|
if(room == NULL || user == NULL)
|
||||||
|
{
|
||||||
|
log_warn(NAME, "[%s] ERR: Missing variable in is_owner", FZONE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", user->user, user->server);
|
||||||
|
- if(room->creator)
|
||||||
|
- {
|
||||||
|
- snprintf(cjid, sizeof(cjid), "%s@%s", room->creator->user, room->creator->server);
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- snprintf(cjid, sizeof(cjid), "@");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
log_debug(NAME, "[%s] Is Owner? >%s<", FZONE, jid_full(user));
|
||||||
|
|
||||||
|
/* Server admin can override */
|
||||||
|
if(is_sadmin(room->master, user))
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is Owner? >%s< - Yes (service admin)", FZONE, jid_full(user));
|
||||||
|
return 2;
|
||||||
|
- else if(j_strcmp(cjid, ujid) == 0)
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if(room->creator && j_strcmp(user->user, room->creator->user) == 0 && j_strcmp(user->server, room->creator->server) == 0)
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is Owner? >%s< - Yes (creator)", FZONE, jid_full(user));
|
||||||
|
return 1;
|
||||||
|
- else if(g_hash_table_lookup(room->owner, ujid) != NULL )
|
||||||
|
- return 1;
|
||||||
|
- else
|
||||||
|
- return 0;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
+ return check_affiliation(room->owner, user, "Owner");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is the user in the admin affiliation list for that room */
|
||||||
|
int is_admin(cnr room, jid user)
|
||||||
|
{
|
||||||
|
- char ujid[2048];
|
||||||
|
-
|
||||||
|
if(room == NULL || user == NULL)
|
||||||
|
{
|
||||||
|
log_warn(NAME, "[%s] ERR: Missing variable in is_admin", FZONE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", user->user, user->server);
|
||||||
|
- log_debug(NAME, "[%s] Is Admin? >%s<", FZONE, jid_full(user));
|
||||||
|
-
|
||||||
|
if(is_owner(room, user))
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Is Admin? >%s< - Yes (owner)", FZONE, jid_full(user));
|
||||||
|
return 2;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if(g_hash_table_lookup(room->admin, ujid) != NULL )
|
||||||
|
- return 1;
|
||||||
|
- else if(g_hash_table_lookup(room->admin, user->server) != NULL )
|
||||||
|
- return 1;
|
||||||
|
- else
|
||||||
|
- return 0;
|
||||||
|
+ return check_affiliation(room->admin, user, "Admin");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is the user in the moderator role list for that room */
|
||||||
|
@@ -271,16 +294,12 @@
|
||||||
|
/* Is the user in the member affiliation list for that room */
|
||||||
|
int is_member(cnr room, jid user)
|
||||||
|
{
|
||||||
|
- char ujid[2048];
|
||||||
|
-
|
||||||
|
if(room == NULL || user == NULL)
|
||||||
|
{
|
||||||
|
log_warn(NAME, "[%s] ERR: Missing variable in is_member", FZONE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", user->user, user->server);
|
||||||
|
-
|
||||||
|
/* Owner is automatically a member */
|
||||||
|
if(is_owner(room, user))
|
||||||
|
{
|
||||||
|
@@ -295,42 +314,19 @@
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if(g_hash_table_lookup(room->member, ujid) != NULL )
|
||||||
|
- {
|
||||||
|
- log_debug(NAME, "[%s] Is Member? >%s< - Yes (case 1)", FZONE, jid_full(user));
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
- else if(g_hash_table_lookup(room->member, user->server) != NULL )
|
||||||
|
- {
|
||||||
|
- log_debug(NAME, "[%s] Is Member? >%s< - Yes (case 2)", FZONE, jid_full(user));
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- log_debug(NAME, "[%s] Is Member? >%s< - No", FZONE, jid_full(user));
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ return check_affiliation(room->member, user, "Member");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is the user in the outcast affiliation list for that room */
|
||||||
|
int is_outcast(cnr room, jid user)
|
||||||
|
{
|
||||||
|
- char ujid[2048];
|
||||||
|
-
|
||||||
|
if(room == NULL || user == NULL)
|
||||||
|
{
|
||||||
|
log_warn(NAME, "[%s] ERR: Missing variable in is_outcast", FZONE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", user->user, user->server);
|
||||||
|
-
|
||||||
|
- if(g_hash_table_lookup(room->outcast, ujid) != NULL )
|
||||||
|
- return 1;
|
||||||
|
- else if(g_hash_table_lookup(room->outcast, user->server) != NULL )
|
||||||
|
- return 1;
|
||||||
|
- else
|
||||||
|
- return 0;
|
||||||
|
+ return check_affiliation(room->outcast, user, "Outcast");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only return 1 if visitor */
|
||||||
|
Index: src/conference_room.c
|
||||||
|
===================================================================
|
||||||
|
--- src/conference_room.c (revision 67)
|
||||||
|
+++ src/conference_room.c (working copy)
|
||||||
|
@@ -1018,7 +1018,7 @@
|
||||||
|
|
||||||
|
if( nick == NULL)
|
||||||
|
{
|
||||||
|
- log_debug(NAME, "[%s] No receipient, returning error", FZONE);
|
||||||
|
+ log_debug(NAME, "[%s] No recipient, returning error", FZONE);
|
||||||
|
|
||||||
|
jutil_error(jp->x,TERROR_BAD);
|
||||||
|
deliver(dpacket_new(jp->x),NULL);
|
||||||
|
@@ -1031,6 +1031,15 @@
|
||||||
|
{
|
||||||
|
id = jid_new(xmlnode_pool(item), nick);
|
||||||
|
|
||||||
|
+ if (id == NULL)
|
||||||
|
+ {
|
||||||
|
+ log_debug(NAME, "[%s] Bad recipient, returning error", FZONE);
|
||||||
|
+ jutil_error(jp->x,TERROR_BAD);
|
||||||
|
+ deliver(dpacket_new(jp->x),NULL);
|
||||||
|
+
|
||||||
|
+ xmlnode_free(item);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
key = j_strdup(jid_full(jid_user(jid_fix(id))));
|
||||||
|
g_hash_table_insert(room->member, key, (void*)item);
|
||||||
|
}
|
||||||
|
@@ -1498,7 +1507,7 @@
|
||||||
|
|
||||||
|
room->creator = jid_new(room->p, jid_full(jid_user(admin->realid)));
|
||||||
|
|
||||||
|
- add_affiliate(room->owner, admin->realid, NULL);
|
||||||
|
+ add_affiliate(room->owner, jid_user(admin->realid), NULL);
|
||||||
|
|
||||||
|
log_debug(NAME, "[%s] Added new admin: %s to room %s", FZONE, jid_full(jid_fix(owner)), jid_full(room->id));
|
||||||
|
}
|
||||||
|
Index: src/roles.c
|
||||||
|
===================================================================
|
||||||
|
--- src/roles.c (revision 67)
|
||||||
|
+++ src/roles.c (working copy)
|
||||||
|
@@ -73,14 +73,37 @@
|
||||||
|
xmlnode old;
|
||||||
|
xmlnode store;
|
||||||
|
xmlnode node;
|
||||||
|
- char ujid[2048];
|
||||||
|
+ char ujid[3072];
|
||||||
|
|
||||||
|
if(userid == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+
|
||||||
|
+ if(userid->user == NULL)
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s", userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s/%s", userid->server, userid->resource);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s/%s", userid->user, userid->server, userid->resource);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
old = g_hash_table_lookup(hash, ujid);
|
||||||
|
|
||||||
|
/* User not previously registered. Set up */
|
||||||
|
@@ -121,18 +144,42 @@
|
||||||
|
xmlnode old;
|
||||||
|
xmlnode store;
|
||||||
|
xmlnode node;
|
||||||
|
- char ujid[2048];
|
||||||
|
+ char ujid[3072];
|
||||||
|
|
||||||
|
if(userid == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+ if(userid->user == NULL)
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s", userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s/%s", userid->server, userid->resource);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s/%s", userid->user, userid->server, userid->resource);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
old = g_hash_table_lookup(hash, ujid);
|
||||||
|
|
||||||
|
if(old == NULL)
|
||||||
|
+ {
|
||||||
|
return 1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
store = xmlnode_dup(old);
|
||||||
|
|
||||||
|
@@ -158,14 +205,36 @@
|
||||||
|
xmlnode store;
|
||||||
|
xmlnode current;
|
||||||
|
char *userjid;
|
||||||
|
- char ujid[2048];
|
||||||
|
+ char ujid[3072];
|
||||||
|
|
||||||
|
if(userid == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+ if(userid->user == NULL)
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s", userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s/%s", userid->server, userid->resource);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if(userid->resource == NULL)
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s", userid->user, userid->server);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ snprintf(ujid, sizeof(ujid), "%s@%s/%s", userid->user, userid->server, userid->resource);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
store = g_hash_table_lookup(hash, ujid);
|
||||||
|
|
||||||
|
if(store == NULL)
|
||||||
|
Index: src/conference.c
|
||||||
|
===================================================================
|
||||||
|
--- src/conference.c (revision 67)
|
||||||
|
+++ src/conference.c (working copy)
|
||||||
|
@@ -538,6 +538,15 @@
|
||||||
|
xmlnode_hide_attrib(jp->x, "type");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // clean the packet from any x muc#user tag
|
||||||
|
+ for( node = xmlnode_get_firstchild(jp->x); node != NULL; node = xmlnode_get_nextsibling(node)) {
|
||||||
|
+ if (xmlnode_get_name(node)==NULL || strcmp("x",xmlnode_get_name(node))!=0) continue; // check if the node is a "x" node
|
||||||
|
+ if(NSCHECK(node, NS_MUC_USER))
|
||||||
|
+ {
|
||||||
|
+ xmlnode_hide(node);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
priority = jutil_priority(jp->x);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -578,7 +587,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't allow user if locknicks is set and resource != JID user */
|
||||||
|
- if ( ((master->locknicks || room->locknicks) && (j_strcmp(jp->to->resource, jp->from->user) != 0)) && !is_sadmin(master, jp->from) ) {
|
||||||
|
+ if ( ((master->locknicks || room->locknicks) && (j_strcasecmp(jp->to->resource, jp->from->user) != 0)) && !is_sadmin(master, jp->from) ) {
|
||||||
|
log_debug(NAME, "[%s] Nicknames locked - Requested nick %s doesn't match required username %s",
|
||||||
|
FZONE, jp->to->resource, jp->from->user);
|
||||||
|
|
||||||
|
Index: src/jabberd/str.c
|
||||||
|
===================================================================
|
||||||
|
--- src/jabberd/str.c (revision 67)
|
||||||
|
+++ src/jabberd/str.c (working copy)
|
||||||
|
@@ -65,11 +65,15 @@
|
||||||
|
if(a == NULL || b == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- while(*a == *b && *a != '\0' && *b != '\0'){ a++; b++; }
|
||||||
|
+ return strcmp(a, b);
|
||||||
|
+}
|
||||||
|
|
||||||
|
- if(*a == *b) return 0;
|
||||||
|
+int j_strcasecmp(const char *a, const char *b)
|
||||||
|
+{
|
||||||
|
+ if(a == NULL || b == NULL)
|
||||||
|
+ return -1;
|
||||||
|
|
||||||
|
- return -1;
|
||||||
|
+ return strcasecmp(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
int j_strncmp(const char *a, const char *b, int i)
|
||||||
|
Index: src/jabberd/sha.c
|
||||||
|
===================================================================
|
||||||
|
--- src/jabberd/sha.c (revision 67)
|
||||||
|
+++ src/jabberd/sha.c (working copy)
|
||||||
|
@@ -50,7 +50,7 @@
|
||||||
|
*/
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
ctx->W[ctx->lenW / 4] <<= 8;
|
||||||
|
- ctx->W[ctx->lenW / 4] |= (unsigned long)dataIn[i];
|
||||||
|
+ ctx->W[ctx->lenW / 4] |= (uint32_t)dataIn[i];
|
||||||
|
if ((++ctx->lenW) % 64 == 0) {
|
||||||
|
shaHashBlock(ctx);
|
||||||
|
ctx->lenW = 0;
|
||||||
|
@@ -109,7 +109,7 @@
|
||||||
|
|
||||||
|
static void shaHashBlock(j_SHA_CTX *ctx) {
|
||||||
|
int t;
|
||||||
|
- unsigned long A,B,C,D,E,TEMP;
|
||||||
|
+ uint32_t A,B,C,D,E,TEMP;
|
||||||
|
|
||||||
|
for (t = 16; t <= 79; t++)
|
||||||
|
ctx->W[t] =
|
Loading…
Reference in a new issue