mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Implement connection sharing between instances of PuTTY.
The basic strategy is described at the top of the new source file sshshare.c. In very brief: an 'upstream' PuTTY opens a Unix-domain socket or Windows named pipe, and listens for connections from other PuTTYs wanting to run sessions on the same server. The protocol spoken down that socket/pipe is essentially the bare ssh-connection protocol, using a trivial binary packet protocol with no encryption, and the upstream has to do some fiddly transformations that I've been referring to as 'channel-number NAT' to avoid resource clashes between the sessions it's managing. This is quite different from OpenSSH's approach of using the Unix- domain socket as a means of passing file descriptors around; the main reason for that is that fd-passing is Unix-specific but this system has to work on Windows too. However, there are additional advantages, such as making it easy for each downstream PuTTY to run its own independent set of port and X11 forwardings (though the method for making the latter work is quite painful). Sharing is off by default, but configuration is intended to be very easy in the normal case - just tick one box in the SSH config panel and everything else happens automatically. [originally from svn r10083]
This commit is contained in:
55
sshdes.c
55
sshdes.c
@ -1031,3 +1031,58 @@ const struct ssh_cipher ssh_des = {
|
||||
des_encrypt_blk, des_decrypt_blk,
|
||||
8, "single-DES CBC"
|
||||
};
|
||||
|
||||
#ifdef TEST_XDM_AUTH
|
||||
|
||||
/*
|
||||
* Small standalone utility which allows encryption and decryption of
|
||||
* single cipher blocks in the XDM-AUTHORIZATION-1 style. Written
|
||||
* during the rework of X authorisation for connection sharing, to
|
||||
* check the corner case when xa1_firstblock matches but the rest of
|
||||
* the authorisation is bogus.
|
||||
*
|
||||
* Just compile this file on its own with the above ifdef symbol
|
||||
* predefined:
|
||||
|
||||
gcc -DTEST_XDM_AUTH -o sshdes sshdes.c
|
||||
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
void *safemalloc(size_t n, size_t size) { return calloc(n, size); }
|
||||
void safefree(void *p) { return free(p); }
|
||||
void smemclr(void *p, size_t size) { memset(p, 0, size); }
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned char words[2][8];
|
||||
unsigned char out[8];
|
||||
int i, j;
|
||||
|
||||
memset(words, 0, sizeof(words));
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 8 && argv[i+1][2*j]; j++) {
|
||||
char x[3];
|
||||
unsigned u;
|
||||
x[0] = argv[i+1][2*j];
|
||||
x[1] = argv[i+1][2*j+1];
|
||||
x[2] = 0;
|
||||
sscanf(x, "%02x", &u);
|
||||
words[i][j] = u;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(out, words[0], 8);
|
||||
des_decrypt_xdmauth(words[1], out, 8);
|
||||
printf("decrypt(%s,%s) = ", argv[1], argv[2]);
|
||||
for (i = 0; i < 8; i++) printf("%02x", out[i]);
|
||||
printf("\n");
|
||||
|
||||
memcpy(out, words[0], 8);
|
||||
des_encrypt_xdmauth(words[1], out, 8);
|
||||
printf("encrypt(%s,%s) = ", argv[1], argv[2]);
|
||||
for (i = 0; i < 8; i++) printf("%02x", out[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user