mirror of
https://github.com/falk-werner/webfused
synced 2024-10-27 20:44:08 +00:00
make userdb optional
This commit is contained in:
parent
3c0fce8eee
commit
dfd2cd4bc0
30
meson.build
30
meson.build
@ -1,30 +1,42 @@
|
||||
project('webfused', 'c', 'cpp', version: '0.6.0', license: 'LGPL-3.0+')
|
||||
|
||||
without_tests = get_option('without_tests')
|
||||
without_userdb = get_option('without_userdb')
|
||||
|
||||
c_compiler = meson.get_compiler('c')
|
||||
|
||||
openssl_dep = dependency('openssl', version: '>=1.1.1')
|
||||
libconfig_dep = dependency('libconfig', version: '>=1.5')
|
||||
libconfig_dep = dependency('libconfig', version: '>=1.4')
|
||||
pam_dep = c_compiler.find_library('pam')
|
||||
|
||||
libwebsockets_dep = dependency('libwebsockets', version: '>=4.0.0')
|
||||
jansson_dep = dependency('jansson', version: '>=2.11')
|
||||
libfuse_dep = dependency('fuse3', version: '>=3.8.0')
|
||||
libfuse_dep = dependency('fuse3', version: '>=3.1.0')
|
||||
|
||||
webfuse_adapter_dep = dependency('webfuse', version: '>=0.5.0')
|
||||
|
||||
inc_dir = include_directories('src')
|
||||
|
||||
if not without_userdb
|
||||
openssl_dep = dependency('openssl', version: '>=1.1.1')
|
||||
jansson_dep = dependency('jansson', version: '>=2.7')
|
||||
|
||||
libuserdb = static_library('userdb',
|
||||
'src/userdb/userdb.c',
|
||||
'src/userdb/userdb_openssl.c',
|
||||
include_directories: inc_dir,
|
||||
dependencies: [libconfig_dep, openssl_dep, jansson_dep])
|
||||
dependencies: [openssl_dep, jansson_dep])
|
||||
|
||||
libuserdb_dep = declare_dependency(
|
||||
include_directories: inc_dir,
|
||||
link_with: libuserdb,
|
||||
dependencies: [libconfig_dep, openssl_dep, jansson_dep])
|
||||
dependencies: [openssl_dep, jansson_dep])
|
||||
else
|
||||
libuserdb = static_library('userdb',
|
||||
'src/userdb/userdb_none.c',
|
||||
include_directories: inc_dir)
|
||||
|
||||
libuserdb_dep = declare_dependency(
|
||||
include_directories: inc_dir,
|
||||
link_with: libuserdb)
|
||||
endif
|
||||
|
||||
libwebfused = static_library('webfused',
|
||||
'src/webfused/daemon.c',
|
||||
@ -43,13 +55,13 @@ libwebfused = static_library('webfused',
|
||||
'src/webfused/log/stderr_logger.c',
|
||||
'src/webfused/log/syslog_logger.c',
|
||||
include_directories: inc_dir,
|
||||
dependencies: [libuserdb_dep, webfuse_adapter_dep, pam_dep],
|
||||
dependencies: [libuserdb_dep, webfuse_adapter_dep, libconfig_dep, pam_dep],
|
||||
install: false)
|
||||
|
||||
libwebfused_dep = declare_dependency(
|
||||
include_directories: inc_dir,
|
||||
link_with: libwebfused,
|
||||
dependencies: [libuserdb_dep, webfuse_adapter_dep, pam_dep],
|
||||
dependencies: [libuserdb_dep, webfuse_adapter_dep, libconfig_dep, pam_dep],
|
||||
install: false)
|
||||
|
||||
webfused = executable('webfused',
|
||||
|
@ -1 +1,2 @@
|
||||
option('without_tests', type: 'boolean', value: false, description: 'disable unit tests')
|
||||
option('without_userdb', type: 'boolean', value: false, description: 'disable userdb')
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <jansson.h>
|
||||
#include <userdb/userdb.h>
|
||||
|
||||
|
||||
|
74
src/userdb/userdb_none.c
Normal file
74
src/userdb/userdb_none.c
Normal file
@ -0,0 +1,74 @@
|
||||
#include "userdb.h"
|
||||
#include <stddef.h>
|
||||
|
||||
struct userdb * userdb_create(
|
||||
char const * pepper)
|
||||
{
|
||||
(void) pepper;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void userdb_dispose(struct userdb * db)
|
||||
{
|
||||
(void) db;
|
||||
}
|
||||
|
||||
bool userdb_save(
|
||||
struct userdb * db,
|
||||
char const * filename)
|
||||
{
|
||||
(void) db;
|
||||
(void) filename;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool userdb_load_file(
|
||||
struct userdb * db,
|
||||
char const * filename)
|
||||
{
|
||||
(void) db;
|
||||
(void) filename;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool userdb_load_string(
|
||||
struct userdb * db,
|
||||
char const * contents)
|
||||
{
|
||||
(void) db;
|
||||
(void) contents;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void userdb_add(
|
||||
struct userdb * db,
|
||||
char const * username,
|
||||
char const * password)
|
||||
{
|
||||
(void) db;
|
||||
(void) username;
|
||||
(void) password;
|
||||
}
|
||||
|
||||
void userdb_remove(
|
||||
struct userdb * db,
|
||||
char const * user)
|
||||
{
|
||||
(void) db;
|
||||
(void) user;
|
||||
}
|
||||
|
||||
bool userdb_check(
|
||||
struct userdb * db,
|
||||
char const * username,
|
||||
char const * password)
|
||||
{
|
||||
(void) db;
|
||||
(void) username;
|
||||
(void) password;
|
||||
|
||||
return false;
|
||||
}
|
@ -9,8 +9,8 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#if ((LIBCONFIG_VER_MAJOR != 1) || (LIBCONFIG_VER_MINOR < 5))
|
||||
#error "linconfig 1.5 or higher needed"
|
||||
#if ((LIBCONFIG_VER_MAJOR != 1) || (LIBCONFIG_VER_MINOR < 4))
|
||||
#error "libconfig 1.5 or higher needed"
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user