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