I think your fix is alright. 1024 characters is an overkill for an XMPP JID. The resource part of a JID is limited to 255 by the spec, so somthing larger than 255 may be required.
I’ll try and raise a fault on JIRA as soon as I get a chance.
Resources identifiers are case-sensitive and are limited to 256 bytes. They may include any Unicode character greater than #x20, except #xFFFE and #xFFFF.
2.5 Limited Resources
To date, resource identifiers have not had a fixed limit on their length. This document seeks to limit it to 256 bytes for the following reasons:
In order to perform JID manipulations safely, one cannot use stack space if there is no limit. This forces temporary calculations onto the heap which is unnecessarily costly.
As a fixed length character field, a resource identifier is more easily stored in, searched on, and retrieved from a database. If an end user may store an encyclopedia’s worth of information in their resource, then the only way it can be stored without truncating it is to store it as a large object (BLOB or CLOB). Depending on the database used, that makes it either grossly inefficient or impossible to search on.
There exist denial of service attacks stemming from an unlimited resource length.
The issue for me is is not with the spec max size. It is the limitation in the implementation
Right now, we need to fix the install script for Openfire that is broken with mySQL 5.6.2, but works fine with HSQLDB (embedded database) and probably the others (which I could not test)
Any DB (mySQL expert) who can through some light on why strings with 1024 characters are no more acceptable in mySQL 5.6.2, but were alright in 5.2 and what is the alternative?
How do we recode this?
CREATE TABLE ofRoster (
rosterID BIGINT NOT NULL,
username VARCHAR(64) NOT NULL,
jid VARCHAR(1024) NOT NULL,
sub TINYINT NOT NULL,
ask TINYINT NOT NULL,
recv TINYINT NOT NULL,
nick VARCHAR(255),
PRIMARY KEY (rosterID),
INDEX ofRoster_unameid_idx (username),
INDEX ofRoster_jid_idx (jid)
);
Thanks Flow. I can confirm this works and is a better fix that truncating JID to 255
CREATE TABLE ofRoster (
rosterID BIGINT NOT NULL,
username VARCHAR(64) NOT NULL,
jid VARCHAR(1024) NOT NULL,
sub TINYINT NOT NULL,
ask TINYINT NOT NULL,
recv TINYINT NOT NULL,
nick VARCHAR(255),
PRIMARY KEY (rosterID),
INDEX ofRoster_unameid_idx (username),
INDEX ofRoster_jid_idx (jid(255))
);
It did not like 256 key length for JID using default character set.
so for us n00bs that depend on commands … what did you do to fix this, I am having to migrate my old openfire server to a new serverhost. As such the old DB is toast (that is why I am moving it) I am switching from the embeded DB to a MySQL db for a couple of reasons. But I have encountered this error on the new install.
I have linked OF-654 with OF-697 thinking maybe newer mysql jdbc driver can fix this issue too, but now i doubt. Dele, Flow can you clarify? New driver is already in the trunk.
I first changed driver myself and it had no effect. The script has to be modified. I still have to deal with this issue on every new deployment of Openfire with SQL