diff options
Diffstat (limited to 'network_io/unix/sockopt.c')
-rw-r--r-- | network_io/unix/sockopt.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index 6ce4b911efc04..6194e9b02c112 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -330,6 +330,20 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, return APR_ENOTIMPL; #endif break; + case APR_SO_FREEBIND: +#if defined(IP_FREEBIND) + if (setsockopt(sock->socketdes, SOL_IP, IP_FREEBIND, + (void *)&one, sizeof(int)) == -1) { + return errno; + } + apr_set_option(sock, APR_SO_FREEBIND, on); +#elif 0 /* defined(IP_BINDANY) ... */ + /* TODO: insert FreeBSD support here, note family specific + * options, IP_BINDANY vs IPV6_BINDANY */ +#else + return APR_ENOTIMPL; +#endif + break; default: return APR_EINVAL; } @@ -428,3 +442,24 @@ apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *nonconst_name, return APR_SUCCESS; } #endif + +APR_PERMS_SET_IMPLEMENT(socket) +{ +#if APR_HAVE_SOCKADDR_UN + apr_status_t rv = APR_SUCCESS; + apr_socket_t *socket = (apr_socket_t *)thesocket; + + if (socket->local_addr->family == APR_UNIX) { + if (!(perms & APR_FPROT_GSETID)) + gid = -1; + if (fchown(socket->socketdes, uid, gid) < 0) { + rv = errno; + } + } + else + rv = APR_EINVAL; + return rv; +#else + return APR_ENOTIMPL; +#endif +} |