projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Plink documentation cribs heavily from PSCP documentation, film at 11.
[u/mdw/putty]
/
rlogin.c
diff --git
a/rlogin.c
b/rlogin.c
index
bf1db8d
..
8a7b1fa
100644
(file)
--- a/
rlogin.c
+++ b/
rlogin.c
@@
-24,8
+24,14
@@
static void c_write (char *buf, int len) {
from_backend(0, buf, len);
}
from_backend(0, buf, len);
}
-static int rlogin_receive (Socket s, int urgent, char *data, int len) {
- if (!len) {
+static int rlogin_receive (Socket skt, int urgent, char *data, int len) {
+ if (urgent==3) {
+ /* A socket error has occurred. */
+ sk_close(s);
+ s = NULL;
+ connection_fatal(data);
+ return 0;
+ } else if (!len) {
/* Connection has closed. */
sk_close(s);
s = NULL;
/* Connection has closed. */
sk_close(s);
s = NULL;
@@
-33,10
+39,9
@@
static int rlogin_receive (Socket s, int urgent, char *data, int len) {
}
if (urgent == 2) {
char c;
}
if (urgent == 2) {
char c;
- int i;
c = *data++; len--;
c = *data++; len--;
- if (c ==
0x80
)
+ if (c ==
'\x80'
)
rlogin_size();
/*
* We should flush everything (aka Telnet SYNCH) if we see
rlogin_size();
/*
* We should flush everything (aka Telnet SYNCH) if we see
@@
-44,8
+49,22
@@
static int rlogin_receive (Socket s, int urgent, char *data, int len) {
* on 0x10 and 0x20 respectively. I'm not convinced it's
* worth it...
*/
* on 0x10 and 0x20 respectively. I'm not convinced it's
* worth it...
*/
+ } else {
+ /*
+ * Main rlogin protocol. This is really simple: the first
+ * byte is expected to be NULL and is ignored, and the rest
+ * is printed.
+ */
+ static int firstbyte = 1;
+ if (firstbyte) {
+ if (data[0] == '\0') {
+ data++;
+ len--;
+ }
+ firstbyte = 0;
+ }
+ c_write(data, len);
}
}
- c_write(data, len);
return 1;
}
return 1;
}
@@
-73,7
+92,7
@@
static char *rlogin_init (char *host, int port, char **realhost) {
/*
* Open socket.
*/
/*
* Open socket.
*/
- s = sk_new(addr, port, 1, rlogin_receive);
+ s = sk_new(addr, port, 1,
0,
rlogin_receive);
if ( (err = sk_socket_error(s)) )
return err;
if ( (err = sk_socket_error(s)) )
return err;
@@
-98,8
+117,6
@@
static char *rlogin_init (char *host, int port, char **realhost) {
sk_write(s, &z, 1);
}
sk_write(s, &z, 1);
}
- begin_session();
-
return NULL;
}
return NULL;
}
@@
-118,7
+135,7
@@
static void rlogin_send (char *buf, int len) {
* Called to set the size of the window
*/
static void rlogin_size(void) {
* Called to set the size of the window
*/
static void rlogin_size(void) {
- char b[12] = {
0xFF, 0xFF
, 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
+ char b[12] = {
'\xFF', '\xFF'
, 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
b[6] = cols >> 8; b[7] = cols & 0xFF;
b[4] = rows >> 8; b[5] = rows & 0xFF;
b[6] = cols >> 8; b[7] = cols & 0xFF;
b[4] = rows >> 8; b[5] = rows & 0xFF;
@@
-138,6
+155,10
@@
static Socket rlogin_socket(void) { return s; }
static int rlogin_sendok(void) { return 1; }
static int rlogin_sendok(void) { return 1; }
+static int rlogin_ldisc(int option) {
+ return 0;
+}
+
Backend rlogin_backend = {
rlogin_init,
rlogin_send,
Backend rlogin_backend = {
rlogin_init,
rlogin_send,
@@
-145,5
+166,6
@@
Backend rlogin_backend = {
rlogin_special,
rlogin_socket,
rlogin_sendok,
rlogin_special,
rlogin_socket,
rlogin_sendok,
+ rlogin_ldisc,
1
};
1
};