Browse Source

use the new application container

v0.1.8
Georg Hopp 12 years ago
parent
commit
de714f8a19
  1. 5
      include/application/application.h
  2. 7
      src/application/application.c
  3. 19
      src/taskrambler.c

5
include/application/application.h

@ -29,6 +29,7 @@
#include "session.h" #include "session.h"
#include "hash.h" #include "hash.h"
#include "auth.h"
#include "auth/credential.h" #include "auth/credential.h"
#include "storage/storage.h" #include "storage/storage.h"
#include "session.h" #include "session.h"
@ -45,8 +46,8 @@ CLASS(Application) {
Hash * active_sessions; Hash * active_sessions;
time_t session_time_ofs; time_t session_time_ofs;
void ** auth;
size_t nauth;
Auth auth;
struct randval * val; struct randval * val;
Storage users; Storage users;

7
src/application/application.c

@ -55,12 +55,7 @@ applicationCtor(void * _this, va_list * params)
this->user_namespace = uuidParse(va_arg(*params, char *)); this->user_namespace = uuidParse(va_arg(*params, char *));
// initialize authenticators to use.
this->nauth = va_arg(*params, size_t);
this->auth = memMalloc(this->nauth * sizeof(void*));
for (i=0; i<this->nauth; i++) {
this->auth[i] = va_arg(*params, void *);
}
this->auth = va_arg(*params, void *);
this->active_sessions = memCalloc(SESSION_LIVETIME, sizeof(Hash)); this->active_sessions = memCalloc(SESSION_LIVETIME, sizeof(Hash));
for (i=0; i<SESSION_LIVETIME; i++) { for (i=0; i<SESSION_LIVETIME; i++) {

19
src/taskrambler.c

@ -162,8 +162,7 @@ main()
{ {
Storage users; Storage users;
Storage passwords; Storage passwords;
AuthLdap authLdap;
AuthStorage authStorage;
Auth auth;
Application application; Application application;
Router router; Router router;
ApplicationAdapterHttp adapterHttp; ApplicationAdapterHttp adapterHttp;
@ -193,14 +192,17 @@ main()
shm_unlink("/fooshm"); shm_unlink("/fooshm");
close(shm); close(shm);
authLdap = new(
AuthLdap,
auth = new(Auth);
authCreate(
auth,
AUTH_LDAP,
(ldap_host->value).string, (ldap_host->value).string,
CONFSTRA(ldap_base)); CONFSTRA(ldap_base));
users = new(Storage, user_storage); users = new(Storage, user_storage);
passwords = new(Storage, password_storage); passwords = new(Storage, password_storage);
authStorage = new(AuthStorage, passwords);
authCreate(auth, AUTH_STORAGE, passwords);
application = new( application = new(
Application, Application,
@ -208,9 +210,7 @@ main()
users, users,
passwords, passwords,
"14de9e60-d497-4754-be72-f3bed52541fc", "14de9e60-d497-4754-be72-f3bed52541fc",
2,
authLdap,
authStorage);
auth);
router = new(Router, application); router = new(Router, application);
adapterHttp = new(ApplicationAdapterHttp, application, router); adapterHttp = new(ApplicationAdapterHttp, application, router);
@ -272,10 +272,9 @@ main()
delete(adapterHttp); delete(adapterHttp);
delete(router); delete(router);
delete(application); delete(application);
delete(authStorage);
delete(passwords); delete(passwords);
delete(users); delete(users);
delete(authLdap);
delete(auth);
clearMimeTypes(); clearMimeTypes();
assetPoolCleanup(); assetPoolCleanup();

Loading…
Cancel
Save