25
25
from irods .message import (PamAuthRequest , PamAuthRequestOut )
26
26
27
27
28
-
29
- ALLOW_PAM_LONG_TOKENS = True # True to fix [#279]
30
28
# Message to be logged when the connection
31
29
# destructor is called. Used in a unit test
32
30
DESTRUCTOR_MSG = "connection __del__() called"
@@ -493,9 +491,10 @@ def _login_pam(self):
493
491
if getattr (self ,'DISALLOWING_PAM_PLAINTEXT' ,True ):
494
492
raise PlainTextPAMPasswordError
495
493
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 ))
497
496
498
- if Pam_Long_Tokens :
497
+ if use_dedicated_pam_api :
499
498
message_body = PamAuthRequest ( pamUser = self .account .client_user ,
500
499
pamPassword = new_pam_password ,
501
500
timeToLive = time_to_live_in_hours )
@@ -505,7 +504,7 @@ def _login_pam(self):
505
504
auth_req = iRODSMessage (
506
505
msg_type = 'RODS_API_REQ' ,
507
506
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' ]
509
508
)
510
509
511
510
self .send (auth_req )
@@ -516,8 +515,7 @@ def _login_pam(self):
516
515
# TODO (#480): In Python3 will be able to do: 'raise RuntimeError(...) from exc' for more succinct error messages
517
516
raise RuntimeError ('Client-configured TTL is outside server parameters (password min and max times)' )
518
517
519
- Pam_Response_Class = (PamAuthRequestOut if Pam_Long_Tokens
520
- else AuthPluginOut )
518
+ Pam_Response_Class = (PamAuthRequestOut if use_dedicated_pam_api else AuthPluginOut )
521
519
522
520
auth_out = output_message .get_main_message ( Pam_Response_Class )
523
521
0 commit comments