Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
lftp
relax-ssh-password-prompt-recognition.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File relax-ssh-password-prompt-recognition.patch of Package lftp
From 0bcd1d2d6bfb9d5397c34433ddb62a9b92eba27b Mon Sep 17 00:00:00 2001 From: Peter Simons <psimons@suse.com> Date: Wed, 27 Feb 2019 10:09:27 +0100 Subject: [PATCH] SSH_Access: be more liberal about recognizing password prompts A SUSE customer reported an issue where the use of a 3rd party PAM module in stack changed the password prompt to: UNIXADS password for username: Unfortunately, the ssh parsing code in lftp does not recognize this as a password prompt, which means that the login process gets stuck. We have found that accepting all strings that contain the phrase "password" and end in a colon works very well and it also covers this particular case. --- src/SSH_Access.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) Index: lftp-4.8.4/src/SSH_Access.cc =================================================================== --- lftp-4.8.4.orig/src/SSH_Access.cc 2019-03-19 12:26:52.246752720 +0000 +++ lftp-4.8.4/src/SSH_Access.cc 2019-03-19 12:27:10.578919458 +0000 @@ -20,6 +20,9 @@ #include <config.h> #include "SSH_Access.h" #include "misc.h" +#include <algorithm> +#include <cctype> +#include <string> void SSH_Access::MakePtyBuffers() { @@ -44,6 +47,18 @@ static bool begins_with(const char *b,co return (e-b>=len && !strncasecmp(b,suffix,len)); } +static bool contains(char const * begin, char const * end, std::string const & needle) +{ + struct nocase_eq + { + inline bool operator() (char lhs, char rhs) const + { + return std::tolower(lhs) == std::tolower(rhs); + }; + }; + return std::search(begin, end, needle.begin(), needle.end(), nocase_eq()) != end; +} + int SSH_Access::HandleSSHMessage() { int m=STALL; @@ -55,9 +70,7 @@ int SSH_Access::HandleSSHMessage() { if(s>0 && b[s-1]==' ') s--; - if(ends_with(b,b+s,"password:") - || (ends_with(b,b+s,"':") && s>10) - || (begins_with(b,b+s,"password for ") && b[s-1]==':')) + if((contains(b,b+s,"password") && b[s-1]==':')) { if(!pass) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor