Commit 8d7ed2cdaae90f209a4744b62327b0a6cc1c7d14

Authored by Georg Hopp
1 parent f1a1399d

login via ldap and gdbm now works. Signup stores the user account as well as the…

… credentials but still returns a 500 and I have a memory leak most likely within the queue code. To reproduce this one has to start the server and send two requests via telnet to the server...no keep-alive just a single GET. refs #36
... ... @@ -28,8 +28,15 @@ Session.prototype.loadJSON = function(data)
28 28 this.firstname = data.firstname;
29 29 this.surname = data.surname;
30 30
  31 + name = " ";
  32 +
31 33 this.eSid.empty().append(this.id);
32   - $("#main p:eq(1) span:eq(0)").empty().append(" " + this.firstname + " " + this.surname);
  34 + if ('(null)' == this.firstname || '(null)' == this.surname) {
  35 + name += this.email;
  36 + } else {
  37 + name += this.firstname + " " + this.surname;
  38 + }
  39 + $("#main p:eq(1) span:eq(0)").empty().append(name);
33 40
34 41 this.draw();
35 42 if (0 < this.timeleft)
... ...
... ... @@ -223,6 +223,7 @@ signupAdapter(Application application, HttpWorker worker, Session session)
223 223 }
224 224
225 225 delete(credential);
  226 + delete(user);
226 227 }
227 228
228 229
... ...
... ... @@ -71,10 +71,6 @@ applicationDtor(void * _this)
71 71
72 72 delete(this->active_sessions);
73 73
74   - for (i=0; i<this->nauth; i++) {
75   - delete(this->auth[i]);
76   - }
77   -
78 74 MEM_FREE(this->auth);
79 75 }
80 76
... ...
... ... @@ -50,11 +50,7 @@ applicationLogin(
50 50 session->user->email = CRED_PWD(credential).user;
51 51 session->user->nemail = &CRED_PWD(credential).nuser;
52 52
53   - if (NULL == userLoad(session->user, this->users)) {
54   - session->user->email = NULL;
55   - session->user->nemail = NULL;
56   - }
57   -
  53 + userLoad(session->user, this->users);
58 54 break;
59 55
60 56 default:
... ...
... ... @@ -111,7 +111,8 @@ authLdapAuthenticate(void * _this, Credential cred)
111 111 return TRUE;
112 112 }
113 113
114   - fprintf(stderr, "%s\n", ldap_err2string(ldap_err));
  114 + //fprintf(stderr, "%s\n", ldap_err2string(ldap_err));
  115 + // @TODO do error logging instead.
115 116 return FALSE;
116 117 }
117 118
... ...
... ... @@ -45,7 +45,7 @@ httpResponseCtor(void * _this, va_list * params)
45 45 this->status = va_arg(* params, unsigned int);
46 46 reason = va_arg(* params, char *);
47 47
48   - this->reason = memCalloc(1, strlen(reason)+1);
  48 + this->reason = memCalloc(1, strlen(reason)+1);
49 49 strcpy(this->reason, reason);
50 50
51 51 return 0;
... ...
... ... @@ -26,8 +26,8 @@
26 26 void *
27 27 queueGet(Queue this)
28 28 {
29   - Queue first;
30   - void * msg;
  29 + Queue first;
  30 + void * msg;
31 31
32 32 if (NULL == this->first) {
33 33 return NULL;
... ...
... ... @@ -40,7 +40,7 @@ static
40 40 int
41 41 sessionCtor(void * _this, va_list * params)
42 42 {
43   - Session this = _this;
  43 + Session this = _this;
44 44 uuid_t uuid;
45 45
46 46 this->livetime = time(NULL) + SESSION_LIVETIME;
... ... @@ -56,6 +56,9 @@ static
56 56 void
57 57 sessionDtor(void * _this)
58 58 {
  59 + Session this = _this;
  60 +
  61 + delete(this->user);
59 62 }
60 63
61 64 static
... ...
... ... @@ -60,7 +60,10 @@ storageDtor(void * _this)
60 60 Storage this = _this;
61 61
62 62 if (NULL != this->db_name) MEM_FREE(this->db_name);
63   - if (NULL != this->gdbm) gdbm_close(this->gdbm);
  63 + if (NULL != this->gdbm) {
  64 + gdbm_close(this->gdbm);
  65 + this->gdbm = NULL;
  66 + }
64 67 }
65 68
66 69 INIT_IFACE(Class, storageCtor, storageDtor, NULL);
... ...
Please register or login to post a comment