Imported Upstream version 4.6.2
This commit is contained in:
23
daemons/ipa-otpd/Makefile.am
Normal file
23
daemons/ipa-otpd/Makefile.am
Normal file
@@ -0,0 +1,23 @@
|
||||
AM_CFLAGS := @LDAP_CFLAGS@ @LIBVERTO_CFLAGS@ @KRB5_CFLAGS@
|
||||
AM_LDFLAGS := @LDAP_LIBS@ @LIBVERTO_LIBS@ @KRAD_LIBS@ @KRB5_LIBS@
|
||||
|
||||
noinst_HEADERS = internal.h
|
||||
appdir = $(libexecdir)/ipa/
|
||||
app_PROGRAMS = ipa-otpd
|
||||
dist_noinst_DATA = ipa-otpd.socket.in ipa-otpd@.service.in test.py
|
||||
systemdsystemunit_DATA = ipa-otpd.socket ipa-otpd@.service
|
||||
|
||||
ipa_otpd_SOURCES = bind.c forward.c main.c parse.c query.c queue.c stdio.c
|
||||
|
||||
%.socket: %.socket.in
|
||||
@sed -e 's|@krb5rundir[@]|$(krb5rundir)|g' \
|
||||
-e 's|@KRB5KDC_SERVICE[@]|$(KRB5KDC_SERVICE)|g' \
|
||||
-e 's|@UNLINK[@]|@UNLINK@|g' \
|
||||
$< > $@
|
||||
|
||||
%.service: %.service.in
|
||||
@sed -e 's|@libexecdir[@]|$(libexecdir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
$< > $@
|
||||
|
||||
CLEANFILES = $(systemdsystemunit_DATA)
|
||||
820
daemons/ipa-otpd/Makefile.in
Normal file
820
daemons/ipa-otpd/Makefile.in
Normal file
@@ -0,0 +1,820 @@
|
||||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
app_PROGRAMS = ipa-otpd$(EXEEXT)
|
||||
subdir = daemons/ipa-otpd
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/VERSION.m4 \
|
||||
$(top_srcdir)/server.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(dist_noinst_DATA) \
|
||||
$(noinst_HEADERS) $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(appdir)" \
|
||||
"$(DESTDIR)$(systemdsystemunitdir)"
|
||||
PROGRAMS = $(app_PROGRAMS)
|
||||
am_ipa_otpd_OBJECTS = bind.$(OBJEXT) forward.$(OBJEXT) main.$(OBJEXT) \
|
||||
parse.$(OBJEXT) query.$(OBJEXT) queue.$(OBJEXT) \
|
||||
stdio.$(OBJEXT)
|
||||
ipa_otpd_OBJECTS = $(am_ipa_otpd_OBJECTS)
|
||||
ipa_otpd_LDADD = $(LDADD)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(ipa_otpd_SOURCES)
|
||||
DIST_SOURCES = $(ipa_otpd_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
DATA = $(dist_noinst_DATA) $(systemdsystemunit_DATA)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
API_VERSION = @API_VERSION@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CONFIG_STATUS = @CONFIG_STATUS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
|
||||
CRYPTO_LIBS = @CRYPTO_LIBS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATA_VERSION = @DATA_VERSION@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DIRSRV_CFLAGS = @DIRSRV_CFLAGS@
|
||||
DIRSRV_LIBS = @DIRSRV_LIBS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_DOMAIN = @GETTEXT_DOMAIN@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GIT_BRANCH = @GIT_BRANCH@
|
||||
GIT_VERSION = @GIT_VERSION@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
INI_CFLAGS = @INI_CFLAGS@
|
||||
INI_LIBS = @INI_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
IPAPLATFORM = @IPAPLATFORM@
|
||||
IPA_DATA_DIR = @IPA_DATA_DIR@
|
||||
IPA_SYSCONF_DIR = @IPA_SYSCONF_DIR@
|
||||
JSLINT = @JSLINT@
|
||||
KRAD_LIBS = @KRAD_LIBS@
|
||||
KRB5KDC_SERVICE = @KRB5KDC_SERVICE@
|
||||
KRB5_CFLAGS = @KRB5_CFLAGS@
|
||||
KRB5_LIBS = @KRB5_LIBS@
|
||||
LD = @LD@
|
||||
LDAP_CFLAGS = @LDAP_CFLAGS@
|
||||
LDAP_LIBS = @LDAP_LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBINTL_LIBS = @LIBINTL_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPDB_NAME = @LIBPDB_NAME@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBVERTO_CFLAGS = @LIBVERTO_CFLAGS@
|
||||
LIBVERTO_LIBS = @LIBVERTO_LIBS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MK_ASSIGN = @MK_ASSIGN@
|
||||
MK_ELSE = @MK_ELSE@
|
||||
MK_ENDIF = @MK_ENDIF@
|
||||
MK_IFEQ = @MK_IFEQ@
|
||||
MSGATTRIB = @MSGATTRIB@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NAMED_GROUP = @NAMED_GROUP@
|
||||
NDRNBT_CFLAGS = @NDRNBT_CFLAGS@
|
||||
NDRNBT_LIBS = @NDRNBT_LIBS@
|
||||
NDRPAC_CFLAGS = @NDRPAC_CFLAGS@
|
||||
NDRPAC_LIBS = @NDRPAC_LIBS@
|
||||
NDR_CFLAGS = @NDR_CFLAGS@
|
||||
NDR_LIBS = @NDR_LIBS@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
NSPR_CFLAGS = @NSPR_CFLAGS@
|
||||
NSPR_LIBS = @NSPR_LIBS@
|
||||
NSS_CFLAGS = @NSS_CFLAGS@
|
||||
NSS_LIBS = @NSS_LIBS@
|
||||
NUM_VERSION = @NUM_VERSION@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
ODS_USER = @ODS_USER@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POPT_CFLAGS = @POPT_CFLAGS@
|
||||
POPT_LIBS = @POPT_LIBS@
|
||||
POSUB = @POSUB@
|
||||
PYLINT = @PYLINT@
|
||||
PYTHON = @PYTHON@
|
||||
PYTHON2 = @PYTHON2@
|
||||
PYTHON3 = @PYTHON3@
|
||||
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
|
||||
PYTHON_INSTALL_EXTRA_OPTIONS = @PYTHON_INSTALL_EXTRA_OPTIONS@
|
||||
PYTHON_PLATFORM = @PYTHON_PLATFORM@
|
||||
PYTHON_PREFIX = @PYTHON_PREFIX@
|
||||
PYTHON_VERSION = @PYTHON_VERSION@
|
||||
RANLIB = @RANLIB@
|
||||
SAMBA40EXTRA_LIBPATH = @SAMBA40EXTRA_LIBPATH@
|
||||
SAMBAUTIL_CFLAGS = @SAMBAUTIL_CFLAGS@
|
||||
SAMBAUTIL_LIBS = @SAMBAUTIL_LIBS@
|
||||
SASL_CFLAGS = @SASL_CFLAGS@
|
||||
SASL_LIBS = @SASL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSSCERTMAP_CFLAGS = @SSSCERTMAP_CFLAGS@
|
||||
SSSCERTMAP_LIBS = @SSSCERTMAP_LIBS@
|
||||
SSSIDMAP_CFLAGS = @SSSIDMAP_CFLAGS@
|
||||
SSSIDMAP_LIBS = @SSSIDMAP_LIBS@
|
||||
SSSNSSIDMAP_CFLAGS = @SSSNSSIDMAP_CFLAGS@
|
||||
SSSNSSIDMAP_LIBS = @SSSNSSIDMAP_LIBS@
|
||||
STRIP = @STRIP@
|
||||
TALLOC_CFLAGS = @TALLOC_CFLAGS@
|
||||
TALLOC_LIBS = @TALLOC_LIBS@
|
||||
TEVENT_CFLAGS = @TEVENT_CFLAGS@
|
||||
TEVENT_LIBS = @TEVENT_LIBS@
|
||||
UNISTRING_LIBS = @UNISTRING_LIBS@
|
||||
UNLINK = @UNLINK@
|
||||
USE_NLS = @USE_NLS@
|
||||
UUID_CFLAGS = @UUID_CFLAGS@
|
||||
UUID_LIBS = @UUID_LIBS@
|
||||
VENDOR_SUFFIX = @VENDOR_SUFFIX@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMLRPC_CFLAGS = @XMLRPC_CFLAGS@
|
||||
XMLRPC_LIBS = @XMLRPC_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
i18ntests = @i18ntests@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
krb5rundir = @krb5rundir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
pkgpyexecdir = @pkgpyexecdir@
|
||||
pkgpythondir = @pkgpythondir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
pyexecdir = @pyexecdir@
|
||||
pythondir = @pythondir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sysconfenvdir = @sysconfenvdir@
|
||||
systemdsystemunitdir = @systemdsystemunitdir@
|
||||
systemdtmpfilesdir = @systemdtmpfilesdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS := @LDAP_CFLAGS@ @LIBVERTO_CFLAGS@ @KRB5_CFLAGS@
|
||||
AM_LDFLAGS := @LDAP_LIBS@ @LIBVERTO_LIBS@ @KRAD_LIBS@ @KRB5_LIBS@
|
||||
noinst_HEADERS = internal.h
|
||||
appdir = $(libexecdir)/ipa/
|
||||
dist_noinst_DATA = ipa-otpd.socket.in ipa-otpd@.service.in test.py
|
||||
systemdsystemunit_DATA = ipa-otpd.socket ipa-otpd@.service
|
||||
ipa_otpd_SOURCES = bind.c forward.c main.c parse.c query.c queue.c stdio.c
|
||||
CLEANFILES = $(systemdsystemunit_DATA)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign daemons/ipa-otpd/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign daemons/ipa-otpd/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-appPROGRAMS: $(app_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(app_PROGRAMS)'; test -n "$(appdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(appdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(appdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(appdir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(appdir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-appPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(app_PROGRAMS)'; test -n "$(appdir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(appdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(appdir)" && rm -f $$files
|
||||
|
||||
clean-appPROGRAMS:
|
||||
@list='$(app_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
ipa-otpd$(EXEEXT): $(ipa_otpd_OBJECTS) $(ipa_otpd_DEPENDENCIES) $(EXTRA_ipa_otpd_DEPENDENCIES)
|
||||
@rm -f ipa-otpd$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(ipa_otpd_OBJECTS) $(ipa_otpd_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bind.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/forward.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-systemdsystemunitDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS) $(DATA) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(appdir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-appPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-appPROGRAMS install-systemdsystemunitDATA
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-appPROGRAMS uninstall-systemdsystemunitDATA
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
|
||||
clean-appPROGRAMS clean-generic clean-libtool cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-appPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
install-systemdsystemunitDATA installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-appPROGRAMS \
|
||||
uninstall-systemdsystemunitDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
%.socket: %.socket.in
|
||||
@sed -e 's|@krb5rundir[@]|$(krb5rundir)|g' \
|
||||
-e 's|@KRB5KDC_SERVICE[@]|$(KRB5KDC_SERVICE)|g' \
|
||||
-e 's|@UNLINK[@]|@UNLINK@|g' \
|
||||
$< > $@
|
||||
|
||||
%.service: %.service.in
|
||||
@sed -e 's|@libexecdir[@]|$(libexecdir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
$< > $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
145
daemons/ipa-otpd/bind.c
Normal file
145
daemons/ipa-otpd/bind.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file takes requests from query.c and performs an LDAP bind on behalf
|
||||
* of the user. The results are placed in the stdout queue (stdio.c).
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include "../ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h"
|
||||
|
||||
static void on_bind_writable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
LDAPControl control = { OTP_REQUIRED_OID, {}, true };
|
||||
LDAPControl *ctrls[] = { &control, NULL };
|
||||
struct otpd_queue *push = &ctx.stdio.responses;
|
||||
const krb5_data *data;
|
||||
struct berval cred;
|
||||
struct otpd_queue_item *item;
|
||||
int i;
|
||||
(void)vctx;
|
||||
|
||||
item = otpd_queue_pop(&ctx.bind.requests);
|
||||
if (item == NULL) {
|
||||
verto_set_flags(ctx.bind.io, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->user.dn == NULL)
|
||||
goto error;
|
||||
|
||||
data = krad_packet_get_attr(item->req,
|
||||
krad_attr_name2num("User-Password"), 0);
|
||||
if (data == NULL)
|
||||
goto error;
|
||||
|
||||
cred.bv_val = data->data;
|
||||
cred.bv_len = data->length;
|
||||
i = ldap_sasl_bind(verto_get_private(ev), item->user.dn, LDAP_SASL_SIMPLE,
|
||||
&cred, ctrls, NULL, &item->msgid);
|
||||
if (i != LDAP_SUCCESS) {
|
||||
otpd_log_err(errno, "Unable to initiate bind: %s", ldap_err2string(i));
|
||||
verto_break(ctx.vctx);
|
||||
ctx.exitstatus = 1;
|
||||
}
|
||||
|
||||
otpd_log_req(item->req, "bind start: %s", item->user.dn);
|
||||
push = &ctx.bind.responses;
|
||||
|
||||
error:
|
||||
otpd_queue_push(push, item);
|
||||
}
|
||||
|
||||
static void on_bind_readable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
const char *errstr = "error";
|
||||
LDAPMessage *results;
|
||||
struct otpd_queue_item *item = NULL;
|
||||
int i, rslt;
|
||||
(void)vctx;
|
||||
|
||||
rslt = ldap_result(verto_get_private(ev), LDAP_RES_ANY, 0, NULL, &results);
|
||||
if (rslt != LDAP_RES_BIND) {
|
||||
if (rslt <= 0)
|
||||
results = NULL;
|
||||
ldap_msgfree(results);
|
||||
otpd_log_err(EIO, "IO error received on bind socket");
|
||||
verto_break(ctx.vctx);
|
||||
ctx.exitstatus = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
item = otpd_queue_pop_msgid(&ctx.bind.responses, ldap_msgid(results));
|
||||
if (item == NULL) {
|
||||
ldap_msgfree(results);
|
||||
return;
|
||||
}
|
||||
item->msgid = -1;
|
||||
|
||||
rslt = ldap_parse_result(verto_get_private(ev), results, &i,
|
||||
NULL, NULL, NULL, NULL, 0);
|
||||
if (rslt != LDAP_SUCCESS) {
|
||||
errstr = ldap_err2string(rslt);
|
||||
goto error;
|
||||
}
|
||||
|
||||
rslt = i;
|
||||
if (rslt != LDAP_SUCCESS) {
|
||||
errstr = ldap_err2string(rslt);
|
||||
goto error;
|
||||
}
|
||||
|
||||
item->sent = 0;
|
||||
i = krad_packet_new_response(ctx.kctx, SECRET,
|
||||
krad_code_name2num("Access-Accept"),
|
||||
NULL, item->req, &item->rsp);
|
||||
if (i != 0) {
|
||||
errstr = krb5_get_error_message(ctx.kctx, i);
|
||||
goto error;
|
||||
}
|
||||
|
||||
error:
|
||||
if (item != NULL)
|
||||
otpd_log_req(item->req, "bind end: %s",
|
||||
item->rsp != NULL ? "success" : errstr);
|
||||
|
||||
ldap_msgfree(results);
|
||||
otpd_queue_push(&ctx.stdio.responses, item);
|
||||
verto_set_flags(ctx.stdio.writer, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ |
|
||||
VERTO_EV_FLAG_IO_WRITE);
|
||||
}
|
||||
|
||||
void otpd_on_bind_io(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
verto_ev_flag flags;
|
||||
|
||||
flags = verto_get_fd_state(ev);
|
||||
if (flags & VERTO_EV_FLAG_IO_WRITE)
|
||||
on_bind_writable(vctx, ev);
|
||||
if (flags & (VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_IO_ERROR))
|
||||
on_bind_readable(vctx, ev);
|
||||
}
|
||||
124
daemons/ipa-otpd/forward.c
Normal file
124
daemons/ipa-otpd/forward.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file proxies the incoming RADIUS request (stdio.c/query.c) to a
|
||||
* third-party RADIUS server if the user is configured for forwarding. The
|
||||
* result is placed in the stdout queue (stdio.c).
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
static void forward_cb(krb5_error_code retval, const krad_packet *request,
|
||||
const krad_packet *response, void *data)
|
||||
{
|
||||
krad_code code, acpt;
|
||||
struct otpd_queue_item *item = data;
|
||||
(void)request;
|
||||
|
||||
acpt = krad_code_name2num("Access-Accept");
|
||||
code = krad_packet_get_code(response);
|
||||
if (retval == 0 && code == acpt) {
|
||||
item->sent = 0;
|
||||
retval = krad_packet_new_response(ctx.kctx, SECRET, acpt,
|
||||
NULL, item->req, &item->rsp);
|
||||
}
|
||||
|
||||
otpd_log_req(item->req, "forward end: %s",
|
||||
retval == 0
|
||||
? krad_code_num2name(code)
|
||||
: krb5_get_error_message(ctx.kctx, retval));
|
||||
|
||||
otpd_queue_push(&ctx.stdio.responses, item);
|
||||
verto_set_flags(ctx.stdio.writer, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ |
|
||||
VERTO_EV_FLAG_IO_WRITE);
|
||||
}
|
||||
|
||||
krb5_error_code otpd_forward(struct otpd_queue_item **item)
|
||||
{
|
||||
krad_attr usernameid, passwordid;
|
||||
const krb5_data *password;
|
||||
krb5_error_code retval;
|
||||
char *username;
|
||||
krb5_data data;
|
||||
|
||||
/* Find the username. */
|
||||
username = (*item)->user.ipatokenRadiusUserName;
|
||||
if (username == NULL) {
|
||||
username = (*item)->user.other;
|
||||
if (username == NULL)
|
||||
username = (*item)->user.uid;
|
||||
}
|
||||
|
||||
/* Check to see if we are supposed to forward. */
|
||||
if ((*item)->radius.ipatokenRadiusServer == NULL ||
|
||||
(*item)->radius.ipatokenRadiusSecret == NULL ||
|
||||
username == NULL)
|
||||
return 0;
|
||||
|
||||
otpd_log_req((*item)->req, "forward start: %s / %s", username,
|
||||
(*item)->radius.ipatokenRadiusServer);
|
||||
|
||||
usernameid = krad_attr_name2num("User-Name");
|
||||
passwordid = krad_attr_name2num("User-Password");
|
||||
|
||||
/* Set User-Name. */
|
||||
data.data = username;
|
||||
data.length = strlen(data.data);
|
||||
retval = krad_attrset_add(ctx.attrs, usernameid, &data);
|
||||
if (retval != 0)
|
||||
goto error;
|
||||
|
||||
/* Set User-Password. */
|
||||
password = krad_packet_get_attr((*item)->req, passwordid, 0);
|
||||
if (password == NULL) {
|
||||
krad_attrset_del(ctx.attrs, usernameid, 0);
|
||||
goto error;
|
||||
}
|
||||
retval = krad_attrset_add(ctx.attrs, passwordid, password);
|
||||
if (retval != 0) {
|
||||
krad_attrset_del(ctx.attrs, usernameid, 0);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Forward the request to the RADIUS server. */
|
||||
retval = krad_client_send(ctx.client,
|
||||
krad_code_name2num("Access-Request"),
|
||||
ctx.attrs,
|
||||
(*item)->radius.ipatokenRadiusServer,
|
||||
(*item)->radius.ipatokenRadiusSecret,
|
||||
(*item)->radius.ipatokenRadiusTimeout,
|
||||
(*item)->radius.ipatokenRadiusRetries,
|
||||
forward_cb, *item);
|
||||
krad_attrset_del(ctx.attrs, usernameid, 0);
|
||||
krad_attrset_del(ctx.attrs, passwordid, 0);
|
||||
if (retval == 0)
|
||||
*item = NULL;
|
||||
|
||||
error:
|
||||
if (retval != 0)
|
||||
otpd_log_req((*item)->req, "forward end: %s",
|
||||
krb5_get_error_message(ctx.kctx, retval));
|
||||
return retval;
|
||||
}
|
||||
150
daemons/ipa-otpd/internal.h
Normal file
150
daemons/ipa-otpd/internal.h
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "krad.h"
|
||||
|
||||
#include <ldap.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#define SECRET ""
|
||||
#define otpd_log_req(req, ...) \
|
||||
otpd_log_req_(__FILE__, __LINE__, (req), __VA_ARGS__)
|
||||
#define otpd_log_err(errnum, ...) \
|
||||
otpd_log_err_(__FILE__, __LINE__, (errnum), __VA_ARGS__)
|
||||
|
||||
struct otpd_queue_iter;
|
||||
|
||||
struct otpd_queue_item {
|
||||
struct otpd_queue_item *next;
|
||||
krad_packet *req;
|
||||
krad_packet *rsp;
|
||||
size_t sent;
|
||||
char *error;
|
||||
|
||||
struct {
|
||||
char *dn;
|
||||
char *uid;
|
||||
char *ipatokenRadiusUserName;
|
||||
char *ipatokenRadiusConfigLink;
|
||||
char *other;
|
||||
} user;
|
||||
|
||||
struct {
|
||||
char *ipatokenUserMapAttribute;
|
||||
char *ipatokenRadiusSecret;
|
||||
char *ipatokenRadiusServer;
|
||||
time_t ipatokenRadiusTimeout;
|
||||
size_t ipatokenRadiusRetries;
|
||||
} radius;
|
||||
int msgid;
|
||||
};
|
||||
|
||||
struct otpd_queue {
|
||||
struct otpd_queue_item *head;
|
||||
struct otpd_queue_item *tail;
|
||||
};
|
||||
|
||||
/* This structure contains our global state. The most important part is the
|
||||
* queues. When a request comes in (stdio.c), it is placed into an item object.
|
||||
* This item exists in only one queue at a time as it flows through this
|
||||
* daemon.
|
||||
*
|
||||
* The flow is: stdin => query => (forward (no queue) or bind) => stdout.
|
||||
*/
|
||||
struct otpd_context {
|
||||
verto_ctx *vctx;
|
||||
krb5_context kctx;
|
||||
krad_client *client;
|
||||
krad_attrset *attrs;
|
||||
int exitstatus;
|
||||
|
||||
struct {
|
||||
verto_ev *reader;
|
||||
verto_ev *writer;
|
||||
struct otpd_queue responses;
|
||||
} stdio;
|
||||
|
||||
struct {
|
||||
char *base;
|
||||
verto_ev *io;
|
||||
struct otpd_queue requests;
|
||||
struct otpd_queue responses;
|
||||
} query;
|
||||
|
||||
struct {
|
||||
verto_ev *io;
|
||||
struct otpd_queue requests;
|
||||
struct otpd_queue responses;
|
||||
} bind;
|
||||
};
|
||||
|
||||
extern struct otpd_context ctx;
|
||||
|
||||
void otpd_log_req_(const char * const file, int line, krad_packet *req,
|
||||
const char * const tmpl, ...);
|
||||
|
||||
void otpd_log_err_(const char * const file, int line, krb5_error_code code,
|
||||
const char * const tmpl, ...);
|
||||
|
||||
krb5_error_code otpd_queue_item_new(krad_packet *req,
|
||||
struct otpd_queue_item **item);
|
||||
|
||||
void otpd_queue_item_free(struct otpd_queue_item *item);
|
||||
|
||||
krb5_error_code otpd_queue_iter_new(const struct otpd_queue * const *queues,
|
||||
struct otpd_queue_iter **iter);
|
||||
|
||||
const krad_packet *otpd_queue_iter_func(void *data, krb5_boolean cancel);
|
||||
|
||||
void otpd_queue_push(struct otpd_queue *q, struct otpd_queue_item *item);
|
||||
|
||||
void otpd_queue_push_head(struct otpd_queue *q, struct otpd_queue_item *item);
|
||||
|
||||
struct otpd_queue_item *otpd_queue_peek(struct otpd_queue *q);
|
||||
|
||||
struct otpd_queue_item *otpd_queue_pop(struct otpd_queue *q);
|
||||
|
||||
struct otpd_queue_item *otpd_queue_pop_msgid(struct otpd_queue *q, int msgid);
|
||||
|
||||
void otpd_queue_free_items(struct otpd_queue *q);
|
||||
|
||||
void otpd_on_stdin_readable(verto_ctx *vctx, verto_ev *ev);
|
||||
|
||||
void otpd_on_stdout_writable(verto_ctx *vctx, verto_ev *ev);
|
||||
|
||||
void otpd_on_query_io(verto_ctx *vctx, verto_ev *ev);
|
||||
|
||||
void otpd_on_bind_io(verto_ctx *vctx, verto_ev *ev);
|
||||
|
||||
krb5_error_code otpd_forward(struct otpd_queue_item **i);
|
||||
|
||||
const char *otpd_parse_user(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item);
|
||||
|
||||
const char *otpd_parse_radius(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item);
|
||||
|
||||
const char *otpd_parse_radius_username(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item);
|
||||
11
daemons/ipa-otpd/ipa-otpd.socket.in
Normal file
11
daemons/ipa-otpd/ipa-otpd.socket.in
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=ipa-otpd socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=@krb5rundir@/DEFAULT.socket
|
||||
RemoveOnStop=true
|
||||
SocketMode=0600
|
||||
Accept=true
|
||||
|
||||
[Install]
|
||||
WantedBy=@KRB5KDC_SERVICE@
|
||||
9
daemons/ipa-otpd/ipa-otpd@.service.in
Normal file
9
daemons/ipa-otpd/ipa-otpd@.service.in
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=ipa-otpd service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=@sysconfdir@/ipa/default.conf
|
||||
ExecStart=@libexecdir@/ipa/ipa-otpd $ldap_uri
|
||||
StandardInput=socket
|
||||
StandardOutput=socket
|
||||
StandardError=syslog
|
||||
341
daemons/ipa-otpd/main.c
Normal file
341
daemons/ipa-otpd/main.c
Normal file
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file initializes a systemd socket-activated daemon which receives
|
||||
* RADIUS packets on STDIN and either proxies them to a third party RADIUS
|
||||
* server or performs authentication directly by binding to the LDAP server.
|
||||
* The choice between bind or proxy is made by evaluating LDAP configuration
|
||||
* for the given user.
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Our global state. */
|
||||
struct otpd_context ctx;
|
||||
|
||||
/* Implementation function for logging a request's state. See internal.h. */
|
||||
void otpd_log_req_(const char * const file, int line, krad_packet *req,
|
||||
const char * const tmpl, ...)
|
||||
{
|
||||
const krb5_data *data;
|
||||
va_list ap;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (file != NULL)
|
||||
fprintf(stderr, "%8s:%03d: ", file, line);
|
||||
#else
|
||||
(void)file;
|
||||
(void)line;
|
||||
#endif
|
||||
|
||||
data = krad_packet_get_attr(req, krad_attr_name2num("User-Name"), 0);
|
||||
if (data == NULL)
|
||||
fprintf(stderr, "<unknown>: ");
|
||||
else
|
||||
fprintf(stderr, "%*s: ", data->length, data->data);
|
||||
|
||||
va_start(ap, tmpl);
|
||||
vfprintf(stderr, tmpl, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Implementation function for logging a generic error. See internal.h. */
|
||||
void otpd_log_err_(const char * const file, int line, krb5_error_code code,
|
||||
const char * const tmpl, ...)
|
||||
{
|
||||
const char *msg;
|
||||
va_list ap;
|
||||
|
||||
if (file != NULL)
|
||||
fprintf(stderr, "%10s:%03d: ", file, line);
|
||||
|
||||
if (code != 0) {
|
||||
msg = krb5_get_error_message(ctx.kctx, code);
|
||||
fprintf(stderr, "%s: ", msg);
|
||||
krb5_free_error_message(ctx.kctx, msg);
|
||||
}
|
||||
|
||||
va_start(ap, tmpl);
|
||||
vfprintf(stderr, tmpl, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
static void on_ldap_free(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
(void)vctx; /* Unused */
|
||||
ldap_unbind_ext_s(verto_get_private(ev), NULL, NULL);
|
||||
}
|
||||
|
||||
static void on_signal(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
(void)ev; /* Unused */
|
||||
fprintf(stderr, "Signaled, exiting...\n");
|
||||
verto_break(vctx);
|
||||
}
|
||||
|
||||
static char *find_base(LDAP *ldp)
|
||||
{
|
||||
LDAPMessage *results = NULL, *entry;
|
||||
struct berval **vals = NULL;
|
||||
struct timeval timeout;
|
||||
int i, len;
|
||||
char *base = NULL, *attrs[] = {
|
||||
"namingContexts",
|
||||
"defaultNamingContext",
|
||||
NULL
|
||||
};
|
||||
|
||||
timeout.tv_sec = -1;
|
||||
i = ldap_search_ext_s(ldp, "", LDAP_SCOPE_BASE, NULL, attrs,
|
||||
0, NULL, NULL, &timeout, 1, &results);
|
||||
if (i != LDAP_SUCCESS) {
|
||||
otpd_log_err(0, "Unable to search for query base: %s",
|
||||
ldap_err2string(i));
|
||||
goto egress;
|
||||
}
|
||||
|
||||
entry = ldap_first_entry(ldp, results);
|
||||
if (entry == NULL) {
|
||||
otpd_log_err(0, "No entries found");
|
||||
goto egress;
|
||||
}
|
||||
|
||||
vals = ldap_get_values_len(ldp, entry, "defaultNamingContext");
|
||||
if (vals == NULL) {
|
||||
vals = ldap_get_values_len(ldp, entry, "namingContexts");
|
||||
if (vals == NULL) {
|
||||
otpd_log_err(0, "No namingContexts found");
|
||||
goto egress;
|
||||
}
|
||||
}
|
||||
|
||||
len = ldap_count_values_len(vals);
|
||||
if (len == 1)
|
||||
base = strndup(vals[0]->bv_val, vals[0]->bv_len);
|
||||
else
|
||||
otpd_log_err(0, "Too many namingContexts found");
|
||||
|
||||
/* TODO: search multiple namingContexts to find the base? */
|
||||
|
||||
egress:
|
||||
ldap_value_free_len(vals);
|
||||
ldap_msgfree(results);
|
||||
return base;
|
||||
}
|
||||
|
||||
/* Set up an LDAP connection as a verto event. */
|
||||
static krb5_error_code setup_ldap(const char *uri, krb5_boolean bind,
|
||||
verto_callback *io, verto_ev **ev,
|
||||
char **base)
|
||||
{
|
||||
struct timeval timeout;
|
||||
int err, ver, fd;
|
||||
char *basetmp;
|
||||
LDAP *ldp;
|
||||
|
||||
err = ldap_initialize(&ldp, uri);
|
||||
if (err != LDAP_SUCCESS)
|
||||
return errno;
|
||||
|
||||
ver = LDAP_VERSION3;
|
||||
ldap_set_option(ldp, LDAP_OPT_PROTOCOL_VERSION, &ver);
|
||||
|
||||
if (bind) {
|
||||
err = ldap_sasl_bind_s(ldp, NULL, "EXTERNAL", NULL, NULL, NULL, NULL);
|
||||
if (err != LDAP_SUCCESS)
|
||||
return errno;
|
||||
}
|
||||
|
||||
/* Always find the base since this forces open the socket. */
|
||||
basetmp = find_base(ldp);
|
||||
if (base != NULL) {
|
||||
if (basetmp == NULL)
|
||||
return ENOTCONN;
|
||||
*base = basetmp;
|
||||
} else {
|
||||
free(basetmp);
|
||||
}
|
||||
|
||||
/* Set default timeout to just return immediately for async requests. */
|
||||
memset(&timeout, 0, sizeof(timeout));
|
||||
err = ldap_set_option(ldp, LDAP_OPT_TIMEOUT, &timeout);
|
||||
if (err != LDAP_OPT_SUCCESS) {
|
||||
ldap_unbind_ext_s(ldp, NULL, NULL);
|
||||
return ENOMEM; /* What error code do I use? */
|
||||
}
|
||||
|
||||
/* Get the file descriptor. */
|
||||
if (ldap_get_option(ldp, LDAP_OPT_DESC, &fd) != LDAP_OPT_SUCCESS) {
|
||||
ldap_unbind_ext_s(ldp, NULL, NULL);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
*ev = verto_add_io(ctx.vctx, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ,
|
||||
io, fd);
|
||||
if (*ev == NULL) {
|
||||
ldap_unbind_ext_s(ldp, NULL, NULL);
|
||||
return ENOMEM; /* What error code do I use? */
|
||||
}
|
||||
|
||||
verto_set_private(*ev, ldp, on_ldap_free);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
krb5_error_code retval;
|
||||
krb5_data hndata;
|
||||
verto_ev *sig;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <ldap_uri>\n", argv[0]);
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr, "LDAP: %s\n", argv[1]);
|
||||
}
|
||||
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ctx.exitstatus = 1;
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) < 0) {
|
||||
otpd_log_err(errno, "Unable to get hostname");
|
||||
goto error;
|
||||
}
|
||||
|
||||
retval = krb5_init_context(&ctx.kctx);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to initialize context");
|
||||
goto error;
|
||||
}
|
||||
|
||||
ctx.vctx = verto_new(NULL, VERTO_EV_TYPE_IO | VERTO_EV_TYPE_SIGNAL);
|
||||
if (ctx.vctx == NULL) {
|
||||
otpd_log_err(ENOMEM, "Unable to initialize event loop");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Build attrset. */
|
||||
retval = krad_attrset_new(ctx.kctx, &ctx.attrs);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to initialize attrset");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Set NAS-Identifier. */
|
||||
hndata.data = hostname;
|
||||
hndata.length = strlen(hndata.data);
|
||||
retval = krad_attrset_add(ctx.attrs, krad_attr_name2num("NAS-Identifier"),
|
||||
&hndata);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to set NAS-Identifier");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Set Service-Type. */
|
||||
retval = krad_attrset_add_number(ctx.attrs,
|
||||
krad_attr_name2num("Service-Type"),
|
||||
KRAD_SERVICE_TYPE_AUTHENTICATE_ONLY);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to set Service-Type");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Radius Client */
|
||||
retval = krad_client_new(ctx.kctx, ctx.vctx, &ctx.client);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to initialize radius client");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Signals */
|
||||
sig = verto_add_signal(ctx.vctx, VERTO_EV_FLAG_NONE, on_signal, SIGTERM);
|
||||
if (sig == NULL) {
|
||||
otpd_log_err(ENOMEM, "Unable to initialize signal event");
|
||||
goto error;
|
||||
}
|
||||
sig = verto_add_signal(ctx.vctx, VERTO_EV_FLAG_NONE, on_signal, SIGINT);
|
||||
if (sig == NULL) {
|
||||
otpd_log_err(ENOMEM, "Unable to initialize signal event");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Standard IO */
|
||||
ctx.stdio.reader = verto_add_io(ctx.vctx, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ,
|
||||
otpd_on_stdin_readable, STDIN_FILENO);
|
||||
if (ctx.stdio.reader == NULL) {
|
||||
otpd_log_err(ENOMEM, "Unable to initialize reader event");
|
||||
goto error;
|
||||
}
|
||||
ctx.stdio.writer = verto_add_io(ctx.vctx, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ,
|
||||
otpd_on_stdout_writable, STDOUT_FILENO);
|
||||
if (ctx.stdio.writer == NULL) {
|
||||
otpd_log_err(ENOMEM, "Unable to initialize writer event");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* LDAP (Query) */
|
||||
retval = setup_ldap(argv[1], TRUE, otpd_on_query_io,
|
||||
&ctx.query.io, &ctx.query.base);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to initialize LDAP (Query)");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* LDAP (Bind) */
|
||||
retval = setup_ldap(argv[1], FALSE, otpd_on_bind_io,
|
||||
&ctx.bind.io, NULL);
|
||||
if (retval != 0) {
|
||||
otpd_log_err(retval, "Unable to initialize LDAP (Bind)");
|
||||
goto error;
|
||||
}
|
||||
|
||||
ctx.exitstatus = 0;
|
||||
verto_run(ctx.vctx);
|
||||
|
||||
error:
|
||||
krad_client_free(ctx.client);
|
||||
otpd_queue_free_items(&ctx.stdio.responses);
|
||||
otpd_queue_free_items(&ctx.query.requests);
|
||||
otpd_queue_free_items(&ctx.query.responses);
|
||||
otpd_queue_free_items(&ctx.bind.requests);
|
||||
otpd_queue_free_items(&ctx.bind.responses);
|
||||
free(ctx.query.base);
|
||||
verto_free(ctx.vctx);
|
||||
krb5_free_context(ctx.kctx);
|
||||
return ctx.exitstatus;
|
||||
}
|
||||
|
||||
176
daemons/ipa-otpd/parse.c
Normal file
176
daemons/ipa-otpd/parse.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file parses the user's configuration received from LDAP (see query.c).
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#define DEFAULT_TIMEOUT 15
|
||||
#define DEFAULT_RETRIES 3
|
||||
|
||||
/* Convert an LDAP entry into an allocated string. */
|
||||
static int get_string(LDAP *ldp, LDAPMessage *entry, const char *name,
|
||||
char **out)
|
||||
{
|
||||
struct berval **vals;
|
||||
ber_len_t i;
|
||||
char *buf;
|
||||
|
||||
vals = ldap_get_values_len(ldp, entry, name);
|
||||
if (vals == NULL)
|
||||
return ENOENT;
|
||||
|
||||
buf = calloc(vals[0]->bv_len + 1, sizeof(char));
|
||||
if (buf == NULL) {
|
||||
ldap_value_free_len(vals);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < vals[0]->bv_len; i++) {
|
||||
if (!isprint(vals[0]->bv_val[i])) {
|
||||
free(buf);
|
||||
ldap_value_free_len(vals);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
buf[i] = vals[0]->bv_val[i];
|
||||
}
|
||||
|
||||
if (*out != NULL)
|
||||
free(*out);
|
||||
*out = buf;
|
||||
ldap_value_free_len(vals);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convert an LDAP entry into an unsigned long. */
|
||||
static int get_ulong(LDAP *ldp, LDAPMessage *entry, const char *name,
|
||||
unsigned long *out)
|
||||
{
|
||||
struct berval **vals;
|
||||
char buffer[32];
|
||||
|
||||
vals = ldap_get_values_len(ldp, entry, name);
|
||||
if (vals == NULL)
|
||||
return ENOENT;
|
||||
|
||||
if (vals[0]->bv_len > sizeof(buffer) - 1) {
|
||||
ldap_value_free_len(vals);
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
memcpy(buffer, vals[0]->bv_val, vals[0]->bv_len);
|
||||
buffer[vals[0]->bv_len] = '\0';
|
||||
ldap_value_free_len(vals);
|
||||
|
||||
*out = strtoul(buffer, NULL, 10);
|
||||
if (*out == ULONG_MAX)
|
||||
return errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse basic user configuration. */
|
||||
const char *otpd_parse_user(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
i = get_string(ldp, entry, "uid", &item->user.uid);
|
||||
if (i != 0)
|
||||
return strerror(i);
|
||||
|
||||
i = get_string(ldp, entry, "ipatokenRadiusUserName",
|
||||
&item->user.ipatokenRadiusUserName);
|
||||
if (i != 0 && i != ENOENT)
|
||||
return strerror(i);
|
||||
|
||||
i = get_string(ldp, entry, "ipatokenRadiusConfigLink",
|
||||
&item->user.ipatokenRadiusConfigLink);
|
||||
if (i != 0 && i != ENOENT)
|
||||
return strerror(i);
|
||||
|
||||
/* Get the DN. */
|
||||
item->user.dn = ldap_get_dn(ldp, entry);
|
||||
if (item->user.dn == NULL) {
|
||||
i = ldap_get_option(ldp, LDAP_OPT_RESULT_CODE, &j);
|
||||
return ldap_err2string(i == LDAP_OPT_SUCCESS ? j : i);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse the user's RADIUS configuration. */
|
||||
const char *otpd_parse_radius(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item)
|
||||
{
|
||||
unsigned long l;
|
||||
int i;
|
||||
|
||||
i = get_string(ldp, entry, "ipatokenRadiusServer",
|
||||
&item->radius.ipatokenRadiusServer);
|
||||
if (i != 0)
|
||||
return strerror(i);
|
||||
|
||||
i = get_string(ldp, entry, "ipatokenRadiusSecret",
|
||||
&item->radius.ipatokenRadiusSecret);
|
||||
if (i != 0)
|
||||
return strerror(i);
|
||||
|
||||
i = get_string(ldp, entry, "ipatokenUserMapAttribute",
|
||||
&item->radius.ipatokenUserMapAttribute);
|
||||
if (i != 0 && i != ENOENT)
|
||||
return strerror(i);
|
||||
|
||||
i = get_ulong(ldp, entry, "ipatokenRadiusTimeout", &l);
|
||||
if (i == ENOENT)
|
||||
l = DEFAULT_TIMEOUT;
|
||||
else if (i != 0)
|
||||
return strerror(i);
|
||||
item->radius.ipatokenRadiusTimeout = l * 1000;
|
||||
|
||||
i = get_ulong(ldp, entry, "ipatokenRadiusRetries", &l);
|
||||
if (i == ENOENT)
|
||||
l = DEFAULT_RETRIES;
|
||||
else if (i != 0)
|
||||
return strerror(i);
|
||||
item->radius.ipatokenRadiusRetries = l;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse the user's RADIUS username. */
|
||||
const char *otpd_parse_radius_username(LDAP *ldp, LDAPMessage *entry,
|
||||
struct otpd_queue_item *item)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = get_string(ldp, entry, item->radius.ipatokenUserMapAttribute,
|
||||
&item->user.other);
|
||||
if (i != 0)
|
||||
return strerror(i);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
252
daemons/ipa-otpd/query.c
Normal file
252
daemons/ipa-otpd/query.c
Normal file
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file receives requests (from stdio.c) and queries the LDAP server for
|
||||
* the user's configuration. When the user's configuration is received, it is
|
||||
* parsed (parse.c). Once the configuration is parsed, the request packet is
|
||||
* either forwarded to a third-party RADIUS server (forward.c) or authenticated
|
||||
* directly via an LDAP bind (bind.c) based on the configuration received.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE 1 /* for asprintf() */
|
||||
#include "internal.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#define DEFAULT_TIMEOUT 15
|
||||
#define DEFAULT_RETRIES 3
|
||||
|
||||
static char *user[] = {
|
||||
"uid",
|
||||
"ipatokenRadiusUserName",
|
||||
"ipatokenRadiusConfigLink",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *radius[] = {
|
||||
"ipatokenRadiusServer",
|
||||
"ipatokenRadiusSecret",
|
||||
"ipatokenRadiusTimeout",
|
||||
"ipatokenRadiusRetries",
|
||||
"ipatokenUserMapAttribute",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Send queued LDAP requests to the server. */
|
||||
static void on_query_writable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
struct otpd_queue *push = &ctx.stdio.responses;
|
||||
const krb5_data *princ = NULL;
|
||||
char *filter = NULL, *attrs[2];
|
||||
int i = LDAP_SUCCESS;
|
||||
struct otpd_queue_item *item;
|
||||
(void)vctx;
|
||||
|
||||
item = otpd_queue_pop(&ctx.query.requests);
|
||||
if (item == NULL) {
|
||||
verto_set_flags(ctx.query.io, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->user.dn == NULL) {
|
||||
princ = krad_packet_get_attr(item->req,
|
||||
krad_attr_name2num("User-Name"), 0);
|
||||
if (princ == NULL)
|
||||
goto error;
|
||||
|
||||
otpd_log_req(item->req, "user query start");
|
||||
|
||||
if (asprintf(&filter, "(&(objectClass=Person)(krbPrincipalName=%*s))",
|
||||
princ->length, princ->data) < 0)
|
||||
goto error;
|
||||
|
||||
i = ldap_search_ext(verto_get_private(ev), ctx.query.base,
|
||||
LDAP_SCOPE_SUBTREE, filter, user, 0, NULL,
|
||||
NULL, NULL, 1, &item->msgid);
|
||||
free(filter);
|
||||
|
||||
} else if (item->radius.ipatokenRadiusSecret == NULL) {
|
||||
otpd_log_req(item->req, "radius query start: %s",
|
||||
item->user.ipatokenRadiusConfigLink);
|
||||
|
||||
i = ldap_search_ext(verto_get_private(ev),
|
||||
item->user.ipatokenRadiusConfigLink,
|
||||
LDAP_SCOPE_BASE, NULL, radius, 0, NULL,
|
||||
NULL, NULL, 1, &item->msgid);
|
||||
|
||||
} else if (item->radius.ipatokenUserMapAttribute != NULL) {
|
||||
otpd_log_req(item->req, "username query start: %s",
|
||||
item->radius.ipatokenUserMapAttribute);
|
||||
|
||||
attrs[0] = item->radius.ipatokenUserMapAttribute;
|
||||
attrs[1] = NULL;
|
||||
i = ldap_search_ext(verto_get_private(ev), item->user.dn,
|
||||
LDAP_SCOPE_BASE, NULL, attrs, 0, NULL,
|
||||
NULL, NULL, 1, &item->msgid);
|
||||
}
|
||||
|
||||
if (i == LDAP_SUCCESS) {
|
||||
item->sent++;
|
||||
push = &ctx.query.responses;
|
||||
}
|
||||
|
||||
error:
|
||||
otpd_queue_push(push, item);
|
||||
}
|
||||
|
||||
/* Read LDAP responses from the server. */
|
||||
static void on_query_readable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
struct otpd_queue *push = &ctx.stdio.responses;
|
||||
verto_ev *event = ctx.stdio.writer;
|
||||
LDAPMessage *results, *entry;
|
||||
struct otpd_queue_item *item = NULL;
|
||||
const char *err;
|
||||
LDAP *ldp;
|
||||
int i;
|
||||
(void)vctx;
|
||||
|
||||
ldp = verto_get_private(ev);
|
||||
|
||||
i = ldap_result(ldp, LDAP_RES_ANY, 0, NULL, &results);
|
||||
if (i != LDAP_RES_SEARCH_ENTRY && i != LDAP_RES_SEARCH_RESULT) {
|
||||
if (i <= 0)
|
||||
results = NULL;
|
||||
ldap_msgfree(results);
|
||||
otpd_log_err(EIO, "IO error received on query socket");
|
||||
verto_break(ctx.vctx);
|
||||
ctx.exitstatus = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
item = otpd_queue_pop_msgid(&ctx.query.responses, ldap_msgid(results));
|
||||
if (item == NULL)
|
||||
goto egress;
|
||||
|
||||
if (i == LDAP_RES_SEARCH_ENTRY) {
|
||||
entry = ldap_first_entry(ldp, results);
|
||||
if (entry == NULL)
|
||||
goto egress;
|
||||
|
||||
err = NULL;
|
||||
switch (item->sent) {
|
||||
case 1:
|
||||
err = otpd_parse_user(ldp, entry, item);
|
||||
break;
|
||||
case 2:
|
||||
err = otpd_parse_radius(ldp, entry, item);
|
||||
break;
|
||||
case 3:
|
||||
err = otpd_parse_radius_username(ldp, entry, item);
|
||||
break;
|
||||
default:
|
||||
ldap_msgfree(entry);
|
||||
goto egress;
|
||||
}
|
||||
|
||||
ldap_msgfree(entry);
|
||||
|
||||
if (err != NULL) {
|
||||
if (item->error != NULL)
|
||||
free(item->error);
|
||||
item->error = strdup(err);
|
||||
if (item->error == NULL)
|
||||
goto egress;
|
||||
}
|
||||
|
||||
otpd_queue_push_head(&ctx.query.responses, item);
|
||||
return;
|
||||
}
|
||||
|
||||
item->msgid = -1;
|
||||
|
||||
switch (item->sent) {
|
||||
case 1:
|
||||
otpd_log_req(item->req, "user query end: %s",
|
||||
item->error == NULL ? item->user.dn : item->error);
|
||||
if (item->user.dn == NULL || item->user.uid == NULL)
|
||||
goto egress;
|
||||
break;
|
||||
case 2:
|
||||
otpd_log_req(item->req, "radius query end: %s",
|
||||
item->error == NULL
|
||||
? item->radius.ipatokenRadiusServer
|
||||
: item->error);
|
||||
if (item->radius.ipatokenRadiusServer == NULL ||
|
||||
item->radius.ipatokenRadiusSecret == NULL)
|
||||
goto egress;
|
||||
break;
|
||||
case 3:
|
||||
otpd_log_req(item->req, "username query end: %s",
|
||||
item->error == NULL ? item->user.other : item->error);
|
||||
break;
|
||||
default:
|
||||
goto egress;
|
||||
}
|
||||
|
||||
if (item->error != NULL)
|
||||
goto egress;
|
||||
|
||||
if (item->sent == 1 && item->user.ipatokenRadiusConfigLink != NULL) {
|
||||
push = &ctx.query.requests;
|
||||
event = ctx.query.io;
|
||||
goto egress;
|
||||
} else if (item->sent == 2 &&
|
||||
item->radius.ipatokenUserMapAttribute != NULL &&
|
||||
item->user.ipatokenRadiusUserName == NULL) {
|
||||
push = &ctx.query.requests;
|
||||
event = ctx.query.io;
|
||||
goto egress;
|
||||
}
|
||||
|
||||
/* Forward to RADIUS if necessary. */
|
||||
i = otpd_forward(&item);
|
||||
if (i != 0)
|
||||
goto egress;
|
||||
|
||||
push = &ctx.bind.requests;
|
||||
event = ctx.bind.io;
|
||||
|
||||
egress:
|
||||
ldap_msgfree(results);
|
||||
otpd_queue_push(push, item);
|
||||
|
||||
if (item != NULL)
|
||||
verto_set_flags(event, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ |
|
||||
VERTO_EV_FLAG_IO_WRITE);
|
||||
}
|
||||
|
||||
/* Handle the reading/writing of LDAP query requests asynchronously. */
|
||||
void otpd_on_query_io(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
verto_ev_flag flags;
|
||||
|
||||
flags = verto_get_fd_state(ev);
|
||||
if (flags & VERTO_EV_FLAG_IO_WRITE)
|
||||
on_query_writable(vctx, ev);
|
||||
if (flags & (VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_IO_ERROR))
|
||||
on_query_readable(vctx, ev);
|
||||
}
|
||||
183
daemons/ipa-otpd/queue.c
Normal file
183
daemons/ipa-otpd/queue.c
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains an implementation of a queue of request/response items.
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
struct otpd_queue_iter {
|
||||
struct otpd_queue_item *next;
|
||||
unsigned int qindx;
|
||||
const struct otpd_queue * const *queues;
|
||||
};
|
||||
|
||||
krb5_error_code otpd_queue_item_new(krad_packet *req,
|
||||
struct otpd_queue_item **item)
|
||||
{
|
||||
*item = calloc(1, sizeof(struct otpd_queue_item));
|
||||
if (*item == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
(*item)->req = req;
|
||||
(*item)->msgid = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void otpd_queue_item_free(struct otpd_queue_item *item)
|
||||
{
|
||||
if (item == NULL)
|
||||
return;
|
||||
|
||||
ldap_memfree(item->user.dn);
|
||||
free(item->user.uid);
|
||||
free(item->user.ipatokenRadiusUserName);
|
||||
free(item->user.ipatokenRadiusConfigLink);
|
||||
free(item->user.other);
|
||||
free(item->radius.ipatokenRadiusServer);
|
||||
free(item->radius.ipatokenRadiusSecret);
|
||||
free(item->radius.ipatokenUserMapAttribute);
|
||||
free(item->error);
|
||||
krad_packet_free(item->req);
|
||||
krad_packet_free(item->rsp);
|
||||
free(item);
|
||||
}
|
||||
|
||||
krb5_error_code otpd_queue_iter_new(const struct otpd_queue * const *queues,
|
||||
struct otpd_queue_iter **iter)
|
||||
{
|
||||
*iter = calloc(1, sizeof(struct otpd_queue_iter));
|
||||
if (*iter == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
(*iter)->queues = queues;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This iterator function is used by krad to loop over all outstanding requests
|
||||
* to check for duplicates. Hence, we have to iterate over all the queues to
|
||||
* return all the outstanding requests as a flat list. */
|
||||
const krad_packet *otpd_queue_iter_func(void *data, krb5_boolean cancel)
|
||||
{
|
||||
struct otpd_queue_iter *iter = data;
|
||||
const struct otpd_queue *q;
|
||||
|
||||
if (cancel) {
|
||||
free(iter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (iter->next != NULL) {
|
||||
struct otpd_queue_item *tmp;
|
||||
tmp = iter->next;
|
||||
iter->next = tmp->next;
|
||||
return tmp->req;
|
||||
}
|
||||
|
||||
q = iter->queues[iter->qindx++];
|
||||
if (q == NULL)
|
||||
return otpd_queue_iter_func(data, TRUE);
|
||||
|
||||
iter->next = q->head;
|
||||
return otpd_queue_iter_func(data, FALSE);
|
||||
}
|
||||
|
||||
void otpd_queue_push(struct otpd_queue *q, struct otpd_queue_item *item)
|
||||
{
|
||||
if (item == NULL)
|
||||
return;
|
||||
|
||||
if (q->tail == NULL)
|
||||
q->head = q->tail = item;
|
||||
else
|
||||
q->tail = q->tail->next = item;
|
||||
}
|
||||
|
||||
void otpd_queue_push_head(struct otpd_queue *q, struct otpd_queue_item *item)
|
||||
{
|
||||
if (item == NULL)
|
||||
return;
|
||||
|
||||
if (q->head == NULL)
|
||||
q->tail = q->head = item;
|
||||
else {
|
||||
item->next = q->head;
|
||||
q->head = item;
|
||||
}
|
||||
}
|
||||
|
||||
struct otpd_queue_item *otpd_queue_peek(struct otpd_queue *q)
|
||||
{
|
||||
return q->head;
|
||||
}
|
||||
|
||||
struct otpd_queue_item *otpd_queue_pop(struct otpd_queue *q)
|
||||
{
|
||||
struct otpd_queue_item *item;
|
||||
|
||||
if (q == NULL)
|
||||
return NULL;
|
||||
|
||||
item = q->head;
|
||||
if (item != NULL)
|
||||
q->head = item->next;
|
||||
|
||||
if (q->head == NULL)
|
||||
q->tail = NULL;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/* Remove and return an item from the queue with the given msgid. */
|
||||
struct otpd_queue_item *otpd_queue_pop_msgid(struct otpd_queue *q, int msgid)
|
||||
{
|
||||
struct otpd_queue_item *item, **prev;
|
||||
|
||||
for (item = q->head, prev = &q->head;
|
||||
item != NULL;
|
||||
item = item->next, prev = &item->next) {
|
||||
if (item->msgid == msgid) {
|
||||
*prev = item->next;
|
||||
if (q->head == NULL)
|
||||
q->tail = NULL;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void otpd_queue_free_items(struct otpd_queue *q)
|
||||
{
|
||||
struct otpd_queue_item *item, *next;
|
||||
|
||||
next = q->head;
|
||||
while (next != NULL) {
|
||||
item = next;
|
||||
next = next->next;
|
||||
otpd_queue_item_free(item);
|
||||
}
|
||||
|
||||
q->head = NULL;
|
||||
q->tail = NULL;
|
||||
}
|
||||
205
daemons/ipa-otpd/stdio.c
Normal file
205
daemons/ipa-otpd/stdio.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* FreeIPA 2FA companion daemon
|
||||
*
|
||||
* Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
* see file 'COPYING' for use and warranty information
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file reads and writes RADIUS packets on STDIN/STDOUT.
|
||||
*
|
||||
* Incoming requests are placed into a "query" queue to look up the user's
|
||||
* configuration from LDAP (query.c).
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
static const struct otpd_queue *const queues[] = {
|
||||
&ctx.stdio.responses,
|
||||
&ctx.query.requests,
|
||||
&ctx.query.responses,
|
||||
&ctx.bind.requests,
|
||||
&ctx.bind.responses,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Read a RADIUS request from stdin. */
|
||||
void otpd_on_stdin_readable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
static char _buffer[KRAD_PACKET_SIZE_MAX];
|
||||
static krb5_data buffer = { .data = _buffer, .length = 0 };
|
||||
(void)vctx;
|
||||
|
||||
const krad_packet *dup;
|
||||
const krb5_data *data;
|
||||
struct otpd_queue_iter *iter;
|
||||
struct otpd_queue_item *item;
|
||||
krad_packet *req;
|
||||
ssize_t pktlen;
|
||||
int i;
|
||||
|
||||
pktlen = krad_packet_bytes_needed(&buffer);
|
||||
if (pktlen < 0) {
|
||||
otpd_log_err(EBADMSG, "Received a malformed packet");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Read the item. */
|
||||
i = read(verto_get_fd(ev), buffer.data + buffer.length, pktlen);
|
||||
if (i < 1) {
|
||||
/* On EOF, shutdown gracefully. */
|
||||
if (i == 0) {
|
||||
fprintf(stderr, "Socket closed, shutting down...\n");
|
||||
verto_break(ctx.vctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (errno != EAGAIN && errno != EINTR) {
|
||||
otpd_log_err(errno, "Error receiving packet");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we have a partial read or just the header, try again. */
|
||||
buffer.length += i;
|
||||
pktlen = krad_packet_bytes_needed(&buffer);
|
||||
if (pktlen > 0)
|
||||
return;
|
||||
|
||||
/* Create the iterator. */
|
||||
i = otpd_queue_iter_new(queues, &iter);
|
||||
if (i != 0) {
|
||||
otpd_log_err(i, "Unable to create iterator");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Decode the item. */
|
||||
i = krad_packet_decode_request(ctx.kctx, SECRET, &buffer,
|
||||
otpd_queue_iter_func, iter, &dup, &req);
|
||||
buffer.length = 0;
|
||||
if (i == EAGAIN)
|
||||
return;
|
||||
else if (i != 0) {
|
||||
otpd_log_err(i, "Unable to decode item");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Drop duplicate requests. */
|
||||
if (dup != NULL) {
|
||||
krad_packet_free(req);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ensure the packet has the User-Name attribute. */
|
||||
data = krad_packet_get_attr(req, krad_attr_name2num("User-Name"), 0);
|
||||
if (data == NULL) {
|
||||
krad_packet_free(req);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create the new queue item. */
|
||||
i = otpd_queue_item_new(req, &item);
|
||||
if (i != 0) {
|
||||
krad_packet_free(req);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Push it to the query queue. */
|
||||
otpd_queue_push(&ctx.query.requests, item);
|
||||
verto_set_flags(ctx.query.io, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ |
|
||||
VERTO_EV_FLAG_IO_WRITE);
|
||||
|
||||
otpd_log_req(req, "request received");
|
||||
return;
|
||||
|
||||
shutdown:
|
||||
verto_break(ctx.vctx);
|
||||
ctx.exitstatus = 1;
|
||||
}
|
||||
|
||||
/* Send a RADIUS response to stdout. */
|
||||
void otpd_on_stdout_writable(verto_ctx *vctx, verto_ev *ev)
|
||||
{
|
||||
const krb5_data *data;
|
||||
struct otpd_queue_item *item;
|
||||
int i;
|
||||
(void)vctx;
|
||||
|
||||
item = otpd_queue_peek(&ctx.stdio.responses);
|
||||
if (item == NULL) {
|
||||
verto_set_flags(ctx.stdio.writer, VERTO_EV_FLAG_PERSIST |
|
||||
VERTO_EV_FLAG_IO_ERROR |
|
||||
VERTO_EV_FLAG_IO_READ);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If no response has been generated thus far, send Access-Reject. */
|
||||
if (item->rsp == NULL) {
|
||||
item->sent = 0;
|
||||
i = krad_packet_new_response(ctx.kctx, SECRET,
|
||||
krad_code_name2num("Access-Reject"),
|
||||
NULL, item->req, &item->rsp);
|
||||
if (i != 0) {
|
||||
otpd_log_err(errno, "Unable to craft response");
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the packet. */
|
||||
data = krad_packet_encode(item->rsp);
|
||||
i = write(verto_get_fd(ev), data->data + item->sent,
|
||||
data->length - item->sent);
|
||||
if (i < 0) {
|
||||
switch (errno) {
|
||||
#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || EAGAIN - EWOULDBLOCK != 0)
|
||||
case EWOULDBLOCK:
|
||||
#endif
|
||||
#if defined(EAGAIN)
|
||||
case EAGAIN:
|
||||
#endif
|
||||
case ENOBUFS:
|
||||
case EINTR:
|
||||
/* In this case, we just need to try again. */
|
||||
return;
|
||||
default:
|
||||
/* Unrecoverable. */
|
||||
break;
|
||||
}
|
||||
|
||||
otpd_log_err(errno, "Error writing to stdout!");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* If the packet was completely sent, free the response. */
|
||||
item->sent += i;
|
||||
if (item->sent == data->length) {
|
||||
otpd_log_req(item->req, "response sent: %s",
|
||||
krad_code_num2name(krad_packet_get_code(item->rsp)));
|
||||
otpd_queue_item_free(otpd_queue_pop(&ctx.stdio.responses));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
shutdown:
|
||||
verto_break(ctx.vctx);
|
||||
ctx.exitstatus = 1;
|
||||
}
|
||||
68
daemons/ipa-otpd/test.py
Normal file
68
daemons/ipa-otpd/test.py
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/python2
|
||||
#
|
||||
# FreeIPA 2FA companion daemon
|
||||
#
|
||||
# Authors: Nathaniel McCallum <npmccallum@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Nathaniel McCallum, Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from six import StringIO
|
||||
|
||||
try:
|
||||
from pyrad import packet
|
||||
from pyrad.dictionary import Dictionary
|
||||
except ImportError:
|
||||
sys.stdout.write("pyrad not found!\n")
|
||||
sys.exit(0)
|
||||
|
||||
# We could use a dictionary file, but since we need
|
||||
# such few attributes, we'll just include them here
|
||||
DICTIONARY = """
|
||||
ATTRIBUTE User-Name 1 string
|
||||
ATTRIBUTE User-Password 2 string
|
||||
ATTRIBUTE NAS-Identifier 32 string
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
dct = Dictionary(StringIO(DICTIONARY))
|
||||
|
||||
proc = subprocess.Popen(["./ipa-otpd", sys.argv[1]],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE)
|
||||
|
||||
pkt = packet.AuthPacket(secret="", dict=dct)
|
||||
pkt["User-Name"] = sys.argv[2]
|
||||
pkt["User-Password"] = pkt.PwCrypt(sys.argv[3])
|
||||
pkt["NAS-Identifier"] = "localhost"
|
||||
proc.stdin.write(pkt.RequestPacket())
|
||||
|
||||
rsp = packet.Packet(secret="", dict=dict)
|
||||
buf = proc.stdout.read(4)
|
||||
buf += proc.stdout.read(struct.unpack("!BBH", buf)[2] - 4)
|
||||
rsp.DecodePacket(buf)
|
||||
pkt.VerifyReply(rsp)
|
||||
|
||||
proc.terminate() # pylint: disable=E1101
|
||||
proc.wait()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user