Project

General

Profile

Bug #6911

tigase.server.BasicComponent#getDefHostName seems to return empty/invalid value

Added by Wojciech Kapcia TigaseTeam 9 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Database:
n/a
Applicable version:
7.1.3
Source Code Disclaimer:

Description

It seems that tigase.server.BasicComponent#getDefHostName returns either empty or invalid value. Occurances with version 7.1.4 and 7.1.3-SNAPSHOT.

Associated revisions

Revision 4ba4cb5e (diff)
Added by W Administrator 4 months ago

#6911 don't accept empty-string explicit configuration for primary/secondary host; don't accept empty-domain in (Bare)JID methods

Revision 1c509527 (diff)
Added by W Administrator 4 months ago

#6911 don't accept empty-string explicit configuration for primary/secondary host; don't accept empty-domain in (Bare)JID methods

Revision bf8ebb78 (diff)
Added by W Administrator 4 months ago

#6911 bump tigase-utils dependency version due to fixes in it

History

#1 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam 8 months ago

  • Status changed from New to In Progress
  • Assignee changed from Andrzej Wójcik to Wojciech Kapcia

I've looked for possible causes of this issue and for me it looks like the only way for getDefHostName() to return empty JID (BareJID with empty domain part) is caused by settings -Dtigase-primary-address to an empty value (adding -Dtigase-primary-address= to Tigase options in tigase.conf.

This is caused by the fact that InetAddress::getByName(tigasePrimaryHost) is NOT throwing an exception if tigasePrimaryHost is set to an empty string, causing Tigase to accept this empty string as default hostname.

Additionally, BareJID accepts domain of BareJID to be an empty string. In my opinion, this should not be allowed and we should:

  • throw TigaseStringprepException for methods bareJIDInstance()
  • return null for methods bareJIDInstanceNS (or throw NPE)

I think that we should also check if tigase-secondary-address does not have similar issues.

#2 Updated by Wojciech Kapcia TigaseTeam 4 months ago

  • Status changed from In Progress to In QA
  • % Done changed from 0 to 100

Andrzej Wójcik wrote:

I've looked for possible causes of this issue and for me it looks like the only way for getDefHostName() to return empty JID (BareJID with empty domain part) is caused by settings -Dtigase-primary-address to an empty value (adding -Dtigase-primary-address= to Tigase options in tigase.conf.

This is caused by the fact that InetAddress::getByName(tigasePrimaryHost) is NOT throwing an exception if tigasePrimaryHost is set to an empty string, causing Tigase to accept this empty string as default hostname.

Thank you for pointing this out - I fixed both places in stable and master.

Additionally, BareJID accepts domain of BareJID to be an empty string. In my opinion, this should not be allowed and we should:

  • throw TigaseStringprepException for methods bareJIDInstance()
  • return null for methods bareJIDInstanceNS (or throw NPE)

You are correct according to 2.2. Domainpart:

it is the primary identifier and is the only **REQUIRED** element of a JID (a mere domainpart is a valid JID)

I added checks in JIDInstance methods and accompanying tests.

#3 Updated by Wojciech Kapcia TigaseTeam 3 months ago

  • Status changed from In QA to Closed

Also available in: Atom PDF