271 changes: 0 additions & 271 deletions compat/my_getopt.c

This file was deleted.

69 changes: 0 additions & 69 deletions compat/my_getopt.h

This file was deleted.

6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ ac_includes_default="\

ac_subst_vars='LTLIBOBJS
LIBOBJS
VERSION
RUNDIR
ENABLE_STATIC
ENABLE_SHARED
Expand Down Expand Up @@ -4472,6 +4473,8 @@ $as_echo "$as_me: WARNING: *** You have not enabled versioned symbols." >&2;}

fi

VERSION=0.101




Expand Down Expand Up @@ -5758,3 +5761,6 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Autotool/configure/make are deprecated, and will be removed soon. Please using \"meson\" instead" >&5
$as_echo "$as_me: WARNING: Autotool/configure/make are deprecated, and will be removed soon. Please using \"meson\" instead" >&2;}
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(open-isns, [0.101])
AC_INIT(open-isns, [0.102])
AC_CONFIG_SRCDIR([isnsd.c])
AC_CONFIG_AUX_DIR([aclocal])

Expand Down Expand Up @@ -161,8 +161,13 @@ if test "x$ENABLE_SHARED" = "x1" ; then
AC_SUBST(HAVE_LD_VERSION_SCRIPT)
fi

VERSION=AC_PACKAGE_VERSION
AC_SUBST(ENABLE_SHARED)
AC_SUBST(ENABLE_STATIC)
AC_SUBST(RUNDIR)
AC_SUBST(VERSION)

AC_OUTPUT(Makefile include/libisns/paths.h)

dnl Warn user that autoconf is deprecated here
AC_MSG_WARN([Autotool/configure/make are deprecated, and will be removed soon. Please using "meson" instead])
2 changes: 1 addition & 1 deletion doc/isns_config.5
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ hostname using the
system call, and use a DNS lookup to look up the canonical name.
Using the
.BR HostName
option, you can overried this. This option is rarely needed.
option, you can override this. This option is rarely needed.
.TP
.BR SourceName
This option is mandatory for all Open-iSNS applications.
Expand Down
10 changes: 10 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# meson build file for open-isns doc (man pages)

# do not install isnssetup.8, as it's a man page
# for aninternal script
man8_pages = files([
'isnsd.8',
'isnsdd.8',
'isnsadm.8'])
man5_pages = files([
'isns_config.5'])
6 changes: 6 additions & 0 deletions etc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# meson build file for open-isns etc files

config_files = files([
'isnsd.conf',
'isnsdd.conf',
'isnsadm.conf'])
27 changes: 27 additions & 0 deletions include/libisns/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# meson build control file for open-isns public include files

inc_conf = configuration_data()
inc_conf.set('RUNDIR', get_option('rundir'))
inc_conf.set('VERSION', meson.project_version())

static_hdr_files = files([
'attrs.h',
'buffer.h',
'isns.h',
'isns-proto.h',
'message.h',
'source.h',
'types.h',
'util.h'])

template_hdr_name = 'paths.h'
template_hdr_file = files('paths.h.in')

configure_file(
input: template_hdr_file,
output: template_hdr_name,
configuration: inc_conf,
install: true,
install_dir: get_option('includedir') / 'libisns')

install_headers(static_hdr_files, subdir: 'libisns')
2 changes: 1 addition & 1 deletion include/libisns/paths.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#define __OPENISNS_MKVERSION(maj, min) (((maj) << 8) + (min))
#define OPENISNS_VERSION __OPENISNS_MKVERSION(0, 101);
#define OPENISNS_VERSION_STRING "0.101"
#define OPENISNS_VERSION_STRING "@VERSION@"

#define ISNS_ETCDIR "/etc/isns"
#define ISNS_RUNDIR "@RUNDIR@"
Expand Down
2 changes: 1 addition & 1 deletion isnsadm.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ main(int argc, char **argv)
isns_security_t *security = NULL;
int c, status;

while ((c = getopt_long(argc, argv, "46Cc:d:hK:k:ls:", options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "46Cc:d:hK:k:ls:Vr", options, NULL)) != -1) {
switch (c) {
case '4':
opt_af = AF_INET;
Expand Down
3 changes: 2 additions & 1 deletion isnsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ enum {
};

static const char * opt_configfile = ISNS_DEFAULT_ISNSD_CONFIG;
static int opt_af = AF_UNSPEC;
static int opt_af = AF_INET6; // should be AF_INET6 as described in isnsd's manual

static int opt_mode = MODE_NORMAL;
static int opt_foreground = 0;

Expand Down
8 changes: 8 additions & 0 deletions libisns.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includedir=/usr/include
libdir=/usr/lib64

Name: libisns
Version: 0.102
Description: iSNS user space library
Libs: -L${libdir} -lisns
Cflags: -I${includedir}
207 changes: 207 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# meson build for open-isns

project('libisns', 'c',
version: '0.102',
meson_version: '>= 0.54.0',
license: 'LGPL-2.1-or-later',
default_options: [
'c_std=gnu99',
'warning_level=2',
'buildtype=release',
'libdir=/usr/lib64',
'prefix=/usr']
)

# we will need this below
cc = meson.get_compiler('c')

# get feature options
security_dep = dependency('libcrypto', required: get_option('security'))
slp_dep = cc.find_library('slp', required: get_option('slp'))

subdir('tests')
subdir('doc')
subdir('etc')
subdir('include/libisns')

lib_srcs = files([
'server.c',
'client.c',
'objects.c',
'callback.c',
'timer.c',
'vendor.c',
'db.c',
'db-file.c',
'db-policy.c',
'relation.c',
'scope.c',
'message.c',
'security.c',
'authblock.c',
'policy.c',
'pki.c',
'register.c',
'query.c',
'getnext.c',
'deregister.c',
'esi.c',
'scn.c',
'dd.c',
'entity.c',
'portal-group.c',
'storage-node.c',
'domain.c',
'simple.c',
'tags.c',
'attrs.c',
'export.c',
'socket.c',
'slp.c',
'error.c',
'logging.c',
'config.c',
'parser.c',
'buffer.c',
'pidfile.c',
'sysdep-unix.c',
'util.c',
'bitvector.c',
'mdebug.c'])

incl_dirs = include_directories(['.', 'include'])

add_project_arguments(
['-D_GNU_SOURCE'],
language: 'c')

#
# build our config.h file
#

conf = configuration_data()
conf.set('WITH_SECURITY', security_dep.found())
conf.set('WITH_SLP', slp_dep.found())
conf.set('HAVE_SLP_H', slp_dep.found())

config_h = configure_file(
output: 'config.h',
configuration: conf)

config_incdir = include_directories('.')

config_dep = declare_dependency(
include_directories: config_incdir,
sources: config_h)

#
# build our library -- we always build either the static or
# the shared library, or both
#

lib_deps = [config_dep, security_dep, slp_dep]

shared_link_args = []
if get_option('shared_version')
shared_link_args = '-Wl,--version-script=@0@/libisns.vers'.format(meson.current_source_dir())
endif

libisns_lib = library('isns',
lib_srcs,
include_directories: incl_dirs,
dependencies: lib_deps,
link_args: shared_link_args,
version: '0',
install: true)

libisns_dep = declare_dependency(link_with: libisns_lib)

#
# build binaries
#

our_dependencies = [config_dep, security_dep, libisns_dep, slp_dep]

sbin_dir = get_option('sbindir')

executable('isnsd',
sources: files('isnsd.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)

executable('isnsdd',
sources: files(['isnsdd.c', 'local.c']),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)

executable('isnsadm',
sources: files('isnsadm.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)

# a testing program (not installed, not currently used here)
e = executable('bitvector',
sources: files('bitvector.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
c_args: ['-DTEST'])
test('test bitvector', e)

# build our test files ??? (FIXME: not working)
pyunit_test_works = false
if pyunit_test_works
test_progs = []
foreach t: tests
e = executable(t,
sources: files('tests' / t + '.c'),
include_directories: incl_dirs,
dependencies: our_dependencies)
test_progs += e
endforeach
endif

#
# man pages
#
install_man([man8_pages, man5_pages])

#
# config files
#
install_data(config_files,
install_dir: get_option('sysconfdir') / 'isns')

#
# systemd service files
#
install_data(files(['isnsd.service', 'isnsd.socket']),
install_dir: get_option('systemddir') / 'system')

#
# our package file
#
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries: libisns_lib,
version: '0',
name: 'libisns',
description: 'iSNS userspace library')

#
# public header files are installed from # include/libisns
#

#
# lastly, create our runtime directory (empty)
#
# NOTE: this can be replaced with install_emptydir() once
# the minimum requirement of Meson is bumped to >=0.60.0

install_subdir('isns',
install_dir: '/var/lib',
install_mode: 'r--------')
18 changes: 18 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# meson options for open-isns

# enabled security and service location protocol usage by default
option('security', type: 'feature', value: 'auto',
description: 'enable security using libcrypt')
option('slp', type: 'feature', value: 'auto',
description: 'enable use of Service Location Protocol')

# disable shared library creation and enable static library
# creation, by default
option('shared_version', type: 'boolean', value: true,
description: 'use library versioning on the shared library')

# set default locations for systemd and runtime files
option('systemddir', type: 'string', value: '/usr/lib/systemd',
description: 'override systemd directory "/usr/lib/systemd"')
option('rundir', type: 'string', value: '/var/run',
description: 'override runtime directory "/var/run"')
45 changes: 24 additions & 21 deletions slp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,26 @@ struct isns_slp_url_state {
};

static void
isns_slp_report(SLPHandle handle, SLPError err, void *cookie)
isns_slp_report(__attribute__((unused))SLPHandle handle,
SLPError err, void *cookie)
{
*(SLPError *) cookie = err;
}

/*
* Register a service with SLP
*/
*/
int
isns_slp_register(const char *url)
{
SLPError err, callbackerr;
SLPHandle handle = NULL;
SLPError err, callbackerr;
SLPHandle handle = NULL;

err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
isns_error("Unable to obtain SLP handle (err %d)\n", err);
return 0;
}
}

err = SLPReg(handle, url, SLP_LIFETIME_MAXIMUM,
ISNS_SLP_SCOPE,
Expand All @@ -69,20 +70,20 @@ isns_slp_register(const char *url)

/*
* DeRegister a service
*/
*/
int
isns_slp_unregister(const char *url)
{
SLPError err, callbackerr;
SLPHandle handle = NULL;
SLPError err, callbackerr;
SLPHandle handle = NULL;

isns_debug_general("SLP: Unregistering \"%s\"\n", url);

err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
isns_error("Unable to obtain SLP handle (err %d)\n", err);
return 0;
}
}

err = SLPDereg(handle, url, isns_slp_report, &callbackerr);

Expand All @@ -102,9 +103,11 @@ isns_slp_unregister(const char *url)
* Find an iSNS server through SLP
*/
static SLPBoolean
isns_slp_url_callback(SLPHandle handle,
const char *url, unsigned short lifetime,
SLPError err, void *cookie)
isns_slp_url_callback(__attribute__((unused))SLPHandle handle,
const char *url,
__attribute__((unused))unsigned short lifetime,
SLPError err,
void *cookie)
{
struct isns_slp_url_state *sp = cookie;
SLPSrvURL *parsed_url = NULL;
Expand Down Expand Up @@ -159,19 +162,19 @@ char *
isns_slp_find(void)
{
static struct isns_slp_url_state state;
SLPHandle handle = NULL;
SLPError err;
SLPHandle handle = NULL;
SLPError err;

if (state.slp_url)
return state.slp_url;

isns_debug_general("Using SLP to locate iSNS server\n");

err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
err = SLPOpen("en", SLP_FALSE, &handle);
if(err != SLP_OK) {
isns_error("Unable to obtain SLP handle (err %d)\n", err);
return NULL;
}
}

err = SLPFindSrvs(handle, ISNS_SLP_SERVICE_NAME,
NULL, "(protocols=isns)",
Expand Down
6 changes: 3 additions & 3 deletions tests/genkey
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#
# This is a very simple script to generate a DSA
# key pair for authenticated iSNS.
Expand All @@ -25,7 +25,7 @@ dsa_bits=1024
opt_force=0
opt_server=0

function usage {
usage() {
cat <<-EOF >&2
$*
Usage:
Expand All @@ -35,7 +35,7 @@ function usage {
exit 1
}

function make_isns_name {
make_isns_name() {
OFS="$IFS"
IFS=.
set -- $*
Expand Down
5 changes: 5 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# meson build control file for open-isns tests

tests = ['pauw1', 'pauw2', 'pauw3', 'pauw4']

test_prog = find_program('test-isns.py')