password.c 709 Bytes
Newer Older
1 2 3
/*
 *	BIRD -- Password handling
 *
4 5
 *	(c) 1999 Pavel Machek <pavel@ucw.cz>
 *	(c) 2004 Ondrej Filip <feela@network.cz>
6 7 8 9 10 11
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#include "nest/bird.h"
#include "nest/password.h"
Martin Mareš's avatar
Martin Mareš committed
12
#include "lib/string.h"
13 14

struct password_item *last_password_item = NULL;
15 16

struct password_item *
17
password_find(list *l)
18
{
19
  struct password_item *pi;
20

21
  if (l)
22
  {
23 24
    WALK_LIST(pi, *l)
    {
25
      if ((pi->genfrom < now_real) && (pi->gento > now_real))
26 27
        return pi;
    }
28
  }
29
  return NULL;
30
}
31

32
void password_cpy(char *dst, char *src, int size)
33
{
34
  bzero(dst, size);
35
  memcpy(dst, src, (strlen(src) < (unsigned) size ? strlen(src) : (unsigned) size));
36 37
}