static pid_t ppid;
static inline int32_t
-buf_to_int32(char *buf)
+buf_to_int32(uint8_t *buf)
{
int32_t x;
memcpy(&x, buf, sizeof(x));
}
static inline void
-int32_to_buf(char *buf, int32_t x)
+int32_to_buf(uint8_t *buf, int32_t x)
{
memcpy(buf, &x, sizeof(x));
return;
}
static inline uint16_t
-buf_to_uint16(char *buf)
+buf_to_uint16(uint8_t *buf)
{
uint16_t x;
memcpy(&x, buf, sizeof(x));
}
static inline void
-uint16_to_buf(char *buf, uint16_t x)
+uint16_to_buf(uint8_t *buf, uint16_t x)
{
memcpy(buf, &x, sizeof(x));
return;
typedef struct _mod_ctl_buf
{
rb_dlink_node node;
- char *buf;
+ uint8_t *buf;
size_t buflen;
rb_fde_t *F[MAXPASSFD];
int nfds;
{
va_list ap;
char reason[128]; /* must always be under 250 bytes */
- char buf[256];
+ uint8_t buf[256];
int len;
if(IsDead(conn))
return;
buf[0] = 'D';
int32_to_buf(&buf[1], conn->id);
- strcpy(&buf[5], reason);
+ rb_strlcpy((char *) &buf[5], reason, sizeof(buf) - 5);
len = (strlen(reason) + 1) + 5;
mod_cmd_write_queue(conn->ctl, buf, len);
}
{
if(rb_rawbuf_length(conn->modbuf_out) >= 4096)
{
- /* if we have over 4k pending outbound, don't read until
+ /* if we have over 4k pending outbound, don't read until
* we've cleared the queue */
SetCork(conn);
rb_setselect(conn->plain_fd, RB_SELECT_READ, NULL, NULL);
ssl_process_accept_cb(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data)
{
conn_t *conn = data;
+ uint8_t buf[5 + RB_SSL_CERTFP_LEN];
+
if(status == RB_OK)
{
+ if(rb_get_ssl_certfp(F, &buf[5]))
+ {
+ buf[0] = 'F';
+ int32_to_buf(&buf[1], conn->id);
+ mod_cmd_write_queue(conn->ctl, buf, sizeof buf);
+ }
conn_mod_read_cb(conn->mod_fd, conn);
conn_plain_read_cb(conn->plain_fd, conn);
return;
ssl_process_connect_cb(rb_fde_t *F, int status, void *data)
{
conn_t *conn = data;
+ uint8_t buf[5 + RB_SSL_CERTFP_LEN];
+
if(status == RB_OK)
{
+ if(rb_get_ssl_certfp(F, &buf[5]))
+ {
+ buf[0] = 'F';
+ int32_to_buf(&buf[1], conn->id);
+ mod_cmd_write_queue(conn->ctl, buf, sizeof buf);
+ }
conn_mod_read_cb(conn->mod_fd, conn);
conn_plain_read_cb(conn->plain_fd, conn);
}
{
char outstat[512];
conn_t *conn;
- const char *odata;
+ uint8_t *odata;
int32_t id;
id = buf_to_int32(&ctlb->buf[1]);
prng_seed_t seed_type;
seed_type = (prng_seed_t) ctl_buf->buf[1];
- path = &ctl_buf->buf[2];
+ path = (char *) &ctl_buf->buf[2];
rb_init_prng(path, seed_type);
}
char *buf;
char *cert, *key, *dhparam;
- buf = &ctl_buf->buf[2];
+ buf = (char *) &ctl_buf->buf[2];
cert = buf;
buf += strlen(cert) + 1;
key = buf;
break;
}
#else
-
+
case 'Z':
send_nozlib_support(ctl, ctl_buf);
break;