6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
8 * Server for user registration with SMS and Kerberos.
10 * This file contains all the information needed by all source
11 * files for the user registration server.
17 #include <sys/types.h>
23 #include "ureg_proto.h"
35 #define FAIL_INST "reg_svr" /* Instance for failure zephyrgrams */
37 #define CUR_UREG_VERSION 1 /* Version for the register protocol */
38 #define SUCCESS 0 /* General purpose success code */
39 #define FAILURE 1 /* To use when any non-zero number will work */
40 #define min(a,b) ((a)>(b)?(b):(a))
41 #define MIN_UNAME 3 /* Username must be between three and */
42 #define MAX_UNAME 8 /* eight characters long. */
43 #define CRYPT_LEN 14 /* crypt() returns a 13 char string */
44 #define LOGIN_LEN MAX_UNAME + 1 /* Leave room for a null */
45 #define UID_LEN 7 /* Allow room for a 16 bit number */
47 extern char *strdup();
48 extern char *malloc();
50 extern char *whoami; /* Name of program - used by libraries */
51 extern int errno; /* Unix error number */
53 /* This structure holds information from the SMS database that will be
54 worth holding on to. An instance of it appears in the formatted
58 char mit_id[CRYPT_LEN]; /* Encrypted MIT ID */
59 int reg_status; /* Registration status */
60 char uid[UID_LEN]; /* Reserved uid */
61 char login[LOGIN_LEN]; /* Login (username) */
64 /* This structure stores information sent over in the packet in a
65 more convenient format and also stores some information obtained
66 from the database that will be needed for each transaction. It
67 initialized from format_pkt() and find_user(). */
70 U_32BIT version; /* User registration protocol version */
71 U_32BIT request; /* Request */
72 char *first; /* First name */
73 char *last; /* Last name */
74 char *encrypted; /* Encrypted information in packet */
75 int encrypted_len; /* Length of encrypted information in packet */
76 char *leftover; /* Leftover information sent in the packet */
77 int leftover_len; /* Length of leftover information */
78 struct db_data db; /* Information from the SMS database */
81 void failure_alert(); /* Log an unexplainable failure */
82 int parse_pkt(); /* Parse a packet from the client */
83 int format_pkt(); /* Prepare a packet to send to client*/
84 int verify_user(); /* Make sure user is allowed to register */
85 int reserve_user(); /* Reserve a login for this user */
86 int set_password(); /* Set this user's password */
89 /* For logging successful database transactions */