version 1.156, 2007/09/09 11:38:01 |
version 1.157, 2007/09/25 23:48:57 |
|
|
process_add_identity(SocketEntry *e, int version) |
process_add_identity(SocketEntry *e, int version) |
{ |
{ |
Idtab *tab = idtab_lookup(version); |
Idtab *tab = idtab_lookup(version); |
|
Identity *id; |
int type, success = 0, death = 0, confirm = 0; |
int type, success = 0, death = 0, confirm = 0; |
char *type_name, *comment; |
char *type_name, *comment; |
Key *k = NULL; |
Key *k = NULL; |
|
|
} |
} |
if (lifetime && !death) |
if (lifetime && !death) |
death = time(NULL) + lifetime; |
death = time(NULL) + lifetime; |
if (lookup_identity(k, version) == NULL) { |
if ((id = lookup_identity(k, version)) == NULL) { |
Identity *id = xmalloc(sizeof(Identity)); |
id = xmalloc(sizeof(Identity)); |
id->key = k; |
id->key = k; |
id->comment = comment; |
|
id->death = death; |
|
id->confirm = confirm; |
|
TAILQ_INSERT_TAIL(&tab->idlist, id, next); |
TAILQ_INSERT_TAIL(&tab->idlist, id, next); |
/* Increment the number of identities. */ |
/* Increment the number of identities. */ |
tab->nentries++; |
tab->nentries++; |
} else { |
} else { |
key_free(k); |
key_free(k); |
xfree(comment); |
xfree(id->comment); |
} |
} |
|
id->comment = comment; |
|
id->death = death; |
|
id->confirm = confirm; |
send: |
send: |
buffer_put_int(&e->output, 1); |
buffer_put_int(&e->output, 1); |
buffer_put_char(&e->output, |
buffer_put_char(&e->output, |