Commit 19ec246e authored by Federico Ceratto's avatar Federico Ceratto

New upstream version 2.5

parents
*~
#*#
*.o
.deps
aclocal.m4
ar-lib
autom4te.cache
compile
config.log
config.status
config.guess
config.sub
config.h*
configure
depcomp
inadyn.service
include/stamp-h1
INSTALL
install-sh
libtool
ltmain.sh
missing
Makefile
Makefile.in
plugins/.dirstamp
m4/*.m4
src/inadyn
/GPATH
/GRTAGS
/GSYMS
/GTAGS
/ID
# Travis CI integration
# Defaults to GNU GCC and autotools: ./configure && make && make test
language: c
# Use docker for quicker builds, it now allows https://docs.travis-ci.com/user/apt/
sudo: false
# Test build with both GCC and Clang (LLVM)
compiler:
- gcc
- clang
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "JFknJb+purjGIPuKNWFBPlsSLX6KohuYmYV4dmisIhjkeFhhXFQNmoabYQ6D+r/mWYPWiNnohoTSyKv8gjj6eC1SbXb+f2dEXHrmAwr36Enbp2tV0XLx7V2KHZzUmKeJxOSwnNUVZxmSvzVbuiDodtU1PJ2YPK0CM0KF/J+wePA="
addons:
apt:
packages:
- tree
- fakeroot
- debhelper
- dh-systemd
- libconfuse-dev
- libgnutls28-dev
coverity_scan:
project:
name: "troglobit/inadyn"
description: "Inadyn | Small and Simple DDNS Client"
notification_email: troglobit@gmail.com
build_command_prepend: "./autogen.sh && PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --enable-openssl"
build_command: "make clean all"
branch_pattern: dev
install:
- wget https://github.com/martinh/libconfuse/releases/download/v3.0/confuse-3.0.tar.xz
- tar xf confuse-3.0.tar.xz
- (cd confuse-3.0 && ./configure --prefix=/tmp --disable-examples && make && make install-strip)
script:
- ./autogen.sh
- PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --prefix=/tmp --disable-ssl
- make clean
- make V=1 -j5
- PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --prefix=/tmp
- make clean
- make V=1 -j5
- PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --prefix=/tmp --enable-openssl
- make clean
- make V=1 -j5
- make install-strip
- tree /tmp
- ldd /tmp/sbin/inadyn
- LD_LIBRARY_PATH=/tmp/lib /tmp/sbin/inadyn -h
- PKG_CONFIG_PATH=/tmp/lib/pkgconfig make package
Main authors
============
Narcis Ilisei
- Original author, http://www.inatech.eu/inadyn/
- All versions up to v1.96.2
Joachim Nilsson
- https://github.com/troglobit/inadyn
- Maintainer since Oct, 2010
Contributors
============
- Steve Horbachuk
- Andrey Tikhomirov
- Mike Fleetwood
- Timur Birsh
- Thomas Waldmann
- and many more
Contributing to In-a-dyn
========================
Thank you for considering contributing back to [Free Software][1]!
There are a few things we would like you to consider when filing an
issue or pull request with this project:
1. If you are filing a bug report or feature request
Please take the time to check if an issue already has been filed
matching your problem
2. What version are you running, have you tried the latest release?
UNIX distributions often package and test software for their
particular brand. If you are using a pre-packaged version,
then please file a bug with that distribution instead.
3. Coding Style
Lines are allowed to be longer than 72 characters these days, there
is no enforced max. length.
> **Tip:** Always submit code that follows the style of surrounding code!
The coding style itself is strictly Linux [KNF][], like GIT it is
becoming a de facto standard for C programming
https://www.kernel.org/doc/Documentation/CodingStyle
4. Logical Change Sets
Changes should be broken down into logical units that add a feature
or fix a bug. Keep changes separate from each other and do not mix a
bug fix with a whitespace cleanup or a new feature addition.
This is important not only for readilibity, or for the possibility of
maintainers to revert changes, but does also increase your chances of
having a change accepted.
5. Commit messages
Commit messages exist to track *why* a change was made. Try to be as
clear and concise as possible in your commit messages, and always, be
proud of your work and set up a proper GIT identity for your commits:
git config --global user.name "Jane Doe"
git config --global user.email jane.doe@example.com
See this helpful guide for how to write simple, readable commit
messages, or have at least a look at the below example.
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
Example
-------
Example commit message from the [Pro Git][gitbook] online book, notice
how `git commit -s` is used to automatically add a `Signed-off-by`:
Capitalized, short (50 chars or less) summary
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.
Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug." This convention matches up with commit messages generated
by commands like git merge and git revert.
Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, followed by a
single space, with blank lines in between, but conventions vary here
- Use a hanging indent
Signed-off-by: Jane Doe <jane.doe@example.com>
[1]: http://www.gnu.org/philosophy/free-sw.en.html
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
This diff is collapsed.
This diff is collapsed.
class Inadyn < Formula
desc "Dynamic DNS client with IPv4, IPv6, and SSL/TLS support"
homepage "http://troglobit.com/inadyn.html"
head "https://github.com/troglobit/inadyn.git"
version "2.4-HEAD"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "cmake" => :build
depends_on "confuse"
depends_on "gnutls"
depends_on "libtool" => :build
depends_on "pkg-config" => :build
def install
mkdir_p buildpath/"inadyn/m4"
system "autoreconf", "-W", "portability", "-vif" unless build.stable?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"
system "make", "install"
end
def caveats; <<-EOF
Place your DDNS provider's parameters in #{etc}/inadyn.conf
Sample configurations can be found in #{HOMEBREW_PREFIX}/share/doc/inadyn/examples/
EOF
end
test do
system "#{sbin}/inadyn", "--check-config", "--config=#{HOMEBREW_PREFIX}/share/doc/inadyn/examples/inadyn.conf"
end
end
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS = --with-systemd=$$dc_install_base/$(systemd)
SUBDIRS = src include man examples
doc_DATA = README.md COPYING ChangeLog.md
EXTRA_DIST = README.md ChangeLog.md CONTRIBUTING.md
DISTCLEANFILES = *~ DEADJOE semantic.cache *.gdb *.elf core core.* *.d
if HAVE_SYSTEMD
systemd_DATA = inadyn.service
endif
## Generate MD5 checksum file
MD5 = md5sum
md5-dist:
@for file in $(DIST_ARCHIVES); do \
$(MD5) $$file > ../$$file.md5; \
done
## Check if tagged in git
release-hook:
@if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
echo; \
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
printf "OK, aborting release.\n"; \
exit 1; \
fi; \
echo; \
else \
echo; \
printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \
printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \
echo; \
fi
# lintian --profile debian -i -I --show-overrides ../$PKG.changes
package build-deb:
@dpkg-buildpackage -uc -us -B
## Target to run when building a release
## distcheck <-- does not work atm., wrong search path for source/header files
release: release-hook distcheck package md5-dist
@mv $(DIST_ARCHIVES) ../
@echo
@echo "Resulting release files:"
@echo "================================================================="
@for file in $(DIST_ARCHIVES); do \
printf "%-32s Distribution tarball\n" $$file; \
printf "%-32s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \
printf "%-32s GPG signature " $$file.asc; \
gpg --verify ../$$file.asc 2>&1 | grep 'key ID' | \
sed 's/.*using \(.*\)/\1/'; echo; \
done
@for file in `cd ..; ls $(PACKAGE)_$(VERSION)*`; do \
printf "%-32s Debian/Ubuntu file\n" $$file; \
done
This diff is collapsed.
#!/bin/sh
mkdir -p m4
autoreconf -W portability -vifm
AC_PREREQ(2.61)
AC_INIT(In-a-dyn, 2.5, https://github.com/troglobit/inadyn/issues, inadyn, http://troglobit.com/inadyn.html)
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADER([include/config.h])
AC_CONFIG_FILES([Makefile inadyn.service src/Makefile include/Makefile man/Makefile examples/Makefile])
AC_CONFIG_MACRO_DIR([m4])
AC_ARG_ENABLE(ssl,
[AS_HELP_STRING([--disable-ssl], [Disable HTTPS support, default: enabled])],
[ac_enable_ssl="$enableval"],
[ac_enable_ssl="yes"]
)
AC_ARG_ENABLE(openssl,
[AS_HELP_STRING([--enable-openssl], [Use OpenSSL/LibreSSL for HTTPS, default: GnuTLS])],
[ac_enable_openssl="$enableval"],
[ac_enable_openssl="no"]
)
AC_ARG_ENABLE(simulation,
[AS_HELP_STRING([--enable-simulation], [Developer simulation mode, do not use!])],
[ac_enable_simulation="$enableval"],
[ac_enable_simulation="no"]
)
AC_ARG_WITH([systemd],
[AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],,
[with_systemd=auto]
)
# Define necessary build flags
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h arpa/nameser.h netinet/in.h stdlib.h stdint.h \
string.h sys/ioctl.h sys/socket.h sys/types.h syslog.h unistd.h],
[], [],
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_UINT32_T
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([atexit memset poll socket strerror])
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
# Check if some func is not in libc
AC_CHECK_LIB([util], [pidfile])
# Check for usually missing API's, which we can replace
AC_REPLACE_FUNCS([pidfile strlcpy strlcat strtonum utimensat])
AC_CONFIG_LIBOBJ_DIR([lib])
# Needed for the libraries
AM_PROG_AR
LT_INIT([disable-shared static])
# Check for required packages
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([confuse], [libconfuse >= 3.0])
LDFLAGS="$LDFLAGS $confuse_LIBS"
CPPFLAGS="$CPPFLAGS $confuse_CFLAGS"
AC_CHECK_LIB([confuse], [cfg_init], [],
AC_MSG_ERROR([*** Configuration file parser library (libConfuse) not found!]))
AC_CHECK_HEADERS([confuse.h], [],
AC_MSG_ERROR([*** Cannot find required header files!]))
# If HTTPS is enabled we check for either OpenSSL/LibreSSL or GnuTLS libs+headers
if test "x$ac_enable_ssl" = "xyes"; then
if test "x$ac_enable_openssl" = "xyes"; then
PKG_CHECK_MODULES([OpenSSL], [openssl])
LDFLAGS="$LDFLAGS $OpenSSL_LIBS"
CPPFLAGS="$CPPFLAGS $OpenSSL_CFLAGS"
AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
AC_MSG_ERROR([*** Crypto library (OpenSSL/LibreSSL) not found!]))
AC_CHECK_LIB([ssl], [SSL_library_init], [],
AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [],
AC_MSG_ERROR([*** SSL library (OpenSSL/LibreSSL) not found!])))
AC_CHECK_HEADERS([openssl/crypto.h openssl/x509.h openssl/pem.h openssl/ssl.h \
openssl/tls1.h openssl/err.h], [],
AC_MSG_ERROR([*** Cannot find required header files!]),
[
#include <openssl/conf.h>
])
AC_DEFINE([CONFIG_OPENSSL], [], [Enable HTTPS support using OpenSSL/LibreSSL library])
else
PKG_CHECK_MODULES([GnuTLS], [gnutls >= 3.0])
LDFLAGS="$LDFLAGS $GnuTLS_LIBS"
CPPFLAGS="$CPPFLAGS $GnuTLS_CFLAGS"
AC_CHECK_LIB([gnutls], [gnutls_init], [],
AC_MSG_ERROR([*** SSL library (GnuTLS) not found!]))
AC_CHECK_HEADERS([gnutls/gnutls.h gnutls/x509.h], [],
AC_MSG_ERROR([*** Cannot find required header files!]))
AC_DEFINE([CONFIG_GNUTLS], [], [Enable HTTPS support using GnuTLS library])
fi
AC_DEFINE([ENABLE_SSL], [], [Enable HTTPS support])
fi
# By default we rely on the built-in locations of Open/LibreSSL and GnuTLS,
# on error we fall back to these two locations
# For more excellent information on the topic, see this blog post
# https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
CAFILE1="/etc/ssl/certs/ca-certificates.crt"
CAFILE2="/etc/pki/tls/certs/ca-bundle.trust.crt"
# Add OS-specific flags
case "$host_os" in
darwin*)
LDFLAGS="$LDFLAGS -lresolv"
CAFILE2="/usr/local/etc/openssl/cert.pem" # where Homebrew's libressl places it
;;
esac
AC_DEFINE_UNQUOTED([CAFILE1], "$CAFILE1", [First fallback location for Open/LibreSSL and GnuTLS trust db])
AC_DEFINE_UNQUOTED([CAFILE2], "$CAFILE2", [Second location for Open/LibreSSL and GnuTLS trust db])
AM_CONDITIONAL([ENABLE_SSL], test "x$ac_enable_ssl" = "xyes")
AM_CONDITIONAL([ENABLE_OPENSSL], test "x$ac_enable_openssl" = "xyes")
if test "x$ac_enable_simulation" = "xyes"; then
AC_DEFINE([ENABLE_SIMULATION], [], [Enable developer-only simulation mode])
fi
# Check where to install the systemd .service file
AS_IF([test "x$with_systemd" = "xyes" -o "x$with_systemd" = "xauto"], [
def_systemd=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AS_IF([test "x$def_systemd" = "x"],
[AS_IF([test "x$with_systemd" = "xyes"],
[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
with_systemd=no], [with_systemd="$def_systemd"])]
)
AS_IF([test "x$with_systemd" != "xno"],
[AC_SUBST([systemddir], [$with_systemd])])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"])
# Expand $sbindir early, into $SBINDIR, for systemd unit file
# NOTE: This does *not* take prefix/exec_prefix override at "make
# install" into account, unfortunately.
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
SYSCONFDIR=`eval echo $sysconfdir`
SYSCONFDIR=`eval echo $SYSCONFDIR`
AC_SUBST(SYSCONFDIR)
SBINDIR=`eval echo $sbindir`
SBINDIR=`eval echo $SBINDIR`
AC_SUBST(SBINDIR)
AC_OUTPUT
examplesdir = $(docdir)/examples
dist_examples_DATA = \
inadyn.conf \
dyndns.conf \
freedns.conf \
custom.conf \
freemyip.conf \
README.md
Example /etc/inadyn.conf files
==============================
This directory holds a few example configuration files for common
DDNS providers. Please feel free to submit pull requests for your
examples at GitHub! :)
https://gitub.com/troglobit/inadyn
Usage
-----
Simply copy the desired example to /etc/inadyn.conf, edit it with
your hostname, username, and password and then start Inadyn.
Example
-------
user@example:~$ sudo cp freedns.conf /etc/inadyn.conf
user@example:~$ sudo chmod 600 /etc/inadyn.conf
user@example:~$ sudo vim /etc/inadyn.conf
[Change username, password and hostname]
user@example:~$ sudo inadyn
user@example:~$
See the the system logfile for progress and the inadyn man page for
debugging help, should you run into problems.
# Inadyn v2.0 configuration file format
iface = wlp3s0
#verify-address = false
custom kruskakli {
username = myuser
password = mypass
ssl = true
# checkip-command = "/sbin/ifconfig wlp3s0 | grep 'inet addr'"
ddns-server = dynamicdns.park-your-domain.com
# ddns-path = "/update?password=mypass&domain="
ddns-path = "/update?user=%u&password=%p&domain=%h&myip=%i"
# ddns-response = { "hej", "ko", "massa" }
ddns-response = ""
hostname = YOURDOMAIN.TLD
# checkip-server = api.ipify.org
}
# Inadyn v2.0 configuration file format
period = 300
#verify-address = false
provider default@dyndns.org {
ssl = true
username = user
password = secret
hostname = example.dyndns.org
}
# Inadyn v2.0 configuration file format
period = 300
#verify-address = false
provider default@freedns.afraid.org {
ssl = true
username = user
password = secret
hostname = coffee.example.org
# checkip-server = api.ipify.org
}
# Inadyn v2.0 configuration file format
period = 300
#verify-address = false
provider default@freemyip.com {
password = token
hostname = hostname.freemyip.com
}
# /etc/inadyn.conf :: v2 configuration file format
#
# 1. Select a matching DDNS provider to uncomment, this file lists a few
# common ones, including a custom one, see inadyn(8) for the full list
#
# 2. Edit the following options:
# <username> - your username at the DDNS provider
# <password> - your password at the DDNS provider
# <hostname> - the DNS hostname(s) you want to update
#
# 3. Ensure to set 600 permissions on this file!
#
# See inadyn.conf(5) for detailed information on the syntax
# How often the IP is checked. The value denotes seconds
#period = 300
# Custom HTTP user agent, some DDNS providers require this.
# Default is inadyn/VERSION, you rarely need this.
#user-agent = Mozilla/4.1
# Set interface to check for IP, default is to ask an external
# checkip server -- you rarely need this.
#iface = eth1
### FreeDNS -- https://freedns.afraid.org
#provider freedns.afraid.org {
# username = <username>
# password = <password>
# hostname = <hostname>
#}
### Loopia -- https://www.loopia.com
#provider loopia {
# username = <username>
# password = <password>
## wildcard = true
# hostname = { <hostname1>, <hostname2>, ... }
#}
### DYN.com -- http://www.dyn.com
#provider Dyn {
# username = <username>
# password = <password>
# hostname = <hostname>
#}
### FreeMyIP -- https://freemyip.com
#provider freemyip.com {
# password = <your_token>
# hostname = <your_hostname>.freemyip.com
#}
### Custom provider setup for http://twoDNS.de
#custom twoDNS {
# username = <username>
# password = <password>
# checkip-server = checkip.two-dns.de
# checkip-path = /
# checkip-ssl = false
# ddns-server = update.twodns.de
# ddns-path = "/update?hostname=%h"
# ssl = true
# hostname = <hostname>.dd-dns.de
#}
[Unit]
Description=Internet Dynamic DNS Client
Documentation=man:inadyn
Documentation=man:inadyn.conf
Documentation=https://github.com/troglobit/inadyn
ConditionPathExists=@SYSCONFDIR@/inadyn.conf
After=network-online.target
Requires=network-online.target
[Service]
Type=simple
ExecStart=@SBINDIR@/inadyn -n -s
[Install]
WantedBy=multi-user.target
inadyndir = ../src
noinst_HEADERS = base64.h md5.h sha1.h \
cache.h compat.h \
config.h.in ddns.h error.h \
http.h log.h \
os.h plugin.h queue.h \
ssl.h strdupa.h tcp.h
/**
* \file base64.h
*
* \brief RFC 1521 base64 encoding/decoding
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* 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 2
* 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, visit the Free Software Foundation
* website at http://www.gnu.org/licenses/gpl-2.0.html or write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BASE64_H
#define BASE64_H
#include <stdint.h>
#include <string.h>
#define ERR_BASE64_BUFFER_TOO_SMALL -0x002A /**< Output buffer too small. */
#define ERR_BASE64_INVALID_CHARACTER -0x002C /**< Invalid character in input. */
/**
* \brief Encode a buffer into base64 format
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be encoded
*
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
* *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_encode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
/**
* \brief Decode a base64-formatted buffer
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be decoded
*
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
* correct. *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_decode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
#endif /* base64.h */
/* Interface to file chache API
*
* Copyright (C) 2014-2017 Joachim Nilsson <troglobit@gmail.com>
*
* This program is free software; you can redistribute it and/or