summaryrefslogtreecommitdiff
path: root/accel-pptpd/pwdb.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-09-04 16:20:11 +0400
committerKozlov Dmitry <dima@server>2010-09-04 16:20:11 +0400
commitaf5a96e2d04056b065a36ecbd140a16d0685c7e6 (patch)
treef873b3c5c68a72d2df1785fdd0931bc57c91fd35 /accel-pptpd/pwdb.c
parente8aa3a1457295f70f8ccc9cd7f2f9073f01a5e2e (diff)
downloadaccel-ppp-af5a96e2d04056b065a36ecbd140a16d0685c7e6.tar.gz
accel-ppp-af5a96e2d04056b065a36ecbd140a16d0685c7e6.zip
started work on radius module
Diffstat (limited to 'accel-pptpd/pwdb.c')
-rw-r--r--accel-pptpd/pwdb.c67
1 files changed, 62 insertions, 5 deletions
diff --git a/accel-pptpd/pwdb.c b/accel-pptpd/pwdb.c
index 37dd0c5f..8bde8fff 100644
--- a/accel-pptpd/pwdb.c
+++ b/accel-pptpd/pwdb.c
@@ -1,12 +1,69 @@
+#include <stdlib.h>
+
+#include "triton.h"
+
#include "pwdb.h"
-#include "ppp.h"
-__export int pwdb_check(struct ppp_t *ppp,const char *username,const char *password)
+static LIST_HEAD(pwdb_handlers);
+
+int __export pwdb_cleartext_check(struct ppp_t *ppp, const char *username,const char *password)
+{
+ struct pwdb_t *pwdb;
+ int r = PWDB_NO_IMPL;
+
+ list_for_each_entry(pwdb, &pwdb_handlers, entry) {
+ if (!pwdb->cleartext_check)
+ continue;
+ r = pwdb->cleartext_check(pwdb, ppp, username, password);
+ if (r == PWDB_NO_IMPL)
+ continue;
+ break;
+ }
+
+ return r;
+}
+int __export pwdb_encrypted_check(struct ppp_t *ppp, const char *username, int type, ...)
+{
+ struct pwdb_t *pwdb;
+ int r = PWDB_NO_IMPL;
+ va_list args;
+
+ va_start(args, type);
+
+ list_for_each_entry(pwdb, &pwdb_handlers, entry) {
+ if (!pwdb->encrypted_check)
+ continue;
+ r = pwdb->encrypted_check(pwdb, ppp, username, type, args);
+ if (r == PWDB_NO_IMPL)
+ continue;
+ break;
+ }
+
+ return r;
+
+}
+__export const char *pwdb_get_passwd(struct ppp_t *ppp, const char *username)
{
- return 0;
+ struct pwdb_t *pwdb;
+ const 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;
}
-__export char *pwdb_get_passwd(struct ppp_t *ppp, const char *username)
+void __export pwdb_register(struct pwdb_t *pwdb)
+{
+ list_add_tail(&pwdb->entry, &pwdb_handlers);
+}
+void __export pwdb_unregister(struct pwdb_t *pwdb)
{
- return strdup("test");
+ list_del(&pwdb->entry);
}
+