Skip to content
Commits on Source (719)
This diff is collapsed.
=======================================================================
389 Directory Server
=======================================================================
The 389 Directory Server is subject to the terms detailed in the
license agreement file called LICENSE.
Late-breaking news and information on the 389 Directory Server is
available on our wiki page:
http://www.port389.org/
389 Directory Server
====================
389 Directory Server is a highly usable, fully featured, reliable
and secure LDAP server implementation. It handles many of the
largest LDAP deployments in the world.
All our code has been extensively tested with sanitisation tools.
As well as a rich feature set of fail-over and backup technologies
gives administrators confidence their accounts are safe.
License
-------
The 389 Directory Server is subject to the terms detailed in the
license agreement file called LICENSE.
Late-breaking news and information on the 389 Directory Server is
available on our wiki page:
http://www.port389.org/
Building
--------
autoreconf -fiv
./configure --enable-debug --with-openldap --enable-cmocka --enable-asan
make
make lib389
make check
sudo make install
sudo make lib389-install
Testing
-------
sudo py.test -s 389-ds-base/dirsrvtests/tests/suites/basic/
More information
----------------
Please see our contributing guide online:
http://www.port389.org/docs/389ds/contributing.html
......@@ -9,8 +9,8 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=3
VERSION_MAINT=8.2
VERSION_MINOR=4
VERSION_MAINT=0.15
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
......
......@@ -24,8 +24,12 @@ AC_SUBST([CONSOLE_VERSION])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIRS([m4])
# Checks for programs.
: ${CXXFLAGS=""}
AC_PROG_CXX
: ${CFLAGS=""}
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AS
......@@ -43,6 +47,7 @@ AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h malloc.h netdb.h netinet/in.h stdl
# These are *required* headers without option.
AC_CHECK_HEADERS([inttypes.h], [], AC_MSG_ERROR([unable to locate required header inttypes.h]))
AC_CHECK_HEADERS([crack.h], [], AC_MSG_ERROR([unable to locate required header crack.h]))
# Checks for typedefs, structures, and compiler characteristics.
......@@ -78,31 +83,130 @@ AC_CHECK_FUNCS([clock_gettime], [], AC_MSG_ERROR([unable to locate required symb
# This will detect if we need to add the LIBADD_DL value for us.
LT_LIB_DLLOAD
# Optional rust component support.
AC_MSG_CHECKING(for --enable-rust)
AC_ARG_ENABLE(rust, AS_HELP_STRING([--enable-rust], [Enable rust language features (default: no)]),
[
AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
AS_IF([test "$CARGO" != "yes" -o "$RUSTC" != "yes"], [
AC_MSG_FAILURE("Rust based plugins cannot be built cargo=$CARGO rustc=$RUSTC")
])
with_rust=yes
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
])
AM_CONDITIONAL([RUST_ENABLE],[test -n "$with_rust"])
AC_MSG_CHECKING(for --enable-debug)
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
[
AC_MSG_RESULT(yes)
debug_defs="-g3 -DDEBUG -DMCC_DEBUG -O0"
debug_defs="-DDEBUG -DMCC_DEBUG"
debug_cflags="-g3 -O0"
debug_cxxflags="-g3 -O0"
debug_rust_defs="-C debuginfo=2"
cargo_defs=""
rust_target_dir="debug"
with_debug=yes
],
[
AC_MSG_RESULT(no)
debug_defs=""
# set the default safe CFLAGS that would be set by AC_PROG_CC otherwise
debug_cflags="-g -O2"
debug_cxxflags="-g -O2"
debug_rust_defs="-C debuginfo=2"
cargo_defs="--release"
rust_target_dir="release"
])
AC_SUBST([debug_defs])
AC_SUBST([debug_cflags])
AC_SUBST([debug_cxxflags])
AC_SUBST([debug_rust_defs])
AC_SUBST([cargo_defs])
AC_SUBST([rust_target_dir])
AM_CONDITIONAL([DEBUG],[test -n "$with_debug"])
AC_MSG_CHECKING(for --enable-asan)
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc address sanitizer options (default: no)]),
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc/clang address sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
asan_defs="-fsanitize=address -fno-omit-frame-pointer"
asan_cflags="-fsanitize=address -fno-omit-frame-pointer"
asan_rust_defs="-Z sanitizer=address"
],
[
AC_MSG_RESULT(no)
asan_defs=""
asan_cflags=""
asan_rust_defs=""
])
AC_SUBST([asan_defs])
AC_SUBST([asan_cflags])
AC_SUBST([asan_rust_defs])
AM_CONDITIONAL(enable_asan,test "$enable_asan" = "yes")
AC_MSG_CHECKING(for --enable-msan)
AC_ARG_ENABLE(msan, AS_HELP_STRING([--enable-msan], [Enable gcc/clang memory sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
msan_cflags="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
msan_rust_defs="-Z sanitizer=memory"
],
[
AC_MSG_RESULT(no)
msan_cflags=""
msan_rust_defs=""
])
AC_SUBST([msan_cflags])
AC_SUBST([msan_rust_defs])
AM_CONDITIONAL(enable_msan,test "$enable_msan" = "yes")
AC_MSG_CHECKING(for --enable-tsan)
AC_ARG_ENABLE(tsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang thread sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
tsan_cflags="-fsanitize=thread -fno-omit-frame-pointer"
tsan_rust_defs="-Z sanitizer=thread"
],
[
AC_MSG_RESULT(no)
tsan_cflags=""
tsan_rust_defs=""
])
AC_SUBST([tsan_cflags])
AC_SUBST([tsan_rust_defs])
AM_CONDITIONAL(enable_tsan,test "$enable_tsan" = "yes")
AC_MSG_CHECKING(for --enable-ubsan)
AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang undefined behaviour sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
ubsan_cflags="-fsanitize=undefined -fno-omit-frame-pointer"
ubsan_rust_defs=""
],
[
AC_MSG_RESULT(no)
ubsan_cflags=""
ubsan_rust_defs=""
])
AC_SUBST([ubsan_cflags])
AC_SUBST([ubsan_rust_defs])
AM_CONDITIONAL(enable_ubsan,test "$enable_ubsan" = "yes")
# Enable CLANG
AC_MSG_CHECKING(for --enable-clang)
AC_ARG_ENABLE(clang, AS_HELP_STRING([--enable-clang], [Enable clang (default: no)]),
[
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
])
AM_CONDITIONAL(CLANG_ENABLE,test "$enable_clang" = "yes")
# Enable Perl
if test -z "$enable_perl" ; then
enable_perl=yes
fi
......@@ -124,15 +228,19 @@ AC_ARG_ENABLE(gcc-security, AS_HELP_STRING([--enable-gcc-security], [Enable gcc
[
AC_MSG_RESULT(yes)
AM_COND_IF([RPM_HARDEND_CC],
[ gccsec_defs="-Wall -Wp,-D_FORITY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
[ gccsec_defs="-Wall -Wp,-D_FORITY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
[ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
[ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
)
],
[
# Without this, -fPIC doesn't work on generic fedora builds, --disable-gcc-sec.
AC_MSG_RESULT(no)
gccsec_defs=""
AM_COND_IF([RPM_HARDEND_CC],
[ gccsec_cflags="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
[ gccsec_cflags="" ]
)
])
AC_SUBST([gccsec_defs])
AC_SUBST([gccsec_cflags])
# Pull in profiling.
AC_MSG_CHECKING(for --enable-profiling)
......@@ -301,6 +409,7 @@ fi
m4_include(m4/fhs.m4)
localrundir='/run'
cockpitdir=/389-console
# installation paths - by default, we store everything
# under the prefix. The with-fhs option will use /usr,
......@@ -437,12 +546,12 @@ if test -n "$with_pythonexec"; then
if test "$with_pythonexec" = yes ; then
AC_MSG_ERROR([You must specify --with-pythonexec=/full/path/to/python])
elif test "$with_pythonexec" = no ; then
with_pythonexec=/usr/bin/python2
with_pythonexec=/usr/bin/python3
else
AC_MSG_RESULT([$with_pythonexec])
fi
else
with_pythonexec=/usr/bin/python2
with_pythonexec=/usr/bin/python3
fi
AC_SUBST(prefixdir)
......@@ -461,9 +570,9 @@ AC_SUBST(infdir)
AC_SUBST(mibdir)
AC_SUBST(mandir)
AC_SUBST(updatedir)
AC_SUBST(defaultuser)
AC_SUBST(defaultgroup)
AC_SUBST(cockpitdir)
# check for --with-instconfigdir
AC_MSG_CHECKING(for --with-instconfigdir)
......@@ -522,7 +631,7 @@ fi
if test -n "$with_pythonexec"; then
pythonexec="$with_pythonexec"
else
pythonexec='/usr/bin/env python2'
pythonexec='/usr/bin/python3'
fi
# Default to no atomic queue operations.
......@@ -544,7 +653,6 @@ case $host in
platform="linux"
initdir='$(sysconfdir)/rc.d/init.d'
# do arch specific linux stuff here
# TCMalloc is only on i686, x86_64, ppc64 and arm, so we pick that here.
case $host in
i*86-*-linux*)
AC_DEFINE([CPU_x86], [], [cpu type x86])
......@@ -733,7 +841,6 @@ m4_include(m4/openldap.m4)
m4_include(m4/mozldap.m4)
m4_include(m4/db.m4)
m4_include(m4/sasl.m4)
m4_include(m4/svrcore.m4)
m4_include(m4/icu.m4)
m4_include(m4/netsnmp.m4)
m4_include(m4/kerberos.m4)
......@@ -742,7 +849,6 @@ m4_include(m4/selinux.m4)
m4_include(m4/systemd.m4)
m4_include(m4/cmocka.m4)
m4_include(m4/doxygen.m4)
m4_include(m4/tcmalloc.m4)
PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
AC_SUBST(PACKAGE_BASE_VERSION)
......@@ -794,7 +900,7 @@ AC_DEFINE([LDAP_ERROR_LOGGING], [1], [LDAP error logging flag])
# AC_CONFIG_FILES([ldap/admin/src/defaults.inf])
AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc])
AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc src/pkgconfig/svrcore.pc])
AC_CONFIG_FILES([Makefile rpm/389-ds-base.spec ])
......
usr/include/dirsrv/*
usr/include/svrcore.h
usr/lib/*/dirsrv/libldaputil.so
usr/lib/*/dirsrv/libns-dshttpd.so
usr/lib/*/dirsrv/libnunc-stans.so
usr/lib/*/dirsrv/libslapd.so
usr/lib/*/dirsrv/libsds.so
usr/lib/*/libsvrcore.so
usr/lib/*/pkgconfig/*
......@@ -3,3 +3,4 @@ usr/lib/*/dirsrv/libnunc-stans.so.*
usr/lib/*/dirsrv/libns-dshttpd-*.so
usr/lib/*/dirsrv/libsds.so.*
usr/lib/*/dirsrv/libslapd.so.*
usr/lib/*/libsvrcore.so.*
......@@ -10,9 +10,13 @@ usr/bin/
usr/lib/*/dirsrv/perl/
usr/lib/*/dirsrv/plugins/*.so
usr/lib/*/dirsrv/python/
usr/lib/*/ds_selinux_enabled
usr/lib/*/ds_selinux_port_query
usr/lib/*/ds_systemd_ask_password_acl
usr/lib/sysctl.d/70-dirsrv.conf
usr/sbin/
usr/share/dirsrv/
usr/share/gdb/auto-load/usr/sbin/ns-slapd-gdb.py
usr/share/man/man1/*.1
usr/share/man/man5/*.5
usr/share/man/man8/*.8
389-ds-base (1.4.0.15-1) unstable; urgency=medium
* New upstream release
- CVE-2018-10935 (Closes: #906985)
* control: Add libcrack2-dev to build-depends.
-- Timo Aaltonen <tjaalton@debian.org> Thu, 23 Aug 2018 00:46:45 +0300
389-ds-base (1.4.0.13-1) experimental; urgency=medium
* New upstream release.
- CVE-2018-10850 (Closes: #903501)
* control: Update maintainer address.
* control: Upstream dropped support for non-64bit architectures, so
build only on supported 64bit archs (amd64, arm64, mips64el,
ppc64el, s390x).
* control: svrcore got merged here, drop it from build-depends.
* ftbs_lsoftotkn3.diff: Dropped, obsolete.
* control: Add rsync to build-depends.
* libs, dev, control: Add libsvrcore files, replace old package.
* base: Add new scripts, add python3-selinux, -semanage, -sepolicy to
depends.
* Add a package for cockpit-389-ds.
* rules: Clean up cruft left after build.
* control: Drop dh_systemd from build-depends, bump debhelper to 11.
* Add varions libjs packages to cockpit-389-ds Depends, add the rest
to d/missing-sources.
* copyright: Updated. (Closes: #904760)
* control: Modify 389-ds to depend on cockpit-389-ds and drop the old
GUI packages which are deprecated upstream.
* dont-build-new-manpages.diff: Debian doesn't have argparse-manpage,
so in order to not FTBFS don't build new manpages.
* base.install: Add man5/*.
-- Timo Aaltonen <tjaalton@debian.org> Tue, 31 Jul 2018 23:46:17 +0300
389-ds-base (1.3.8.2-1) unstable; urgency=medium
* New upstream release.
......
usr/share/cockpit/389-console/
Source: 389-ds-base
Section: net
Priority: optional
Maintainer: Debian FreeIPA Team <pkg-freeipa-devel@lists.alioth.debian.org>
Maintainer: Debian FreeIPA Team <pkg-freeipa-devel@alioth-lists.debian.net>
Uploaders:
Timo Aaltonen <tjaalton@debian.org>,
Build-Depends:
libcmocka-dev,
debhelper (>= 9),
dh-autoreconf,
debhelper (>= 11),
dh-python,
dh-systemd,
doxygen,
libbz2-dev,
libcrack2-dev,
libdb-dev,
libevent-dev,
libicu-dev,
......@@ -27,11 +26,11 @@ Build-Depends:
libsasl2-dev,
libsnmp-dev,
libssl-dev,
libsvrcore-dev (>= 1:4.1.2+dfsg1-3),
libsystemd-dev,
pkg-config,
python3-all-dev,
python3-setuptools,
rsync,
zlib1g-dev,
Standards-Version: 4.1.0
Vcs-Git: https://salsa.debian.org/freeipa-team/389-ds-base.git
......@@ -41,31 +40,28 @@ Homepage: http://directory.fedoraproject.org
Package: 389-ds
Architecture: all
Depends:
389-admin,
389-admin-console,
389-console,
389-ds-base,
389-ds-console,
389-dsgw,
cockpit-389-ds,
${misc:Depends},
Description: 389 Directory Server suite - metapackage
Based on the Lightweight Directory Access Protocol (LDAP), the 389
Directory Server is designed to manage large directories of users and
resources robustly and scalably.
.
This is a metapackage depending on the LDAPv3 server, the HTTP
daemon used for server administration, and the graphical console used
for server and user/group administration.
This is a metapackage depending on the LDAPv3 server and a Cockpit UI plugin
for administration.
Package: 389-ds-base-libs
Section: libs
Architecture: any
Architecture: amd64 arm64 mips64el ppc64el s390x
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends}, ${shlibs:Depends}
Breaks: 389-ds-base (<< 1.3.6.7-5),
389-ds-base-dev (<< 1.3.6.7-4)
389-ds-base-dev (<< 1.3.6.7-4),
libsvrcore0,
Replaces: 389-ds-base (<< 1.3.6.7-5),
389-ds-base-dev (<< 1.3.6.7-4)
389-ds-base-dev (<< 1.3.6.7-4),
libsvrcore0,
Description: 389 Directory Server suite - libraries
Based on the Lightweight Directory Access Protocol (LDAP), the 389
Directory Server is designed to manage large directories of users and
......@@ -75,15 +71,17 @@ Description: 389 Directory Server suite - libraries
Package: 389-ds-base-dev
Section: libdevel
Architecture: any
Architecture: amd64 arm64 mips64el ppc64el s390x
Depends:
389-ds-base-libs (= ${binary:Version}),
libldap2-dev,
libnspr4-dev,
${misc:Depends},
${shlibs:Depends},
Breaks: 389-ds-base (<< 1.3.6.7-4)
Replaces: 389-ds-base (<< 1.3.6.7-4)
Breaks: 389-ds-base (<< 1.3.6.7-4),
libsvrcore-dev,
Replaces: 389-ds-base (<< 1.3.6.7-4),
libsvrcore-dev,
Description: 389 Directory Server suite - development files
Based on the Lightweight Directory Access Protocol (LDAP), the 389
Directory Server is designed to manage large directories of users and
......@@ -94,7 +92,7 @@ Description: 389 Directory Server suite - development files
having to install the server itself.
Package: 389-ds-base
Architecture: any
Architecture: amd64 arm64 mips64el ppc64el s390x
Pre-Depends: debconf (>= 0.5) | debconf-2.0
Depends:
389-ds-base-libs (= ${binary:Version}),
......@@ -107,6 +105,9 @@ Depends:
libsasl2-modules-gssapi-mit,
libsocket-getaddrinfo-perl,
python,
python3-selinux,
python3-semanage,
python3-sepolicy,
systemd,
${misc:Depends},
${shlibs:Depends},
......@@ -149,3 +150,20 @@ Depends: ${misc:Depends}, ${python3:Depends},
Description: Python3 module for 389 Directory Server Continuous Integration testing
This Python3 module contains Continuous Integration tests that can be
run against an instance of 389 Directory Server.
Package: cockpit-389-ds
Architecture: any
Depends: ${misc:Depends},
cockpit,
libjs-bootstrap,
libjs-c3,
libjs-d3,
libjs-jquery-datatables,
libjs-jquery-datatables-extensions,
libjs-jquery-jstree,
libjs-moment,
python3,
python3-lib389,
Description: Cockpit user interface for 389 Directory Server
This package includes a Cockpit UI plugin for configuring and administering
the 389 Directory Server.
......@@ -5,7 +5,7 @@ Source: http://directory.fedoraproject.org/wiki/Source
Files: *
Copyright: 2001 Sun Microsystems, Inc.
2005 Red Hat, Inc.
License: GPL-2 and Other
License: GPL-3+ and Other
Files: ldap/libraries/libavl/*.[ch] ldap/servers/slapd/abandon.c
ldap/servers/slapd/add.c ldap/servers/slapd/abandon.c
......@@ -18,7 +18,7 @@ Files: ldap/libraries/libavl/*.[ch] ldap/servers/slapd/abandon.c
Copyright: 1993 Regents of the University of Michigan
2001 Sun Microsystems, Inc.
2005 Red Hat, Inc.
License: GPL-2 and Other
License: GPL-3+ and Other
Files: ldap/servers/slapd/tools/ldaptool.h
Copyright: 1998 Netscape Communication Corporation
......@@ -30,14 +30,84 @@ Copyright: 2005 Sun Microsystems, Inc.
License: GPL-2+ or LGPL-2.1 or MPL-1.1
Files: m4/*
Copyright: 2006, 2007 Red Hat, Inc.
License: GPL-2+
Copyright: 2006-2017 Red Hat, Inc.
2016 William Brown <william at blackhats dot net dot au>
License: GPL-3+
Files: src/svrcore/*
Copyright: 2016 Red Hat, Inc.
License: MPL-2.0
Files: src/cockpit/389-console/static/bootpopup.min.js
debian/missing-sources/bootpopup.js
Copyright: 2016 rigon<ricardompgoncalves@gmail.com>
License: GPL-3+
Files: src/cockpit/389-console/static/bootstrap.min.js
debian/missing-sources/bootstrap.js
Copyright: 2011-2016 Twitter, Inc.
License: MIT
Files: src/cockpit/389-console/static/c3.min.js
debian/missing-sources/c3.js
Copyright: 2013 Masayuki Tanaka
License: MIT
Files: src/cockpit/389-console/static/d3.min.js
debian/missing-sources/d3.js
Copyright: 2018 Mike Bostock
License: BSD-3-clause
Files: src/cockpit/389-console/static/d3.min.js
debian/missing-sources/d3.js
Copyright: 2018 Mike Bostock
License: BSD-3-clause
Files: src/cockpit/389-console/static/jquery-3.3.1.min.js
src/cockpit/389-console/static/jquery.min.js
src/cockpit/389-console/static/jquery-ui.min.js
src/cockpit/389-console/static/moment.min.js
debian/missing-sources/jquery-1.12.4.js
debian/missing-sources/jquery-3.3.1.js
debian/missing-sources/jquery-ui.js
debian/missing-sources/moment.js
Copyright: 2015-2018 JS Foundation and other contributors
License: MIT
Files: src/cockpit/389-console/static/jquery.dataTables*.min.js
debian/missing-sources/jquery.dataTables*.js
Copyright: 2008-2017 SpryMedia Ltd
License: MIT
Files: src/cockpit/389-console/static/jquery.dropdown.min.js
debian/missing-sources/jquery.dropdown.js
Copyright: 2018 A Beautiful Site, LLC
License: MIT
Files: src/cockpit/389-console/static/jquery.timepicker.min.js
debian/missing-sources/jquery.timepicker.js
Copyright: 2015 Jon Thornton
License: MIT
Files: src/cockpit/389-console/static/jstree.min.js
debian/missing-sources/jstree.js
Copyright: 2014 Ivan Bozhanov
License: MIT
Files: src/cockpit/389-console/static/patternfly.min.js
debian/missing-sources/patternfly.js
Copyright: 2013 Red Hat, Inc.
License: Apache-2.0
Files: debian/*
Copyright: 2008 Michele Baldessari <michele@acksyn.org>
2012 Timo Aaltonen <tjaalton@ubuntu.com>
License: GPL-2+ or LGPL-2.1 or MPL-1.1
License: Apache-2.0
On Debian machines the full text of the Apache License 2.0 can be found in the
file /usr/share/common-licenses/Apache-2.0.
License: Other
In addition, as a special exception, Red Hat, Inc. gives You the additional
right to link the code of this Program with code not covered under the GNU
......@@ -58,14 +128,59 @@ License: Other
statement from your version and license this file solely under the GPL without
exception.
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Dojo Foundation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: GPL-2 or GPL-2+
On Debian machines the full text of the GNU General Public License
can be found in the file /usr/share/common-licenses/GPL-2.
License: GPL-3+
On Debian machines the full text of the GNU General Public License v3
can be found in the file /usr/share/common-licenses/GPL-3.
License: LGPL-2.1
On Debian machines the full text of the GNU General Public License
can be found in the file /usr/share/common-licenses/LGPL-2.1.
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
.
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License: MPL-1.1
MOZILLA PUBLIC LICENSE
......@@ -537,3 +652,7 @@ License: MPL-1.1
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
License: MPL-2.0
On Debian machines the full text of the Mozilla Public License version 2.0
can be found in the file /usr/share/common-licenses/MPL-2.0.
/**************************************************************************
* Popup dialog boxes for Bootstrap - http://www.bootpopup.tk
* Copyright (C) 2016 rigon<ricardompgoncalves@gmail.com>
*
* 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/>.
*************************************************************************/
/* // List of input types
case "button": case "checkbox": case "color": case "date": case "datetime-local":
case "email": case "file": case "hidden": case "image": case "month": case "number":
case "password": case "radio": case "range": case "reset": case "search":
case "submit": case "tel": case "text": case "time": case "url": case "week": */
var INPUT_SHORTCUT_TYPES = [ "button", "text", "submit", "color", "url", "password",
"hidden", "file", "number", "email", "reset", "date", "checkbox", "select", "radio" ];
function bootpopup(options) {
// Create a new instance if this is not
if(!(this instanceof bootpopup))
return new bootpopup(options);
var self = this;
// Create a global random ID for the form
this.formid = "bootpopup-form" + String(Math.random()).substr(2);
this.options = {
title: document.title,
showclose: true,
size: "normal",
size_labels: "col-sm-4",
size_inputs: "col-sm-8",
content: [],
onsubmit: "close",
buttons: ["close"],
before: function() {},
dismiss: function() {},
close: function() {},
ok: function() {},
cancel: function() {},
yes: function() {},
no: function() {},
complete: function() {},
submit: function(e) {
self.callback(self.options.onsubmit, e);
return false; // Cancel form submision
}
};
this.addOptions = function(options) {
var buttons = [];
for(var key in options) {
if(key in this.options)
this.options[key] = options[key];
// If an event for a button is given, show the respective button
if(["close", "ok", "cancel", "yes", "no"].indexOf(key) >= 0)
buttons.push(key);
}
// Copy news buttons to this.options.buttons
if(buttons.length > 0) {
// Clear default buttons if new are not given
if(!("buttons" in options)) this.options.buttons = [];
buttons.forEach(function(item) {
if(self.options.buttons.indexOf(item) < 0)
self.options.buttons.push(item);
});
}
// Determine what is the best action if none is given
if(typeof options.onsubmit !== "string") {
if(this.options.buttons.indexOf("close") > 0) this.options.onsubmit = "close";
else if(this.options.buttons.indexOf("ok") > 0) this.options.onsubmit = "ok";
else if(this.options.buttons.indexOf("yes") > 0) this.options.onsubmit = "yes";
}
return this.options;
};
this.setOptions = function(options) {
this.options = options;
return this.options;
};
this.create = function() {
// Option for modal dialog size
var classModalDialog = "modal-dialog";
if(this.options.size == "large") classModalDialog += " modal-lg";
if(this.options.size == "small") classModalDialog += " modal-sm";
// Create HTML elements for modal dialog
this.modal = $('<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="bootpopup-title"></div>');
this.dialog = $('<div></div>', { class: classModalDialog, role: "document" });
this.content = $('<div class="modal-content"></div>');
this.dialog.append(this.content);
this.modal.append(this.dialog);
// Header
this.header = $('<div class="modal-header"></div>');
if(this.options.showclose) // Close button
this.header.append('<button type="button" class="bootpopup-button close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>');
this.header.append('<h4 class="modal-title" id="bootpopup-title">' + this.options.title + '</h4>');
this.content.append(this.header);
// Body
this.body = $('<div class="modal-body"></div>');
this.form = $("<form></form>", { id: this.formid, class: "form-horizontal", submit: function(e) { return self.options.submit(e); } });
this.body.append(this.form);
this.content.append(this.body);
// Iterate over entries
for(var i in this.options.content) {
var entry = this.options.content[i];
switch(typeof entry) {
case "string": // HTML string
this.form.append(entry);
break;
case "object":
for(var type in entry) {
var attrs = entry[type];
// Convert functions to string to be used as callback
for(var attribute in attrs)
if(typeof attrs[attribute] === "function")
attrs[attribute] = "(" + attrs[attribute] + ")(this)";
// Check if type is a shortcut for input
if(INPUT_SHORTCUT_TYPES.indexOf(type) >= 0) {
attrs.type = type; // Add attribute for type
type = "input"; // Continue to input
}
if(type == "input") {
// To avoid adding "form-control" class
if(attrs.type === "checkbox" && typeof attrs.class === "undefined")
attrs.class = "";
// Create a random id for the input if none provided
attrs.id = (typeof attrs.id === "undefined" ? "bootpopup-input" + String(Math.random()).substr(2) : attrs.id);
attrs.class = (typeof attrs.class === "undefined" ? "form-control" : attrs.class);
attrs.type = (typeof attrs.type === "undefined" ? "text" : attrs.type);
// Create input
var input;
switch(attrs.type) {
case "checkbox":
// Special case for checkbox
input = $('<div class="checkbox"></div>')
.append($('<label></label>')
.append($("<input />", attrs))
.append(attrs.label));
// Clear label to not be added as header
attrs.label = "";
break;
case "select":
// Special case for select
input = $("<select></select>", attrs);
for(var option in attrs.options)
input.append($("<option></option>", { value: option })
.append(attrs.options[option]));
break;
case "radio":
// Special case for radios
input = [];
for(var option in attrs.options)
input.push($('<div class="radio"></div>', attrs)
.append($('<label></label>')
.append($("<input />", { type: "radio", name: attrs.name, value: option }))
.append(attrs.options[option])));
break;
default:
input = $("<input />", attrs);
}
// Form Group
var formGroup = $('<div class="form-group"></div>').appendTo(this.form);
// Label
$("<label></label>", { for: attrs.id, class: "control-label " + this.options.size_labels, text: attrs.label }).appendTo(formGroup);
// Input and div to control width
var divInput = $('<div></div>', { class: this.options.size_inputs });
divInput.append(input);
formGroup.append(divInput);
}
else // Anything else besides input
this.form.append($("<" + type + "></" + type + ">", attrs)); // Add directly
}
break;
default:
throw "Invalid entry type";
}
}
// Footer
this.footer = $('<div class="modal-footer"></div>');
this.content.append(this.footer);
for(var key in this.options.buttons) {
var item = this.options.buttons[key];
var btnClass = "";
var btnText = "";
switch(item) {
case "close": btnClass = "btn-primary"; btnText = "Close"; break;
case "ok": btnClass = "btn-primary"; btnText = "OK"; break;
case "cancel": btnClass = "btn-default"; btnText = "Cancel"; break;
case "yes": btnClass = "btn-primary"; btnText = "Yes"; break;
case "no": btnClass = "btn-default"; btnText = "No"; break;
}
var button = $("<button></button>", {
type: "button",
text: btnText,
class: "btn " + btnClass,
"data-dismiss": "modal",
"data-callback": item,
"data-form": this.formid,
click: function(event) {
var name = $(event.target).data("callback");
self.callback(name, event);
}
});
this.footer.append(button);
// Reference for buttons
switch(item) {
case "close": this.btnClose = button; break;
case "ok": this.btnOk = button; break;
case "cancel": this.btnCancel = button; break;
case "yes": this.btnYes = button; break;
case "no": this.btnNo = button; break;
}
}
// Setup events for dismiss and complete
this.modal.on('hide.bs.modal', this.options.dismiss);
this.modal.on('hidden.bs.modal', function(e) {
self.options.complete(e);
self.modal.remove(); // Delete window after complete
});
// Don't close on backdrop click
if(this.options.showclose === false)
this.modal.attr('data-backdrop', 'static');
// Add window to body
$(document.body).append(this.modal);
};
this.show = function() {
// Call before event
this.options.before(this);
// Fire the modal window
this.modal.modal();
};
this.data = function() {
var keyval = {};
var array = this.form.serializeArray();
for(var i in array) {
var name = array[i].name, val = array[i].value;
if(typeof keyval[name] === "undefined")
keyval[name] = val;
else {
if(!Array.isArray(keyval[name]))
keyval[name] = [keyval[name]];
keyval[name].push(val);
}
}
return keyval;
};
this.callback = function(name, event) {
var func = this.options[name]; // Get function to call
if(typeof func !== "function") return;
// Perform callback
var array = this.form.serializeArray();
var ret = func(this.data(), array, event);
// Hide window
this.modal.modal("hide");
return ret;
};
this.dismiss = function() { this.callback("dismiss"); };
this.submit = function() { this.callback("submit"); };
this.close = function() { this.callback("close"); };
this.ok = function() { this.callback("ok"); };
this.cancel = function() { this.callback("cancel"); };
this.yes = function() { this.callback("yes"); };
this.no = function() { this.callback("no"); };
this.addOptions(options);
this.create();
this.show();
}
bootpopup.alert = function(message, title, callback) {
if(typeof title === "function")
callback = title;
if(typeof title !== "string")
title = document.title;
if(typeof callback !== "function")
callback = function() {};
return bootpopup({
title: title,
content: [{ p: { text: message } }],
dismiss: function() { callback(); }
});
};
bootpopup.confirm = function(message, title, callback) {
if(typeof title === "function")
callback = title;
if(typeof title !== "string")
title = document.title;
if(typeof callback !== "function")
callback = function() {};
var answer = false;
return bootpopup({
title: title,
showclose: false,
content: [{ p: { text: message } }],
buttons: ["no", "yes"],
yes: function() { answer = true; },
dismiss: function() { callback(answer); }
});
};
bootpopup.prompt = function(label, type, message, title, callback) {
// Callback can be in any position, except label
var callback_function = function() {};
if(typeof type === "function")
callback_function = type;
if(typeof message === "function")
callback_function = message;
if(typeof title === "function")
callback_function = title;
if(typeof callback === "function")
callback_function = callback;
// If a list of values is provided, then the parameters are shifted
// because type should be ignored
if(typeof label === "object") {
title = message;
message = type;
type = null;
}
// Sanitize message and title
if(typeof message !== "string")
message = "Please, provide values for:";
if(typeof title !== "string")
title = document.title;
// Add message to the window
var content = [{ p: { text: message } }];
// If label is a list of values to be asked to input
if(typeof label === "object") {
label.forEach(function(entry) {
var obj = null;
// HTML
if (typeof entry === "string")
obj = entry;
// Input
if ( entry !== null && typeof entry === "object" && typeof entry.label === "string") {
if(typeof entry.name !== "string") // Name in lower case and dashes instead spaces
entry.name = entry.label.toLowerCase().replace(/\s+/g, "-");
if(typeof entry.type !== "string")
entry.type = "text";
obj = { input: entry };
}
if(obj !== null)
content.push(obj);
});
}
else {
if(typeof type !== "string") type = "text";
content.push({ input: { type: type, name: "value", label: label } });
var callback_tmp = callback_function; // Overload callback function to return "data.value"
callback_function = function(data) { callback_tmp(data.value); };
}
return bootpopup({
title: title,
content: content,
buttons: ["cancel", "ok"],
ok: function(data) {
callback_function(data);
}
});
};
/**
* AMD support: require.js
*/
if(typeof define === "function") {
define(["jquery", "bootstrap"], function() {
return bootpopup;
});
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.