version 1.109, 2003/04/08 20:21:29 |
version 1.110, 2003/06/11 11:18:38 |
|
|
process_add_smartcard_key (SocketEntry *e) |
process_add_smartcard_key (SocketEntry *e) |
{ |
{ |
char *sc_reader_id = NULL, *pin; |
char *sc_reader_id = NULL, *pin; |
int i, version, success = 0; |
int i, version, success = 0, death = 0, confirm = 0; |
Key **keys, *k; |
Key **keys, *k; |
Identity *id; |
Identity *id; |
Idtab *tab; |
Idtab *tab; |
|
|
sc_reader_id = buffer_get_string(&e->request, NULL); |
sc_reader_id = buffer_get_string(&e->request, NULL); |
pin = buffer_get_string(&e->request, NULL); |
pin = buffer_get_string(&e->request, NULL); |
|
|
|
while (buffer_len(&e->request)) { |
|
switch (buffer_get_char(&e->request)) { |
|
case SSH_AGENT_CONSTRAIN_LIFETIME: |
|
death = time(NULL) + buffer_get_int(&e->request); |
|
break; |
|
case SSH_AGENT_CONSTRAIN_CONFIRM: |
|
confirm = 1; |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
if (lifetime && !death) |
|
death = time(NULL) + lifetime; |
|
|
keys = sc_get_keys(sc_reader_id, pin); |
keys = sc_get_keys(sc_reader_id, pin); |
xfree(sc_reader_id); |
xfree(sc_reader_id); |
xfree(pin); |
xfree(pin); |
|
|
id = xmalloc(sizeof(Identity)); |
id = xmalloc(sizeof(Identity)); |
id->key = k; |
id->key = k; |
id->comment = xstrdup("smartcard key"); |
id->comment = xstrdup("smartcard key"); |
id->death = 0; |
id->death = death; |
id->confirm = 0; |
id->confirm = confirm; |
TAILQ_INSERT_TAIL(&tab->idlist, id, next); |
TAILQ_INSERT_TAIL(&tab->idlist, id, next); |
tab->nentries++; |
tab->nentries++; |
success = 1; |
success = 1; |
|
|
break; |
break; |
#ifdef SMARTCARD |
#ifdef SMARTCARD |
case SSH_AGENTC_ADD_SMARTCARD_KEY: |
case SSH_AGENTC_ADD_SMARTCARD_KEY: |
|
case SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED: |
process_add_smartcard_key(e); |
process_add_smartcard_key(e); |
break; |
break; |
case SSH_AGENTC_REMOVE_SMARTCARD_KEY: |
case SSH_AGENTC_REMOVE_SMARTCARD_KEY: |