]> andersk Git - moira.git/blame - reg_svr/reg_svr.h
encrypt ID if necessary to use as encryption key
[moira.git] / reg_svr / reg_svr.h
CommitLineData
9a83b251 1/*
2 * $Source$
3 * $Author$
4 * $Header$
5 *
6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 *
2ce085d2 8 * Server for user registration with MOIRA and Kerberos.
9a83b251 9 *
10 * This file contains all the information needed by all source
11 * files for the user registration server.
12 */
13
9a83b251 14#include <sys/types.h>
952aa193 15#include <ctype.h>
9a83b251 16#include "ureg_err.h"
17#include "ureg_proto.h"
9a83b251 18
19#ifndef TRUE
20#define TRUE 1
21#endif
22
23#ifndef FALSE
24#define FALSE 0
25#endif
26
27#define FAIL_INST "reg_svr" /* Instance for failure zephyrgrams */
28
29#define CUR_UREG_VERSION 1 /* Version for the register protocol */
30#define SUCCESS 0 /* General purpose success code */
31#define FAILURE 1 /* To use when any non-zero number will work */
32#define min(a,b) ((a)>(b)?(b):(a))
33#define MIN_UNAME 3 /* Username must be between three and */
34#define MAX_UNAME 8 /* eight characters long. */
35#define CRYPT_LEN 14 /* crypt() returns a 13 char string */
36#define LOGIN_LEN MAX_UNAME + 1 /* Leave room for a null */
37#define UID_LEN 7 /* Allow room for a 16 bit number */
38
9a83b251 39extern char *strdup();
40extern char *malloc();
41
42extern char *whoami; /* Name of program - used by libraries */
43extern int errno; /* Unix error number */
44
2ce085d2 45/* This structure holds information from the MOIRA database that will be
9a83b251 46 worth holding on to. An instance of it appears in the formatted
47 packet structure. */
48struct db_data
49{
50 char mit_id[CRYPT_LEN]; /* Encrypted MIT ID */
51 int reg_status; /* Registration status */
52 char uid[UID_LEN]; /* Reserved uid */
53 char login[LOGIN_LEN]; /* Login (username) */
54};
55
56/* This structure stores information sent over in the packet in a
57 more convenient format and also stores some information obtained
58 from the database that will be needed for each transaction. It
59 initialized from format_pkt() and find_user(). */
60struct msg
61{
62 U_32BIT version; /* User registration protocol version */
63 U_32BIT request; /* Request */
64 char *first; /* First name */
65 char *last; /* Last name */
66 char *encrypted; /* Encrypted information in packet */
67 int encrypted_len; /* Length of encrypted information in packet */
68 char *leftover; /* Leftover information sent in the packet */
69 int leftover_len; /* Length of leftover information */
2ce085d2 70 struct db_data db; /* Information from the MOIRA database */
9a83b251 71};
72
73void failure_alert(); /* Log an unexplainable failure */
74int parse_pkt(); /* Parse a packet from the client */
75int format_pkt(); /* Prepare a packet to send to client*/
76int verify_user(); /* Make sure user is allowed to register */
77int reserve_user(); /* Reserve a login for this user */
78int set_password(); /* Set this user's password */
49312245 79
80
81/* For logging successful database transactions */
49312245 82extern FILE *journal;
83
This page took 0.071029 seconds and 5 git commands to generate.