Skip to content

Commit 2d19eac

Browse files
committed
[_362][_522][_523] allow '=' and ';' in PAM passwords
1 parent 6a17f6f commit 2d19eac

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

Diff for: irods/api_number.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,7 @@
179179
"GET_RESOURCE_INFO_FOR_OPERATION_AN": 10220,
180180
"ATOMIC_APPLY_METADATA_OPERATIONS_APN": 20002,
181181
"GET_FILE_DESCRIPTOR_INFO_APN": 20000,
182-
"REPLICA_CLOSE_APN": 20004
182+
"REPLICA_CLOSE_APN": 20004,
183+
184+
"AUTH_PLUG_REQ_AN": 1201
183185
}

Diff for: irods/connection.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
from irods.message import (PamAuthRequest, PamAuthRequestOut)
2626

2727

28-
29-
ALLOW_PAM_LONG_TOKENS = True # True to fix [#279]
3028
# Message to be logged when the connection
3129
# destructor is called. Used in a unit test
3230
DESTRUCTOR_MSG = "connection __del__() called"
@@ -493,9 +491,10 @@ def _login_pam(self):
493491
if getattr(self,'DISALLOWING_PAM_PLAINTEXT',True):
494492
raise PlainTextPAMPasswordError
495493

496-
Pam_Long_Tokens = (ALLOW_PAM_LONG_TOKENS and (len(ctx) >= MAX_NAME_LEN))
494+
use_dedicated_pam_api = len(ctx) >= MAX_NAME_LEN or \
495+
{';','='}.intersection(set(new_pam_password))
497496

498-
if Pam_Long_Tokens:
497+
if use_dedicated_pam_api:
499498
message_body = PamAuthRequest( pamUser = self.account.client_user,
500499
pamPassword = new_pam_password,
501500
timeToLive = time_to_live_in_hours)
@@ -505,7 +504,7 @@ def _login_pam(self):
505504
auth_req = iRODSMessage(
506505
msg_type='RODS_API_REQ',
507506
msg=message_body,
508-
int_info=(725 if Pam_Long_Tokens else 1201)
507+
int_info=api_number['PAM_AUTH_REQUEST_AN' if use_dedicated_pam_api else 'AUTH_PLUG_REQ_AN']
509508
)
510509

511510
self.send(auth_req)
@@ -516,8 +515,7 @@ def _login_pam(self):
516515
# TODO (#480): In Python3 will be able to do: 'raise RuntimeError(...) from exc' for more succinct error messages
517516
raise RuntimeError('Client-configured TTL is outside server parameters (password min and max times)')
518517

519-
Pam_Response_Class = (PamAuthRequestOut if Pam_Long_Tokens
520-
else AuthPluginOut)
518+
Pam_Response_Class = (PamAuthRequestOut if use_dedicated_pam_api else AuthPluginOut)
521519

522520
auth_out = output_message.get_main_message( Pam_Response_Class )
523521

Diff for: irods/test/PRC_issue_362.bats

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ prc_test()
5050
}
5151

5252
@test "test_with_atsymbol" { prc_test; }
53-
# TODO: investigate: the following two cases fail with SYS_BAD_INPUT (when tested with iRODS 4.3.1)
54-
#@test "test_with_semicolon" { prc_test; }
55-
#@test "test_with_equals" { prc_test; }
53+
@test "test_with_semicolon" { prc_test; }
54+
@test "test_with_equals" { prc_test; }
5655
@test "test_with_ampersand" { prc_test; }

0 commit comments

Comments
 (0)