if(ssld_path == NULL)
{
- rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", BINPATH, suffix);
+ rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1)
{
if(access(fullpath, X_OK) == -1)
{
ilog(L_MAIN,
- "Unable to execute ssld%s in %s/bin or %s",
- ConfigFileEntry.dpath, suffix, BINPATH);
+ "Unable to execute ssld%s in %s or %s/bin",
+ suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
return 0;
}
}
for(i = 0; i < count; i++)
{
ssl_ctl_t *ctl;
- rb_socketpair(AF_UNIX, SOCK_DGRAM, 0, &F1, &F2, "SSL/TLS handle passing socket");
+ if(rb_socketpair(AF_UNIX, SOCK_DGRAM, 0, &F1, &F2, "SSL/TLS handle passing socket") == -1)
+ {
+ ilog(L_MAIN, "Unable to create ssld - rb_socketpair failed: %s", strerror(errno));
+ return started;
+ }
+
rb_set_buffers(F1, READBUF_SIZE);
rb_set_buffers(F2, READBUF_SIZE);
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2));
rb_setenv("CTL_FD", fdarg, 1);
- rb_pipe(&P1, &P2, "SSL/TLS pipe");
+ if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1)
+ {
+ ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno));
+ return started;
+ }
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1));
rb_setenv("CTL_PIPE", fdarg, 1);
rb_snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid());
exit_client(client_p, client_p, &me, reason);
}
+static void
+ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
+{
+ struct Client *client_p;
+ int32_t fd;
+ uint8_t *certfp;
+ char *certfp_string;
+ int i;
+
+ if(ctl_buf->buflen != 5 + RB_SSL_CERTFP_LEN)
+ return; /* bogus message..drop it.. XXX should warn here */
+
+ fd = buf_to_int32(&ctl_buf->buf[1]);
+ certfp = (uint8_t *)&ctl_buf->buf[5];
+ client_p = find_cli_fd_hash(fd);
+ if(client_p == NULL)
+ return;
+ rb_free(client_p->certfp);
+ certfp_string = rb_malloc(RB_SSL_CERTFP_LEN * 2 + 1);
+ for(i = 0; i < RB_SSL_CERTFP_LEN; i++)
+ rb_snprintf(certfp_string + 2 * i, 3, "%02x",
+ certfp[i]);
+ client_p->certfp = certfp_string;
+}
+
static void
ssl_process_cmd_recv(ssl_ctl_t * ctl)
{
case 'D':
ssl_process_dead_fd(ctl, ctl_buf);
break;
+ case 'F':
+ ssl_process_certfp(ctl, ctl_buf);
+ break;
case 'S':
ssl_process_zipstats(ctl, ctl_buf);
break;
case 'I':
ssl_ok = 0;
- ilog(L_MAIN, cannot_setup_ssl);
- sendto_realops_snomask(SNO_GENERAL, L_ALL, cannot_setup_ssl);
+ ilog(L_MAIN, "%s", cannot_setup_ssl);
+ sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", cannot_setup_ssl);
+ break;
case 'U':
zlib_ok = 0;
ssl_ok = 0;
- ilog(L_MAIN, no_ssl_or_zlib);
- sendto_realops_snomask(SNO_GENERAL, L_ALL, no_ssl_or_zlib);
+ ilog(L_MAIN, "%s", no_ssl_or_zlib);
+ sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", no_ssl_or_zlib);
ssl_killall();
break;
case 'z':
/* Pass the socket to ssld. */
*buf = 'Z';
- rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF1, &xF2, "Initial zlib socketpairs");
-
+ if(rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF1, &xF2, "Initial zlib socketpairs") == -1)
+ {
+ sendto_realops_snomask(SNO_GENERAL, L_ALL, "Error creating zlib socketpair - %s", strerror(errno));
+ ilog(L_MAIN, "Error creating zlib socketpairs - %s", strerror(errno));
+ exit_client(server, server, server, "Error creating zlib socketpair");
+ return;
+ }
+
if(IsSSL(server))
{
/* tell ssld the new connid for the ssl part*/