You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.1 KiB

/*
* Remote Laboratory Authentication Server
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (c) 2012 Timothy Pearson
* Raptor Engineering
* http://www.raptorengineeringinc.com
*/
#include <tqsocket.h>
#include <tqserversocket.h>
#include <tqapplication.h>
#include <tqvbox.h>
#include <tqtextview.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include <tqtextstream.h>
#include <sasl.h>
#include <saslplug.h>
#include <saslutil.h>
class AuthSocket : public TQSocket
{
Q_OBJECT
public:
AuthSocket(int sock, TQObject *parent=0, const char *name=0);
~AuthSocket();
public:
void close();
int initiateKerberosHandshake();
private:
void free_conn(void);
void send_sasl_data_to_network(const char *buffer, unsigned length, int netfd);
unsigned int get_sasl_data_from_network(char *buf);
int write_data_to_client(int fd, const char* readbuf, int cc);
int receive_data_from_client(char *buf, int netfd);
int authenticate_connection_with_kerberos(int netfd);
sasl_callback_t callbacks[];
private slots:
void connectionClosedHandler();
private:
char *iplocal;
char *ipremote;
char *searchpath;
const char *service;
char *localdomain;
char *userdomain;
sasl_conn_t *conn;
private:
int line;
TQString m_remoteHost;
friend class AuthServer;
};
class AuthServer : public TQServerSocket
{
Q_OBJECT
public:
AuthServer(TQObject* parent=0);
~AuthServer();
void newConnection(int socket);
signals:
void newConnect(AuthSocket*);
};