]>
Commit | Line | Data |
---|---|---|
1a2ded45 PM |
1 | /* |
2 | * BIRD -- Password handling | |
3 | * | |
5236fb03 OF |
4 | * (c) 1999 Pavel Machek <pavel@ucw.cz> |
5 | * (c) 2004 Ondrej Filip <feela@network.cz> | |
1a2ded45 PM |
6 | * |
7 | * Can be freely distributed and used under the terms of the GNU GPL. | |
8 | */ | |
9 | ||
10 | #include "nest/bird.h" | |
11 | #include "nest/password.h" | |
7d875e09 | 12 | #include "lib/string.h" |
1a2ded45 PM |
13 | |
14 | struct password_item *last_password_item = NULL; | |
900d5470 | 15 | |
900d5470 | 16 | struct password_item * |
b21f68b4 | 17 | password_find(list *l, int first_fit) |
900d5470 | 18 | { |
5236fb03 | 19 | struct password_item *pi; |
b21f68b4 | 20 | struct password_item *pf = NULL; |
900d5470 | 21 | |
02ad2737 | 22 | if (l) |
5236fb03 | 23 | { |
02ad2737 OF |
24 | WALK_LIST(pi, *l) |
25 | { | |
fd91ae33 | 26 | if ((pi->genfrom < now_real) && (pi->gento > now_real)) |
b21f68b4 OZ |
27 | { |
28 | if (first_fit) | |
29 | return pi; | |
30 | ||
31 | if (!pf || pf->genfrom < pi->genfrom) | |
32 | pf = pi; | |
33 | } | |
02ad2737 | 34 | } |
900d5470 | 35 | } |
b21f68b4 | 36 | return pf; |
900d5470 | 37 | } |
2e6197d6 | 38 | |
5236fb03 | 39 | void password_cpy(char *dst, char *src, int size) |
2e6197d6 | 40 | { |
5236fb03 | 41 | bzero(dst, size); |
32d3228d | 42 | memcpy(dst, src, (strlen(src) < (unsigned) size ? strlen(src) : (unsigned) size)); |
2e6197d6 PM |
43 | } |
44 |