Source Code Directories Overview
Common subdirectories
At the top level of the source tree are locate all essential components of the server:
- helper libs: libwzd-base, libwzd-auth
- server main lib: libwzd-core
- the executable: wzdftpd
- users and groups are managed by modules called 'backends', in the directory with the same name.
- extensions, for ex perl and tcl interpreters, in the modules directory
You'll also find libraries and tools which are not really part of the server, but are used to access the server remotely or locally, send commands, etc:
- libwzd: C library containing code to connect to the server, authenticate, send commands and get results
- tools: tools based on libwzd, to know who's online, the uptime of the server, etc.
- libwzd-perl: a perl wrapper to libwzd
Helper libraries
libwzd-base
This library contains some common structures like stacks, linked lists and hash tables. It also contains some replacement code for functions which does not exist on all platforms, like strtok_r (not on windows), strlcat (only on BSD) and strpcpy.
libwzd-auth
Authentication routines (used for the login sequence):
- DES encryption
- MD5
- SHA1
- PAM
- TLS (certificates)
- kerberos
Functions are provided to check a password (or equivalent: certificate, kerberos token), or to change the password (if possible).
gnu_regex
Replacement library for platforms with no support for regexes (understand: windows)
Server
libwzd-core
This library contains most of the code, which is separated in many modules (with corresponding file names):
- thread event
- crontab
- event handler
- modules
- backends
- config
- cookies parser
- messages
- files/directories
- mutexes/threads (abstraction to system functions: pthreads, or native threads on windows)
- utf8
- users/groups cache
- strings
- site commands, separated in generic site commands, users-related and groups-related.
wzdftpd
This is the main executable. Its role is to read the configuration and create a thread which will listen to connections and call the functions of libwzd-core.
This executable is only an interface to the main library. It is implemented as a daemon (a program runnin in background, without any interaction with user). On windows, it can also be registered as a service.
Backends
Keep in mind that the backends are not in charge of managing password: they use libwzd-auth for that. This means that all backends can use all authentication methods, but also that they do not know how the password is encoded: it can be a crypted text, or a path to a certificate, etc. The only thing that we are sure of is that the password is never stored in clear (the default algorithm is DES).
plaintext
This is the default backend. It stores all users and groups in a plain text file.
mysql
Uses a MySQL database to store users and groups.
pgsql
Uses a PostgreSQL database (surprised ?) to store users and groups.
Modules
debug
This module provides some tools and functions to help debugging the server:
- examine crontab content
- list backends/modules
perl
An embedded perl interpreter.
sfv
The SFV module has some functions to check files integrity:
- zip files are checked (using libz)
- if a .sfv file containing checksums is provided, files listed are checked using a CRC32 algorithm
- if the number of files to be uploaded is known, the percentage of completeness is displayed (by creating an empty file with a specific name)
tcl
An embedded tcl interpreter.
zeroconf
The zeroconf module is used to send notifications to the network. 3 implementations are provided (only one will be used, depending on the results of the configuration step when building):
- avahi
- howl
- bonjour
