Fix build on SunOS and add SMF manifest. Based on patches provided by

Jorge Schrauwen in joyent/pkgsrc#14.
This commit is contained in:
jperkin 2017-08-15 13:13:36 +00:00
parent c77d0e3c10
commit 0e5ec21510
5 changed files with 151 additions and 1 deletions

View file

@ -1,8 +1,11 @@
$NetBSD: distinfo,v 1.6 2016/08/07 13:19:24 nils Exp $
$NetBSD: distinfo,v 1.7 2017/08/15 13:13:36 jperkin Exp $
SHA1 (sslh-1.18.tar.gz) = dacf6250e26250513deeaa310c78591d5b3e77f4
RMD160 (sslh-1.18.tar.gz) = 49e83f975f7e8df8358bdd1d7afeabdbe6269a82
SHA512 (sslh-1.18.tar.gz) = 859ad65a258534fde68295a2880c077a00205d96a6aafeb525abce836850b9deea7b39daa2dc74a0dc18d2b198884958a39fbe758d61c93b257676f3a7d4f7bc
Size (sslh-1.18.tar.gz) = 53175 bytes
SHA1 (patch-common.c) = fb812e7aca2216c6b6577c9d33e37dd837e26fe7
SHA1 (patch-common.h) = 376a7d4d9ef28707d3dfc3df763a2a577f020772
SHA1 (patch-echosrv.c) = 611044fd7ed1fd52c44e2d8ff393091c35478e17
SHA1 (patch-sslh-main.c) = a74502a087b11c4d8f32791ac86c45c7a38923d9
SHA1 (patch-sslh-select.c) = d470e6dc803164fbdfa77ddc189cdb4dd7672bd4

View file

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='@SMF_NAME@'>
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='fs-root' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/root' />
</dependency>
<dependency name='network-service' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/service'/>
</dependency>
<dependency name='config-file' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file://localhost/@PKG_SYSCONFDIR@/sslh.cfg' />
</dependency>
<exec_method type='method' name='start' exec='@PREFIX@/sbin/sslh -F@PKG_SYSCONFDIR@/sslh.cfg' timeout_seconds='60' />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds='30' />
<template>
<common_name>
<loctext xml:lang='C'>SSL multiplexer service</loctext>
</common_name>
<documentation>
<manpage title='sslh' section='8' />
</documentation>
</template>
</service>
</service_bundle>

View file

@ -0,0 +1,51 @@
$NetBSD: patch-common.c,v 1.1 2017/08/15 13:13:36 jperkin Exp $
Avoid queue variable conflict.
--- common.c.orig 2016-03-29 19:19:05.000000000 +0000
+++ common.c
@@ -237,7 +237,7 @@ int connect_addr(struct connection *cnx,
}
/* Store some data to write to the queue later */
-int defer_write(struct queue *q, void* data, int data_size)
+int defer_write(struct sslhqueue *q, void* data, int data_size)
{
char *p;
if (verbose)
@@ -261,7 +261,7 @@ int defer_write(struct queue *q, void* d
* Upon success, the number of bytes written is returned.
* Upon failure, -1 returned (e.g. connexion closed)
* */
-int flush_deferred(struct queue *q)
+int flush_deferred(struct sslhqueue *q)
{
int n;
@@ -313,7 +313,7 @@ void dump_connection(struct connection *
* returns FD_STALLED if data was read, could not be written, and has been
* stored in temporary buffer.
*/
-int fd2fd(struct queue *target_q, struct queue *from_q)
+int fd2fd(struct sslhqueue *target_q, struct sslhqueue *from_q)
{
char buffer[BUFSIZ];
int target, from, size_r, size_w;
@@ -594,7 +594,7 @@ void setup_syslog(const char* bin_name)
int res;
name1 = strdup(bin_name);
- res = asprintf(&name2, "%s[%d]", basename(name1), getpid());
+ res = asprintf(&name2, "%s[%d]", basename(name1), (int)getpid());
CHECK_RES_DIE(res, "asprintf");
openlog(name2, LOG_CONS, LOG_AUTH);
free(name1);
@@ -694,7 +694,7 @@ void write_pid_file(const char* pidfile)
exit(3);
}
- fprintf(f, "%d\n", getpid());
+ fprintf(f, "%d\n", (int)getpid());
fclose(f);
}

View file

@ -0,0 +1,44 @@
$NetBSD: patch-common.h,v 1.1 2017/08/15 13:13:36 jperkin Exp $
Avoid queue variable conflict.
--- common.h.orig 2016-03-29 19:19:05.000000000 +0000
+++ common.h
@@ -69,7 +69,7 @@ enum connection_state {
/* A 'queue' is composed of a file descriptor (which can be read from or
* written to), and a queue for deferred write data */
-struct queue {
+struct sslhqueue {
int fd;
void *begin_deferred_data;
void *deferred_data;
@@ -84,7 +84,7 @@ struct connection {
/* q[0]: queue for external connection (client);
* q[1]: queue for internal connection (httpd or sshd);
* */
- struct queue q[2];
+ struct sslhqueue q[2];
};
#define FD_CNXCLOSED 0
@@ -95,7 +95,7 @@ struct connection {
/* common.c */
void init_cnx(struct connection *cnx);
int connect_addr(struct connection *cnx, int fd_from);
-int fd2fd(struct queue *target, struct queue *from);
+int fd2fd(struct sslhqueue *target, struct sslhqueue *from);
char* sprintaddr(char* buf, size_t size, struct addrinfo *a);
void resolve_name(struct addrinfo **out, char* fullname);
void log_connection(struct connection *cnx);
@@ -110,8 +110,8 @@ int resolve_split_name(struct addrinfo *
int start_listen_sockets(int *sockfd[], struct addrinfo *addr_list);
-int defer_write(struct queue *q, void* data, int data_size);
-int flush_deferred(struct queue *q);
+int defer_write(struct sslhqueue *q, void* data, int data_size);
+int flush_deferred(struct sslhqueue *q);
extern int probing_timeout, verbose, inetd, foreground,
background, transparent, numeric;

View file

@ -0,0 +1,25 @@
$NetBSD: patch-sslh-select.c,v 1.1 2017/08/15 13:13:36 jperkin Exp $
Avoid queue variable conflict.
--- sslh-select.c.orig 2016-03-29 19:19:05.000000000 +0000
+++ sslh-select.c
@@ -131,7 +131,7 @@ int accept_new_connection(int listen_soc
/* Connect queue 1 of connection to SSL; returns new file descriptor */
int connect_queue(struct connection *cnx, fd_set *fds_r, fd_set *fds_w)
{
- struct queue *q = &cnx->q[1];
+ struct sslhqueue *q = &cnx->q[1];
q->fd = connect_addr(cnx, cnx->q[0].fd);
if ((q->fd != -1) && fd_is_in_range(q->fd)) {
@@ -156,7 +156,8 @@ int connect_queue(struct connection *cnx
void shovel(struct connection *cnx, int active_fd,
fd_set *fds_r, fd_set *fds_w)
{
- struct queue *read_q, *write_q;
+ struct sslhqueue *read_q, *write_q;
+
read_q = &cnx->q[active_fd];
write_q = &cnx->q[1-active_fd];