1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

Many rfblib improvements

svn path=/trunk/kdenetwork/krfb/; revision=129944
This commit is contained in:
Tim Jansen
2002-01-05 03:40:06 +00:00
parent c3aa315ff7
commit 5755630cda
8 changed files with 36 additions and 24 deletions

View File

@@ -1,6 +1,17 @@
2002-01-05 Tim Jansen <tim@tjansen.de>
* krfb/rfbcontroller.cc: fixed crash after client disconnect while
krfb was writing
* lib/rfbServer.cc: fixed some bugs, avoid endlessly collecting
data if client doesn't take them, check input from client
2002-01-04 Tim Jansen <tim@tjansen.de>
* lib/: moved lib directory from krfb/lib to lib
* lib/rfbServer.cc: use /dev/urandom for authentication challenge
if available
* moved rfb lib directory from krfb/lib to lib
2002-01-03 Tim Jansen <tim@tjansen.de>

3
TODO
View File

@@ -1,8 +1,9 @@
Todo:
- i18n
- docs
- knotify
- kcontrol module?
- encrypted connections (ssh, OpenSSL?)
- encrypted connections: http://web.mit.edu/thouis/vnc/
- TightVNC extensions
- do something against potential denial-of-service attacks by repeatedly
trying to connect to users until they agree. Maybe a message box

View File

@@ -52,8 +52,8 @@ XUpdateScanner::XUpdateScanner(Display *_dpy,
dpy(_dpy),
window(_window),
fb(_fb),
tileWidth(32),
tileHeight(32),
tileWidth(_tileWidth),
tileHeight(_tileHeight),
blockWidth(_blockWidth),
blockHeight(_blockHeight),
count (0),
@@ -160,8 +160,7 @@ void XUpdateScanner::checkTile(int x, int y, list<Hint> &hintList)
}
}
void XUpdateScanner::searchUpdates(list<Hint> &hintList,
bool showMousePointer)
void XUpdateScanner::searchUpdates(list<Hint> &hintList)
{
count %= 32;
unsigned int i;

View File

@@ -44,7 +44,7 @@ class XUpdateScanner
~XUpdateScanner();
void checkTile( int x, int y, list< Hint > &hintList );
void searchUpdates( list< Hint > &hintList, bool showMouse );
void searchUpdates( list< Hint > &hintList);
Display *dpy;
@@ -66,4 +66,4 @@ class XUpdateScanner
} // namespace rfb
#endif _hexonet_rfb_XUpdateScanner_h_
#endif // _hexonet_rfb_XUpdateScanner_h_

View File

@@ -47,9 +47,9 @@ Configuration::Configuration(bool oneConnection, bool askOnConnect,
bool allowDesktopControl, QString password,
int port) :
preconfiguredFlag(true),
oneConnectionFlag(oneConnection),
askOnConnectFlag(askOnConnect),
allowDesktopControlFlag(allowDesktopControl),
oneConnectionFlag(oneConnection),
passwordString(password)
{
if ((port >= 5900) && (port < 6000))

View File

@@ -35,14 +35,12 @@ static XTestDisabler disabler;
RFBConnection::RFBConnection(Display *_dpy,
int _fd,
const QString &cpassword,
bool _allowInput,
bool _showMousePointer) :
bool _allowInput) :
Server(),
dpy(_dpy),
fd(_fd),
buttonMask(0),
allowInput(_allowInput),
showMousePointer(_showMousePointer),
buttonMask(0)
dpy(_dpy)
{
memcpy(password, "\0\0\0\0\0\0\0\0", 8);
if (!cpassword.isNull())
@@ -59,7 +57,7 @@ RFBConnection::RFBConnection(Display *_dpy,
InitBlocks(32, 32);
connection->send((unsigned char*) RFB_PROTOCOL_VERSION, 12);
sendFirstHandshake(connection);
}
RFBConnection::~RFBConnection() {
@@ -164,7 +162,7 @@ void RFBConnection::scanUpdates()
{
list<Hint> hintList;
scanner->searchUpdates(hintList, showMousePointer);
scanner->searchUpdates(hintList);
list<Hint>::iterator i;
for (i = hintList.begin(); i != hintList.end(); i++)
handleHint(*i);

View File

@@ -52,7 +52,7 @@ class RFBConnection : public QObject, public Server {
public:
RFBConnection(Display *dpy, int fd,
const QString &cpassword,
bool allowInput, bool showMouse);
bool allowInput);
~RFBConnection();
virtual void handleKeyEvent(KeyEvent &keyEvent);
virtual void handlePointerEvent(PointerEvent &pointerEvent);
@@ -68,7 +68,6 @@ private:
int fd;
int buttonMask;
bool allowInput;
bool showMousePointer;
XUpdateScanner *scanner;

View File

@@ -102,6 +102,7 @@ void RFBController::accepted(KSocket *s) {
if (socket) {
kdWarning() << "refuse 2nd connection" << endl;
// TODO: send connection failed with reason
delete s;
return;
}
@@ -136,8 +137,7 @@ void RFBController::acceptConnection(bool allowDesktopControl) {
s->enableWrite(true);
connection = new RFBConnection(qt_xdisplay(), s->socket(),
configuration->password(),
allowDesktopControl,
false);
allowDesktopControl);
emit sessionEstablished();
}
@@ -162,7 +162,8 @@ void RFBController::checkWriteBuffer() {
}
void RFBController::socketReadable() {
ASSERT(socket);
if ((!socket) || (!connection))
return;
int fd = socket->socket();
BufferedConnection *bc = connection->bufferedConnection;
int count = read(fd,
@@ -175,6 +176,7 @@ void RFBController::socketReadable() {
KMessageBox::error(0,
i18n("An error occurred while reading from the remote client. The connection will be terminated."),
i18n("KRfb Error"));
return;
}
while (connection->currentState && bc->hasReceiverBufferData()) {
connection->update();
@@ -188,8 +190,10 @@ void RFBController::socketReadable() {
}
void RFBController::socketWritable() {
ASSERT(socket);
if ((!socket) || (!connection))
return;
int fd = socket->socket();
BufferedConnection *bc = connection->bufferedConnection;
ASSERT((bc->senderBuffer.end - bc->senderBuffer.pos) > 0);
int count = write(fd,
@@ -197,13 +201,13 @@ void RFBController::socketWritable() {
bc->senderBuffer.end - bc->senderBuffer.pos);
if (count >= 0) {
bc->senderBuffer.pos += count;
checkWriteBuffer();
} else {
closeSession();
KMessageBox::error(0,
i18n("An error occurred while writing to the remote client. The connection will be terminated."),
i18n("KRfb Error"));
}
checkWriteBuffer();
}
void RFBController::closeSession() {