E-MailRelay
gsaslserverpam.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gsaslserverpam.h
19///
20
21#ifndef G_SASL_SERVER_PAM_H
22#define G_SASL_SERVER_PAM_H
23
24#include "gdef.h"
25#include "gvalid.h"
26#include "gsecrets.h"
27#include "gsaslserver.h"
28#include "gexception.h"
29#include "gaddress.h"
30#include "gpath.h"
31#include <map>
32#include <memory>
33
34namespace GAuth
35{
36 class SaslServerPamImp ;
37 class SaslServerPam ;
38}
39
40//| \class GAuth::SaslServerPam
41/// An implementation of the SaslServer interface using PAM as
42/// the authentication mechanism.
43///
44/// This class tries to match up the PAM interface with the SASL server
45/// interface. The match is not perfect; only single-challenge PAM mechanisms
46/// are supported, the PAM delay feature is not implemented, and PAM sessions
47/// are not part of the SASL interface.
48///
50{
51public:
52 SaslServerPam( const SaslServerSecrets & , const std::string & config , bool allow_apop ) ;
53 ///< Constructor.
54
55public:
56 ~SaslServerPam() override ;
57 SaslServerPam( const SaslServerPam & ) = delete ;
58 SaslServerPam( SaslServerPam && ) = delete ;
59 SaslServerPam & operator=( const SaslServerPam & ) = delete ;
60 SaslServerPam & operator=( SaslServerPam && ) = delete ;
61
62private: // overrides
63 bool requiresEncryption() const override ; // Override from GAuth::SaslServer.
64 bool active() const override ; // Override from GAuth::SaslServer.
65 std::string mechanisms( char sep ) const override ; // Override from GAuth::SaslServer.
66 bool init( const std::string & mechanism ) override ; // Override from GAuth::SaslServer.
67 std::string mechanism() const override ; // Override from GAuth::SaslServer.
68 bool mustChallenge() const override ; // Override from GAuth::SaslServer.
69 std::string initialChallenge() const override ; // Override from GAuth::SaslServer.
70 std::string apply( const std::string & response , bool & done ) override ; // Override from GAuth::SaslServer.
71 bool authenticated() const override ; // Override from GAuth::SaslServer.
72 std::string id() const override ; // Override from GAuth::SaslServer.
73 bool trusted( const GNet::Address & ) const override ; // Override from GAuth::SaslServer.
74
75private:
76 std::unique_ptr<SaslServerPamImp> m_imp ;
77} ;
78
79#endif
An implementation of the SaslServer interface using PAM as the authentication mechanism.
SaslServerPam(const SaslServerSecrets &, const std::string &config, bool allow_apop)
Constructor.
An interface used by GAuth::SaslServer to obtain authentication secrets.
An interface for implementing the server-side SASL challenge/response concept.
Definition: gsaslserver.h:67
The GNet::Address class encapsulates a TCP/UDP transport address.
Definition: gaddress.h:53
SASL authentication classes.
Definition: gcram.cpp:36