@@ -272,7 +272,7 @@ def _impl(self, *method_args, **method_kwargs):
272272 except Exception as exc :
273273 result = None
274274 msg = "(%d:%d): %s" \
275- % (offset , offset + length , exc )
275+ % (offset , offset + length , exc )
276276 logger .error ("%s failed: '%s': %s"
277277 % (operation , path , msg ))
278278 project_log (configuration ,
@@ -358,7 +358,7 @@ def chattr(self, attr):
358358 def read (self , offset , length ):
359359 """Handle operations of same name"""
360360 path = getattr (self , "path" , "unknown" )
361- #self.logger.debug("read %db @%d of %s" % (length, offset, [path]))
361+ # self.logger.debug("read %db @%d of %s" % (length, offset, [path]))
362362 try :
363363 return super (SFTPHandle , self ).read (offset , length )
364364 except Exception as exc :
@@ -371,7 +371,7 @@ def read(self, offset, length):
371371 def write (self , offset , data ):
372372 """Handle operations of same name"""
373373 path = getattr (self , "path" , "unknown" )
374- #self.logger.debug("write %db @%d of %s" % (len(data), offset, [path]))
374+ # self.logger.debug("write %db @%d of %s" % (len(data), offset, [path]))
375375 try :
376376 return super (SFTPHandle , self ).write (offset , data )
377377 except Exception as exc :
@@ -532,7 +532,7 @@ def session_started(self):
532532 # TODO: merge sftp and sftp-subsys auth validation into single helper?
533533 # NOTE: proto == 'sftp' is handled in _validate_authentication
534534 if proto == 'sftp-subsys' :
535- #logger.debug("sftp-subsys env is: %s" % os.environ)
535+ # logger.debug("sftp-subsys env is: %s" % os.environ)
536536 # TODO: can we extract actual auth method somehow instead of this
537537 # dummy 'session' workaround when auth is handled by sshd?
538538 authtype = os .environ .get ('AUTHTYPE' , 'session' )
@@ -800,7 +800,7 @@ def _chattr(self, path, attr, sftphandle=None):
800800 self .logger .warning ('chattr on read-only path %s :: %s' %
801801 ([path ], [real_path ]))
802802 return paramiko .SFTP_PERMISSION_DENIED
803- #self.logger.debug("_chattr %s activate" % [path])
803+ # self.logger.debug("_chattr %s activate" % [path])
804804 if sftphandle is not None :
805805 active = getattr (sftphandle , 'active' )
806806 file_obj = getattr (sftphandle , active )
@@ -1019,7 +1019,7 @@ def list_folder(self, path):
10191019 # self.logger.debug("list_folder for %s" % filename)
10201020 if invisible_path (filename ):
10211021 continue
1022- #full_name = ("%s/%s" % (real_path, filename)).replace("//", "/")
1022+ # full_name = ("%s/%s" % (real_path, filename)).replace("//", "/")
10231023 full_name = os .path .join (real_path ,
10241024 filename .lstrip (os .sep )).replace ("//" , "/" )
10251025 self .logger .debug ("list_folder stat %s" % [full_name ])
@@ -1398,13 +1398,13 @@ def _validate_authentication(self, username, password=None, key=None):
13981398 elif not default_username_validator (configuration , username ):
13991399 invalid_username = True
14001400 else :
1401+ hash_cache = daemon_conf ['hash_cache' ]
14011402 if key is not None :
14021403 update_key_map = True
14031404 key_offered = key .get_base64 ()
14041405 hashed_secret = key_offered
14051406 if password is not None :
14061407 update_password_map = True
1407- hash_cache = daemon_conf ['hash_cache' ]
14081408 # NOTE: keep password on native form in general
14091409 password_offered = force_native_str (password )
14101410 # IMPORTANT: pass a hash of password to register_auth_attempt
@@ -1427,6 +1427,7 @@ def _validate_authentication(self, username, password=None, key=None):
14271427 elif check_account_accessible (configuration , username , 'sftp' ):
14281428 account_accessible = True
14291429 for entry in login_map :
1430+ password_allowed , key_allowed = False , False
14301431 if password is not None and entry .password is not None :
14311432 password_enabled = True
14321433 # NOTE: make sure allowed value is native string as well
0 commit comments