/usr/include/signond/signondaemon.h is in signond-dev 8.58+16.04.20151106-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2013 Canonical Ltd.
*
* Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef SIGNONDAEMON_H_
#define SIGNONDAEMON_H_
extern "C" {
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
}
#include <QtCore>
#include <QtDBus>
#include "credentialsaccessmanager.h"
#ifndef SIGNOND_PLUGINS_DIR
#define SIGNOND_PLUGINS_DIR "/usr/lib/signon"
#endif
#ifndef SIGNOND_PLUGIN_PREFIX
#define SIGNOND_PLUGIN_PREFIX QLatin1String("lib")
#endif
#ifndef SIGNOND_PLUGIN_SUFFIX
#define SIGNOND_PLUGIN_SUFFIX QLatin1String("plugin.so")
#endif
class QSocketNotifier;
namespace SignonDaemonNS {
/*!
* @class SignonDaemonConfiguration
* The daemon's configuration object;
* loads date from the daemon configuration file.
*/
class SignonDaemonConfiguration
{
public:
SignonDaemonConfiguration();
~SignonDaemonConfiguration();
const CAMConfiguration &camConfiguration() const {
return m_camConfiguration;
}
void setEncryptionPassphrase(const QByteArray &passphrase) {
m_camConfiguration.m_encryptionPassphrase = passphrase;
}
void load();
QString pluginsDir() const { return m_pluginsDir; }
QString extensionsDir() const { return m_extensionsDir; }
QString busAddress() const { return m_busAddress; }
uint daemonTimeout() const { return m_daemonTimeout; }
uint identityTimeout() const { return m_identityTimeout; }
uint authSessionTimeout() const { return m_authSessionTimeout; }
private:
QString m_pluginsDir;
QString m_extensionsDir;
QString m_busAddress;
// storage configuration
CAMConfiguration m_camConfiguration;
//object timeouts
uint m_daemonTimeout;
uint m_identityTimeout;
uint m_authSessionTimeout;
};
class SignonIdentity;
/*!
* @class SignonDaemon
* Daemon core.
* @todo description.
*/
class SignonDaemon: public QObject, protected QDBusContext
{
Q_OBJECT
friend class SignonSessionCore;
friend class SignonDaemonAdaptor;
public:
static SignonDaemon *instance();
virtual ~SignonDaemon();
Q_INVOKABLE void init();
/*!
* Returns the number of seconds of inactivity after which identity
* objects might be automatically deleted.
*/
int identityTimeout() const;
int authSessionTimeout() const;
public:
QObject *registerNewIdentity();
QObject *getIdentity(const quint32 id, QVariantMap &identityData);
QObject *getAuthSession(const quint32 id, const QString type,
pid_t ownerPid);
QStringList queryMethods();
QStringList queryMechanisms(const QString &method);
QList<QVariantMap> queryIdentities(const QVariantMap &filter);
bool clear();
QString lastErrorName() const { return m_lastErrorName; }
QString lastErrorMessage() const { return m_lastErrorMessage; }
bool lastErrorIsValid() const { return !m_lastErrorName.isEmpty(); }
private Q_SLOTS:
void onDisconnected();
void onNewConnection(const QDBusConnection &connection);
void onIdentityStored(SignonIdentity *identity);
void onIdentityDestroyed();
public Q_SLOTS: // backup METHODS
uchar backupStarts();
uchar backupFinished();
uchar restoreStarts();
uchar restoreFinished();
private:
SignonDaemon(QObject *parent);
void initExtensions();
void initExtension(const QString &filePath);
bool initStorage();
void watchIdentity(SignonIdentity *identity);
void setupSignalHandlers();
void eraseBackupDir() const;
bool copyToBackupDir(const QStringList &fileNames) const;
bool copyFromBackupDir(const QStringList &fileNames) const;
bool createStorageFileTree(const QStringList &fileNames) const;
void setLastError(const QString &name, const QString &msg);
void clearLastError();
private:
/*
* The list of created SignonIdentities
* */
QMap<quint32, SignonIdentity *> m_storedIdentities;
SignonDaemonConfiguration *m_configuration;
/*
* The instance of CAM
* */
CredentialsAccessManager *m_pCAMManager;
bool m_backup;
int m_identityTimeout;
int m_authSessionTimeout;
QDBusServer *m_dbusServer;
QString m_lastErrorName;
QString m_lastErrorMessage;
/*
* UNIX signals handling related
* */
public:
static void signalHandler(int signal);
Q_INVOKABLE void handleUnixSignal();
private:
QSocketNotifier *m_sigSn;
static SignonDaemon *m_instance;
}; //class SignonDaemon
} //namespace SignonDaemonNS
#endif /* SIGNONDAEMON_H_ */
|