/* Define if you have libacl */
#undef HAVE_ACL
+/* Define if you have extended acls */
+#undef HAVE_EXTENDED_ACL
+
/* General libs */
#undef LIBS
/* Define if you have libacl */
#undef HAVE_ACL
+/* Define if you have extended acls */
+#undef HAVE_EXTENDED_ACL
+
/* General libs */
#undef LIBS
dnl Check for ACL libraries
dnl
have_acl=no
+have_extended_acl=no
AC_CHECK_HEADER(sys/acl.h)
AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
[
[
have_acl=yes;
FDLIBS="-lsec $FDLIBS"
+
+ AC_CHECK_LIB(sec, acl_totext,
+ [
+ have_extended_acl=yes
+ ]
+ )
]
)
]
AC_DEFINE(HAVE_ACL)
fi
+if test $have_extended_acl = yes; then
+ AC_DEFINE(HAVE_EXTENDED_ACL)
+fi
+
dnl Check for pthread libraries
PTHREAD_LIB=""
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
#
INCLUDE_FILES = bdb.h cats.h protos.h sql_cmds.h
-#
-SVRSRCS = cats.c sql.c
-SVROBJS = cats.o sql.o
-
LIBSRCS = mysql.c bdb.c dbi.c \
sql.c sql_cmds.c sql_create.c sql_delete.c sql_find.c \
sql_get.c sql_list.c sql_update.c sqlite.c \
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(SQL_INC) $(DINCLUDE) $(CFLAGS) $<
#-------------------------------------------------------------------------
all: Makefile libbacsql$(DEFAULT_ARCHIVE_TYPE)
- @echo "==== Make of cats is good ===="
+ @echo "==== Make of sqllib is good ===="
@echo " "
libbacsql.a: $(LIBOBJS)
@echo "Making $@ ..."
$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBOBJS) -export-dynamic -rpath $(libdir) -version-info $(LIBBACSQL_LT_CURRENT):$(LIBBACSQL_LT_REVISION):$(LIBBACSQL_LT_AGE) $(DB_LIBS)
-cats: Makefile $(SVROBJS) ../findlib/libfind$(DEFAULT_ARCHIVE_TYPE)
- $(LIBTOOL_LINK) $(CC) $(WLDFLAGS) $(LDFLAGS) -L../findlib -L../lib -o $@ $(SVROBJS) $(LIBS) $(DB_LIBS) -lfind -lbac
-
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
cd $(topdir) \
&& CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(RMF) -r .libs _libs
clean: @LIBTOOL_CLEAN_TARGET@
- $(RMF) cats core a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
+ $(RMF) core a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
realclean: clean
$(RMF) tags
install-includes:
$(MKDIR) $(DESTDIR)/$(includedir)/bacula/sql
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bacula/sql/`basename $$I`; \
done
uninstall-includes:
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(RMF) $(DESTDIR)$(includedir)/bacula/sql/`basename $$I`; \
done
$(INSTALL_SCRIPT) drop_bacula_database $(DESTDIR)$(scriptdir)/drop_bacula_database
@filename=make_catalog_backup; \
- if test -f ${DESTDIR}${scriptdir}/$$filename; then \
+ if test -f $(DESTDIR)$(scriptdir)/$$filename; then \
destname=$$filename.new; \
echo " ==> Found existing $$filename, installing new file as $$destname"; \
else \
destname=$$filename; \
fi; \
- echo "${INSTALL_SCRIPT} $$filename ${DESTDIR}${scriptdir}/$$destname"; \
- ${INSTALL_SCRIPT} $$filename ${DESTDIR}${scriptdir}/$$destname
+ echo "$(INSTALL_SCRIPT) $$filename $(DESTDIR)$(scriptdir)/$$destname"; \
+ $(INSTALL_SCRIPT) $$filename $(DESTDIR)$(scriptdir)/$$destname
@filename=delete_catalog_backup; \
- if test -f ${DESTDIR}${scriptdir}/$$filename; then \
+ if test -f $(DESTDIR)$(scriptdir)/$$filename; then \
destname=$$filename.new; \
echo " ==> Found existing $$filename, installing new file as $$destname"; \
else \
destname=$$filename; \
fi; \
- echo "${INSTALL_SCRIPT} $$filename ${DESTDIR}${scriptdir}/$$destname"; \
- ${INSTALL_SCRIPT} $$filename ${DESTDIR}${scriptdir}/$$destname
+ echo "$(INSTALL_SCRIPT) $$filename $(DESTDIR)$(scriptdir)/$$destname"; \
+ $(INSTALL_SCRIPT) $$filename $(DESTDIR)$(scriptdir)/$$destname
uninstall: @LIBTOOL_UNINSTALL_TARGET@ @INCLUDE_UNINSTALL_TARGET@
(cd $(DESTDIR)$(scriptdir); $(RMF) create_@DB_TYPE@_database)
(cd $(DESTDIR)$(scriptdir); $(RMF) delete_catalog_backup)
# Semi-automatic generation of dependencies:
-# Use gcc -MM because X11 `makedepend' doesn't work on all systems
+# Use gcc -M because X11 `makedepend' doesn't work on all systems
# and it also includes system headers.
# `semi'-automatic since dependencies are generated at distribution time.
@$(MV) Makefile Makefile.bak
@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
@$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
- @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
+ @for src in $(LIBSRCS); do \
+ $(CXX) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) $$src >> Makefile; \
+ done
@if test -f Makefile ; then \
$(RMF) Makefile.bak; \
else \
#elif defined(HAVE_SUN_OS)
#include <sys/acl.h>
+/*
+ * As the new libsec interface with acl_totext and acl_fromtext also handles
+ * the old format from acltotext we can use the new functions even
+ * for acls retrieved and stored in the database with older fd versions. If the
+ * new interface is not defined (Solaris 9 and older we fall back to the old code)
+ */
+#if defined(HAVE_EXTENDED_ACL)
+int bacl_get(JCR *jcr, int acltype)
+{
+ int len, flags;
+ acl_t *aclp;
+ char *acl_text;
+
+ /*
+ * Get ACL info: don't bother allocating space if there is only a trivial ACL.
+ */
+ if (acl_get(jcr->last_fname, ACL_NO_TRIVIAL, &aclp) != 0)
+ return -1;
+
+ if (aclp == NULL) {
+ /* The ACLs simply reflect the (already known) standard permissions */
+ return pm_strcpy(jcr->acl_text, "");
+ }
+
+#if defined(ACL_SID_FMT)
+ /*
+ * New format flag added in newer Solaris versions.
+ */
+ flags = ACL_APPEND_ID | ACL_COMPACT_FMT | ACL_SID_FMT;
+#else
+ flags = ACL_APPEND_ID | ACL_COMPACT_FMT;
+#endif /* ACL_SID_FMT */
+
+ if ((acl_text = acl_totext(aclp, flags)) != NULL) {
+ len = pm_strcpy(jcr->acl_text, acl_text);
+ actuallyfree(acl_text);
+
+ acl_free(aclp);
+
+ return len;
+ }
+
+ acl_free(aclp);
+
+ return -1;
+}
+
+/*
+ * As the header acl.h doesn't seem to define this one we need to.
+ */
+extern "C" {
+char *acl_strerror(int);
+}
+
+int bacl_set(JCR *jcr, int acltype)
+{
+ acl_t *aclp;
+ int error;
+
+ if ((error = acl_fromtext(jcr->acl_text, &aclp)) != 0) {
+ Jmsg2(jcr, M_ERROR, 0, _("acl_fromtext error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, acl_strerror(error));
+ Dmsg3(100, "acl_fromtext error acl=%s file=%s ERR=%s\n",
+ jcr->acl_text, jcr->last_fname, acl_strerror(error));
+ return -1;
+ }
+
+ /*
+ * Restore the ACLs, but don't complain about links which really should
+ * not have attributes, and the file it is linked to may not yet be restored.
+ */
+ if ((error = acl_set(jcr->last_fname, aclp)) == -1 && jcr->last_type != FT_LNK) {
+ Jmsg2(jcr, M_ERROR, 0, _("acl_set error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, acl_strerror(error));
+ Dmsg3(100, "acl_set error acl=%s file=%s ERR=%s\n",
+ jcr->acl_text, jcr->last_fname, acl_strerror(error));
+
+ acl_free(aclp);
+ return -1;
+ }
+
+ acl_free(aclp);
+ return 0;
+}
+
+#else /* HAVE_EXTENDED_ACL */
+
int bacl_get(JCR *jcr, int acltype)
{
int n, len;
return 0;
}
-#endif
+#endif /* HAVE_EXTENDED_ACL */
+#endif /* HAVE_SUN_OS */
#ifdef TEST_PROGRAM
install-includes:
$(MKDIR) $(DESTDIR)/$(includedir)/bacula/findlib
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bacula/findlib/`basename $$I`; \
done
uninstall-includes:
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(RMF) $(DESTDIR)$(includedir)/bacula/findlib/`basename $$I`; \
done
@$(MV) Makefile Makefile.bak
@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
@$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
- @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
+ @for src in $(LIBSRCS); do \
+ $(CXX) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) $$src >> Makefile; \
+ done
@if test -f Makefile ; then \
$(RMF) Makefile.bak; \
else \
install-includes:
$(MKDIR) $(DESTDIR)/$(includedir)/bacula
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bacula/`basename $$I`; \
done
uninstall-includes:
- for I in ${INCLUDE_FILES}; do \
+ for I in $(INCLUDE_FILES); do \
$(RMF) $(DESTDIR)$(includedir)/bacula/`basename $$I`; \
done
(cd $(srcdir); $(RMF) Makefile)
# Semi-automatic generation of dependencies:
-# Use gcc -MM because X11 `makedepend' doesn't work on all systems
+# Use gcc -M because X11 `makedepend' doesn't work on all systems
# and it also includes system headers.
# `semi'-automatic since dependencies are generated at distribution time.
@$(MV) Makefile Makefile.bak
@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
@$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
- @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >>Makefile
+ @for src in $(LIBBAC_SRCS) $(LIBBACCFG_SRCS) $(LIBBACPY_SRCS); do \
+ $(CXX) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) $$src >> Makefile; \
+ done
@if test -f Makefile ; then \
$(RMF) Makefile.bak; \
else \
#undef VERSION
#define VERSION "2.5.17"
-#define BDATE "21 October 2008"
-#define LSMDATE "21Oct08"
+#define BDATE "23 October 2008"
+#define LSMDATE "23Oct08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
General:
+23Oct08
+kes Apply patch from Marco van Wieringen that implements the new
+ Solaris libsec interface for ACLs so that Bacula can save and
+ restore both the new ACLs and old ACLs.
+kes Marco's patch also corrects the file dependency generation code
+ so that it works properly both with shared libraries and static
+ libraries.
+kes Marco's patch also includes a small cleanup of the cats Makefile
+ to remove some references to non-existent files.
22Oct08
kes Modify win32 Makefiles to use full paths in most cases.
In particular add MAINDIR environment variable that points