]>
Commit | Line | Data |
---|---|---|
b50f996d | 1 | #include <sys/time.h> |
2 | #include <des.h> | |
9a83b251 | 3 | |
b50f996d | 4 | typedef 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 | } reg_client; | |
9a83b251 | 21 | |
b50f996d | 22 | void RIFO(reg_client *rc, int argc, char **argv); |
23 | void SWRD(reg_client *rc, int argc, char **argv); | |
24 | void LOGN(reg_client *rc, int argc, char **argv); | |
25 | void PSWD(reg_client *rc, int argc, char **argv); | |
26 | void QUIT(reg_client *rc, int argc, char **argv); | |
9a83b251 | 27 | |
b50f996d | 28 | #define REG_SVR_PRINCIPAL "sms" |
29 | #define REG_SVR_INSTANCE "" | |
9a83b251 | 30 | |
b50f996d | 31 | #define REG_SVR_RSA_KEY "/moira/reg_svr/rsa_key" |
32 | #define REG_SVR_HMAC_KEY "/moira/reg_svr/hmac_key" | |
9a83b251 | 33 | |
b50f996d | 34 | #define REG_SVR_ERROR_MESSAGES "/moira/reg_svr/errors" |
35 | enum { NO_MESSAGE, INTERNAL_ERROR, PROTOCOL_ERROR, DATABASE_CLOSED, | |
36 | ENCRYPT_KEY, NOT_FOUND_IN_DATABASE, ALREADY_REGISTERED, | |
37 | ACCOUNT_DELETED, NOT_ELIGIBLE, FOUND, FORCED_USERNAME, | |
38 | BAD_SIX_WORDS, BAD_USERNAME, USERNAME_UNAVAILABLE, | |
39 | RESERVED_USERNAME_UNAVAILABLE, USERNAME_OK, PASSWORD_SHORT, | |
40 | PASSWORD_SIMPLE, PASSWORD_SAMPLE, KADM_ERROR, DONE, | |
41 | NUM_REG_ERRORS }; | |
9a83b251 | 42 | |
b50f996d | 43 | #define TIMEOUT 300 /* 5 minutes */ |
9a83b251 | 44 | |
b50f996d | 45 | #define REG_RSA_ENCRYPTED_KEY 0x43 |
46 | #define REG_ENCRYPTED 0x45 | |
47 | #define REG_UNENCRYPTED 0x50 | |
9a83b251 | 48 | |
b50f996d | 49 | /* Prototypes from kerberos.c */ |
50 | long init_kerberos(void); | |
51 | long check_kerberos(char *username); | |
52 | long register_kerberos(char *username, char *password); | |
9a83b251 | 53 | |
b50f996d | 54 | /* Prototypes from procotol.c */ |
55 | int read_rsa_key(void); | |
56 | int read_errors(void); | |
57 | void reply(reg_client *rc, int msg, char *state, char *clean, char *data, | |
58 | ...); | |
59 | void parse_packet(reg_client *rc, int type, long len, char *buf, int sleeping); | |
49312245 | 60 | |
b50f996d | 61 | /* prototypes from reg_svr.pc */ |
62 | void *xmalloc(size_t); | |
63 | void *xrealloc(void *, size_t); | |
64 | char *xstrdup(char *); | |
65 | ||
66 | /* Prototypes from words.c */ | |
67 | int read_hmac_key(void); | |
68 | unsigned short *init_rand(void *); | |
69 | void getwordlist(char *input, char *words[]); |