capability API to allow plugin-controlled capability set
[strongswan.git] / src / charon / plugins / eap_gtc / eap_gtc_plugin.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 #include "eap_gtc_plugin.h"
19
20 #include "eap_gtc.h"
21
22 #include <daemon.h>
23
24 #include <linux/capability.h>
25
26 /**
27 * Implementation of plugin_t.destroy
28 */
29 static void destroy(eap_gtc_plugin_t *this)
30 {
31 charon->eap->remove_method(charon->eap,
32 (eap_constructor_t)eap_gtc_create_server);
33 charon->eap->remove_method(charon->eap,
34 (eap_constructor_t)eap_gtc_create_peer);
35 free(this);
36 }
37
38 /*
39 * see header file
40 */
41 plugin_t *plugin_create()
42 {
43 eap_gtc_plugin_t *this = malloc_thing(eap_gtc_plugin_t);
44
45 this->plugin.destroy = (void(*)(plugin_t*))destroy;
46
47 /* required for PAM authentication */
48 charon->keep_cap(charon, CAP_AUDIT_WRITE);
49
50 charon->eap->add_method(charon->eap, EAP_GTC, 0, EAP_SERVER,
51 (eap_constructor_t)eap_gtc_create_server);
52 charon->eap->add_method(charon->eap, EAP_GTC, 0, EAP_PEER,
53 (eap_constructor_t)eap_gtc_create_peer);
54
55 return &this->plugin;
56 }
57