~larryprice/acolyterm/release-0.1

« back to all changes in this revision

Viewing changes to src/plugin/pamauthentication/pamauthentication.h

  • Committer: Tarmac
  • Author(s): Larry Price
  • Date: 2016-06-22 16:14:21 UTC
  • mfrom: (210.1.5 acolyterm)
  • Revision ID: tarmac-20160622161421-cnyw0bjrpdig3238
Use pkexec to run default terminal and remove dependency on pam. Fixes: https://bugs.launchpad.net/bugs/1593399.

Approved by Libertine CI Bot, Larry Price.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2014 Canonical Ltd
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 version 3 as
6
 
 * published by the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Author : Arto Jalkanen <ajalkane@gmail.com>
17
 
 */
18
 
 
19
 
#ifndef PAMAUTHENTICATION_H
20
 
#define PAMAUTHENTICATION_H
21
 
 
22
 
#include <QObject>
23
 
#include <QAbstractListModel>
24
 
#include <QStandardPaths>
25
 
#include <QSettings>
26
 
 
27
 
// Forward declarations
28
 
struct pam_handle;
29
 
struct pam_message;
30
 
struct pam_response;
31
 
 
32
 
// TODO: documentation
33
 
class PamAuthentication : public QObject
34
 
{
35
 
    Q_OBJECT
36
 
 
37
 
public:
38
 
    explicit PamAuthentication(QObject *parent = 0);
39
 
    ~PamAuthentication();
40
 
 
41
 
    Q_INVOKABLE bool requireAuthentication();
42
 
 
43
 
    Q_INVOKABLE bool validatePasswordToken(const QString &token);
44
 
 
45
 
    Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged)
46
 
    inline const QString &serviceName() const {
47
 
        return m_serviceName;
48
 
    }
49
 
 
50
 
    void setServiceName(const QString &serviceName);
51
 
signals:
52
 
    void serviceNameChanged();
53
 
 
54
 
public slots:
55
 
private:
56
 
    static int ConversationFunction(int num_msg,
57
 
                                    const pam_message** msg,
58
 
                                    pam_response** resp,
59
 
                                    void* appdata_ptr);
60
 
 
61
 
    bool initPam(pam_handle **pamHandle);
62
 
    int validateAccount(pam_handle *pamHandle);
63
 
 
64
 
    QString m_passwordToken;
65
 
    QString m_serviceName;
66
 
    QString m_userLogin;
67
 
};
68
 
 
69
 
#endif // PAMAUTHENTICATION_H
70
 
 
71
 
 
72