]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BPAM: move code to the proper location and correct regression build.
authorRadosław Korzeniewski <radoslaw@korzeniewski.net>
Fri, 19 Feb 2021 13:14:24 +0000 (14:14 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:00 +0000 (09:03 +0100)
bacula/autoconf/configure.in
bacula/src/plugins/dir/Makefile
bacula/src/plugins/dir/ldap/.gitignore [moved from bacula/src/plugins/dir/ldap/src/.gitignore with 100% similarity]
bacula/src/plugins/dir/ldap/Makefile [moved from bacula/src/plugins/dir/ldap/src/Makefile with 83% similarity]
bacula/src/plugins/dir/ldap/ldap-dir.c [moved from bacula/src/plugins/dir/ldap/src/ldap-dir.c with 100% similarity]
bacula/src/plugins/dir/ldap/ldap-dir.h [moved from bacula/src/plugins/dir/ldap/src/ldap-dir.h with 100% similarity]
bacula/src/plugins/dir/ldap/ldap-util.c [moved from bacula/src/plugins/dir/ldap/src/ldap-util.c with 100% similarity]
bacula/src/plugins/dir/ldap/ldap-util.h [moved from bacula/src/plugins/dir/ldap/src/ldap-util.h with 100% similarity]
bacula/src/plugins/dir/ldap/ldaptest.c [moved from bacula/src/plugins/dir/ldap/src/ldaptest.c with 100% similarity]
regress/scripts/setup
regress/tests/ldap-auth-plugin-test

index 6eb075d5c25a996420e0ae3158722948495ac4b3..d001177e4d3b2f7dae2ff0101bcef5a6e64d651e 100644 (file)
@@ -620,7 +620,7 @@ AC_ARG_ENABLE(build-dird,
 
 DIRD_DIR="src/dird"
 DIR_TOOLS="DIRTOOLS"
-DIR_PLUGIN_DIR="src/plugins/dir"
+DIR_PLUGIN_DIR="src/plugins/dir"
 
 if test x$build_dird = xyes; then
    DIRD_DIR="src/dird"
@@ -632,7 +632,7 @@ fi
 
 AC_SUBST(DIRD_DIR)
 AC_SUBST(DIR_TOOLS)
-AC_SUBST(DIR_PLUGIN_DIR)
+AC_SUBST(DIR_PLUGIN_DIR)
 
 dnl -------------------------------------------
 dnl stored  (default on)
@@ -3351,7 +3351,7 @@ if test x$support_ldap_bpam = xyes -o x$support_ldap_bpam = xauto; then
    fi
 fi
 if test x$support_ldap_bpam = xyes; then
-   DIR_PLUGIN_DIR="${DIR_PLUGIN_DIR} src/plugins/dir/ldap/src"
+   DIR_PLUGIN_DIR="${DIR_PLUGIN_DIR} src/plugins/dir/ldap"
 fi
 
 AC_SUBST(BPAM_LDAP_TARGET)
index 3f5e858f2cf335ca303630f5867cd30386a91b64..eafbb2d504dcba44549c48a2fa3aa62372869b71 100644 (file)
@@ -8,39 +8,48 @@
 include Makefile.inc
 
 .c.lo:
-       $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) $(CFLAGS) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $<
+       @echo "Compiling $< ..."
+       $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) $(CFLAGS) -I${SRCDIR} -I${DIRDIR} -I${LIBDIR} -DWORKDIR=\"$(DESTDIR)$(working_dir)\" -c $<
 
-all: dirpluglib.lo
+%.lo: %.c %.h
+       @echo "Pattern compiling $< ..."
+       $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) $(CFLAGS) -I${SRCDIR} -I${DIRDIR} -I${LIBDIR} -DWORKDIR=\"$(DESTDIR)$(working_dir)\" -c $(@:.lo=.c)
 
-example-plugin-dir.lo: example-plugin-dir.c ${DIRDIR}/dir_plugins.h
-       $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c
+all: dirpluglib.lo example-plugin-dir.la test-authentication-api-dir.la
 
-example-plugin-dir.la: Makefile example-plugin-dir.lo
-       $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared example-plugin-dir.lo -o $@ -rpath $(plugindir) -module -export-dynamic -avoid-version
+# example-plugin-dir.lo: example-plugin-dir.c ${DIRDIR}/dir_plugins.h
+#      $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c
 
-test-authentication-api-dir.lo: test-authentication-api-dir.c ${DIRDIR}/dir_plugins.h
-       $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c test-authentication-api-dir.c
+example-plugin-dir.la: example-plugin-dir.lo
+       @echo "Linking $(@:.la=.so) ..."
+       $(NO_ECHO)$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared example-plugin-dir.lo -o $@ -rpath $(plugindir) -module -export-dynamic -avoid-version
+
+# test-authentication-api-dir.lo: test-authentication-api-dir.c ${DIRDIR}/dir_plugins.h
+#      $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c test-authentication-api-dir.c
 
-test-authentication-api-dir.la: Makefile test-authentication-api-dir.lo dirpluglib.lo
+test-authentication-api-dir.la: test-authentication-api-dir.lo dirpluglib.lo
        @echo "Linking $(@:.la=.so) ..."
        $(NO_ECHO)$(LIBTOOL_LINK) --silent $(CXX) $(LDFLAGS) -shared $^ -o $@ -rpath $(plugindir) -module -export-dynamic -avoid-version
 
 install: all
-       $(MKDIR) $(DESTDIR)$(plugindir)
+       $(NO_ECHO)$(MKDIR) $(DESTDIR)$(plugindir)
+
+install-bpam-ldap:
+       $(MAKE) -C ldap install
 
 $(LIBTOOL_CLEAN_TARGET):
-       find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
-       $(RMF) *.la
-       $(RMF) -r .libs _libs
+       $(NO_ECHO)find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
+       $(NO_ECHO)$(RMF) *.la
+       $(NO_ECHO)$(RMF) -r .libs _libs
 
 clean: $(LIBTOOL_CLEAN_TARGET)
-       rm -f main *.so *.o 1 2 3
+       $(NO_ECHO)rm -f main *.so *.o 1 2 3
 
 distclean: clean
-       rm -f Makefile
+       $(NO_ECHO)rm -f Makefile
 
 $(LIBTOOL_UNINSTALL_TARGET):
-       $(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.la
+       $(NO_ECHO)$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.la
 
 uninstall: $(LIBTOOL_UNINSTALL_TARGET)
 
similarity index 83%
rename from bacula/src/plugins/dir/ldap/src/Makefile
rename to bacula/src/plugins/dir/ldap/Makefile
index f5f1983e4dab1a5d3ac0316853f8c09e0d411047..143cc00e8ccf40207103fcef5a809782753c5ccb 100644 (file)
@@ -6,7 +6,7 @@
 #
 #
 
-include ../../Makefile.inc
+include ../Makefile.inc
 
 LDAPSRC = ldap-dir.c
 LDAPTESTSRC = ldaptest.c
@@ -39,7 +39,7 @@ install: $(BPAM_LDAP_TARGET_INSTALL)
 
 install-ldap: ldap-dir.la
        @echo "Installing plugin $(^:.la=.so) ..."
-       $(MKDIR) $(DESTDIR)$(plugindir)
+       $(NO_ECHO)$(MKDIR) $(DESTDIR)$(plugindir)
        $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) ldap-dir.la $(DESTDIR)$(plugindir)
        $(NO_ECHO)$(RMF) $(DESTDIR)$(plugindir)/ldap-dir.la
 
@@ -47,21 +47,17 @@ install-ldaptest: ldaptest
        @echo "Installing $< ..."
        $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $< $(DESTDIR)$(sbindir)
 
-Makefile: Makefile.in $(topdir)/config.status
-       cd $(topdir) \
-         && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
 $(LIBTOOL_CLEAN_TARGET):
-       @find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
-       @$(RMF) *.la
-       @$(RMF) -r .libs _libs
+       $(NO_ECHO)find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
+       $(NO_ECHO)$(RMF) *.la
+       $(NO_ECHO)$(RMF) -r .libs _libs
 
 clean: $(LIBTOOL_CLEAN_TARGET)
-       @rm -f main ldaptest *.so *.o
+       $(NO_ECHO)rm -f main ldaptest *.so *.o
 
 distclean: clean
-       @rm -f Makefile *.la *.lo
-       @rm -rf .libs
+       $(NO_ECHO)rm -f Makefile *.la *.lo
+       $(NO_ECHO)rm -rf .libs
 
 $(LIBTOOL_UNINSTALL_TARGET):
        $(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(plugindir)/ldap-dir.so
index 97989b6fab18f9eff13356677347d44c01e725f4..ea34b54358ca4d0ebf58b9b4df8f23b6d691df5a 100755 (executable)
@@ -10,7 +10,7 @@ check_exit_code()
 {
    if [ $? != 0 ] ; then
       echo "Bad exit code giving up"
-      exit 1 
+      exit 1
    fi
 }
 
@@ -43,7 +43,7 @@ if [ x$PREBUILT != xyes ]; then
   fi
 fi
 scripts/create_sed
-# In default bacula-dir.conf.in, change default file 
+# In default bacula-dir.conf.in, change default file
 # to backup to be build directory
 echo "s%File = @sbindir@%File = @BUILD_DIR@%g" >tmp/t$$
 sed -f tmp/t$$ build/src/dird/bacula-dir.conf.in >tmp/o$$
@@ -72,6 +72,7 @@ if [ x$PREBUILT != xyes ]; then
   make ${MAKEOPT}
   check_exit_code
   make install
+  make install-plugins
 fi
 if [ a${KEEP_SOURCE} = a ]; then
    rm -rf examples patches
index 6ed4de33150db030784a1ba4f8a156c3d0c3d98f..12e4db5fcfcfdc38dbadeef1892237f503dfaef6 100755 (executable)
@@ -16,7 +16,7 @@ scripts/copy-ldap-auth-plugin-confs
 start_local_slapd
 
 # Authentication Plugin = "ldap:binddn=@BINDDN@ bindpass=@BINDPASS@ url=ldap://localhost:3890 query=@LDAPQUERY@"
-db_name=`cat ${tmp}/ldap_db_name`
+db_name=$(cat ${tmp}/ldap_db_name)
 BINDDN="cn=root,dc=$db_name,dc=bacula,dc=com"
 BINDPASS=rootroot
 LDAPQUERY="dc=$db_name,dc=bacula,dc=com/(cn=%u)"
@@ -47,7 +47,7 @@ END_OF_DATA
 run_bacula
 
 # now check if we have ldap-dir loaded
-if [ `grep ldap-dir ${tmp}/log.out | wc -l` -lt 1 ]
+if [ "$(grep -c ldap-dir ${tmp}/log.out)" -lt 1 ]
 then
    echo "BPAM LDAP Plugin is not loaded, cannot perform the test!"
    exit 1
@@ -58,26 +58,26 @@ printf "Authentication test ... "
 estat=0
 
 # check invalid login
-printf "admin\nadmin\nstatus dir\nquit\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf 2>&1 > ${tmp}/log1.out
-if [ `grep Version: ${tmp}/log1.out | wc -l` -gt 0 ]
+printf "admin\nadmin\nstatus dir\nquit\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf > ${tmp}/log1.out 2>&1
+if [ "$(grep -c Version: ${tmp}/log1.out)" -gt 0 ]
 then
    printf "failed ... "
    estat=1
 else
-   if [ `grep "LDAP Authentication Successfull" ${working}/*.trace | wc -l` -gt 0 ]
+   if [ "$(grep -c "LDAP Authentication Successfull" ${working}/*.trace)" -gt 0 ]
    then
       estat=2
    fi
 fi
 
 # check proper login
-printf "root\nrootroot\nstatus dir\nquit\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf 2>&1 > ${tmp}/log2.out
-if [ `grep Version: ${tmp}/log2.out | wc -l` -lt 1 ]
+printf "root\nrootroot\nstatus dir\nquit\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf > ${tmp}/log2.out 2>&1
+if [ "$(grep -c Version: ${tmp}/log2.out)" -lt 1 ]
 then
    printf "failed ... "
    estat=3
 else
-   if [ `grep "LDAP Authentication Successfull" ${working}/*.trace | wc -l` -lt 1 ]
+   if [ "$(grep -c "LDAP Authentication Successfull" ${working}/*.trace)" -lt 1 ]
    then
       estat=4
    fi