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