iof-bird-daemon / nest / password.h @ 7152e5ef
History | View | Annotate | Download (809 Bytes)
1 |
/*
|
---|---|
2 |
* BIRD -- Password handling
|
3 |
*
|
4 |
* (c) 1999 Pavel Machek <pavel@ucw.cz>
|
5 |
* (c) 2004 Ondrej Filip <feela@network.cz>
|
6 |
*
|
7 |
* Can be freely distributed and used under the terms of the GNU GPL.
|
8 |
*/
|
9 |
|
10 |
#ifndef PASSWORD_H
|
11 |
#define PASSWORD_H
|
12 |
#include "sysdep/unix/timer.h" |
13 |
|
14 |
struct password_item {
|
15 |
node n; |
16 |
char *password;
|
17 |
int id;
|
18 |
bird_clock_t accfrom, accto, genfrom, gento; |
19 |
}; |
20 |
|
21 |
extern struct password_item *last_password_item; |
22 |
|
23 |
struct password_item *password_find(list *l, int first_fit); |
24 |
struct password_item *password_find_by_id(list *l, int id); |
25 |
struct password_item *password_find_by_value(list *l, char *pass, uint size); |
26 |
|
27 |
static inline int password_verify(struct password_item *p1, char *p2, uint size) |
28 |
{ |
29 |
char buf[size];
|
30 |
strncpy(buf, p1->password, size); |
31 |
return !memcmp(buf, p2, size);
|
32 |
} |
33 |
|
34 |
#endif
|