32 class SaslServerPamImp ;
46 PamImp(
const std::string & app ,
const std::string &
id ) ;
49 void apply(
const std::string & ) ;
50 std::string
id()
const ;
53 virtual void converse( ItemArray & ) ;
54 virtual void delay(
unsigned int usec ) ;
58 void operator=(
const PamImp & ) ;
78 std::string
apply(
const std::string & pwd ,
bool & done ) ;
79 std::string
id()
const ;
98 G_DEBUG(
"GAuth::PamImp::ctor: [" << app <<
"] [" <<
id <<
"]" ) ;
113 for( ItemArray::iterator p = items.begin() ; p != items.end() ; ++p )
115 if( (*p).in_type ==
"password" )
118 (*p).out_defined = true ;
131 authenticate(
true ) ;
159 return m_pam ? m_pam->id() : std::string() ;
165 std::string sep( 1U ,
'\0' ) ;
166 std::string s =
G::Str::tail( response , response.find(sep) , std::string() ) ;
167 std::string
id =
G::Str::head( s , s.find(sep) , std::string() ) ;
168 std::string pwd =
G::Str::tail( s , s.find(sep) , std::string() ) ;
172 m_pam =
new PamImp(
"emailrelay" ,
id ) ;
176 m_pam->apply( pwd ) ;
184 catch( PamImp::NoPrompt & e )
186 G_WARNING(
"GAuth::SaslServer::apply: pam error: " << e.what() ) ;
192 return std::string() ;
224 return m_imp->active() ;
234 return mechanism ==
"PLAIN" ;
239 return std::string() ;
244 return m_imp->apply( response , done ) ;
249 return !m_imp->id().empty() ;
virtual ~SaslServerPamImp()
virtual bool trusted(GNet::Address) const
Final override from GAuth::SaslServer.
virtual void delay(unsigned int usec)
Called when the pam library wants the application to introduce a delay to prevent brute-force attacks...
The Address class encapsulates an IP transport address.
GAuth::PamImp::ItemArray ItemArray
static std::string tail(const std::string &in, std::string::size_type pos, const std::string &default_=std::string())
Returns the last part of the string after the given position.
PamImp(const std::string &app, const std::string &id)
std::vector< Item > ItemArray
virtual std::string initialChallenge() const
Final override from GAuth::SaslServer.
virtual ~SaslServerPam()
Destructor.
An exception class used by G::Pam.
virtual std::string mechanisms(char sep= ' ') const
Final override from GAuth::SaslServer.
virtual bool requiresEncryption() const
Final override from GAuth::SaslServer.
static std::string head(const std::string &in, std::string::size_type pos, const std::string &default_=std::string())
Returns the first part of the string up to just before the given position.
virtual std::string id() const
Final override from GAuth::SaslServer.
virtual std::string apply(const std::string &response, bool &done)
Final override from GAuth::SaslServer.
A private implementation class used by GAuth::SaslServerPam.
virtual bool authenticated() const
Final override from GAuth::SaslServer.
virtual void converse(ItemArray &)
Called to pass a message to the user, or request a password etc.
bool authenticated() const
SaslServerPam(const Secrets &, bool ignored, bool force_one_mechanism)
Constructor.
A private implementation of the G::Pam interface used by GAuth::SaslServerPamImp, which is itself a p...
virtual std::string mechanism() const
Final override from GAuth::SaslServer.
void apply(const std::string &)
virtual const char * what() const
Override from std::exception.
virtual bool active() const
Final override from GAuth::SaslServer.
An interface used by GAuth::SaslServer to obtain authentication secrets.
SASL authentication classes.
virtual bool mustChallenge() const
Final override from GAuth::SaslServer.
virtual bool init(const std::string &mechanism)
Final override from GAuth::SaslServer.
std::string apply(const std::string &pwd, bool &done)
#define G_EXCEPTION_CLASS(class_name, description)
A thin abstract interface to the system PAM library.
SaslServerPamImp(bool valid)