~tatokis/unity/gcc-72-errors

« back to all changes in this revision

Viewing changes to lockscreen/UserAuthenticatorPam.h

  • Committer: Bileto Bot
  • Author(s): Andrea Azzarone
  • Date: 2017-09-25 16:03:52 UTC
  • mfrom: (4253.3.3 fix-missing-entry-lockscreen)
  • Revision ID: ci-train-bot@canonical.com-20170925160352-kqd3v7i3wdwhixjn
Refactor the way UserAuthenticator is created and passed around. Handle failures to create new threads and fallback to a "Switch to greeter..." button in case of failure. (LP: #1311316)

Approved by: Marco Trevisan (Treviño)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef UNITY_USER_AUTHENTICATOR_PAM_H
21
21
#define UNITY_USER_AUTHENTICATOR_PAM_H
22
22
 
23
 
#include <boost/noncopyable.hpp>
24
 
#include <UnityCore/GLibWrapper.h>
25
23
#include <UnityCore/GLibSource.h>
26
24
 
27
25
#include "UserAuthenticator.h"
36
34
namespace lockscreen
37
35
{
38
36
 
39
 
class UserAuthenticatorPam : public UserAuthenticator, private boost::noncopyable
 
37
class UserAuthenticatorPam : public UserAuthenticator
40
38
{
41
39
public:
 
40
  UserAuthenticatorPam() = default;
42
41
  bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) override;
43
42
 
44
43
private:
45
 
  // TODO (andy) move to pimpl
 
44
  UserAuthenticatorPam(UserAuthenticatorPam const&) = delete;
 
45
  UserAuthenticatorPam& operator=(UserAuthenticatorPam const&) = delete;
 
46
 
 
47
  static gpointer AuthenticationThreadFunc(gpointer);
46
48
  bool InitPam();
47
49
 
48
50
  static int ConversationFunction(int num_msg,
53
55
  std::string username_;
54
56
  AuthenticateEndCallback authenticate_cb_;
55
57
 
56
 
  int status_;
57
 
  bool first_prompt_;
58
 
  pam_handle* pam_handle_;
59
 
  glib::Cancellable cancellable_;
 
58
  int status_ = 0;
 
59
  bool first_prompt_ = true;
 
60
  pam_handle* pam_handle_ = nullptr;
60
61
  glib::SourceManager source_manager_;
61
62
};
62
63