source: trunk/third/moira/reg_svr/reg_svr.h @ 25817

Revision 25817, 2.6 KB checked in by jdreed, 12 years ago (diff)
In moira: * Re-snapshot moira at r4097 to pick up Status 10 (Suspended) (Trac: #1295) * Remove our addusr.1 and namespace.1 in favor of upstreams (Trac: #918) * Build-dep on OpenSSL and pass new configure flag per moira r4091
Line 
1#include <sys/time.h>
2#include <openssl/des.h>
3
4typedef struct reg_client {
5  int fd;                               /* socket */
6  int clientid;                         /* client id */
7  unsigned char *buf;                   /* buffer for data read */
8  int nread, nmax;                      /* # of bytes cur/max in buffer */
9  time_t lastmod;                       /* last time we sent/received */
10  int encrypted;                        /* set if sched is valid */
11  des_key_schedule sched;               /* DES key schedule */
12  long uid;                             /* uid of user. set by RIFO */
13  char *id;                             /* stored MIT ID if "six words" are
14                                           needed. NULL otherwise. Set by
15                                           RIFO, cleared by SWRD */
16  char *suggestions;                    /* suggested usernames */
17  char *username;                       /* desired username. set by LOGN */
18  int reserved_username;                /* if username wasn't picked by user */
19  unsigned short *random;               /* random state */
20  int user_status;                      /* Status of account */
21} reg_client;
22
23void RIFO(reg_client *rc, int argc, char **argv);
24void SWRD(reg_client *rc, int argc, char **argv);
25void SPIN(reg_client *rc, int argc, char **argv);
26void CLGN(reg_client *rc, int argc, char **argv);
27void LOGN(reg_client *rc, int argc, char **argv);
28void PSWD(reg_client *rc, int argc, char **argv);
29void QUIT(reg_client *rc, int argc, char **argv);
30
31#define REG_SVR_PRINCIPAL "sms"
32#define REG_SVR_INSTANCE ""
33
34#define REG_SVR_RSA_KEY "/moira/reg_svr/rsa_key"
35#define REG_SVR_HMAC_KEY "/moira/reg_svr/hmac_key"
36
37#define REG_SVR_ERROR_MESSAGES "/moira/reg_svr/errors"
38enum { NO_MESSAGE, INTERNAL_ERROR, PROTOCOL_ERROR, DATABASE_CLOSED,
39       ENCRYPT_KEY, NOT_FOUND_IN_DATABASE, ALREADY_REGISTERED,
40       ACCOUNT_DELETED, NOT_ELIGIBLE, FOUND, FORCED_USERNAME,
41       BAD_SIX_WORDS, BAD_USERNAME, USERNAME_UNAVAILABLE,
42       RESERVED_USERNAME_UNAVAILABLE, USERNAME_OK, PASSWORD_SHORT,
43       PASSWORD_SIMPLE, PASSWORD_SAMPLE, KADM_ERROR, DONE, BAD_PIN,
44       USERNAME_AVAILABLE, NUM_REG_ERRORS };
45
46#define TIMEOUT 300 /* 5 minutes */
47
48#define REG_RSA_ENCRYPTED_KEY 0x43
49#define REG_ENCRYPTED 0x45
50#define REG_UNENCRYPTED 0x50
51
52/* Prototypes from kerberos.c */
53long init_kerberos(void);
54long check_kerberos(char *username);
55long register_kerberos(char *username, char *password);
56
57/* Prototypes from procotol.c */
58int read_rsa_key(void);
59int read_errors(void);
60void reply(reg_client *rc, int msg, char *state, char *clean, char *data,
61           ...);
62void parse_packet(reg_client *rc, int type, int len, char *buf, int sleeping);
63
64/* prototypes from reg_svr.pc */
65void *xmalloc(size_t);
66void *xrealloc(void *, size_t);
67char *xstrdup(char *);
68
69/* Prototypes from words.c */
70int read_hmac_key(void);
71unsigned short *init_rand(void *);
72void getwordlist(char *input, char *words[]);
Note: See TracBrowser for help on using the repository browser.