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