]>
Commit | Line | Data |
---|---|---|
9a83b251 | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * | |
59ec8dae | 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" |
7ac48069 | 17 | #define REG_SVR |
9a83b251 | 18 | #include "ureg_proto.h" |
9a83b251 | 19 | |
20 | #ifndef TRUE | |
21 | #define TRUE 1 | |
22 | #endif | |
23 | ||
24 | #ifndef FALSE | |
25 | #define FALSE 0 | |
26 | #endif | |
27 | ||
28 | #define FAIL_INST "reg_svr" /* Instance for failure zephyrgrams */ | |
29 | ||
30 | #define CUR_UREG_VERSION 1 /* Version for the register protocol */ | |
31 | #define SUCCESS 0 /* General purpose success code */ | |
32 | #define FAILURE 1 /* To use when any non-zero number will work */ | |
5eaef520 | 33 | #define min(a,b) ((a) > (b) ? (b) : (a)) |
9a83b251 | 34 | #define MIN_UNAME 3 /* Username must be between three and */ |
35 | #define MAX_UNAME 8 /* eight characters long. */ | |
36 | #define CRYPT_LEN 14 /* crypt() returns a 13 char string */ | |
37 | #define LOGIN_LEN MAX_UNAME + 1 /* Leave room for a null */ | |
38 | #define UID_LEN 7 /* Allow room for a 16 bit number */ | |
39 | ||
9a83b251 | 40 | extern char *whoami; /* Name of program - used by libraries */ |
9a83b251 | 41 | |
59ec8dae | 42 | /* This structure holds information from the Moira database that will be |
5eaef520 | 43 | worth holding on to. An instance of it appears in the formatted |
9a83b251 | 44 | packet structure. */ |
45 | struct db_data | |
46 | { | |
5eaef520 | 47 | char mit_id[CRYPT_LEN]; /* Encrypted MIT ID */ |
48 | int reg_status; /* Registration status */ | |
49 | char uid[UID_LEN]; /* Reserved uid */ | |
50 | char login[LOGIN_LEN]; /* Login (username) */ | |
9a83b251 | 51 | }; |
52 | ||
5eaef520 | 53 | /* This structure stores information sent over in the packet in a |
54 | more convenient format and also stores some information obtained | |
9a83b251 | 55 | from the database that will be needed for each transaction. It |
56 | initialized from format_pkt() and find_user(). */ | |
57 | struct msg | |
5eaef520 | 58 | { |
59 | U_32BIT version; /* User registration protocol version */ | |
60 | U_32BIT request; /* Request */ | |
61 | char *first; /* First name */ | |
62 | char *last; /* Last name */ | |
63 | char *encrypted; /* Encrypted information in packet */ | |
64 | int encrypted_len; /* Length of encrypted information in packet */ | |
65 | char *leftover; /* Leftover information sent in the packet */ | |
66 | int leftover_len; /* Length of leftover information */ | |
59ec8dae | 67 | struct db_data db; /* Information from the Moira database */ |
9a83b251 | 68 | }; |
69 | ||
49312245 | 70 | /* For logging successful database transactions */ |
49312245 | 71 | extern FILE *journal; |
72 | ||
7ac48069 | 73 | /* prototypes from requests.c */ |
74 | void req_initialize(void); | |
75 | void get_request(struct msg *message); | |
76 | void report(int status, char *message); | |
77 | u_long cur_req_sender(void); |