3
|
1 /* $Id: reserved.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */
|
|
2
|
|
3 /* reserved.c
|
|
4
|
|
5 * Kevin P. Smith 7/3/89
|
|
6 */
|
|
7 #include "copyright2.h"
|
|
8 #include <stdio.h>
|
|
9 #include <sys/types.h>
|
|
10 #include <sys/socket.h>
|
|
11 #include <netinet/in.h>
|
|
12 #include <netdb.h>
|
|
13 #include "defs.h"
|
|
14 #include "packets.h"
|
|
15
|
|
16 void
|
|
17 makeReservedPacket(packet)
|
|
18 struct reserved_spacket *packet;
|
|
19 {
|
|
20 int i;
|
|
21
|
|
22 for (i = 0; i < 16; i++) {
|
|
23 packet->data[i] = random() % 256;
|
|
24 } packet->type = SP_RESERVED;
|
|
25 }
|
|
26
|
|
27 void
|
|
28 encryptReservedPacket(spacket, cpacket, server, pno)
|
|
29 struct reserved_spacket *spacket;
|
|
30 struct reserved_cpacket *cpacket;
|
|
31 char *server;
|
|
32 int pno;
|
|
33 {
|
|
34
|
|
35 memcpy(cpacket->data, spacket->data, 16);
|
|
36 memcpy(cpacket->resp, spacket->data, 16);
|
|
37 cpacket->type = CP_RESERVED;
|
|
38
|
|
39 /*
|
|
40 Encryption algorithm goes here. Take the 16 bytes in cpacket->data,
|
|
41 and create cpacket->resp, which you require the client to also do. If
|
|
42 he fails, he gets kicked out.
|
|
43 */
|
|
44 }
|