ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/src/authcookie.C
(Generate patch)

Comparing cvsroot/ermyth/src/authcookie.C (file contents):
Revision 1.3 by pippijn, Sat Jul 21 13:23:21 2007 UTC vs.
Revision 1.4 by pippijn, Tue Aug 28 17:08:12 2007 UTC

1/* 1/*
2 * authcookie.C: Remote authentication ticket management 2 * authcookie.C: Remote authentication ticket management
3 * Rights to this code are documented in doc/pod/license.pod. 3 * Rights to this code are documented in doc/pod/license.pod.
4 * 4 *
5 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) 5 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org)
6 */ 6 */
7 7
8static char const rcsid[] = "$Id: authcookie.C,v 1.3 2007/07/21 13:23:21 pippijn Exp $"; 8static char const rcsid[] = "$Id: authcookie.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $";
9 9
10#include "atheme.h" 10#include "atheme.h"
11#include "authcookie.h" 11#include "authcookie.h"
12 12
13list_t authcookie_list; 13list_t authcookie_list;
14static BlockHeap *authcookie_heap;
15 14
16void 15void
17authcookie_init (void) 16authcookie_init (void)
18{ 17{
18#if 0
19 authcookie_heap = BlockHeapCreate (sizeof (authcookie_t), 1024); 19 authcookie_heap = BlockHeapCreate (sizeof (authcookie_t), 1024);
20 20#endif
21 if (!authcookie_heap)
22 {
23 slog (LG_ERROR, "authcookie_init(): cannot initialize block allocator.");
24 exit (EXIT_FAILURE);
25 }
26} 21}
27 22
28/* 23/*
29 * authcookie_create() 24 * authcookie_create()
30 * 25 *
38 * an authcookie ticket is created, and validated. 33 * an authcookie ticket is created, and validated.
39 */ 34 */
40authcookie_t * 35authcookie_t *
41authcookie_create (myuser_t *mu) 36authcookie_create (myuser_t *mu)
42{ 37{
43 authcookie_t *au = static_cast<authcookie_t *> (BlockHeapAlloc (authcookie_heap)); 38 authcookie_t *au = new authcookie_t;
44 39
45 au->ticket = gen_pw (20); 40 au->ticket = gen_pw (20);
46 au->myuser = mu; 41 au->myuser = mu;
47 au->expire = NOW + 3600; 42 au->expire = NOW + 3600;
48 43
122authcookie_destroy (authcookie_t *ac) 117authcookie_destroy (authcookie_t *ac)
123{ 118{
124 return_if_fail (ac != NULL); 119 return_if_fail (ac != NULL);
125 120
126 node_del (&ac->node, &authcookie_list); 121 node_del (&ac->node, &authcookie_list);
127 free (ac->ticket); 122 sfree (ac->ticket);
128 BlockHeapFree (authcookie_heap, ac); 123 delete ac;
129} 124}
130 125
131/* 126/*
132 * authcookie_destroy_all() 127 * authcookie_destroy_all()
133 * 128 *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines