diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-01-05 15:18:59 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-01-05 15:18:59 +0300 |
commit | f28cb1b0a926f1ea98700b7871537ad1793511fd (patch) | |
tree | baf35570bc6b38b6fab5b6524e8f19f58f71e57f /accel-pppd/pwdb.c | |
parent | 2fdf3586c13a72c36f9530084962e29d57dc0329 (diff) | |
download | accel-ppp-f28cb1b0a926f1ea98700b7871537ad1793511fd.tar.gz accel-ppp-f28cb1b0a926f1ea98700b7871537ad1793511fd.zip |
rename accel-pptp to accel-ppp
Diffstat (limited to 'accel-pppd/pwdb.c')
-rw-r--r-- | accel-pppd/pwdb.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/accel-pppd/pwdb.c b/accel-pppd/pwdb.c new file mode 100644 index 0000000..4c0ab02 --- /dev/null +++ b/accel-pppd/pwdb.c @@ -0,0 +1,56 @@ +#include <stdlib.h> + +#include "triton.h" + +#include "pwdb.h" + +#include "memdebug.h" + +static LIST_HEAD(pwdb_handlers); + +int __export pwdb_check(struct ppp_t *ppp, const char *username, int type, ...) +{ + struct pwdb_t *pwdb; + int r, res = PWDB_NO_IMPL; + va_list args; + + va_start(args, type); + + list_for_each_entry(pwdb, &pwdb_handlers, entry) { + if (!pwdb->check) + continue; + r = pwdb->check(pwdb, ppp, username, type, args); + if (r == PWDB_NO_IMPL) + continue; + if (r == PWDB_SUCCESS) + return PWDB_SUCCESS; + res = r; + } + + return res; +} +__export char *pwdb_get_passwd(struct ppp_t *ppp, const char *username) +{ + struct pwdb_t *pwdb; + char *r = NULL; + + list_for_each_entry(pwdb, &pwdb_handlers, entry) { + if (!pwdb->get_passwd) + continue; + r = pwdb->get_passwd(pwdb, ppp, username); + if (r) + break; + } + + return r; +} + +void __export pwdb_register(struct pwdb_t *pwdb) +{ + list_add_tail(&pwdb->entry, &pwdb_handlers); +} +void __export pwdb_unregister(struct pwdb_t *pwdb) +{ + list_del(&pwdb->entry); +} + |