File: db.c

package info (click to toggle)
shishi 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 22,144 kB
  • ctags: 7,865
  • sloc: ansic: 61,153; sh: 12,212; yacc: 1,219; makefile: 1,164; perl: 624; sed: 16
file content (55 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* db.c --- Definitions of all Shisa database backends.
 * Copyright (C) 2003, 2004, 2007  Simon Josefsson
 *
 * This file is part of Shishi.
 *
 * Shishi is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Shishi is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Shishi; if not, see http://www.gnu.org/licenses or write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA
 *
 */

#include "info.h"

/* Get "file" database prototypes. */
#include "file.h"

static _Shisa_backend _shisa_backends[] = {
  {"file",
   shisa_file_init,
   shisa_file_done,
   shisa_file_enumerate_realms,
   shisa_file_enumerate_principals,
   shisa_file_principal_find,
   shisa_file_principal_update,
   shisa_file_principal_add,
   shisa_file_principal_remove,
   shisa_file_keys_find,
   shisa_file_key_add,
   shisa_file_key_update,
   shisa_file_key_remove}
};

/* Return structure with function pointers implementing a Shisa
   backend, given a name (e.g., "file"). */
_Shisa_backend *
_shisa_find_backend (const char *name)
{
  size_t i;
  for (i = 0; i < sizeof (_shisa_backends) / sizeof (_shisa_backends[0]); i++)
    if (strcmp (name, _shisa_backends[i].name) == 0)
      return &_shisa_backends[i];

  return NULL;
}