Compare commits
2 Commits
master
...
plugin_rew
Author | SHA1 | Date | |
---|---|---|---|
|
c7d40dc6e0 | ||
|
9ac1a378d0 |
17
.drone.yml
17
.drone.yml
@ -1,17 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
network_mode: bridge
|
|
||||||
settings:
|
|
||||||
repo: sneak/uhub
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
tags:
|
|
||||||
- ${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}
|
|
||||||
- ${DRONE_COMMIT_SHA}
|
|
||||||
- ${DRONE_BRANCH/\//-}
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,3 +21,5 @@ debian/uhub.postrm.debhelper
|
|||||||
debian/uhub.prerm.debhelper
|
debian/uhub.prerm.debhelper
|
||||||
debian/uhub.substvars
|
debian/uhub.substvars
|
||||||
uhub-passwd
|
uhub-passwd
|
||||||
|
src/version.h
|
||||||
|
src/system.h
|
||||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "thirdparty/sqlite"]
|
[submodule "thirdparty/sqlite"]
|
||||||
path = thirdparty/sqlite
|
path = thirdparty/sqlite
|
||||||
url = https://github.com/janvidar/sqlite.git
|
url = git://github.com/janvidar/sqlite.git
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
dist: xenial
|
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
@ -10,5 +9,3 @@ install:
|
|||||||
- autotest/travis/install-build-depends.sh
|
- autotest/travis/install-build-depends.sh
|
||||||
script:
|
script:
|
||||||
- autotest/travis/build-and-test.sh
|
- autotest/travis/build-and-test.sh
|
||||||
dist: xenial
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
##
|
##
|
||||||
## Makefile for uhub
|
## Makefile for uhub
|
||||||
## Copyright (C) 2007-2013, Jan Vidar Krey <janvidar@extatic.org>
|
## Copyright (C) 2007-2019, Jan Vidar Krey <janvidar@extatic.org>
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.8.2)
|
cmake_minimum_required (VERSION 2.8.2)
|
||||||
@ -77,7 +77,6 @@ check_symbol_exists(memmem string.h HAVE_MEMMEM)
|
|||||||
check_symbol_exists(strndup string.h HAVE_STRNDUP)
|
check_symbol_exists(strndup string.h HAVE_STRNDUP)
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}")
|
include_directories("${PROJECT_SOURCE_DIR}")
|
||||||
include_directories("${PROJECT_BINARY_DIR}")
|
|
||||||
include_directories(${SQLITE3_INCLUDE_DIRS})
|
include_directories(${SQLITE3_INCLUDE_DIRS})
|
||||||
link_directories(${SQLITE3_LIBRARY_DIRS})
|
link_directories(${SQLITE3_LIBRARY_DIRS})
|
||||||
|
|
||||||
@ -121,6 +120,14 @@ add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c)
|
|||||||
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c)
|
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c)
|
||||||
add_library(mod_no_guest_downloads MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_no_guest_downloads.c)
|
add_library(mod_no_guest_downloads MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_no_guest_downloads.c)
|
||||||
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c)
|
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c)
|
||||||
|
add_library(mod_require_tls MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_require_tls.c)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(uhub ws2_32)
|
||||||
|
target_link_libraries(autotest-bin ws2_32)
|
||||||
|
target_link_libraries(mod_logging ws2_32)
|
||||||
|
target_link_libraries(mod_welcome ws2_32)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
mod_example
|
mod_example
|
||||||
@ -133,29 +140,27 @@ set_target_properties(
|
|||||||
mod_chat_only
|
mod_chat_only
|
||||||
mod_no_guest_downloads
|
mod_no_guest_downloads
|
||||||
mod_topic
|
mod_topic
|
||||||
|
mod_require_tls
|
||||||
PROPERTIES PREFIX "")
|
PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
||||||
target_link_libraries(uhub-passwd ${SQLITE3_LIBRARIES} utils)
|
target_link_libraries(uhub-passwd ${SQLITE3_LIBRARIES} utils)
|
||||||
target_link_libraries(autotest-bin ${CMAKE_DL_LIBS} adc network utils)
|
target_link_libraries(autotest-bin ${CMAKE_DL_LIBS} adc network utils)
|
||||||
target_link_libraries(mod_example utils)
|
target_link_libraries(mod_example utils)
|
||||||
target_link_libraries(mod_welcome network utils)
|
target_link_libraries(mod_welcome utils)
|
||||||
target_link_libraries(mod_auth_simple utils)
|
target_link_libraries(mod_auth_simple utils)
|
||||||
target_link_libraries(mod_auth_sqlite ${SQLITE3_LIBRARIES} utils)
|
target_link_libraries(mod_auth_sqlite ${SQLITE3_LIBRARIES} utils)
|
||||||
target_link_libraries(mod_chat_history utils)
|
target_link_libraries(mod_chat_history utils)
|
||||||
target_link_libraries(mod_chat_history_sqlite ${SQLITE3_LIBRARIES} utils)
|
target_link_libraries(mod_chat_history_sqlite ${SQLITE3_LIBRARIES} utils)
|
||||||
target_link_libraries(mod_no_guest_downloads utils)
|
target_link_libraries(mod_no_guest_downloads utils)
|
||||||
target_link_libraries(mod_chat_only utils)
|
target_link_libraries(mod_chat_only utils)
|
||||||
target_link_libraries(mod_logging network utils)
|
target_link_libraries(mod_logging utils)
|
||||||
target_link_libraries(mod_topic utils)
|
target_link_libraries(mod_topic utils)
|
||||||
|
target_link_libraries(mod_require_tls utils)
|
||||||
target_link_libraries(utils network)
|
target_link_libraries(utils network)
|
||||||
|
target_link_libraries(mod_welcome network)
|
||||||
|
target_link_libraries(mod_logging network)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(uhub ws2_32)
|
|
||||||
target_link_libraries(autotest-bin ws2_32)
|
|
||||||
target_link_libraries(mod_logging ws2_32)
|
|
||||||
target_link_libraries(mod_welcome ws2_32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_library(adcclient STATIC ${adcclient_SOURCES})
|
add_library(adcclient STATIC ${adcclient_SOURCES})
|
||||||
@ -221,8 +226,8 @@ if (SYSTEMD_SUPPORT)
|
|||||||
add_definitions(-DSYSTEMD)
|
add_definitions(-DSYSTEMD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file ("${PROJECT_SOURCE_DIR}/version.h.in" "${PROJECT_BINARY_DIR}/version.h")
|
configure_file ("${PROJECT_SOURCE_DIR}/version.h.in" "${PROJECT_SOURCE_DIR}/version.h")
|
||||||
configure_file ("${PROJECT_SOURCE_DIR}/system.h.in" "${PROJECT_BINARY_DIR}/system.h")
|
configure_file ("${PROJECT_SOURCE_DIR}/system.h.in" "${PROJECT_SOURCE_DIR}/system.h")
|
||||||
|
|
||||||
# mark_as_advanced(FORCE CMAKE_BUILD_TYPE)
|
# mark_as_advanced(FORCE CMAKE_BUILD_TYPE)
|
||||||
# if (RELEASE)
|
# if (RELEASE)
|
||||||
|
@ -47,8 +47,8 @@
|
|||||||
- marked plugin callbacks that are not called yet
|
- marked plugin callbacks that are not called yet
|
||||||
- add on_change_nick() to struct plugin_funcs
|
- add on_change_nick() to struct plugin_funcs
|
||||||
- minimal changes
|
- minimal changes
|
||||||
- Updated init script in Debian package.
|
- Updated init script in debian package.
|
||||||
- Updated list of man pages in Debian package.
|
- Updated list of man pages in debian package.
|
||||||
- Added man page for uhub-passwd.
|
- Added man page for uhub-passwd.
|
||||||
- Merge branch 'master' of https://github.com/Tilka/uhub
|
- Merge branch 'master' of https://github.com/Tilka/uhub
|
||||||
- Fix issue with QUI messages being allowed through the hub
|
- Fix issue with QUI messages being allowed through the hub
|
||||||
@ -78,7 +78,7 @@
|
|||||||
- minimal documentation fixes
|
- minimal documentation fixes
|
||||||
- update client software link
|
- update client software link
|
||||||
- update compile howto link
|
- update compile howto link
|
||||||
- fix Debian changelog
|
- fix debian changelog
|
||||||
- Fix bug #158 - Added plugin for setting topic (hub description).
|
- Fix bug #158 - Added plugin for setting topic (hub description).
|
||||||
- Command arguments handling + cleanups
|
- Command arguments handling + cleanups
|
||||||
|
|
||||||
|
19
Dockerfile
19
Dockerfile
@ -1,19 +0,0 @@
|
|||||||
FROM alpine:latest as builder
|
|
||||||
RUN apk update && apk upgrade && apk add --no-cache bash util-linux cmake make gcc git sqlite-dev openssl-dev git build-base
|
|
||||||
WORKDIR /app
|
|
||||||
COPY . .
|
|
||||||
RUN cmake . && make
|
|
||||||
RUN sed -i 's/\/usr\/lib\/uhub\//\/libs\//g' ./doc/*.conf && \
|
|
||||||
sed -i 's/\/usr\/lib\/uhub\//\/libs\//g' ./doc/rules.txt && \
|
|
||||||
sed -i 's/\/etc\/uhub\//\/conf\//g' ./doc/*.conf && \
|
|
||||||
sed -i 's/\/etc\/uhub\//\/conf\//g' ./doc/rules.txt && \
|
|
||||||
echo 'Welcome to uHub' > ./doc/motd.txt
|
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
RUN apk update && apk upgrade && apk add --no-cache bash util-linux openssl-dev sqlite-dev
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/uhub .
|
|
||||||
COPY --from=builder /app/doc/plugins.conf /app/doc/uhub.conf /app/doc/users.conf /app/doc/rules.txt /app/doc/motd.txt /conf/
|
|
||||||
COPY --from=builder /app/*.so /libs/
|
|
||||||
ENTRYPOINT ["./uhub"]
|
|
||||||
CMD ["-c","/conf/uhub.conf"]
|
|
@ -1,13 +1,8 @@
|
|||||||
# uhub
|
|
||||||
|
|
||||||
Welcome and thanks for downloading uHub, a high performance ADC p2p hub.
|
Welcome and thanks for downloading uHub, a high performance ADC p2p hub.
|
||||||
|
|
||||||
For the official documentation, bugs and other information, please visit:
|
For the official documentation, bugs and other information, please visit:
|
||||||
https://www.uhub.org/
|
http://www.uhub.org/
|
||||||
|
|
||||||
For a list of compatible ADC clients, see:
|
For a list of compatible ADC clients, see:
|
||||||
https://en.wikipedia.org/wiki/Comparison_of_ADC_software#Client_software
|
http://en.wikipedia.org/wiki/Advanced_Direct_Connect#Client_software
|
||||||
|
|
||||||
# on dockerhub
|
|
||||||
|
|
||||||
* https://hub.docker.com/r/sneak/uhub
|
|
@ -78,7 +78,7 @@ Description: a high performance hub for the ADC peer-to-peer network
|
|||||||
Its low memory footprint allows it to handle several thousand users
|
Its low memory footprint allows it to handle several thousand users
|
||||||
on high-end servers, or a small private hub on embedded hardware.
|
on high-end servers, or a small private hub on embedded hardware.
|
||||||
.
|
.
|
||||||
Homepage: https://www.uhub.org/
|
Homepage: http://www.extatic.org/uhub/
|
||||||
EOF
|
EOF
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SQLITE3_FOUND True if sqlite3 got found
|
# SQLITE3_FOUND True if sqlite3 got found
|
||||||
# SQLITE3_INCLUDEDIR Location of sqlite3 headers
|
# SQLITE3_INCLUDEDIR Location of sqlite3 headers
|
||||||
# SQLITE3_LIBRARIES List of libraries to use sqlite3
|
# SQLITE3_LIBRARIES List of libaries to use sqlite3
|
||||||
# SQLITE3_DEFINITIONS Definitions to compile sqlite3
|
# SQLITE3_DEFINITIONS Definitions to compile sqlite3
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Juha Tuomala <tuju@iki.fi>
|
# Copyright (c) 2007 Juha Tuomala <tuju@iki.fi>
|
||||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -20,5 +20,5 @@ Description: High performance ADC p2p hub
|
|||||||
- Advanced access control support
|
- Advanced access control support
|
||||||
- Easy configuration
|
- Easy configuration
|
||||||
.
|
.
|
||||||
Homepage: https://www.uhub.org/
|
Homepage: http://www.uhub.org/
|
||||||
|
|
||||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
On Debian GNU/Linux systems, the complete text of the GNU General Public
|
On Debian GNU/Linux systems, the complete text of the GNU General Public
|
||||||
License can be found in `/usr/share/common-licenses/GPL'.
|
License can be found in `/usr/share/common-licenses/GPL'.
|
||||||
|
@ -67,7 +67,7 @@ Accepting new users
|
|||||||
| | |
|
| | |
|
||||||
| V |
|
| V |
|
||||||
| --------------------- ---------------------
|
| --------------------- ---------------------
|
||||||
| | Send password | ------> | Receive and check |
|
| | Send password | ------> | Reveive and check |
|
||||||
| | request, if needed| | password. |
|
| | request, if needed| | password. |
|
||||||
| --------------------- ---------------------
|
| --------------------- ---------------------
|
||||||
| |
|
| |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
How to compile:
|
How to compile:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
See the official compiling howto: https://www.uhub.org/compile.php
|
See the official compiling howto: http://www.uhub.org/compile.php
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ Before you try to compile µHub, please make sure the following prerequisites ar
|
|||||||
* openssl > 0.9.8 (or use "make USE_SSL=NO")
|
* openssl > 0.9.8 (or use "make USE_SSL=NO")
|
||||||
* sqlite > 3.x
|
* sqlite > 3.x
|
||||||
|
|
||||||
or read https://www.uhub.org/compile.php for more info.
|
or read http://www.uhub.org/compile.php for more info.
|
||||||
|
|
||||||
|
|
||||||
Linux, Mac OSX, FreeBSD, NetBSD and OpenBSD
|
Linux, Mac OSX, FreeBSD, NetBSD and OpenBSD
|
||||||
|
@ -31,7 +31,7 @@ The hub should send a packet containing the token back:
|
|||||||
'IECH {token} {host:port}', aswell as the same message via TCP.
|
'IECH {token} {host:port}', aswell as the same message via TCP.
|
||||||
|
|
||||||
If the client receives the message via UDP, it should now be able to determine the type of NAT.
|
If the client receives the message via UDP, it should now be able to determine the type of NAT.
|
||||||
If the client receives the message via TCP only it knows it has a firewall blocking incoming communication.
|
If the client receives the message via TCP only it knows it has a firewall blocking incomming communication.
|
||||||
If the client does not receive the message, it should assume a firewall is blocking all UDP communication,
|
If the client does not receive the message, it should assume a firewall is blocking all UDP communication,
|
||||||
and resume in passive mode.
|
and resume in passive mode.
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ Example:
|
|||||||
If you are planning to more than 1024 users on hub, you must increase the max number of file descriptors allowed.
|
If you are planning to more than 1024 users on hub, you must increase the max number of file descriptors allowed.
|
||||||
This limit needs to be higher than the configured max_users in uhub.conf.
|
This limit needs to be higher than the configured max_users in uhub.conf.
|
||||||
|
|
||||||
In Linux can add the following lines to /etc/security/limits.conf (allows for ~4000 users)
|
In linux can add the following lines to /etc/security/limits.conf (allows for ~4000 users)
|
||||||
* soft nofile 4096
|
* soft nofile 4096
|
||||||
* hard nofile 4096
|
* hard nofile 4096
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# chkconfig: - 91 35
|
# chkconfig: - 91 35
|
||||||
# description: Starts and stops the Uhub ( https://www.uhub.org ) daemons on RHEL\CentOS \
|
# description: Starts and stops the Uhub ( http://www.uhub.org ) daemons on RHEL\CentOS \
|
||||||
# used to provide p2p network services.
|
# used to provide p2p network services.
|
||||||
#
|
#
|
||||||
# pidfile: /var/run/uhub.pid
|
# pidfile: /var/run/uhub.pid
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
# You should normally place this file in /etc/uhub/uhub.conf
|
# You should normally place this file in /etc/uhub/uhub.conf
|
||||||
# and customize some of the settings below.
|
# and customize some of the settings below.
|
||||||
#
|
#
|
||||||
# This file is read only to the uhub daemon, and if you
|
# This file is read only to the uhub deamon, and if you
|
||||||
# make changes to it while uhub is running you can send a
|
# make changes to it while uhub is running you can send a
|
||||||
# HUP signal to it ( $ killall -HUP uhub ), to reparse configuration (only on UNIX).
|
# HUP signal to it ( $ killall -HUP uhub ), to reparse configuration (only on UNIX).
|
||||||
# All configuration directives: https://www.uhub.org/config.php
|
# All configuration directives: http://www.uhub.org/config.php
|
||||||
|
|
||||||
# Bind to this port and address
|
# Bind to this port and address
|
||||||
# server_bind_addr=any means listen to "::" if IPv6 is supported
|
# server_bind_addr=any means listen to "::" if IPv6 is supported
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
inherit eutils
|
inherit eutils
|
||||||
|
|
||||||
if [ "$PV" != "9999" ]; then
|
if [ "$PV" != "9999" ]; then
|
||||||
SRC_URI="https://www.extatic.org/downloads/uhub/${P}-src.tar.bz2"
|
SRC_URI="http://www.extatic.org/downloads/uhub/${P}-src.tar.bz2"
|
||||||
KEYWORDS="~amd64 ~x86"
|
KEYWORDS="~amd64 ~x86"
|
||||||
else
|
else
|
||||||
inherit git
|
inherit git
|
||||||
@ -16,7 +16,7 @@ fi
|
|||||||
EAPI="2"
|
EAPI="2"
|
||||||
|
|
||||||
DESCRIPTION="High performance ADC hub"
|
DESCRIPTION="High performance ADC hub"
|
||||||
HOMEPAGE="https://www.uhub.org/"
|
HOMEPAGE="http://www.uhub.org/"
|
||||||
|
|
||||||
LICENSE="GPL-3"
|
LICENSE="GPL-3"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
|
@ -5,7 +5,7 @@ Release: 2
|
|||||||
License: GPLv3
|
License: GPLv3
|
||||||
Group: Networking/File transfer
|
Group: Networking/File transfer
|
||||||
Source: uhub-%{version}.tar.gz
|
Source: uhub-%{version}.tar.gz
|
||||||
URL: https://www.uhub.org
|
URL: http://www.uhub.org
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||||
|
|
||||||
BuildRequires: sqlite-devel
|
BuildRequires: sqlite-devel
|
||||||
@ -80,7 +80,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
if [ $1 -gt 1 ] ; then
|
if [ $1 -gt 1 ] ; then
|
||||||
/etc/rc.d/init.d/uhub restart >/dev/null || :
|
/etc/rc.d/init.d/uhub restart >/dev/null || :
|
||||||
fi
|
fi
|
||||||
# need more information about add services and users in system
|
# need more informations about add services and users in system
|
||||||
/usr/sbin/adduser -M -d /tmp -G nobody -s /sbin/nologin -c 'The Uhub ADC p2p hub Daemon' uhub >/dev/null 2>&1 ||:
|
/usr/sbin/adduser -M -d /tmp -G nobody -s /sbin/nologin -c 'The Uhub ADC p2p hub Daemon' uhub >/dev/null 2>&1 ||:
|
||||||
# write SSL create
|
# write SSL create
|
||||||
echo "PLS see /usr/share/doc/uhub/"
|
echo "PLS see /usr/share/doc/uhub/"
|
||||||
|
@ -8,7 +8,7 @@ start on filesystem or runlevel [2345]
|
|||||||
stop on runlevel [!2345]
|
stop on runlevel [!2345]
|
||||||
|
|
||||||
# Allow the service to respawn, but if its happening too often
|
# Allow the service to respawn, but if its happening too often
|
||||||
# (10 times in 5 seconds) there's a problem and we should stop trying.
|
# (10 times in 5 seconds) theres a problem and we should stop trying.
|
||||||
respawn
|
respawn
|
||||||
respawn limit 10 5
|
respawn limit 10 5
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -118,8 +118,8 @@ typedef uint32_t fourcc_t;
|
|||||||
#define ADC_INF_FLAG_SUPPORT "SU" /* support (extensions, feature cast) */
|
#define ADC_INF_FLAG_SUPPORT "SU" /* support (extensions, feature cast) */
|
||||||
#define ADC_INF_FLAG_SHARED_SIZE "SS" /* size of total files shared in bytes */
|
#define ADC_INF_FLAG_SHARED_SIZE "SS" /* size of total files shared in bytes */
|
||||||
#define ADC_INF_FLAG_SHARED_FILES "SF" /* number of files shared */
|
#define ADC_INF_FLAG_SHARED_FILES "SF" /* number of files shared */
|
||||||
#define ADC_INF_FLAG_UPLOAD_SPEED "US" /* maximum upload speed achieved in bytes/sec */
|
#define ADC_INF_FLAG_UPLOAD_SPEED "US" /* maximum upload speed acheived in bytes/sec */
|
||||||
#define ADC_INF_FLAG_DOWNLOAD_SPEED "DS" /* maximum download speed achieved in bytes/sec */
|
#define ADC_INF_FLAG_DOWNLOAD_SPEED "DS" /* maximum download speed acheived in bytes/sec */
|
||||||
#define ADC_INF_FLAG_UPLOAD_SLOTS "SL" /* maximum upload slots (concurrent uploads) */
|
#define ADC_INF_FLAG_UPLOAD_SLOTS "SL" /* maximum upload slots (concurrent uploads) */
|
||||||
#define ADC_INF_FLAG_AUTO_SLOTS "AS" /* automatic slot if upload speed is less than this in bytes/sec */
|
#define ADC_INF_FLAG_AUTO_SLOTS "AS" /* automatic slot if upload speed is less than this in bytes/sec */
|
||||||
#define ADC_INF_FLAG_AUTO_SLOTS_MAX "AM" /* maximum number of automatic slots */
|
#define ADC_INF_FLAG_AUTO_SLOTS_MAX "AM" /* maximum number of automatic slots */
|
||||||
@ -134,7 +134,7 @@ typedef uint32_t fourcc_t;
|
|||||||
#define ADC_MSG_FLAG_PRIVATE "PM" /* message is a private message */
|
#define ADC_MSG_FLAG_PRIVATE "PM" /* message is a private message */
|
||||||
|
|
||||||
#define ADC_SCH_FLAG_INCLUDE "AN" /* include given search term */
|
#define ADC_SCH_FLAG_INCLUDE "AN" /* include given search term */
|
||||||
#define ADC_SCH_FLAG_EXCLUDE "NO" /* exclude given search term */
|
#define ADC_SCH_FLAG_EXCLUDE "NO" /* exclude given serach term */
|
||||||
#define ADC_SCH_FLAG_FILE_EXTENSION "EX" /* search only for files with the given file extension */
|
#define ADC_SCH_FLAG_FILE_EXTENSION "EX" /* search only for files with the given file extension */
|
||||||
#define ADC_SCH_FLAG_FILE_TYPE "TY" /* search only for files with this file type (separate type) */
|
#define ADC_SCH_FLAG_FILE_TYPE "TY" /* search only for files with this file type (separate type) */
|
||||||
#define ADC_SCH_FLAG_LESS_THAN "LE" /* search for files with this size or less */
|
#define ADC_SCH_FLAG_LESS_THAN "LE" /* search for files with this size or less */
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ enum msg_status_level
|
|||||||
extern struct adc_message* adc_msg_incref(struct adc_message* msg);
|
extern struct adc_message* adc_msg_incref(struct adc_message* msg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease the reference counter, and free the memory when appropriate.
|
* Decrease the reference counter, and free the memory when apropriate.
|
||||||
*/
|
*/
|
||||||
extern void adc_msg_free(struct adc_message* msg);
|
extern void adc_msg_free(struct adc_message* msg);
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ extern char* adc_msg_get_argument(struct adc_message* cmd, int offset);
|
|||||||
*
|
*
|
||||||
* @arg prefix a 2 character argument prefix
|
* @arg prefix a 2 character argument prefix
|
||||||
* @arg string must be escaped (see adc_msg_escape).
|
* @arg string must be escaped (see adc_msg_escape).
|
||||||
* @return 0 if successful, or -1 if an error occurred.
|
* @return 0 if successful, or -1 if an error occured.
|
||||||
*/
|
*/
|
||||||
extern int adc_msg_replace_named_argument(struct adc_message* cmd, const char prefix[2], const char* string);
|
extern int adc_msg_replace_named_argument(struct adc_message* cmd, const char prefix[2], const char* string);
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ extern int adc_msg_replace_named_argument(struct adc_message* cmd, const char pr
|
|||||||
* Append an argument
|
* Append an argument
|
||||||
*
|
*
|
||||||
* @arg string must be escaped (see adc_msg_escape).
|
* @arg string must be escaped (see adc_msg_escape).
|
||||||
* @return 0 if successful, or -1 if an error occurred (out of memory).
|
* @return 0 if successful, or -1 if an error occured (out of memory).
|
||||||
*/
|
*/
|
||||||
extern int adc_msg_add_argument(struct adc_message* cmd, const char* string);
|
extern int adc_msg_add_argument(struct adc_message* cmd, const char* string);
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ extern int adc_msg_add_argument(struct adc_message* cmd, const char* string);
|
|||||||
*
|
*
|
||||||
* @arg prefix a 2 character argument prefix
|
* @arg prefix a 2 character argument prefix
|
||||||
* @arg string must be escaped (see adc_msg_escape).
|
* @arg string must be escaped (see adc_msg_escape).
|
||||||
* @return 0 if successful, or -1 if an error occurred (out of memory).
|
* @return 0 if successful, or -1 if an error occured (out of memory).
|
||||||
*/
|
*/
|
||||||
extern int adc_msg_add_named_argument(struct adc_message* cmd, const char prefix[2], const char* string);
|
extern int adc_msg_add_named_argument(struct adc_message* cmd, const char prefix[2], const char* string);
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ extern int adc_msg_add_named_argument(struct adc_message* cmd, const char prefix
|
|||||||
*
|
*
|
||||||
* @arg prefix a 2 character argument prefix
|
* @arg prefix a 2 character argument prefix
|
||||||
* @arg string must NOT be escaped
|
* @arg string must NOT be escaped
|
||||||
* @return 0 if successful, or -1 if an error occurred (out of memory).
|
* @return 0 if successful, or -1 if an error occured (out of memory).
|
||||||
*/
|
*/
|
||||||
extern int adc_msg_add_named_argument_string(struct adc_message* cmd, const char prefix[2], const char* string);
|
extern int adc_msg_add_named_argument_string(struct adc_message* cmd, const char prefix[2], const char* string);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ struct command_base;
|
|||||||
*
|
*
|
||||||
* @param cbase Command base pointer.
|
* @param cbase Command base pointer.
|
||||||
* @param user User who invoked the command.
|
* @param user User who invoked the command.
|
||||||
* @param message The message that is to be interpreted as a command (including the invocation prefix '!' or '+')
|
* @param message The message that is to be interpreted as a command (including the invokation prefix '!' or '+')
|
||||||
*
|
*
|
||||||
* @return a hub_command that must be freed with command_free(). @See struct hub_command.
|
* @return a hub_command that must be freed with command_free(). @See struct hub_command.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@
|
|||||||
<check min="1024" max="1048576" />
|
<check min="1024" max="1048576" />
|
||||||
<short>Max read buffer before parse, per user</short>
|
<short>Max read buffer before parse, per user</short>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
Maximum receive buffer allowed before commands are processed. If a single ADC message exceeds this limit, it will be discarded by the hub. Use with caution.
|
Maximum receive buffer allowed before commands are procesed. If a single ADC message exceeds this limit, it will be discarded by the hub. Use with caution.
|
||||||
]]></description>
|
]]></description>
|
||||||
<since>0.1.3</since>
|
<since>0.1.3</since>
|
||||||
</option>
|
</option>
|
||||||
@ -567,7 +567,7 @@
|
|||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option name="msg_inf_error_nick_taken" type="message" default="Nickname is already in use">
|
<option name="msg_inf_error_nick_taken" type="message" default="Nickname is already in use">
|
||||||
<description><![CDATA[This message will be sent to clients if their provided nickname is already in use on the hub.]]></description>
|
<description><![CDATA[This message will be sent to clients if their provided nickname is alredy in use on the hub.]]></description>
|
||||||
<since>0.2.0</since>
|
<since>0.2.0</since>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ static int check_hash_tiger(const char* cid, const char* pid)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Only works for tiger hash. If a client doesn't support tiger we cannot let it in!
|
* FIXME: Only works for tiger hash. If a client doesnt support tiger we cannot let it in!
|
||||||
*/
|
*/
|
||||||
static int check_cid(struct hub_info* hub, struct hub_user* user, struct adc_message* cmd)
|
static int check_cid(struct hub_info* hub, struct hub_user* user, struct adc_message* cmd)
|
||||||
{
|
{
|
||||||
@ -337,19 +337,9 @@ static int check_logged_in(struct hub_info* hub, struct hub_user* user, struct a
|
|||||||
{
|
{
|
||||||
if (lookup1 == lookup2)
|
if (lookup1 == lookup2)
|
||||||
{
|
{
|
||||||
if (user_flag_get(lookup1, flag_choke))
|
LOG_DEBUG("check_logged_in: exact same user is logged in: %s", user->id.nick);
|
||||||
{
|
|
||||||
LOG_DEBUG("check_logged_in: exact same user is already logged in, but likely ghost: %s", user->id.nick);
|
|
||||||
|
|
||||||
// Old user unable to swallow data.
|
|
||||||
// Disconnect the existing user, and allow new user to enter.
|
|
||||||
hub_disconnect_user(hub, lookup1, quit_ghost_timeout);
|
hub_disconnect_user(hub, lookup1, quit_ghost_timeout);
|
||||||
}
|
return 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_DEBUG("check_logged_in: exact same user is already logged in: %s", user->id.nick);
|
|
||||||
return status_msg_inf_error_cid_taken;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int main_loop()
|
|||||||
setup_signal_handlers(hub);
|
setup_signal_handlers(hub);
|
||||||
#ifdef SYSTEMD
|
#ifdef SYSTEMD
|
||||||
/* Notify the service manager that this daemon has
|
/* Notify the service manager that this daemon has
|
||||||
* been successfully initialized and shall enter the
|
* been successfully initalized and shall enter the
|
||||||
* main loop.
|
* main loop.
|
||||||
*/
|
*/
|
||||||
sd_notifyf(0, "READY=1\n"
|
sd_notifyf(0, "READY=1\n"
|
||||||
@ -471,7 +471,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else if (ret == 0)
|
else if (ret == 0)
|
||||||
{
|
{
|
||||||
/* child process - detach from TTY */
|
/* child process - detatch from TTY */
|
||||||
fclose(stdin);
|
fclose(stdin);
|
||||||
fclose(stdout);
|
fclose(stdout);
|
||||||
fclose(stderr);
|
fclose(stderr);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -137,12 +137,6 @@ void net_event(struct net_connection* con, int event, void *arg)
|
|||||||
LOG_TRACE("net_event() : fd=%d, ev=%d, arg=%p", con->sd, (int) event, arg);
|
LOG_TRACE("net_event() : fd=%d, ev=%d, arg=%p", con->sd, (int) event, arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (event == NET_EVENT_ERROR)
|
|
||||||
{
|
|
||||||
hub_disconnect_user(user->hub, user, quit_socket_error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event == NET_EVENT_TIMEOUT)
|
if (event == NET_EVENT_TIMEOUT)
|
||||||
{
|
{
|
||||||
if (user_is_connecting(user))
|
if (user_is_connecting(user))
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -96,6 +96,29 @@ static int cbfunc_user_disconnect(struct plugin_handle* plugin, struct plugin_us
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cbfunc_user_redirect(struct plugin_handle* plugin, struct plugin_user* user, const char* address)
|
||||||
|
{
|
||||||
|
char* buffer = adc_msg_escape(address);
|
||||||
|
struct adc_message* command = adc_msg_construct(ADC_CMD_IQUI, strlen(buffer) + 10);
|
||||||
|
adc_msg_add_named_argument(command, ADC_QUI_FLAG_REDIRECT, buffer);
|
||||||
|
route_to_user(plugin_get_hub(plugin), convert_user_type(user), command);
|
||||||
|
adc_msg_free(command);
|
||||||
|
hub_free(buffer);
|
||||||
|
hub_disconnect_user(plugin_get_hub(plugin), convert_user_type(user), quit_disconnected);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cbfunc_user_is_tls_connected(struct plugin_handle* plugin, struct plugin_user* user)
|
||||||
|
{
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
struct hub_user* u = convert_user_type(user);
|
||||||
|
return net_con_is_ssl(u->connection);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int cbfunc_command_add(struct plugin_handle* plugin, struct plugin_command_handle* cmdh)
|
static int cbfunc_command_add(struct plugin_handle* plugin, struct plugin_command_handle* cmdh)
|
||||||
{
|
{
|
||||||
struct plugin_callback_data* data = get_callback_data(plugin);
|
struct plugin_callback_data* data = get_callback_data(plugin);
|
||||||
@ -203,6 +226,8 @@ void plugin_register_callback_functions(struct plugin_handle* handle)
|
|||||||
handle->hub.send_broadcast_message = cbfunc_send_broadcast;
|
handle->hub.send_broadcast_message = cbfunc_send_broadcast;
|
||||||
handle->hub.send_status_message = cbfunc_send_status;
|
handle->hub.send_status_message = cbfunc_send_status;
|
||||||
handle->hub.user_disconnect = cbfunc_user_disconnect;
|
handle->hub.user_disconnect = cbfunc_user_disconnect;
|
||||||
|
handle->hub.user_redirect = cbfunc_user_redirect;
|
||||||
|
handle->hub.user_is_tls_connected = cbfunc_user_is_tls_connected;
|
||||||
handle->hub.command_add = cbfunc_command_add;
|
handle->hub.command_add = cbfunc_command_add;
|
||||||
handle->hub.command_del = cbfunc_command_del;
|
handle->hub.command_del = cbfunc_command_del;
|
||||||
handle->hub.command_arg_reset = cbfunc_command_arg_reset;
|
handle->hub.command_arg_reset = cbfunc_command_arg_reset;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -90,14 +90,11 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
|
|||||||
if (probe->hub->config->tls_enable)
|
if (probe->hub->config->tls_enable)
|
||||||
{
|
{
|
||||||
LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[9], (int) probe_recvbuf[10]);
|
LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[9], (int) probe_recvbuf[10]);
|
||||||
if (net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ctx) < 0)
|
if (user_create(probe->hub, probe->connection, &probe->addr))
|
||||||
{
|
|
||||||
LOG_TRACE("TLS handshake negotiation failed.");
|
|
||||||
}
|
|
||||||
else if (user_create(probe->hub, probe->connection, &probe->addr))
|
|
||||||
{
|
{
|
||||||
probe->connection = 0;
|
probe->connection = 0;
|
||||||
}
|
}
|
||||||
|
net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ctx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -82,19 +82,16 @@ static int check_send_queue(struct hub_info* hub, struct hub_user* user, struct
|
|||||||
|
|
||||||
if ((user->send_queue->size + msg->length) > get_max_send_queue(hub))
|
if ((user->send_queue->size + msg->length) > get_max_send_queue(hub))
|
||||||
{
|
{
|
||||||
user_flag_set(user, flag_choke);
|
|
||||||
LOG_WARN("send queue overflowed, message discarded.");
|
LOG_WARN("send queue overflowed, message discarded.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user->send_queue->size > get_max_send_queue_soft(hub))
|
if (user->send_queue->size > get_max_send_queue_soft(hub))
|
||||||
{
|
{
|
||||||
user_flag_set(user, flag_choke);
|
|
||||||
LOG_WARN("send queue soft overflowed.");
|
LOG_WARN("send queue soft overflowed.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
user_flag_unset(user, flag_choke);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ enum user_quit_reason
|
|||||||
quit_timeout = 4, /** User timed out (no data for a while) */
|
quit_timeout = 4, /** User timed out (no data for a while) */
|
||||||
quit_send_queue = 5, /** User's send queue was overflowed */
|
quit_send_queue = 5, /** User's send queue was overflowed */
|
||||||
quit_memory_error = 6, /** Not enough memory available */
|
quit_memory_error = 6, /** Not enough memory available */
|
||||||
quit_socket_error = 7, /** A socket error occurred */
|
quit_socket_error = 7, /** A socket error occured */
|
||||||
quit_protocol_error = 8, /** Fatal protocol error */
|
quit_protocol_error = 8, /** Fatal protocol error */
|
||||||
quit_logon_error = 9, /** Unable to login (wrong password, CID/PID, etc) */
|
quit_logon_error = 9, /** Unable to login (wrong password, CID/PID, etc) */
|
||||||
quit_update_error = 10, /** Update error. INF update changed share/slot info and no longer satisfies the hub limits. */
|
quit_update_error = 10, /** Update error. INF update changed share/slot info and no longer satisfies the hub limits. */
|
||||||
@ -76,7 +76,7 @@ enum user_quit_reason
|
|||||||
quit_ghost_timeout = 12, /** The user is a ghost, and trying to login from another connection */
|
quit_ghost_timeout = 12, /** The user is a ghost, and trying to login from another connection */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns an appropriate string for the given quit reason */
|
/** Returns an apropriate string for the given quit reason */
|
||||||
extern const char* user_get_quit_reason_string(enum user_quit_reason);
|
extern const char* user_get_quit_reason_string(enum user_quit_reason);
|
||||||
|
|
||||||
struct hub_user_info
|
struct hub_user_info
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ extern struct hub_user_manager* uman_init();
|
|||||||
* Shuts down the user manager.
|
* Shuts down the user manager.
|
||||||
* All users will be disconnected and deleted as part of this.
|
* All users will be disconnected and deleted as part of this.
|
||||||
*
|
*
|
||||||
* @return 0 on success, or -1 in an error occurred (invalid pointer).
|
* @return 0 on success, or -1 in an error occured (invalid pointer).
|
||||||
*/
|
*/
|
||||||
extern int uman_shutdown(struct hub_user_manager* users);
|
extern int uman_shutdown(struct hub_user_manager* users);
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ extern struct hub_user* uman_get_user_by_nick(struct hub_user_manager* users, co
|
|||||||
*
|
*
|
||||||
* @param[out] target the list of users matching the address
|
* @param[out] target the list of users matching the address
|
||||||
* @param range the IP range of users to match
|
* @param range the IP range of users to match
|
||||||
* @return The number of users matching the addresses, or -1 on error (mask is wrong).
|
* @return The number of users matching the addressess, or -1 on error (mask is wrong).
|
||||||
*/
|
*/
|
||||||
extern size_t uman_get_user_by_addr(struct hub_user_manager* users, struct linked_list* target, struct ip_range* range);
|
extern size_t uman_get_user_by_addr(struct hub_user_manager* users, struct linked_list* target, struct ip_range* range);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ extern void net_con_close(struct net_connection* con);
|
|||||||
*
|
*
|
||||||
* @return returns the number of bytes sent.
|
* @return returns the number of bytes sent.
|
||||||
* 0 if no data is sent, and this function should be called again (EWOULDBLOCK/EINTR)
|
* 0 if no data is sent, and this function should be called again (EWOULDBLOCK/EINTR)
|
||||||
* <0 if an error occurred, the negative number contains the error code.
|
* <0 if an error occured, the negative number contains the error code.
|
||||||
*/
|
*/
|
||||||
extern ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len);
|
extern ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len);
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ extern ssize_t net_con_send(struct net_connection* con, const void* buf, size_t
|
|||||||
*
|
*
|
||||||
* @return returns the number of bytes sent.
|
* @return returns the number of bytes sent.
|
||||||
* 0 if no data is sent, and this function should be called again (EWOULDBLOCK/EINTR)
|
* 0 if no data is sent, and this function should be called again (EWOULDBLOCK/EINTR)
|
||||||
* <0 if an error occurred, the negative number contains the error code.
|
* <0 if an error occured, the negative number contains the error code.
|
||||||
*/
|
*/
|
||||||
extern ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len);
|
extern ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len);
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ extern ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len);
|
|||||||
extern ssize_t net_con_peek(struct net_connection* con, void* buf, size_t len);
|
extern ssize_t net_con_peek(struct net_connection* con, void* buf, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set timeout for connection.
|
* Set timeout for connetion.
|
||||||
*
|
*
|
||||||
* @param seconds the number of seconds into the future.
|
* @param seconds the number of seconds into the future.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ extern int ip_is_valid_ipv6(const char* address);
|
|||||||
*
|
*
|
||||||
* @param text_addr is an ipaddress either ipv6 or ipv4.
|
* @param text_addr is an ipaddress either ipv6 or ipv4.
|
||||||
* Special magic addresses called "any" and "loopback" exist,
|
* Special magic addresses called "any" and "loopback" exist,
|
||||||
* and will work across IPv6/IPv4.
|
* and will work accross IPv6/IPv4.
|
||||||
* @param port Fill the struct sockaddr* with the given port, can safely be ignored.
|
* @param port Fill the struct sockaddr* with the given port, can safely be ignored.
|
||||||
*/
|
*/
|
||||||
extern int ip_convert_address(const char* text_address, int port, struct sockaddr* addr, socklen_t* addr_len);
|
extern int ip_convert_address(const char* text_address, int port, struct sockaddr* addr, socklen_t* addr_len);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2019, Jan Vidar Krey
|
* Copyright (C) 2007-2014, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -805,22 +805,4 @@ void net_stats_add_close()
|
|||||||
stats.closed++;
|
stats.closed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_stats_tls_add_accept()
|
|
||||||
{
|
|
||||||
stats.tls_accept++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void net_stats_tls_add_connect()
|
|
||||||
{
|
|
||||||
stats.tls_connect++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void net_stats_tls_add_error()
|
|
||||||
{
|
|
||||||
stats.tls_error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void net_stats_tls_add_close()
|
|
||||||
{
|
|
||||||
stats.tls_close++;
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2019, Jan Vidar Krey
|
* Copyright (C) 2007-2014, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -28,10 +28,6 @@ struct net_statistics
|
|||||||
size_t accept;
|
size_t accept;
|
||||||
size_t closed;
|
size_t closed;
|
||||||
size_t errors;
|
size_t errors;
|
||||||
size_t tls_accept;
|
|
||||||
size_t tls_connect;
|
|
||||||
size_t tls_error;
|
|
||||||
size_t tls_close;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct net_socket_t;
|
struct net_socket_t;
|
||||||
@ -57,7 +53,7 @@ extern int net_initialize();
|
|||||||
extern int net_destroy();
|
extern int net_destroy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of sockets currently being monitored.
|
* @return the number of sockets currrently being monitored.
|
||||||
*/
|
*/
|
||||||
extern int net_monitor_count();
|
extern int net_monitor_count();
|
||||||
|
|
||||||
@ -67,7 +63,7 @@ extern int net_monitor_count();
|
|||||||
extern int net_monitor_capacity();
|
extern int net_monitor_capacity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the last error code occurred.
|
* @return the last error code occured.
|
||||||
*
|
*
|
||||||
* NOTE: On Windows this is the last error code from the socket library, but
|
* NOTE: On Windows this is the last error code from the socket library, but
|
||||||
* on UNIX this is the errno variable that can be overwritten by any
|
* on UNIX this is the errno variable that can be overwritten by any
|
||||||
@ -251,14 +247,9 @@ extern void net_stats_report();
|
|||||||
extern void net_stats_reset();
|
extern void net_stats_reset();
|
||||||
extern void net_stats_add_tx(size_t bytes);
|
extern void net_stats_add_tx(size_t bytes);
|
||||||
extern void net_stats_add_rx(size_t bytes);
|
extern void net_stats_add_rx(size_t bytes);
|
||||||
extern void net_stats_tls_add_accept();
|
|
||||||
extern void net_stats_tls_add_connect();
|
|
||||||
extern void net_stats_tls_add_error();
|
|
||||||
extern void net_stats_tls_add_close();
|
|
||||||
extern void net_stats_add_accept();
|
extern void net_stats_add_accept();
|
||||||
extern void net_stats_add_error();
|
extern void net_stats_add_error();
|
||||||
extern void net_stats_add_close();
|
extern void net_stats_add_close();
|
||||||
extern void net_stats_add_connect();
|
|
||||||
extern int net_stats_timeout();
|
extern int net_stats_timeout();
|
||||||
extern void net_stats_get(struct net_statistics** intermediate, struct net_statistics** total);
|
extern void net_stats_get(struct net_statistics** intermediate, struct net_statistics** total);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2019, Jan Vidar Krey
|
* Copyright (C) 2007-2014, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
void net_stats_add_tx(size_t bytes);
|
void net_stats_add_tx(size_t bytes);
|
||||||
void net_stats_add_rx(size_t bytes);
|
void net_stats_add_rx(size_t bytes);
|
||||||
void net_stats_tls_add_accept();
|
|
||||||
void net_stats_tls_add_errors();
|
|
||||||
void net_stats_tls_add_accept();
|
|
||||||
|
|
||||||
|
|
||||||
struct net_ssl_openssl
|
struct net_ssl_openssl
|
||||||
{
|
{
|
||||||
@ -133,104 +129,37 @@ static void add_io_stats(struct net_ssl_openssl* handle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SSL_METHOD* get_ssl_method(const char* tls_version, long* flags)
|
static const SSL_METHOD* get_ssl_method(const char* tls_version)
|
||||||
{
|
{
|
||||||
if (!flags)
|
|
||||||
{
|
|
||||||
LOG_ERROR("flags is null");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tls_version || !*tls_version)
|
if (!tls_version || !*tls_version)
|
||||||
{
|
{
|
||||||
LOG_ERROR("tls_version is not set.");
|
LOG_ERROR("tls_version is not set.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*flags = 0;
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
*flags |= SSL_OP_NO_SSLv2;
|
|
||||||
*flags |= SSL_OP_NO_SSLv3;
|
|
||||||
|
|
||||||
if (!strcmp(tls_version, "1.0"))
|
if (!strcmp(tls_version, "1.0"))
|
||||||
{
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
||||||
return TLSv1_method();
|
return TLSv1_method();
|
||||||
#endif
|
if (!strcmp(tls_version, "1.1"))
|
||||||
}
|
|
||||||
else if (!strcmp(tls_version, "1.1"))
|
|
||||||
{
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
||||||
return TLSv1_1_method();
|
return TLSv1_1_method();
|
||||||
#else
|
if (!strcmp(tls_version, "1.2"))
|
||||||
*flags |= SSL_OP_NO_TLSv1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (!strcmp(tls_version, "1.2"))
|
|
||||||
{
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
||||||
return TLSv1_2_method();
|
return TLSv1_2_method();
|
||||||
#else
|
|
||||||
*flags |= SSL_OP_NO_TLSv1;
|
LOG_ERROR("Unable to recognize tls_version.");
|
||||||
*flags |= SSL_OP_NO_TLSv1_1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (!strcmp(tls_version, "1.3"))
|
|
||||||
{
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
||||||
LOG_ERROR("TLS 1.3 is not supported by this version of OpenSSL");
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
*flags |= SSL_OP_NO_TLSv1;
|
LOG_WARN("tls_version is obsolete, and should not be used.");
|
||||||
*flags |= SSL_OP_NO_TLSv1_1;
|
|
||||||
*flags |= SSL_OP_NO_TLSv1_2;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_ERROR("Unable to recognize tls_version: %s", tls_version);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
||||||
// never gets here!
|
|
||||||
#else
|
|
||||||
return TLS_method();
|
return TLS_method();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List of supported protocols for ALPN.
|
|
||||||
* We only support "adc" protocol.
|
|
||||||
*/
|
|
||||||
unsigned char alpn_protocols[] = {
|
|
||||||
3, 'a', 'd', 'c',
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback for the server to select a protocol from the list
|
|
||||||
* sent by the client via ALPN.
|
|
||||||
*/
|
|
||||||
static int alpn_server_select_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen,
|
|
||||||
const unsigned char *in, unsigned int inlen, void *arg)
|
|
||||||
{
|
|
||||||
int res = SSL_select_next_proto((unsigned char **)out, outlen,
|
|
||||||
alpn_protocols, sizeof(alpn_protocols), in, inlen);
|
|
||||||
if (res == OPENSSL_NPN_NO_OVERLAP)
|
|
||||||
{
|
|
||||||
// set default protocol
|
|
||||||
*out = alpn_protocols;
|
|
||||||
*outlen = 1+alpn_protocols[0];
|
|
||||||
}
|
|
||||||
return SSL_TLSEXT_ERR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new SSL context.
|
* Create a new SSL context.
|
||||||
*/
|
*/
|
||||||
struct ssl_context_handle* net_ssl_context_create(const char* tls_version, const char* tls_ciphersuite)
|
struct ssl_context_handle* net_ssl_context_create(const char* tls_version, const char* tls_ciphersuite)
|
||||||
{
|
{
|
||||||
struct net_context_openssl* ctx = (struct net_context_openssl*) hub_malloc_zero(sizeof(struct net_context_openssl));
|
struct net_context_openssl* ctx = (struct net_context_openssl*) hub_malloc_zero(sizeof(struct net_context_openssl));
|
||||||
long flags = 0;
|
const SSL_METHOD* ssl_method = get_ssl_method(tls_version);
|
||||||
const SSL_METHOD* ssl_method = get_ssl_method(tls_version, &flags);
|
|
||||||
|
|
||||||
if (!ssl_method)
|
if (!ssl_method)
|
||||||
{
|
{
|
||||||
@ -240,18 +169,23 @@ struct ssl_context_handle* net_ssl_context_create(const char* tls_version, const
|
|||||||
|
|
||||||
ctx->ssl = SSL_CTX_new(ssl_method);
|
ctx->ssl = SSL_CTX_new(ssl_method);
|
||||||
|
|
||||||
|
/* Disable SSLv2 */
|
||||||
|
SSL_CTX_set_options(ctx->ssl, SSL_OP_NO_SSLv2);
|
||||||
|
|
||||||
|
// #ifdef SSL_OP_NO_SSLv3
|
||||||
|
/* Disable SSLv3 */
|
||||||
|
SSL_CTX_set_options(ctx->ssl, SSL_OP_NO_SSLv3);
|
||||||
|
// #endif
|
||||||
|
|
||||||
// FIXME: Why did we need this again?
|
// FIXME: Why did we need this again?
|
||||||
SSL_CTX_set_quiet_shutdown(ctx->ssl, 1);
|
SSL_CTX_set_quiet_shutdown(ctx->ssl, 1);
|
||||||
|
|
||||||
#ifdef SSL_OP_NO_COMPRESSION
|
#ifdef SSL_OP_NO_COMPRESSION
|
||||||
/* Disable compression */
|
/* Disable compression */
|
||||||
LOG_TRACE("Disabling SSL compression."); /* "CRIME" attack */
|
LOG_TRACE("Disabling SSL compression."); /* "CRIME" attack */
|
||||||
flags |= SSL_OP_NO_COMPRESSION;
|
SSL_CTX_set_options(ctx->ssl, SSL_OP_NO_COMPRESSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set flags
|
|
||||||
SSL_CTX_set_options(ctx->ssl, flags);
|
|
||||||
|
|
||||||
/* Set preferred cipher suite */
|
/* Set preferred cipher suite */
|
||||||
if (SSL_CTX_set_cipher_list(ctx->ssl, tls_ciphersuite) != 1)
|
if (SSL_CTX_set_cipher_list(ctx->ssl, tls_ciphersuite) != 1)
|
||||||
{
|
{
|
||||||
@ -261,8 +195,6 @@ struct ssl_context_handle* net_ssl_context_create(const char* tls_version, const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSL_CTX_set_alpn_select_cb(ctx->ssl, alpn_server_select_protocol, NULL);
|
|
||||||
|
|
||||||
return (struct ssl_context_handle*) ctx;
|
return (struct ssl_context_handle*) ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,16 +265,13 @@ static int handle_openssl_error(struct net_connection* con, int ret, int read)
|
|||||||
|
|
||||||
case SSL_ERROR_SSL:
|
case SSL_ERROR_SSL:
|
||||||
net_ssl_set_state(handle, tls_st_error);
|
net_ssl_set_state(handle, tls_st_error);
|
||||||
net_stats_tls_add_error();
|
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
case SSL_ERROR_SYSCALL:
|
case SSL_ERROR_SYSCALL:
|
||||||
net_ssl_set_state(handle, tls_st_error);
|
net_ssl_set_state(handle, tls_st_error);
|
||||||
net_stats_tls_add_error();
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
net_stats_tls_add_error();
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +287,6 @@ ssize_t net_con_ssl_accept(struct net_connection* con)
|
|||||||
{
|
{
|
||||||
net_con_update(con, NET_EVENT_READ);
|
net_con_update(con, NET_EVENT_READ);
|
||||||
net_ssl_set_state(handle, tls_st_connected);
|
net_ssl_set_state(handle, tls_st_connected);
|
||||||
net_stats_tls_add_accept();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return handle_openssl_error(con, ret, tls_st_accepting);
|
return handle_openssl_error(con, ret, tls_st_accepting);
|
||||||
@ -377,13 +305,10 @@ ssize_t net_con_ssl_connect(struct net_connection* con)
|
|||||||
{
|
{
|
||||||
net_con_update(con, NET_EVENT_READ);
|
net_con_update(con, NET_EVENT_READ);
|
||||||
net_ssl_set_state(handle, tls_st_connected);
|
net_ssl_set_state(handle, tls_st_connected);
|
||||||
net_stats_tls_add_connect();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = handle_openssl_error(con, ret, tls_st_connecting);
|
ret = handle_openssl_error(con, ret, tls_st_connecting);
|
||||||
|
|
||||||
if (ret != 0)
|
|
||||||
LOG_ERROR("net_con_ssl_connect: ret=%d", ret);
|
LOG_ERROR("net_con_ssl_connect: ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along wtimeout_evtith this program. If not, see <https://www.gnu.org/licenses/>.
|
* along wtimeout_evtith this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -114,6 +114,8 @@ typedef int (*hfunc_send_message)(struct plugin_handle*, struct plugin_user* use
|
|||||||
typedef int (*hfunc_send_broadcast_message)(struct plugin_handle*, const char* message);
|
typedef int (*hfunc_send_broadcast_message)(struct plugin_handle*, const char* message);
|
||||||
typedef int (*hfunc_send_status)(struct plugin_handle*, struct plugin_user* to, int code, const char* message);
|
typedef int (*hfunc_send_status)(struct plugin_handle*, struct plugin_user* to, int code, const char* message);
|
||||||
typedef int (*hfunc_user_disconnect)(struct plugin_handle*, struct plugin_user* user);
|
typedef int (*hfunc_user_disconnect)(struct plugin_handle*, struct plugin_user* user);
|
||||||
|
typedef int (*hfunc_user_redirect)(struct plugin_handle*, struct plugin_user* user, const char* address);
|
||||||
|
typedef int (*hfunc_user_is_tls_connected)(struct plugin_handle*, struct plugin_user* user);
|
||||||
typedef int (*hfunc_command_add)(struct plugin_handle*, struct plugin_command_handle*);
|
typedef int (*hfunc_command_add)(struct plugin_handle*, struct plugin_command_handle*);
|
||||||
typedef int (*hfunc_command_del)(struct plugin_handle*, struct plugin_command_handle*);
|
typedef int (*hfunc_command_del)(struct plugin_handle*, struct plugin_command_handle*);
|
||||||
|
|
||||||
@ -137,6 +139,8 @@ struct plugin_hub_funcs
|
|||||||
hfunc_send_broadcast_message send_broadcast_message;
|
hfunc_send_broadcast_message send_broadcast_message;
|
||||||
hfunc_send_status send_status_message;
|
hfunc_send_status send_status_message;
|
||||||
hfunc_user_disconnect user_disconnect;
|
hfunc_user_disconnect user_disconnect;
|
||||||
|
hfunc_user_redirect user_redirect;
|
||||||
|
hfunc_user_is_tls_connected user_is_tls_connected;
|
||||||
hfunc_command_add command_add;
|
hfunc_command_add command_add;
|
||||||
hfunc_command_del command_del;
|
hfunc_command_del command_del;
|
||||||
hfunc_command_arg_reset command_arg_reset;
|
hfunc_command_arg_reset command_arg_reset;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ enum Warnings
|
|||||||
struct user_info
|
struct user_info
|
||||||
{
|
{
|
||||||
sid_t sid; // The SID of the user
|
sid_t sid; // The SID of the user
|
||||||
int warnings; // The number of denies (used to track whether or not a warning should be sent). @see enum Warnings.
|
int warnings; // The number of denies (used to track wether or not a warning should be sent). @see enum Warnings.
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chat_only_data
|
struct chat_only_data
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
41
src/plugins/mod_require_tls.c
Normal file
41
src/plugins/mod_require_tls.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* uhub - A tiny ADC p2p connection hub
|
||||||
|
* Copyright (C) 2007-2018, Jan Vidar Krey
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "plugin_api/handle.h"
|
||||||
|
#include "plugin_api/command_api.h"
|
||||||
|
#include "util/memory.h"
|
||||||
|
|
||||||
|
struct example_plugin_data
|
||||||
|
{
|
||||||
|
struct plugin_command_handle* redirect;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int plugin_register(struct plugin_handle* plugin, const char* config)
|
||||||
|
{
|
||||||
|
PLUGIN_INITIALIZE(plugin, "TLS redirect plugin", "1.0", "A simple redirect to TLS plug-in");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int plugin_unregister(struct plugin_handle* plugin)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user