sslproc: set Client.localClient.cipher_string if sent by ssld

This commit is contained in:
William Pitcock 2015-12-11 08:19:50 -06:00
parent 196740c42b
commit ebe33dbfab
2 changed files with 30 additions and 0 deletions

View file

@ -228,6 +228,7 @@ struct LocalUser
char *opername; /* name of operator{} block being used or tried (challenge) */
char *challenge;
char *fullcaps;
char *cipher_string;
int caps; /* capabilities bit-field */
rb_fde_t *F; /* >= 0, for local clients */

View file

@ -384,6 +384,32 @@ ssl_process_dead_fd(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
exit_client(client_p, client_p, &me, reason);
}
static void
ssl_process_cipher_string(ssl_ctl_t *ctl, ssl_ctl_buf_t *ctl_buf)
{
struct Client *client_p;
const char *cstring;
uint32_t fd;
if(ctl_buf->buflen < 6)
return; /* bogus message..drop it.. XXX should warn here */
fd = buf_to_uint32(&ctl_buf->buf[1]);
cstring = (const char *)&ctl_buf->buf[5];
if(EmptyString(cstring))
return;
client_p = find_cli_fd_hash(fd);
if(client_p != NULL && client_p->localClient != NULL)
{
rb_free(client_p->localClient->cipher_string);
client_p->localClient->cipher_string = rb_strdup(cstring);
}
}
static void
ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
{
@ -431,6 +457,9 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl)
case 'D':
ssl_process_dead_fd(ctl, ctl_buf);
break;
case 'C':
ssl_process_cipher_string(ctl, ctl_buf);
break;
case 'F':
ssl_process_certfp(ctl, ctl_buf);
break;