summaryrefslogtreecommitdiffstats
path: root/auth.c
diff options
context:
space:
mode:
authordscho <dscho>2004-05-25 09:05:09 +0000
committerdscho <dscho>2004-05-25 09:05:09 +0000
commit876868553da8f69ed1a368688b6d01a8a7bc1a39 (patch)
tree0bf872ebeadb746eec0f4695230c8777680ece9f /auth.c
parent0130bdb9d6c61e0446ab514816041f1b9283410a (diff)
downloadlibtdevnc-876868553da8f69ed1a368688b6d01a8a7bc1a39.tar.gz
libtdevnc-876868553da8f69ed1a368688b6d01a8a7bc1a39.zip
move the library into libvncserver/, x11vnc into x11vnc/
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/auth.c b/auth.c
deleted file mode 100644
index ec253dd..0000000
--- a/auth.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * auth.c - deal with authentication.
- *
- * This file implements the VNC authentication protocol when setting up an RFB
- * connection.
- */
-
-/*
- * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
- * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
- * All Rights Reserved.
- *
- * This 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 2 of the License, or
- * (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include <rfb/rfb.h>
-
-/*
- * rfbAuthNewClient is called when we reach the point of authenticating
- * a new client. If authentication isn't being used then we simply send
- * rfbNoAuth. Otherwise we send rfbVncAuth plus the challenge.
- */
-
-void
-rfbAuthNewClient(cl)
- rfbClientPtr cl;
-{
- char buf[4 + CHALLENGESIZE];
- int len;
-
- cl->state = RFB_AUTHENTICATION;
-
- if (cl->screen->rfbAuthPasswdData && !cl->reverseConnection) {
- *(uint32_t *)buf = Swap32IfLE(rfbVncAuth);
- vncRandomBytes(cl->authChallenge);
- memcpy(&buf[4], (char *)cl->authChallenge, CHALLENGESIZE);
- len = 4 + CHALLENGESIZE;
- } else {
- *(uint32_t *)buf = Swap32IfLE(rfbNoAuth);
- len = 4;
- cl->state = RFB_INITIALISATION;
- }
-
- if (WriteExact(cl, buf, len) < 0) {
- rfbLogPerror("rfbAuthNewClient: write");
- rfbCloseClient(cl);
- return;
- }
-}
-
-
-/*
- * rfbAuthProcessClientMessage is called when the client sends its
- * authentication response.
- */
-
-void
-rfbAuthProcessClientMessage(cl)
- rfbClientPtr cl;
-{
- int n;
- uint8_t response[CHALLENGESIZE];
- uint32_t authResult;
-
- if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
- if (n != 0)
- rfbLogPerror("rfbAuthProcessClientMessage: read");
- rfbCloseClient(cl);
- return;
- }
-
- if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) {
- rfbErr("rfbAuthProcessClientMessage: password check failed\n");
- authResult = Swap32IfLE(rfbVncAuthFailed);
- if (WriteExact(cl, (char *)&authResult, 4) < 0) {
- rfbLogPerror("rfbAuthProcessClientMessage: write");
- }
- rfbCloseClient(cl);
- return;
- }
-
- authResult = Swap32IfLE(rfbVncAuthOK);
-
- if (WriteExact(cl, (char *)&authResult, 4) < 0) {
- rfbLogPerror("rfbAuthProcessClientMessage: write");
- rfbCloseClient(cl);
- return;
- }
-
- cl->state = RFB_INITIALISATION;
-}