Statistics
| Branch: | Revision:

iof-bird-daemon / nest / password.h @ 8e433d6a

History | View | Annotate | Download (801 Bytes)

1 1a2ded45 Pavel Machek
/*
2
 *        BIRD -- Password handling
3
 *
4 5236fb03 Ondrej Filip
 *        (c) 1999 Pavel Machek <pavel@ucw.cz>
5
 *        (c) 2004 Ondrej Filip <feela@network.cz>
6 1a2ded45 Pavel Machek
 *
7
 *        Can be freely distributed and used under the terms of the GNU GPL.
8
 */
9
10 858a7177 Pavel Machek
#ifndef PASSWORD_H
11
#define PASSWORD_H
12 900d5470 Pavel Machek
#include "lib/timer.h"
13
14 1a2ded45 Pavel Machek
struct password_item {
15 5236fb03 Ondrej Filip
  node n;
16 1a2ded45 Pavel Machek
  char *password;
17
  int id;
18 5236fb03 Ondrej Filip
  bird_clock_t accfrom, accto, genfrom, gento;
19 1a2ded45 Pavel Machek
};
20
21
extern struct password_item *last_password_item;
22 900d5470 Pavel Machek
23 b21f68b4 Ondrej Zajicek
struct password_item *password_find(list *l, int first_fit);
24 f8fefde3 Ondrej Zajicek
struct password_item *password_find_by_id(list *l, int id);
25 8465dccb Ondrej Zajicek (work)
struct password_item *password_find_by_value(list *l, char *pass, uint size);
26 f8fefde3 Ondrej Zajicek
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 900d5470 Pavel Machek
34 858a7177 Pavel Machek
#endif