~collinp/paradise-netrek/3.1p0

« back to all changes in this revision

Viewing changes to src/ntserv/reserved.c

  • Committer: Collin Pruitt
  • Date: 2009-05-22 04:40:09 UTC
  • Revision ID: collinp111@gmail.com-20090522044009-gw30zywb9oaae4nr
Initial upload - just the source release of 3.1p0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* reserved.c
 
3
 
 
4
 * Kevin P. Smith   7/3/89
 
5
 */
 
6
#include "config.h"
 
7
#include <stdlib.h>
 
8
 
 
9
#include "defs.h"
 
10
#include "struct.h"
 
11
#include "data.h"
 
12
#include "proto.h"
 
13
#include "packets.h"
 
14
#include "gppackets.h"
 
15
 
 
16
#ifdef AUTHORIZE
 
17
void
 
18
makeReservedPacket(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(struct reserved_spacket *spacket, 
 
29
                      struct reserved_cpacket *cpacket, 
 
30
                      char *server, int pno)
 
31
{
 
32
 
 
33
    memcpy(cpacket->data, spacket->data, 16);
 
34
    memcpy(cpacket->resp, spacket->data, 16);
 
35
    cpacket->type = CP_RESERVED;
 
36
 
 
37
    /*
 
38
       Encryption algorithm goes here. Take the 16 bytes in cpacket->data,
 
39
       and create cpacket->resp, which you require the client to also do.  If
 
40
       he fails, he gets kicked out.
 
41
    */
 
42
}
 
43
#endif