2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2011 Daniel Borkmann.
5 * Subject to the GPL, version 2.
14 #include "crypto_hash_sha512.h"
17 USERNAMES_OK
= 0, /* Usernames match, valid 'token' */
18 USERNAMES_NE
, /* Usernames do not match */
19 USERNAMES_TS
, /* Usernames match, but 'token' invalid,
20 Drop connection here */
24 struct username_struct
{
26 uint8_t hash
[crypto_hash_sha512_BYTES
];
29 extern int username_msg(char *username
, size_t len
, char *dst
, size_t dlen
);
30 extern enum is_user_enum
username_msg_is_user(char *src
, size_t slen
,
31 char *username
, size_t len
);
32 extern void parse_userfile_and_generate_user_store_or_die(char *homedir
);
33 extern void dump_user_store(void);
34 extern void destroy_user_store(void);
36 extern int get_user_by_socket(int sock
, struct curve25519_proto
**proto
);
37 extern int get_user_by_sockaddr(struct sockaddr_storage
*sa
, size_t sa_len
,
38 struct curve25519_proto
**proto
);
39 extern int try_register_user_by_socket(struct curve25519_struct
*c
,
40 char *src
, size_t slen
, int sock
,
42 extern int try_register_user_by_sockaddr(struct curve25519_struct
*c
,
43 char *src
, size_t slen
,
44 struct sockaddr_storage
*sa
,
45 size_t sa_len
, int log
);
46 extern void remove_user_by_socket(int sock
);
47 extern void remove_user_by_sockaddr(struct sockaddr_storage
*sa
,
50 #endif /* CT_USERMGMT_H */