Skip to content

Commit ad71767

Browse files
d-w-moorealanking
authored andcommitted
[#730] remove delimiter semicolon in StartupPack option tag
1 parent 4315b8d commit ad71767

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

irods/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def client_logging(flag=True, handler=None):
7171
MAX_SQL_ATTR = 50
7272
MAX_PATH_ALLOWED = 1024
7373
MAX_NAME_LEN = MAX_PATH_ALLOWED + 64
74+
LONG_NAME_LEN = 256
7475
RESPONSE_LEN = 16
7576
CHALLENGE_LEN = 64
7677
MAX_SQL_ROWS = 256

irods/connection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import datetime
88
import errno
99
import irods.password_obfuscation as obf
10-
from irods import MAX_NAME_LEN
10+
from irods import LONG_NAME_LEN, MAX_NAME_LEN
1111
from irods.exception import PAM_AUTH_PASSWORD_INVALID_TTL
1212
from ast import literal_eval as safe_eval
1313
import re
@@ -305,6 +305,9 @@ def _connect(self):
305305
# No client-server negotiation
306306
if not self.requires_cs_negotiation():
307307

308+
if len(main_message.option) >= LONG_NAME_LEN:
309+
message = "Application name too long."
310+
raise ValueError(message)
308311
# Send startup pack without negotiation request
309312
msg = iRODSMessage(msg_type="RODS_CONNECT", msg=main_message)
310313
self.send(msg)
@@ -322,7 +325,10 @@ def _connect(self):
322325
validate_policy(client_policy)
323326

324327
# Send startup pack with negotiation request
325-
main_message.option = "{};{}".format(main_message.option, REQUEST_NEGOTIATION)
328+
main_message.option = "{}{}".format(main_message.option, REQUEST_NEGOTIATION)
329+
if len(main_message.option) >= LONG_NAME_LEN:
330+
message = f"Application name too long when appended with string {REQUEST_NEGOTIATION!r}."
331+
raise ValueError(message)
326332
msg = iRODSMessage(msg_type="RODS_CONNECT", msg=main_message)
327333
self.send(msg)
328334

0 commit comments

Comments
 (0)