zentyal-common-2.3.9+quantal1/0000775000000000000000000000000012017102227013105 5ustar zentyal-common-2.3.9+quantal1/COPYING0000664000000000000000000004311012017102227014137 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. zentyal-common-2.3.9+quantal1/debian/0000775000000000000000000000000012017102227014327 5ustar zentyal-common-2.3.9+quantal1/debian/dirs0000664000000000000000000000007512017102227015215 0ustar var/lib/zentyal/conf var/lib/zentyal/tmp var/lib/zentyal/log zentyal-common-2.3.9+quantal1/debian/compat0000664000000000000000000000000212017102227015525 0ustar 5 zentyal-common-2.3.9+quantal1/debian/copyright0000664000000000000000000000214112017102227016260 0ustar This package was debianized by Zentyal Packaging Maintainers Fri, 20 Aug 2004 14:10:24 +0100. It was downloaded from http://www.zentyal.org/ Files: * Upstream Author: eBox Technologies S.L. Copyright (C) 2004-2012 eBox Technologies S.L. License: 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 2 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. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. The Debian packaging is: (C) 2004-2011, Zentyal Packaging Maintainers and is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. zentyal-common-2.3.9+quantal1/debian/control0000664000000000000000000000241412017102227015733 0ustar Source: zentyal-common Section: web Priority: optional Maintainer: Zentyal Packaging Maintainers Uploaders: Jorge Salamero Sanz Build-Depends: zbuildtools Standards-Version: 3.9.2 Homepage: http://www.zentyal.org/ Vcs-Browser: http://git.zentyal.org/zentyal.git/tree/quantal:/main/common Vcs-Git: git://git.zentyal.org/zentyal.git Package: zentyal-common Architecture: all Replaces: libebox (<< 2.0.100) Breaks: libebox (<< 2.0.100) Depends: sudo, iproute, liblog-dispatch-perl, liblog-log4perl-perl, libhtml-mason-perl (>= 1:1.44-1+zentyal1), liblocale-gettext-perl, liberror-perl, libdevel-stacktrace-perl, libintl-perl, libnet-ip-perl, gettext, libfile-slurp-perl, libreadonly-perl, libreadonly-xs-perl, libperl6-junction-perl, libmail-rfc822-address-perl, libsoap-lite-perl, libjs-scriptaculous, libjs-prototype, libdata-validate-domain-perl, libconfig-tiny-perl, libio-interface-perl, libgd-gd2-perl, ${misc:Depends} Conflicts: sudo-ldap Description: Zentyal - Common Library Zentyal is a Linux small business server that can act as a Gateway, Unified Threat Manager, Office Server, Infrastructure Manager, a Unified Communications Server or a combination of them. One single, easy-to-use platform to manage all your network services. zentyal-common-2.3.9+quantal1/debian/zentyal-common.postinst0000664000000000000000000000027012017102227021107 0ustar #!/bin/bash set -e #DEBHELPER# case "$1" in configure) STDERR_FILE=/var/lib/zentyal/tmp/stderr touch $STDERR_FILE && chmod 0666 $STDERR_FILE ;; esac exit 0 zentyal-common-2.3.9+quantal1/debian/source/0000775000000000000000000000000012017102227015627 5ustar zentyal-common-2.3.9+quantal1/debian/source/format0000664000000000000000000000001512017102227017036 0ustar 3.0 (native) zentyal-common-2.3.9+quantal1/debian/zentyal-common.postrm0000664000000000000000000000033212017102227020547 0ustar #!/bin/bash set -e #DEBHELPER# case "$1" in purge) # delete logs and temporal files rm -rf /var/lib/zentyal/ # delete configuration files rm -rf /etc/zentyal ;; esac exit 0 zentyal-common-2.3.9+quantal1/debian/rules0000775000000000000000000000010612017102227015404 0ustar #!/usr/bin/make -f include /usr/share/zbuildtools/1/rules/zentyal.mk zentyal-common-2.3.9+quantal1/debian/changelog0000664000000000000000000002611312017102227016204 0ustar zentyal-common (2.3.9+quantal1) quantal; urgency=low * New upstream release for Quantal -- Jorge Salamero Sanz Tue, 28 Aug 2012 10:13:48 +0200 zentyal-common (2.3.9) precise; urgency=low * New upstream release -- José A. Calvo Thu, 23 Aug 2012 03:14:04 +0200 zentyal-common (2.3.8) precise; urgency=low * New upstream release -- José A. Calvo Wed, 18 Jul 2012 02:21:10 +0200 zentyal-common (2.3.7) precise; urgency=low * New upstream release -- José A. Calvo Thu, 12 Jul 2012 14:34:47 +0200 zentyal-common (2.3.6) precise; urgency=low * New upstream release -- José A. Calvo Thu, 14 Jun 2012 16:33:27 +0200 zentyal-common (2.3.5) precise; urgency=low * New upstream release -- José A. Calvo Mon, 04 Jun 2012 11:11:33 +0200 zentyal-common (2.3.4) precise; urgency=low * New upstream release -- José A. Calvo Thu, 22 Mar 2012 20:38:01 +0100 zentyal-common (2.3.1) precise; urgency=low * New upstream release -- José A. Calvo Sun, 26 Feb 2012 19:42:06 +0100 zentyal-common (2.3-1) precise; urgency=low * Updated Standards-Version to 3.9.2 -- José A. Calvo Wed, 08 Feb 2012 16:11:49 +0100 zentyal-common (2.3) precise; urgency=low * New upstream release -- José A. Calvo Mon, 30 Jan 2012 01:42:23 +0100 zentyal-common (2.2.2) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 23 Nov 2011 18:53:38 +0100 zentyal-common (2.2.1) lucid; urgency=low * New upstream release -- José A. Calvo Sat, 15 Oct 2011 12:50:16 +0200 zentyal-common (2.2) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 13 Sep 2011 04:39:12 +0200 zentyal-common (2.1.10) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 07 Sep 2011 18:20:33 +0200 zentyal-common (2.1.9) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 30 Aug 2011 17:25:47 +0200 zentyal-common (2.1.8) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 24 Aug 2011 03:18:09 +0200 zentyal-common (2.1.7) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 26 Jul 2011 01:04:41 +0200 zentyal-common (2.1.6) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 21 Jul 2011 02:20:43 +0200 zentyal-common (2.1.5) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 14 Jul 2011 22:55:33 +0200 zentyal-common (2.1.4) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 30 Jun 2011 01:02:47 +0200 zentyal-common (2.1.3) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 28 Jun 2011 03:49:02 +0200 zentyal-common (2.1.2) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 14 Jun 2011 20:11:54 +0200 zentyal-common (2.1.1) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 10 May 2011 22:39:41 +0200 zentyal-common (2.1) lucid; urgency=low * New upstream release -- José A. Calvo Tue, 22 Feb 2011 03:11:06 +0100 libebox (2.0.7) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 09 Jan 2011 19:27:37 +0100 libebox (2.0.6) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 29 Dec 2010 03:01:42 +0100 libebox (2.0.5) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 19 Dec 2010 15:45:15 +0100 libebox (2.0.4) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 05 Dec 2010 13:31:05 +0100 libebox (2.0.3) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 18 Nov 2010 17:00:09 +0100 libebox (2.0.2) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 17 Oct 2010 20:15:16 +0200 libebox (2.0.1) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 06 Oct 2010 15:25:21 +0200 libebox (2.0) lucid; urgency=low * New upstream release -- José A. Calvo Mon, 30 Aug 2010 22:13:52 +0200 libebox (1.5.10-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 26 Aug 2010 16:03:05 +0200 libebox (1.5.9-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Mon, 23 Aug 2010 02:13:46 +0200 libebox (1.5.8-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 18 Aug 2010 17:25:23 +0200 libebox (1.5.7-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Wed, 04 Aug 2010 15:50:01 +0200 libebox (1.5.6-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 25 Jul 2010 20:38:02 +0200 libebox (1.5.5-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Mon, 19 Jul 2010 12:13:30 +0200 libebox (1.5.4-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Sun, 20 Jun 2010 20:37:56 +0200 libebox (1.5.3-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 17 Jun 2010 04:58:04 +0200 libebox (1.5.2-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 10 Jun 2010 16:35:17 +0200 libebox (1.5.1-0ubuntu1~ppa1~lucid1) lucid; urgency=low * New upstream release -- José A. Calvo Thu, 13 May 2010 01:35:19 +0200 libebox (1.5-0ubuntu1) lucid; urgency=low [Javier Uruen Val] * New upstream release. (LP: #521798) * debian/patches - Drop 01_js_libraries.patch as upstream uses external library now. - Drop simple-patchsys * debian/links - Change from prototype-1.6.0.js to prototype.js * debian/control - Update description -- Javier Uruen Val Sun, 07 Feb 2010 17:36:21 +0100 libebox (1.3.5-0ubuntu2) karmic; urgency=low [Javier Uruen Val] * Backport fixes from 1.3.6 (LP: #451481) - debian/patches/02_remove_cmd_files.patch - debian/patches/03_fix_log_file_owner.patch: set file -- Javier Uruen Val Tue, 13 Oct 2009 19:08:29 +0200 libebox (1.3.5-0ubuntu1) karmic; urgency=low [Javier Uruen Val] * New upstream release. (Closes: #411462) * debian/control - Bump standards version - Add dependency on libsoap-lite-perl - Remove dependency on dpatch * debian/libebox.postinst - Create log directory - Add set -e * debian/libebox.postrm - Add set -e * debian/patches - Drop dpatch system: + Drop 01_dbug_gconf.dpatch (Shipped by upstream) - Use simple-patchsys + Move 02_js_libraries.dpatch to 01_js_libraries.patch * cdbs/ebox.mk - Use simple-patchsys.mk -- Javier Uruen Val Wed, 05 Aug 2009 12:29:43 +0200 libebox (0.12.2-0ubuntu1) jaunty; urgency=low [ Javier Uruen Val ] * New upstream release. Closes (LP: #318697) * debian/control: - Bump standard version to 3.8.0. - Depends on scriptaculous and prototype javascript libraries. - Update the upstream project url. * debian/copyright: - Include modalbox license. * debian/patches/: 01_set_multiple_groups, 02_fix_interpolation_warning, 03_abstract_daemon_tmp_dir, 04_disable_debug: Drop patches. * debian/patches/01_dbus_gconf.dpatch - Patch to make eBox gconf classes work with the new gconf version that uses dbus. * debian/patches/02_js_libraries.dpatch - Patch to strip out javascript libraries that are already packaged in Jaunty. -- Mathias Gug Mon, 26 Jan 2009 17:57:54 -0500 libebox (0.11.99-0ubuntu3) hardy; urgency=low * debian/patches/04_disable_debug.dpatch - Disable debug information so that it does not disclose information. (LP: #219343) -- Chuck Short Mon, 21 Apr 2008 08:28:10 -0400 libebox (0.11.99-0ubuntu2) hardy; urgency=low * debian/control, debian/rules, debian/patches/01_set_multiple_groups.dpatch, debian/patches/02_fix_interpolation_warning.dpatch, debian/patches/03_abstract_daemon_tmp_dir.dpatch - Updated with patches from upstream. -- Chuck Short Tue, 11 Mar 2008 09:10:47 -0400 libebox (0.11.99-0ubuntu1) hardy; urgency=low * New upstream release. -- Chuck Short Wed, 27 Feb 2008 13:19:28 -0500 libebox (0.11.99-0ubuntu1~ppa1) hardy; urgency=low * New upstream release -- Javier Uruen Val Mon, 25 Feb 2008 12:06:20 +0100 libebox (0.11.99) unstable; urgency=low * New upstream release -- Enrique José Hernández Blasco Tue, 8 Jan 2008 16:24:51 +0100 libebox (0.11-0ubuntu1~ppa1) hardy; urgency=low * New upstream release -- Javier Uruen Val Wed, 28 Nov 2007 15:23:40 +0100 libebox (0.10.99) unstable; urgency=low * New upstream release -- Javier Uruen Val Thu, 01 Nov 2007 21:38:21 +0100 libebox (0.10) unstable; urgency=low * New upstream release -- Javier Uruen Val Wed, 10 Oct 2007 21:54:38 +0200 libebox (0.9.100) unstable; urgency=low * New upstream release -- Javier Uruen Val Mon, 03 Sep 2007 11:10:58 +0200 libebox (0.9.99) unstable; urgency=low * New upstream release -- Javier Amor Garcia Tue, 24 Jul 2007 13:06:39 +0200 libebox (0.9.3) unstable; urgency=low * New upstream release -- Javier Uruen Val Sun, 24 Jun 2007 16:39:02 +0200 libebox (0.9.2) unstable; urgency=low * New upstream release -- Javier Uruen Val Tue, 12 Jun 2007 19:00:16 +0200 libebox (0.9.1) unstable; urgency=low * New upstream release -- Javier Uruen Val Tue, 15 May 2007 13:02:50 +0200 libebox (0.9) unstable; urgency=low * New upstream release -- Javier Amor Garcia Mon, 19 Mar 2007 12:03:48 +0100 libebox (0.8.99) unstable; urgency=low * New upstream release -- Enrique Jos� Hern�ndez Blasco Fri, 16 Feb 2007 11:45:49 +0100 libebox (0.7.99-1) unstable; urgency=low * New upstream release -- Javier Amor Garcia Wed, 8 Nov 2006 13:22:37 +0100 libebox (0.7.0.99-rc1+0.7.1-rc1) unstable; urgency=low * New upstream release -- Javier Uruen Val Tue, 17 Jan 2006 11:45:54 +0100 libebox (0.5.1) unstable; urgency=low * New upstream release -- Isaac Clerencia Thu, 3 Mar 2005 19:55:13 +0100 zentyal-common-2.3.9+quantal1/conf/0000775000000000000000000000000012017102227014032 5ustar zentyal-common-2.3.9+quantal1/conf/zentyal.conf0000664000000000000000000000202212017102227016363 0ustar # zentyal.conf - configuration file for Zentyal. # # This file contains the most basic settings, most other stuff is configured # using the web interface. # # Everything after a '#' character is ignored # # All whitespace is ignored # # Config keys are set this way: # # key = value # # They may contain comments at the end: # # key = value # this is ignored # user [required]. The user under which Zentyal will run. # It should have enough sudo privileges to perform all needed tasks. user = ebox # egroup [required]. The group under which Zentyal will run. egroup = ebox # debug mode [required]. yes|no # # Note: In order to take effect, after changing this you need to execute: # /etc/init.d/zentyal apache restart # debug = yes # Dump exceptions on interface # This is useful for developers and is only enabled during beta period #dump_exceptions = yes # Don't ask when a user modification is found. Override any user # change by eBox configuration. # Allowed values = [yes|no] # Default value = no override_user_modification = yes zentyal-common-2.3.9+quantal1/src/0000775000000000000000000000000012017102227013674 5ustar zentyal-common-2.3.9+quantal1/src/EBox.pm0000664000000000000000000000712212017102227015071 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox; use strict; use warnings; use EBox::Config; use EBox::Exceptions::DeprecatedMethod; use POSIX qw(setuid setgid setlocale LC_ALL LC_NUMERIC); use English; use constant LOGGER_CAT => 'EBox'; my $loginit = 0; my $debug = 0; sub deprecated { if ($debug) { throw EBox::Exceptions::DeprecatedMethod(); } } sub info { my ($msg) = @_; my $logger = EBox::logger(LOGGER_CAT); $Log::Log4perl::caller_depth +=1; $logger->info($msg); $Log::Log4perl::caller_depth -=1; } sub error { my ($msg) = @_; my $logger = EBox::logger(LOGGER_CAT); $Log::Log4perl::caller_depth +=1; $logger->error($msg); $Log::Log4perl::caller_depth -=1; } sub debug { my ($msg) = @_; if ($debug) { my $logger = EBox::logger(LOGGER_CAT); $Log::Log4perl::caller_depth +=1; $logger->debug($msg); $Log::Log4perl::caller_depth -=1; } } sub warn { my ($msg) = @_; my $logger = EBox::logger(LOGGER_CAT); $Log::Log4perl::caller_depth +=1; $logger->warn($msg); $Log::Log4perl::caller_depth -=1; } sub trace { my ($msg) = @_; if ($debug) { use Devel::StackTrace; my $trace = new Devel::StackTrace(indent => 1); EBox::debug($trace->as_string()); } } sub initLogger { my ($conffile) = @_; my $umask = umask(022); unless ($loginit) { Log::Log4perl->init(EBox::Config::conf() . '/' . $conffile); $loginit = 1; } umask($umask); } # returns the logger for the caller package, initLogger must be called before sub logger # (caller?) { my ($cat) = @_; defined($cat) or $cat = LOGGER_CAT; if(not $loginit) { use Devel::StackTrace; my $trace = Devel::StackTrace->new(); print STDERR $trace->as_string(); } return Log::Log4perl->get_logger($cat); } # arguments # - locale: the locale the interface should use sub setLocale # (locale) { my ($locale) = @_; open(LOCALE, ">" . EBox::Config::conf() . "/locale"); print LOCALE $locale; close(LOCALE); } # returns: # - the locale sub locale { my $locale="C"; if (-f (EBox::Config::conf() . "locale")) { open(LOCALE, EBox::Config::conf() . "locale"); $locale = ; close(LOCALE); } return $locale; } sub init { # FIXME: workaround until permission denied warning in GD is fixed use GD; POSIX::setlocale(LC_ALL, EBox::locale()); POSIX::setlocale(LC_NUMERIC, 'C'); my $gids = EBox::Config::gids(); $GID = $EGID = getgrnam(EBox::Config::group()) . " $gids"; my $user = EBox::Config::user(); my $uid = getpwnam($user); setuid($uid) or die "Cannot change user to $user. Are you root?"; EBox::initLogger('eboxlog.conf'); # Set HOME environment variable to avoid some issues calling # external programs $ENV{HOME} = EBox::Config::home(); $debug = EBox::Config::boolean('debug'); } 1; zentyal-common-2.3.9+quantal1/src/EBox/0000775000000000000000000000000012017102227014531 5ustar zentyal-common-2.3.9+quantal1/src/EBox/NetWrappers.pm0000664000000000000000000002706212017102227017350 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::NetWrappers; use strict; use warnings; use EBox::Config; use EBox::Gettext; use EBox::Exceptions::DataNotFound; use EBox::Exceptions::MissingArgument; use Perl6::Junction qw(any); use EBox::Validate; use EBox::Sysfs; use IO::Socket::INET; use IO::Interface::Simple; BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = qw(); %EXPORT_TAGS = (all => [qw{ list_ifaces iface_exists iface_is_up iface_netmask iface_addresses iface_addresses_with_netmask iface_by_address iface_mac_address list_routes list_local_addresses list_local_addresses_with_netmask route_is_up ip_network ip_broadcast ip_mac bits_from_mask mask_from_bits to_network_with_mask to_network_without_mask } ], ); @EXPORT_OK = qw(); Exporter::export_ok_tags('all'); $VERSION = EBox::Config::version; } my @ifaceList; # Function: iface_exists # # Check if a given interface exists in the system # # Parameters: # # iface - Interface's name # # Returns: # # True if exists, otherwise undef # sub iface_exists { my ($iface) = @_; my @ifaces = list_ifaces(); return ($iface eq any(@ifaces)); } # Function: list_ifaces # # Return a list of all real interfaces in the machine # # Returns: # # An array containg the interfaces # sub list_ifaces { unless (@ifaceList) { @ifaceList = map { $_->{name} } IO::Interface::Simple->interfaces; @ifaceList = grep (!/:/, @ifaceList); @ifaceList = sort @ifaceList; } return @ifaceList; } # Function: iface_is_up # # Checks if a given interface is up. # # Parameters: # # iface - Interface's name # # Returns: # # True if it's up, undef otherwise # # Exceptions: # # DataNotFound - If interface does not exists # sub iface_is_up { my $iface = shift; unless (iface_exists($iface)) { throw EBox::Exceptions::DataNotFound( data => __('Interface'), value => $iface); } my $state = EBox::Sysfs::read_value("/sys/class/net/$iface/operstate"); return ($state eq 'up' or $state eq 'unknown'); # backward compatibility } # Function: iface_mac_address # # Returns the mac address for a given interface # # Parameters: # # iface - Interface's name # # Returns: # # A string containing the mac address # # Exceptions: # # DataNotFound - If interface does not exists # sub iface_mac_address { my ($if) = @_; unless (iface_exists($if)) { throw EBox::Exceptions::DataNotFound( data => __('Interface'), value => $if); } my $mac = EBox::Sysfs::read_value("/sys/class/net/$if/address"); return $mac; } # Function: iface_addresses # # Return the addresses for a given interface (dot format) # # Parameters: # # iface - Interface's name # # Returns: # # A list of strings containing the addresses # # Exceptions: # # DataNotFound - If interface does not exists # sub iface_addresses { my ($if) = @_; my @addrs = map { $_ =~ s{/.*$}{}; $_ } _ifaceShowAddress($if); return @addrs; } # Function: iface_by_address # # Search a iface by his address # # Assumption/Limitation: It assumes that we have not repeated addresses # # Returns: # # The iface or undef if there are not any iface with this address sub iface_by_address { my ($addr) = @_; foreach my $if (list_ifaces()) { my @addresses = iface_addresses($if); if ( $addr eq any(@addresses) ) { return $if; } } return undef; } # Function: iface_addresses_with_netmask # # Returns the addresses for a given interface (dot format) # # Parameters: # # iface - Interface's name # # Returns: # # A hash reference wich keys are the ip addresses and the values the address' netmask # # Exceptions: # # DataNotFound - If interface does not exists # sub iface_addresses_with_netmask { my ($if) = @_; my %netmaskByAddr; my @addrs = _ifaceShowAddress($if); foreach my $addr (@addrs) { $addr =~ /^(.*)\/(.*)$/ ; my $ip = $1; my $netmask = mask_from_bits($2); $netmaskByAddr{$ip} = $netmask; } return \%netmaskByAddr; } sub _ifaceShowAddress { my ($if) = @_; unless (iface_exists($if)) { throw EBox::Exceptions::DataNotFound( data => __('Interface'), value => $if); } my @output = `/bin/ip -f inet -o address show $if 2> /dev/null`; my @addrs = map { my ($number, $iface, $family, $ip) = split /\s+/, $_, 5; $ip; } @output; return @addrs; } # Function: list_routes # # Rertuns the list of current routes # # Parameters: # viaGateway - returns routes that uses a gateway (default: true) # localSource - returns routes that uses a local source (default: false) # # Returns: # # An array containing hash references. Each hash contains a route # and consists of: # # network - network destination # router - router used to reach the above network if used # source - local ip used to reach the above network if used # sub list_routes { my ($viaGateway, $localSource) = @_; defined $viaGateway or $viaGateway = 1; defined $localSource or $localSource = 0; my @routes = (); my @ipOutput = `/bin/ip route show 2>/dev/null`; chomp(@ipOutput); if ($viaGateway) { my @gwRoutes = grep { $_ =~ m{via} } @ipOutput; # select routes with gateway foreach (@gwRoutes) { my ($net, $via, $router) = split(/ /,$_); my $route = {network => $net, router => $router}; push(@routes, $route); } } # get no-gateway routes if instructed to do if ($localSource) { my @srcRoutes = grep { $_ =~ m{src} } @ipOutput; foreach my $r (@srcRoutes) { $r =~ m/^(.*?)\sdev.*?src\s(.*?)$/; my $net = $1; my $source = $2; my $route = { network => $net, source => $source }; push(@routes, $route);; } } return @routes; } # Function: route_is_up # # Checks if a given route is already up. # # Parameters: # # network - network destination # router - router used to reach the network # # Returns: # # True if it's up, undef otherwise # sub route_is_up { my ($network, $router) = @_; my @routes = list_routes(); foreach (@routes) { if (($_->{router} eq $router) and ($_->{network} eq $network)) { return 1; } } return undef; } # Function: ip_network # # Returns the network for an address and netmask # # Parameters: # # address - IPv4 address # netmask - network mask for the above ip # # Returns: # # The network address # sub ip_network # (address, netmask) { my ($address, $netmask) = @_; my $net_bits = pack("CCCC", split(/\./, $address)); my $mask_bits = pack("CCCC", split(/\./, $netmask)); return join(".", unpack("CCCC", $net_bits & $mask_bits)); } # Function: ip_broadcast # # Returns the broadcast address for an address and netmask # # Parameters: # # address - IPv4 address # netmask - network mask for the above ip # # Returns: # # The broadcast address # sub ip_broadcast { my ($address, $netmask) = @_; my $net_bits = pack("CCCC", split(/\./, $address)); my $mask_bits = pack("CCCC", split(/\./, $netmask)); return join(".", unpack("CCCC", $net_bits | (~$mask_bits))); } # Function: ip_mac # # Returns the mac address for a given IP # # Parameters: # # address - IPv4 address # # Returns: # # The mac address if found or undef # sub ip_mac { my ($address) = @_; my $output = `arp -an $address`; my ($mac) = ($output =~ /(([0-9a-f]{2}:){5}[0-9a-f]{2})/i); return $mac; } # Function: bits_from_mask # # Given a network mask it returns it in binary format # # Parameters: # # netmask - network mask # # Returns: # # Network mask in binary format # sub bits_from_mask { my $netmask = shift; return unpack("%B*", pack("CCCC", split(/\./, $netmask))); } # Function: mask_from_bits # # Given a network mask in binary format it returns it in decimal dot notation # # Parameters: # # bits - number of bits # # Returns: # # Network mask in decimal dot notation # sub mask_from_bits { my ($bits) = @_; unless($bits >= 0 and $bits <= 32) { return undef; } my $mask_binary = "1" x $bits . "0" x (32 - $bits); return join(".",unpack("CCCC", pack("B*",$mask_binary))); } # Function: to_network_with_mask # # Given a network and a netmask rerurns the network with embeded mask (form x.x.x.x/n) # # Parameters: # # network - network address # netmask - network mask # # Returns: # # The network in format x.x.x.x/m # sub to_network_with_mask { my ($network, $netmask) = @_; my $bits = bits_from_mask($netmask); return "$network/$bits"; } # Function: to_network_without_mask # # Given a network with embeded mask (form x.x.x.x/n) it returns the network and netmask # # Parameters: # # networkWithMask - network address in format x.x.x.x/m # # Returns: # # (network, netmask) # sub to_network_without_mask { my ($networkWithMask) = @_; my ($network, $bits) = split '/', $networkWithMask, 2; my $netmask = mask_from_bits($bits); return ($network, $netmask); } # Function: list_local_addresses # # Returns: # a list with all local ipv4 addresses # sub list_local_addresses { my @ifaces = list_ifaces(); my @localAddresses = map { iface_is_up($_) ? iface_addresses($_) : () } @ifaces; @localAddresses = map { s{/.*$}{}; $_ } @localAddresses; return @localAddresses; } # Function: list_local_addresses_with_netmask # # Returns: # a flat list with pairs of all local ipv4 addresses # and their netmask sub list_local_addresses_with_netmask { my @ifaces = list_ifaces(); my @localAddresses = map { iface_is_up($_) ? %{ iface_addresses_with_netmask($_) } : () } @ifaces; return @localAddresses; } # Method: getFreePort # # Looks for a unused port # # Parameters: # proto - protocol ('tcp' or 'udp') # localAddess - local address on which look for a free port # # Returns: # port number or undef if it could not find a free port sub getFreePort { my ($proto, $localAddr) = @_; $proto or throw EBox::Exceptions::MissingArgument('proto'); $localAddr or throw EBox::Exceptions::MissingArgument('localAddr'); my @socketParams = ( Proto => $proto, LocalAddr => $localAddr, LocalPort => 0, # to select a unused port ); my $sock = IO::Socket::INET->new(@socketParams ); defined $sock or return undef; my $port = $sock->sockport(); $sock->close(); return $port; } 1; zentyal-common-2.3.9+quantal1/src/EBox/NetWrappers/0000775000000000000000000000000012017102227017003 5ustar zentyal-common-2.3.9+quantal1/src/EBox/NetWrappers/TestStub.pm0000664000000000000000000000561012017102227021120 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::NetWrappers::TestStub; # Description: # use strict; use warnings; use Test::MockObject; use EBox::NetWrappers; my %fakeIfaces; my %fakeRoutes; sub fake { Test::MockObject->fake_module('EBox::NetWrappers', iface_exists => \&iface_exists, list_ifaces => \&list_ifaces, iface_is_up => \&iface_is_up, iface_mac_address => \&iface_mac_address, iface_addresses => \&iface_addresses, iface_addresses_with_netmask => \&iface_addresses_with_netmask, list_routes => \&list_routes, route_is_up => \&route_is_up, ); } sub unfake { delete $INC{'EBox/NetWrappers.pm'}; eval 'use EBox::NetWrappers'; $@ and die "Error reloading EBox::NetWrappers: $@"; } sub setFakeIfaces { my ($fakeIfaces_r) = @_; %fakeIfaces = %{$fakeIfaces_r}; } sub fakeIfaces { return \%fakeIfaces; } sub setFakeRoutes { my ($fakeRoutes_r) = @_; %fakeRoutes = %{$fakeRoutes_r}; } sub fakeRoutes { return \%fakeRoutes; } # fake methods: sub iface_exists { my ($iface) = @_; return exists $fakeIfaces{$iface}; } sub list_ifaces { return keys %fakeIfaces; } sub iface_is_up { my ($iface) = @_; return _ifacePropierty($iface, 'up'); } sub iface_mac_address { my ($iface) = @_; return _ifacePropierty($iface, 'mac_address'); } sub iface_addresses { my ($iface) = @_; my $address_r = _ifacePropierty($iface, 'address') ; return keys %{ $address_r }; } sub iface_addresses_with_netmask { my ($iface) = @_; return _ifacePropierty($iface, 'address'); } sub _ifacePropierty { my ($iface, $propierty) = @_; unless (exists $fakeIfaces{$iface}) { throw EBox::Exceptions::DataNotFound( data => 'Interface', value => $iface); } unless (exists $fakeIfaces{$iface}->{$propierty} ) { die "You had not setted a $propierty propierty for the fake iface $iface"; } return $fakeIfaces{$iface}->{$propierty}; } sub list_routes { my @routes; while (my ($dest, $router) = each %fakeRoutes) { push @routes, { network => $dest, router => $router }; } return @routes; } sub route_is_up { my ($network, $router) = @_; if (exists $fakeRoutes{$network}) { if ($fakeRoutes{$network} eq $router) { return 1; } } return undef; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Sysfs.pm0000664000000000000000000000224412017102227016200 0ustar # Copyright (C) 2010-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Sysfs; use strict; use warnings; use base 'Exporter'; our @EXPORT_OK = qw(read_value); # Function: read_value # # Reads a value from a sysfs file # # Parameters: # # sysfs_path - Path to sysfs file # # Returns: # # A string with the first line of the sysfs file sub read_value # (sysfs_path) { my ($sysfs_path) = @_; open(my $sysfs_file, '<', $sysfs_path); my $value = <$sysfs_file>; close($sysfs_file); $value =~ s/\s+$//; return $value; } zentyal-common-2.3.9+quantal1/src/EBox/Sudo.pm0000664000000000000000000002267312017102227016013 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Sudo; use strict; use warnings; use EBox::Config; use EBox::Exceptions::Internal; use EBox::Gettext; use File::stat qw(); use Error qw(:try); use Params::Validate; use Perl6::Junction; use File::Temp qw(tempfile); use File::Slurp; use EBox::Exceptions::Sudo::Command; use EBox::Exceptions::Sudo::Wrapper; use EBox::Exceptions::Command; BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = qw(); %EXPORT_TAGS = (all => [qw{ root command stat fileStat} ], ); @EXPORT_OK = qw();; Exporter::export_ok_tags('all'); $VERSION = EBox::Config::version; } use Readonly; Readonly::Scalar our $SUDO_PATH => '/usr/bin/sudo -p sudo:'; # our declaration eases testing Readonly::Scalar our $STDERR_FILE => EBox::Config::tmp() . 'stderr'; Readonly::Scalar my $STAT_CMD => '/usr/bin/stat -c%dI%iI%fI%hI%uI%gIhI%sI%XI%YI%ZI%oI%bI%tI%T'; Readonly::Scalar my $TEST_PATH => '/usr/bin/test'; # # Procedure: command # # Executes a command as ebox user # # Parameters: # # command - string with the command to execute # # # Exceptions: # # - If command fails to run or it # was signaled # - If command returns # something different than zero and it was not signaled # # Returns: # # array ref - Returns the output of the command in an array # sub command # (command) { my ($cmd) = @_; validate_pos(@_, 1); my $procname = $ENV{script} ? "$0 $ENV{script}" : @ARGV ? "$0 @ARGV" : $0; EBox::debug("$procname (pid: $$) - $cmd"); my @output = `$cmd 2> $STDERR_FILE`; if ($? != 0) { my @error; if ( -r $STDERR_FILE) { @error = read_file($STDERR_FILE); } _commandError($cmd, $?, \@output, \@error); } return \@output; } sub _commandError { my ($cmd, $childError, $output, $error) = @_; if ($childError == -1) { throw EBox::Exceptions::Internal("Failed to execute child process $cmd"); } elsif ($childError & 127) { my $signal = ($childError & 127); my $coredump = ($childError & 128) ? 'with coredump' : 'without coredump'; throw EBox::Exceptions::Internal("$cmd died with signal $signal $coredump"); } my $exitValue = $childError >> 8; throw EBox::Exceptions::Command(cmd => $cmd, output => $output, error => $error, exitValue => $exitValue); } # Procedure: root # # Executes the commands provided through sudo. Use this to execute privileged # commands. # # Parameters: # # commands - strings with the commands to execute # # Exceptions: # # - If a command cannot be # executed or it was signalled # # - If acommand fails # (returning something different than zero) and it was not # signalled # # Returns: # array ref - Returns the output of the command in an array # sub root { _root(1, @_); } # Procedure: silentRoot # # Executes the commands provided through sudo. Use this to execute privileged # commands. Doesn't throw exceptions, only returns the output and the exit # status in the $? variable. # # Parameters: # # commands - strings with the commands to execute # # Returns: # array ref - Returns the output of the command in an array # sub silentRoot { _root(0, @_); } sub _root { my ($wantError, @cmds) = @_; unshift (@cmds, 'set -e') if (@cmds > 1); my $commands = join("\n", @cmds); my $procname = $ENV{script} ? "$0 $ENV{script}" : @ARGV ? "$0 @ARGV" : $0; EBox::debug("$procname (pid: $$) - $commands"); # Create a tempfile to run commands afterwards my ($fhCmdFile, $cmdFile) = tempfile(DIR => EBox::Config::tmp(), SUFFIX => '.cmd'); print $fhCmdFile $commands; close ($fhCmdFile); chmod (0700, $cmdFile); my $sudocmd = "$SUDO_PATH $cmdFile 2> $STDERR_FILE"; my @output = `$sudocmd`; my $ret = $?; unlink $cmdFile; if ($ret != 0) { if ($wantError) { my @error; if ( -r $STDERR_FILE) { @error = read_file($STDERR_FILE); } _rootError($sudocmd, $commands, $ret, \@output, \@error); } } return \@output; } sub _rootError { my ($sudocmd, $cmd, $childError, $output, $error) = @_; if ($childError == -1) { throw EBox::Exceptions::Sudo::Wrapper("Failed to execute $sudocmd"); } elsif ($childError & 127) { my $signal = ($childError & 127); my $coredump = ($childError & 128) ? 'with coredump' : 'without coredump'; throw EBox::Exceptions::Sudo::Wrapper("$sudocmd died with signal $signal $coredump"); } my $exitValue = $childError >> 8; if ($exitValue == 1 ) { # may be a sudo-program error my $errorText = join "\n", @{$error}; if ($errorText =~ m/^sudo:/m) { throw EBox::Exceptions::Sudo::Wrapper("$sudocmd raised the following sudo error: $errorText"); } elsif ($errorText =~ m/is not in the sudoers file/m) { throw EBox::Exceptions::Sudo::Wrapper("$sudocmd failed because either the current user (EUID $>) is not in sudoers files or it has incorrects settings on it. Running /usr/share/zentyal/sudoers-friendly maybe can fix this problem"); } } throw EBox::Exceptions::Sudo::Command(cmd => $cmd, output => $output, error => $error, exitValue => $exitValue) } # Procedure: rootWithoutException # # Executes a command through sudo. This version does not raises exception on error level and must be used _only_ if you take responsability to parse the output or use anorther method to determine success status # # Parameters: # # command - string with the command to execute # # Returns: # array ref - Returns the output of the command in an array sub rootWithoutException { my ($cmd) = @_; validate_pos(@_, 1); my $output; try { $output = root($cmd); } catch EBox::Exceptions::Sudo::Command with { # ignore failed commands my $ex = shift @_; $output = $ex->output(); }; return $output; } # # Procedure: sudo # # Executes a command through sudo as a given user. # # Parameters: # # command - string with the command to execute # user - user to run the command as # # # Exceptions: # # Internal - If command fails # sub sudo # (command, user) { my ($cmd, $user) = @_; validate_pos(@_, 1 ,1); root("$SUDO_PATH -u $user $cmd"); unless ($? == 0) { throw EBox::Exceptions::Internal( __x("Running command '{cmd}' as {user} failed", cmd => $cmd, user => $user)); } } # Procedure: stat # stat a file as root user and returns the information as File::stat object # # Parameters: # $file - file we want stat # # Returns: # a File::Stat object with the file system status for the file # sub stat { my ($file) = @_; validate_pos(@_, 1); my $statCmd = "$STAT_CMD '$file'"; my $statOutput; try { $statOutput = root($statCmd); } catch EBox::Exceptions::Sudo::Command with { $statOutput = undef; }; return undef if !defined $statOutput; return undef if !defined $statOutput->[0]; # this is for systems where stat does not return a different exit code when stating a inexistent file my @statElements = split '[I\n]', $statOutput->[0]; # convert file mode from hexadecimal... $statElements[2] = hex $statElements[2]; # extract minor and major numbers for recereate rdev my $minorNumber = hex (pop @statElements); my $majorNumber = hex (pop @statElements); $statElements[6] = _makeRdev($majorNumber, $minorNumber); my $statObject = File::stat::populate( @statElements ); return $statObject; } # XXX maybe this should be constants.. my $MAJOR_MASK = 03777400; my $MAJOR_SHIFT = 0000010; my $MINOR_MASK = 037774000377; my $MINOR_SHIFT = 0000000; sub _makeRdev { my ($major, $minor) = @_; my $rdev = (($major << $MAJOR_SHIFT) & $MAJOR_MASK) | (($minor << $MINOR_SHIFT) & $MINOR_MASK); return $rdev; } my $anyFileTestPredicate = Perl6::Junction::any(qw(-b -c -d -e -f -g -G -h -k -L -O -p -r -s -S -t -u -w -x) ); # Procedure: fileTest # # Do a file test as the root user. Implemented as a wrapper around the test program # # Parameters: # $test - the file test. File tests allowed: -b -c -d -e -f -g -G -h -k -L -O -p -r -s -S -t -u -w - # $file - file to test # # Returns: # bool value with the result of the file test sub fileTest { my ($test, $file) = @_; validate_pos(@_, 1, 1); ($test eq $anyFileTestPredicate) or throw EBox::Exceptions::Internal("Unknown or unsupported test file predicate: $test (upon $file)"); my $testCmd = "$TEST_PATH $test '$file'"; silentRoot($testCmd); return ($? == 0); # $? was set by execution of $testCmd } 1; zentyal-common-2.3.9+quantal1/src/EBox/Event.pm0000664000000000000000000001506412017102227016156 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Event; # Class: EBox::Event # # This package is intended to support events. These events could be # sent to the control center or it is also be recorded # use strict; use warnings; # Constants: use constant LEVEL_VALUES => qw(info warn error fatal); # eBox uses use EBox::Config; ################## # Core modules ################## use POSIX qw(strftime); ################## # Dependencies ################## use Perl6::Junction qw(any); # Constructor: new # # Create a new object # # Parameters: # # message - String a i18ned message which will be dispatched # # source - String the event watcher/subwatcher name to categorise # afterwards the event depending on the source. # # compMessage - String this field is indicated to distinguish # among events from the same source but the message # is different. We could think of it as a message # which is not i18ned. # # *(Optional)* Default value: undef # # level - Enumerate the level of the event *(Optional)* # Possible values: 'info', 'warn', 'error' or 'fatal'. # Default: 'info' # # timestamp - Int the number of seconds since the epoch (1 Jan 1970) # *(Optional)* Default value: now # # dispatchTo - array ref containing the relative name for the # dispatchers you want to dispatch this event *(Optional)* # Default value: *any*, which means any available dispatcher will # dispatch the event. Concrete example: ControlCenter # # duration - Int the event duration in seconds # Default value: 0, no duration an instant event # # # additional - Hash ref containing additional info for further processing # *(Optional)* Default value: {} # # - Named parameters # # Exceptions: # # - thrown if any argument is # not present # - thrown if any # argument is not from the correct type # sub new { my ($class, %args) = @_; my $self = {}; bless ( $self, $class ); defined ( $args{message} ) or throw EBox::Exceptions::MissingArgument('message'); defined ( $args{source} ) or throw EBox::Exceptions::MissingArgument('source'); if ( defined ($args{level}) ) { unless ( $args{level} eq any(LEVEL_VALUES)) { throw EBox::Exceptions::InvalidType('level', 'enumerate type, possible values: ' . LEVEL_VALUES); } } $self->{message} = delete ( $args{message} ); $self->{source} = delete ( $args{source} ); $self->{compMessage} = delete ( $args{compMessage} ); $self->{level} = delete ( $args{level} ); $self->{level} = 'info' unless defined ( $self->{level} ); $self->{dispatchers} = delete ( $args{dispatchTo} ); $self->{dispatchers} = ['any'] unless defined ( $self->{dispatchers} ); unless ( ref($self->{dispatchers}) eq 'ARRAY' ) { throw EBox::Exceptions::InvalidType('dispatchTo', 'array ref'); } $self->{timestamp} = delete ( $args{timestamp} ); $self->{timestamp} = time() unless defined ( $self->{timestamp} ); $self->{duration} = delete ( $args{duration} ); $self->{duration} = 0 unless ( defined($self->{duration}) ); $self->{additional} = delete ( $args{additional} ); $self->{additional} = {} unless ( defined($self->{additional}) ); return $self; } # Method: message # # Accessor to the i18ned event message # # Returns: # # String - the message # sub message { my ( $self ) = @_; return $self->{message}; } # Method: source # # Accessor to the source of the event, that is, the event # watcher/subwatcher name # # Returns: # # String - the source # sub source { my ( $self ) = @_; return $self->{source}; } # Method: compMessage # # Accessor to the compMessage of the event, that is, the category of # a source from an event. The non-i18ned counterpart of message. # # Returns: # # String - the compMessage field, it could be undef # sub compMessage { my ( $self ) = @_; return $self->{compMessage}; } # Method: level # # Accessor to the event level # # Returns: # # Enum - the level can be 'info', 'warn', 'error' or 'fatal' # sub level { my ( $self ) = @_; return $self->{level}; } # Method: dispatchTo # # Get the dispatcher to dispatch the message # # Returns: # # array ref - the containing the relative name for the # dispatchers you want to dispatch this event # sub dispatchTo { my ($self) = @_; return $self->{dispatchers}; } # Method: timestamp # # Get the event timestamp when the event has been happened # # Returns: # # Int - the event timestamp # sub timestamp { my ($self) = @_; return $self->{timestamp}; } # Method: strTimestamp # # Get the event timestamp in RFC 822 complaint format. That is, # "dayweek, dm month yyyy hh:mm:ss". # # Example: # # Tue, 02 Sep 2007 10:02:12 # # Returns: # # String - the event timestamp in RFC 822 format # sub strTimestamp { my ($self) = @_; return strftime("%a, %d %b %Y %T %z", localtime($self->{timestamp})); } # Method: duration # # Get the event duration. That is, from the event starting point # up to the event was dispatched by the watcher. # # Returns: # # Int - the event duration # sub duration { my ($self) = @_; return $self->{duration}; } # Method: additional # # Get the event additional info for further processing # # Returns: # # Hash ref - the event additional info # sub additional { my ($self) = @_; return $self->{additional}; } # Method: TO_JSON # # Call by JSON::XS::encode # # Returns: # # Unblessed result of this object # sub TO_JSON { my ($self) = @_; return { %{$self} }; } 1; zentyal-common-2.3.9+quantal1/src/EBox/FileSystem.pm0000664000000000000000000002464512017102227017166 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::FileSystem; use strict; use warnings; use base 'Exporter'; our @EXPORT_OK = qw(makePrivateDir cleanDir isSubdir dirDiskUsage dirFileSystem); use Params::Validate; use EBox::Validate; use EBox::Gettext; use EBox::Sudo; use Error qw(:try); use constant FSTAB_PATH => '/etc/fstab'; use constant MTAB_PATH => '/etc/mtab'; # Group: Public procedures # Procedure: makePrivateDir # # Creates a directory owned by the user running this # process and with private permissions. # # Parameters: # # dir - The path of the directory to be created, if it exists it must # already have proper ownership and permissions. # # Exceptions: # # Internal & External - The path exists and is not a directory or has wrong # ownership or permissions. Or it does not exist and # cannot be created. sub makePrivateDir { my ($dir) = @_; validate_pos(@_, 1); if (-e $dir) { if ( not -d $dir) { throw EBox::Exceptions::Internal( "Cannot create private directory $dir: file exists"); } else { return EBox::Validate::isPrivateDir($dir, 1); } } mkdir($dir, 0700) or throw EBox::Exceptions::Internal("Could not create directory: $dir"); } # Procedure: cleanDir # # take action to assure that one or more directories have not # any file into them. To achieve so, these files may be deleted or # directories created # # Parameters: # # dirs - Array list of directories # sub cleanDir { my @dirs = @_; if (@dirs == 0) { throw EBox::Exceptions::Internal('cleanDir must be supplied at least a dir as parameter'); } EBox::Validate::checkFilePath($_, 'directory') foreach (@dirs); foreach my $d (@dirs) { my $dir; my $mode = 0700; if (ref $d eq 'HASH' ) { $dir = $d->{name}; $mode = $d->{mode} } else { $dir = $d; } if (-e $dir) { if (! -d $dir) { throw EBox::Exceptions::Internal("$dir exists and is not a directory"); } system "rm -rf '$dir'/*"; if ($? != 0) { throw EBox::Exceptions::Internal "Error cleaning $dir: $!"; } } else { mkdir ($dir, $mode) or throw EBox::Exceptions::Internal("Could not create directory: $dir"); } } } # Function: isSubdir # # Find if a directory is a sub dir of another. A directory is # always a subdirectory of itself # # Parameters: # # $subDir - String the directory which we want to check if it is a # sub directory. It must be a abolute path # # $parentDir - the possible parent directory # # Returns: # # boolean - Whether the first directory is a subdirectory of the # second or not # sub isSubdir { my ($subDir, $parentDir) = @_; foreach ($subDir, $parentDir) { if (! EBox::Validate::checkAbsoluteFilePath($_)) { throw EBox::Exceptions::Internal("isSubdir can only called with absolute paths. Argumentes were ($subDir, $parentDir)))"); } } # normalize paths $subDir .= '/'; $parentDir .= '/'; $subDir =~ s{/+}{/}g; $parentDir =~ s{/+}{/}g; return $subDir =~ m/^$parentDir/; } # Function: dirIsEmpty # # Find if a directory is empty or not. Not existent directories are considered empty. # # Returns: # - boolean sub dirIsEmpty { my ($dir) = @_; my $empty = 0; try { EBox::Sudo::root("ls $dir/*"); }otherwise { $empty = 1; }; return $empty; } # Function: unusedFileName # # return the first unused fiel name in the form '$file.N' while N are # consecutive numbers. # If N == 0 the suffix is ignored. # Holes in numbers are reused. sub unusedFileName { my ($file) = @_; defined $file or throw EBox::Exceptions::MissingArgument('file'); my $name = $file; my $suffix = 0; while (EBox::Sudo::fileTest('-e', $name)) { $suffix += 1; if ($suffix > 100) { throw EBox::Exceptions::Internal("Maximum suffix name reached: $name"); } $name = $file . '.' . $suffix; } return $name; } # Function: permissionsFromStat # examines a File::stat result object and extract the permissions value # # Parameters: # $stat - stat result object # # Returns: # the permissions as string # sub permissionsFromStat { my ($stat) = @_; return sprintf("%04o", $stat->mode & 07777); } # Function: dirDiskUsage # # Get the space used up by the files and subdirectories in a # directory # # Parameters: # # dir - String directory # blockSize - Int size of the block in bytes. Default: 1 Kb # # Returns: # # Int - the space used in block size units # sub dirDiskUsage { my ($dir, $blockSize) = @_; defined $dir or throw EBox::Exceptions::MissingArgument('dir'); defined $blockSize or $blockSize = 1024; (-d $dir) or throw EBox::Exceptions::External(__x('Directory not found: {d}', d => $dir)); my $duCommand = "/usr/bin/du --summarize --block-size=$blockSize '$dir'"; my @duOutput = @{ EBox::Sudo::silentRoot($duCommand) }; my ($blockCount) = split '\s', $duOutput[0], 2; # du outputs the block count first return $blockCount; } # Function: staticFileSystems # # Return static file systems information as seen in /etc/fstab # file # # Parameters: # bind - whether to include or not bind filesystems (name, default false) # # Returns: # # Hash ref - with the file system as key and a hash with its # properties as value. # # The properties are: mountPoint, type, options, dump and pass # The properties have the same format that the fields in the # fstab file. # sub staticFileSystems { return _fileSystems(FSTAB_PATH, @_); } # Function: fileSystems # # return mounted file systems information as seen in /etc/mtab # # Parameters: # bind - whether to include or not bind filesystems (name, default false) # # Returns: # a hash reference with the file system as key and a hash with his # properties as value. # The properties are: mountPoint, type, options, dump and pass # The properties have the same format that the fields in the fstab file sub fileSystems { return _fileSystems(MTAB_PATH, @_); } # Function: partitionsFileSystems # # return the file system data for mounted disk partitions # # Parameters: # includeRemovables - include removable FS (now detected as FS under /media) # # Returns: # a hash reference with the file system as key and a hash with his # properties as value. # The properties are: mountPoint, type, options, dump and pass # The properties have the same format that the fields in the fstab file # my %noDeviceFs = ( proc => 1, devpts => 1, tmpfs => 1, securityfs => 1, selinuxfs => 1, fuse => 1, devtmpfs => 1, binfmt_misc => 1, gvfs => 1, ); sub partitionsFileSystems { my ($includeRemovable) = @_; my %fileSys = %{ fileSystems() }; while (my ($fs, $attrs) = each %fileSys) { # remove non-device filesystems unless ($fs =~ m{^/}) { delete $fileSys{$fs}; next; } my $type = $attrs->{type}; if (exists $noDeviceFs{$type} and $noDeviceFs{$type}) { delete $fileSys{$fs}; next; } elsif ($type =~ /^fuse\./) { # ignore any fuse files system delete $fileSys{$fs}; next; } if (not $includeRemovable) { # remove removable media files my $mpoint = $attrs->{mountPoint}; if ($mpoint =~ m{^/media/}) { delete $fileSys{$fs}; next; } } } return \%fileSys; } # Group: Private procedures sub _fileSystems { my ($tabFile, %options) = @_; my $includeBind = $options{bind}; my %fileSystems; my $FH; open $FH, $tabFile or throw EBox::Exceptions::Internal($tabFile . ' cannot be opened'); while (my $line = <$FH>) { chomp $line; my ($lineData) = split '#', $line, 2; # remove comments next if not $lineData; next if ($lineData =~ m/^\s*$/); # discard empty lines my ($fsys, $mpoint, $type, $options, $dump, $pass) = split '\s+', $lineData; if ($fsys eq 'none') { # none file sys are ignored by now next; } my @options = split /,/, $options; my $bind = grep { $_ eq 'bind' } @options; if ($bind and not $includeBind) { # ignoring binded filesystems next; } my $attrs = { mountPoint => $mpoint, type => $type, options => $options, dump => $dump, pass => $pass, }; $fileSystems{$fsys} = $attrs; } close $FH or throw EBox::Exceptions::Internal('Cannot properly close ' . FSTAB_PATH); return \%fileSystems; } # Function: dirFileSystem # # Returns: # the file system in which the directory resides # sub dirFileSystem { my ($dir) = @_; (-d $dir) or throw EBox::Exceptions::External(__x('Directory not found: {d}', d=>$dir)); my $fs; my $dirToCheck = $dir; my $realFSFound = 0; while (not $realFSFound) { my $dfOutput = EBox::Sudo::root("df '$dirToCheck'"); my $infoLine =$dfOutput->[1]; chomp $infoLine; ($fs) = split '\s+', $infoLine; defined $fs or throw EBox::Exceptions::Internal("Cannot find file system for directory $dir"); if (EBox::Sudo::fileTest('-d', $fs)) { # this is a bind fs.. $dirToCheck = $fs; } else { $realFSFound = 1; } } return $fs; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Gettext.pm0000664000000000000000000001301212017102227016510 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Gettext; use Locale::gettext; use EBox::Config; BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = qw{ __ __n __x __d __dx __s __sx __p __px settextdomain gettextdomain langs }; %EXPORT_TAGS = ( DEFAULT => \@EXPORT ); @EXPORT_OK = qw(); $VERSION = EBox::Config::version; } my $cur_domain = 'zentyal'; my $old_domain; use constant SUBS_DOMAIN => 'zentyal-subscription'; use constant PROF_DOMAIN => 'zentyal-prof'; # Method: settextdomain # # Sets the curent message domain # # Parameters: # # domain - The domain name # sub settextdomain # (domain) { my $domain = shift; textdomain($domain); bindtextdomain($domain, EBox::Config::locale()); my $old_domain = $cur_domain; $cur_domain = $domain; return $old_domain; } # Method: gettextdomain # # Gathers the curent message domain # # Returns: # # The current message domain # sub gettextdomain { return $cur_domain; } sub __ # (text) { my ($msgid) = @_; # FIXME: Probably there is a better way to do this # and avoid setting the domain every time, so this is a # temporary solution my $string = __d($msgid, 'zentyal'); $string =~ s/\'/\'\;/g; $string =~ s/\"/\"\;/g; return $string; } sub __n # (text) { my $string = shift; my ($p, $a, $c) = caller; return $string; } sub __x # (text, %variables) { my ($msgid, %vars) = @_; #FIXME: my $string = gettext($msgid); my $string = __d($msgid, 'zentyal'); return __expand($string, %vars); } sub __d # (text,domain) { my ($string, $domain) = @_; return '' unless ($string); bindtextdomain($domain, EBox::Config::locale()); textdomain($domain); $string = gettext($string); textdomain($cur_domain); return $string; } sub __dx # (text,domain, %variables) { my ($string, $domain, %vars) = @_; return '' unless ($string); bindtextdomain($domain, EBox::Config::locale()); textdomain($domain); $string = gettext($string); textdomain($cur_domain); return __expand($string, %vars); } sub __s # (text) { my ($text) = @_; return __d($text, SUBS_DOMAIN); } sub __sx # (text, %variables) { my ($text, %vars) = @_; return __dx($text, SUBS_DOMAIN, %vars); } sub __p # (text) { my ($text) = @_; return __d($text, PROF_DOMAIN); } sub __px # (text, %variables) { my ($text, %vars) = @_; return __dx($text, PROF_DOMAIN, %vars); } sub __expand # (translation, %arguments) { my ($translation, %args) = @_; my $re = join '|', map { quotemeta $_ } keys %args; $translation =~ s/\{($re)\}/defined $args{$1} ? $args{$1} : "{$1}"/ge; return $translation; } my $langs = undef; # Method: langname # # Gathers the current set language # # Returns: # # the current domain language # sub langname # (locale) { my ($locale) = @_; return langs()->{$locale}; } # Method: langs # # gathers the available languages # # Returns: # # hash reference - containing the available languages. Each key # represents a *locale* and its value contains the associated # language # sub langs { unless (defined $langs) { $langs = {}; $langs->{'an_ES.UTF-8'} = 'Aragonés'; $langs->{'bn_BD.UTF-8'} = 'Bengali'; $langs->{'bg_BG.UTF-8'} = 'Български'; $langs->{'es_ES.UTF-8'} = 'Español'; $langs->{'et_EE.UTF-8'} = 'Eesti'; $langs->{'ca_ES.UTF-8'} = 'Català'; $langs->{'cs_CZ.UTF-8'} = 'Czech'; $langs->{'da_DK.UTF-8'} = 'Dansk'; $langs->{'de_DE.UTF-8'} = 'Deutsch'; $langs->{'el_GR.UTF-8'} = 'ελληνικά'; if (EBox::Config::configkey('english_locale')) { $langs->{'en_US.UTF-8'} = 'English'; } else { $langs->{'C'} = 'English'; } $langs->{'eu_ES.UTF-8'} = 'Euskara'; $langs->{'fa_IR.UTF-8'} = 'فارسی'; $langs->{'fr_FR.UTF-8'} = 'Français'; $langs->{'gl_ES.UTF-8'} = 'Galego'; $langs->{'hu_HU.UTF-8'} = 'Magyar'; $langs->{'it_IT.UTF-8'} = 'Italiano'; $langs->{'ja_JP.UTF-8'} = '日本語'; $langs->{'lt_LT.UTF-8'} = 'Lietuvių'; $langs->{'nb_NO.UTF-8'} = 'Norsk (bokmål)'; $langs->{'nl_BE.UTF-8'} = 'Nederlands'; $langs->{'pl_PL.UTF-8'} = 'Polski'; $langs->{'pt_BR.UTF-8'} = 'Português do Brasil'; $langs->{'pt_PT.UTF-8'} = 'Português'; $langs->{'ro_RO.UTF-8'} = 'Română'; $langs->{'ru_RU.UTF-8'} = 'Русский'; $langs->{'sv_SE.UTF-8'} = 'Svenska'; $langs->{'th_TH.UTF-8'} = 'ภาษาไทย'; $langs->{'tr_TR.UTF-8'} = 'Türkçe'; $langs->{'uk_UA.UTF-8'} = 'украї́нська'; $langs->{'zh_CN.UTF-8'} = '汉字'; $langs->{'zh_TW.UTF-8'} = '繁體中文'; } return $langs; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/0000775000000000000000000000000012017102227016652 5ustar zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/External.pm0000664000000000000000000000251512017102227020775 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::External; use base 'EBox::Exceptions::Base'; use EBox::Gettext; # Constructor: new # # An exception called when a user defined parameter is wrong and # it is going to be shown to the user # # Parameters: # # text - the localisated text to show to the user # sub new { my $class = shift; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $self = $class->SUPER::new(@_); bless ($self, $class); $Log::Log4perl::caller_depth++; $self->log; $Log::Log4perl::caller_depth--; return $self; } sub _logfunc { my ($self, $logger, $msg) = @_; $logger->debug($msg); } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Internal.pm0000664000000000000000000000220712017102227020765 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Internal; use base 'EBox::Exceptions::Base'; use Log::Log4perl; use EBox::Gettext; sub new # (text) { my $class = shift; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $self = $class->SUPER::new(@_); bless ($self, $class); $Log::Log4perl::caller_depth++; $self->log; $Log::Log4perl::caller_depth--; return $self; } sub _logfunc # (logger, msg) { my ($self, $logger, $msg) = @_; $logger->error($msg); } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/DeprecatedMethod.pm0000664000000000000000000000331112017102227022407 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::DeprecatedMethod # # Internal exception raised when a deprecated method has been # called at runtime package EBox::Exceptions::DeprecatedMethod; use base 'EBox::Exceptions::Internal'; use Log::Log4perl; use EBox::Gettext; sub new { my $class = shift; local $Error::Depth = $Error::Depth + 3; local $Error::Debug = 1; my ($package, $filename, $line, $subroutine) = caller(2); # this is to avoid anonymous subroutines created by try/catch if ($subroutine eq 'main::__ANON__') { # check for try presence my ($idle1, $idle2, $idle3, $subroutine4th) = caller(4); if ($subroutine4th eq 'Error::subs::try') { ($package, $filename, $line, $subroutine) = caller(5); } } my $errorTxt = "Call to deprecated method $subroutine in $filename line $line"; $Log::Log4perl::caller_depth += 3; $self = $class->SUPER::new($errorTxt); $Log::Log4perl::caller_depth -= 3; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/InvalidData.pm0000664000000000000000000000314212017102227021370 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::InvalidData # # External exception raised when a user enters a value for a data # which is invalid. An advice to the user may be set. package EBox::Exceptions::InvalidData; use base 'EBox::Exceptions::External'; use EBox::Gettext; sub new # (data=>string, value=>string, advice => string) { my $class = shift; my %opts = @_; my $data = delete $opts{data}; utf8::decode($data); my $value = delete $opts{value}; my $advice = delete $opts{advice}; my $error = __x("Invalid value for {data}: {value}.", data => $data, value => $value); if (defined $advice) { $error .= "\n$advice"; } local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($error, @_); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Base.pm0000664000000000000000000000333312017102227020064 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Base; use base 'Error'; use Log::Log4perl; use EBox::Gettext; use EBox; # Constructor: new # # Create a new exception base class # # Parameters: # # text - String the exception text (Positional) # # Named parameters: # # silent - Boolean indicating not logging when it sets to true # sub new # (text) { my $class = shift; my $text = shift; my (%opts) = @_; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $self = $class->SUPER::new(-text => $text, @_); if (exists $opts{silent} and $opts{silent}) { $self->{silent} = 1; } else { $self->{silent} = 0; } bless ($self, $class); return $self; } sub toStderr { $self = shift; print STDERR "[EBox::Exceptions] ". $self->stringify() ."\n"; } sub _logfunc # (logger, msg) { my ($self, $logger, $msg) = @_; $logger->debug($msg); } sub log { $self = shift; my $log = EBox::logger(); $Log::Log4perl::caller_depth +=3; $self->_logfunc($log, $self->stringify()) unless $self->{silent}; $Log::Log4perl::caller_depth -=3; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Protocol.pm0000664000000000000000000000301312017102227021006 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Protocol; # Class: EBox::Exceptions::Protocol # # An exception launched when the TCP/IP protocol has failed in # some way. For instance, a connection cannot be made. # use base 'EBox::Exceptions::Base'; use EBox::Gettext; # Group: Public methods # Constructor: new # # Create exception object # # Parameters: # # statusCode - Integer the status code given # text - String the text given by the protocol # sub new # (statusCode, text) { my ($class, $statusCode, $text) = @_; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $self = $class->SUPER::new(("$statusCode $text")); bless ($self, $class); $Log::Log4perl::caller_depth++; $self->log; $Log::Log4perl::caller_depth--; return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/NotConnected.pm0000664000000000000000000000245212017102227021576 0ustar # Copyright (C) 2011-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::NotConnected # # External exception raised when Zentyal could not connect to package EBox::Exceptions::NotConnected; use base 'EBox::Exceptions::External'; use EBox::Gettext; sub new { my ($class, $text, @extraParams) = @_; if (not $text) { $text = __('Cannot connect to Zentyal Cloud. Check your Internet connection.'); } local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($text, @extraParams); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/NotImplemented.pm0000664000000000000000000000252112017102227022134 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::NotImplemented # # Internal exception raised when a method is not yet # implemented. It could be used in an Abstract class in order to # simulate its behaviour. package EBox::Exceptions::NotImplemented; use base 'EBox::Exceptions::Internal'; use Log::Log4perl; use EBox::Gettext; sub new { my $class = shift; my $method = shift; my $caller = shift; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new("Method '$method' not implemented in ". "'$caller'"); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/DataMissing.pm0000664000000000000000000000260212017102227021413 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::DataMissing # # External exception raised when a user ignores a compulsory # element which has to be filled to apply the configuration # change. package EBox::Exceptions::DataMissing; use base 'EBox::Exceptions::External'; use EBox::Gettext; sub new # (data=>string) { my $class = shift; my %opts = @_; my $data = delete $opts{data}; utf8::decode($data); my $error = __x("{data} is empty.", data => $data); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($error, @_); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Sudo/0000775000000000000000000000000012017102227017564 5ustar zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Sudo/Wrapper.pm0000664000000000000000000000230612017102227021543 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Sudo::Wrapper; use base 'EBox::Exceptions::Sudo::Base'; # package: # this class exists to notify any sudo error which does not relates to the exceutiomn of the actual command (sudoers error, bad command, etc..) use strict; use warnings; sub new { my $class = shift @_; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth += 1; my $self = $class->SUPER::new(@_); $Log::Log4perl::caller_depth -= 1; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Sudo/Base.pm0000664000000000000000000000167212017102227021002 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Sudo::Base; use base EBox::Exceptions::Internal; # package: # this package only exists to give sudo-related exceptions a common parent use strict; use warnings; sub new { my $class = shift @_; return $class->SUPER::new(@_); } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Sudo/Command.pm0000664000000000000000000000213312017102227021477 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Sudo::Command; use base qw(EBox::Exceptions::Command EBox::Exceptions::Sudo::Base); use strict; use warnings; sub new { my ($class, @constructorParams) = @_; push @constructorParams, (cmdType => 'root command'); $Log::Log4perl::caller_depth += 1; my $self = $class->SUPER::new(@constructorParams); $Log::Log4perl::caller_depth -= 1; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/DataInUse.pm0000664000000000000000000000210412017102227021022 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::DataInUse # # Internal exception raised when there is a data in eBox which # it is about to be removed which it is being used by another # part of eBox. # package EBox::Exceptions::DataInUse; use base 'EBox::Exceptions::Internal'; use Log::Log4perl; use EBox::Gettext; sub new # { my $class = shift; $self = $class->SUPER::new(@_); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/DataNotFound.pm0000664000000000000000000000271312017102227021541 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::DataNotFound # # External exception raised when a user searches for an element # which does not exist in eBox. package EBox::Exceptions::DataNotFound; use base 'EBox::Exceptions::External'; use EBox::Gettext; sub new # (data=>string, value=>string) { my $class = shift; my %opts = @_; my $data = delete $opts{data}; utf8::decode($data); my $value = delete $opts{value}; my $error = __x("{data} {value} does not exist.", data => $data, value => $value); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($error, @_); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/InvalidType.pm0000664000000000000000000000310312017102227021435 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::InvalidType; use base 'EBox::Exceptions::Internal'; use Log::Log4perl; # Constructor: new # # This exception is taken to say the type of an argument is not # the correct one. # # Parameters: # # arg - the mistaken argument # type - the correct type # # - Positional parameters # # Returns: # # The newly created exception # sub new # (arg, type) { my $class = shift; my ($arg, $type) = @_; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; my $argType = ref ($arg); $argType = 'scalar' unless ( $argType ); $Log::Log4perl::caller_depth++; $self = $class->SUPER::new("Invalid type for argument: $arg with type " . $argType . ', which should be this type: ' . $type); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Lock.pm0000664000000000000000000000241112017102227020076 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Exceptions::Lock; use base 'EBox::Exceptions::Internal'; use Log::Log4perl; use EBox::Gettext; sub new # (module) { my $class = shift; my $mod = shift; my $err; if ($mod->isa('EBox::Module')) { $err = "Could not get lock for module: " . $mod->name; } else { $err = "Could not get lock for service: $mod"; } local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($err); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/Command.pm0000664000000000000000000000731712017102227020576 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::Command # # Internal exception raised when a command has failed, that is, # its returned value is different from zero. # package EBox::Exceptions::Command; use base 'EBox::Exceptions::Internal'; use strict; use warnings; use Params::Validate qw(validate SCALAR ARRAYREF); # Group: Public methods # Constructor: new # # This exception is taken to say the type of an argument is not # the correct one. # # Parameters: # # (NAMED) # cmd - String the launched command # output - array ref the standard output, every component is a line # *(Optional)* Default value: empty array # error - array ref the standard error, every component is a line # *(Optional)* Default value: empty array # exitValue - Integer the returned value from the command # # cmdType - String the command type. *(Optional)* Default value: # 'eBox command' # # # Returns: # # The newly created exception # sub new { my $class = shift @_; validate (@_, { cmd => { type => SCALAR }, output => { type => ARRAYREF, default => []}, error => { type => ARRAYREF, default => []}, exitValue => { type => SCALAR }, cmdType => { type => SCALAR, default => 'eBox command'}, } ); my %params = @_; my $self; my $cmd = $params{cmd}; my $output = $params{output} ; my $error = $params{error}; my $exitValue = $params{exitValue}; my $cmdType = $params{cmdType}; local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; # we need this ugly workaround because Exceptions::Internal constructor logs the error parameter my $errorMsg = _errorMsg($cmdType, $cmd, $error, $output, $exitValue); $Log::Log4perl::caller_depth += 1; $self = $class->SUPER::new($errorMsg); $Log::Log4perl::caller_depth -= 1; $self->{cmd} = $cmd; $self->{output} = $output; $self->{error} = $error; $self->{exitValue} = $exitValue; bless ($self, $class); return $self; } # Method: cmd # # Return the command string # # Returns: # # String - the command string # sub cmd { my ($self) = @_; return $self->{cmd}; } # Method: output # # Return the standard output in an array # # Returns: # # Array ref - the standard output, one line per element # sub output { my ($self) = @_; return $self->{output}; } # Method: error # # Return the standard error in an array # # Returns: # # Array ref - the standard error, one line per element # sub error { my ($self) = @_; return $self->{error}; } # Method: exitValue # # Return the exit value # # Returns: # # Int - the exit value # sub exitValue { my ($self) = @_; return $self->{exitValue}; } # Group: Private methods sub _errorMsg { my ($cmdType, $cmd, $error, $output, $exitValue) = @_; my $errorStr = join ' ', @{ $error }; my $outputStr = join ' ', @{ $output }; $cmdType = '' unless defined($cmdType); return "$cmdType $cmd failed. \nError output: $errorStr\nCommand output: $outputStr. \nExit value: $exitValue"; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/DataExists.pm0000664000000000000000000000271012017102227021261 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::DataExists # # External exception raised when a user wants to add an element # to eBox which already exists. package EBox::Exceptions::DataExists; use base 'EBox::Exceptions::External'; use EBox::Gettext; sub new # (data=>string, value=>string) { my $class = shift; my %opts = @_; my $data = delete $opts{data}; utf8::decode($data); my $value = delete $opts{value}; my $error = __x("{data} {value} already exists.", data => $data, value => $value); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($error, @_); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Exceptions/MissingArgument.pm0000664000000000000000000000273212017102227022330 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Class: EBox::Exceptions::MissingArgument # # Internal exception raised when a compulsory argument is # missing in a method call package EBox::Exceptions::MissingArgument; use base 'EBox::Exceptions::External'; use Log::Log4perl; use EBox::Gettext; # Constructor: new # # An exception called when a mandatory argument is missing a # block call # # Parameters: # # arg - the argument name # sub new { my $class = shift; my $arg = shift; utf8::decode($arg); my $error = __x('Missing argument: {data}', data => $arg); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; $Log::Log4perl::caller_depth++; $self = $class->SUPER::new($error, @_); $Log::Log4perl::caller_depth--; bless ($self, $class); return $self; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Validate.pm0000664000000000000000000004635212017102227016632 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Validate; use strict; use warnings; use EBox::Config; use EBox::Exceptions::InvalidData; use EBox::Gettext; use EBox::NetWrappers qw(); use Net::IP; use Mail::RFC822::Address; use Data::Validate::Domain qw(is_hostname); use constant IFNAMSIZ => 16; #Max length name for interfaces BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = qw(); %EXPORT_TAGS = (all => [qw{ checkCIDR checkIP checkNetmask checkIPNetmask checkProtocol checkPort checkName checkMAC checkVifaceName checkDomainName checkHost isIPInNetwork checkVlanID isPrivateDir isANumber isAPositiveNumber checkFilePath checkAbsoluteFilePath } ], ); @EXPORT_OK = qw(); Exporter::export_ok_tags('all'); $VERSION = EBox::Config::version; } # Function: isIPInNetwork # # Checks if an IP is within a given network address and its masks # # Parameters: # # network_ip - network address # network_mask - network mask for above address # host_ip - host address to check it belongs to the given network # # Returns: # # boolean - True if the address is within the network, false otherwise # sub isIPInNetwork # net_ip, net_mask, host_ip { my ($net_ip, $net_mask, $host_ip) = @_; my $net_net = EBox::NetWrappers::ip_network($net_ip, $net_mask); my $bits = EBox::NetWrappers::bits_from_mask($net_mask); my $ip = new Net::IP("$net_net/$bits"); my $ip2 = new Net::IP($host_ip); return ($ip2->overlaps($ip)==$IP_A_IN_B_OVERLAP); } # Function: checkCIDR # # Check the validity for a given CIDR block # # Parameters: # # cidr - CIDR block to check # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if the cidr is correct, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # - CIDR is incorrect # sub checkCIDR # (cidr, name?) { my $cidr = shift; my $name = shift; my $ip; my @values = split(/\//, $cidr); if(@values == 2) { my ($address,$mask) = @values; if(checkIP($address)) { my $netmask = EBox::NetWrappers::mask_from_bits($mask); if($netmask){ my $network = EBox::NetWrappers::ip_network($address, $netmask); if ($network eq $address) { $ip = new Net::IP("$network/$mask"); } } } } unless($ip) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $cidr); } else { return undef; } } return 1; } # Function: checkIP # # Checks if the string param that holds an ip address is a valid # IPv4 address. # # Parameters: # # ip - IPv4 address # name - ip's name to be used when throwing an Exception (optional) # # Returns: # # boolean - True if it is a valid IPv4 address, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - IP is invalid # sub checkIP # (ip, name?) { my $ip = shift; my $name = shift; if("$ip\." =~ m/^(([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){4}$/){ my $first = (split(/\./, $ip))[0]; if(($first != 0) and ($first < 224)) { return 1; } } if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $ip); } else { return undef; } } # Function: checkIP6 # # Checks if the string param that holds an ip address is a valid # IPv6 address. # # Parameters: # # ip - IPv6 address # name - ip's name to be used when throwing an Exception (optional) # # Returns: # # boolean - True if it is a valid IPv4 address, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - IP is invalid # sub checkIP6 # (ip, name?) { my ($ip, $name) = @_; if (Net::IP::ip_is_ipv6($ip)) { return 1; } if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $ip); } else { return undef; } } # Function: checkNetmask # # Checks if the string param that holds a network mask is valid . # # Parameters: # # nmask - network mask # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid network mask, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - mask is incorrect # sub checkNetmask # (mask, name?) { my $nmask = shift; my $name = shift; my $error; if("$nmask\." =~ m/^(([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){4}$/){ my $bits; foreach (split(/\./, $nmask)){ $bits .= unpack( "B*", pack( "C", $_ )); } unless ($bits =~ /^((0+)|(1+0*))$/){ $error = 1; } } else { $error = 1; } if ($error) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $nmask); } else { return undef; } } return 1; } # # Function: checkIPNetmask # # Checks if the IP and the mask are valid and that the IP is not a # network or broadcast address with the given mask. # # Note that both name_ip and name_mask should be set, or not set at all # # # Parameters: # # ip - IPv4 address # mask - network mask address # name_ip - Data's name to be used when throwing an Exception # name_mask - Data's name to be used when throwing an Exception # Returns: # # boolean - True if it is a valid IPv4 address, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - ip/mask is incorrect # sub checkIPNetmask # (ip, mask, name_ip?, name_mask?) { my ($ip,$mask,$name_ip, $name_mask) = @_; my $error = 0; checkIP($ip,$name_ip); if ($mask eq '255.255.255.255') { return 1; } checkNetmask($mask,$name_mask); my $ip_bpack = pack("CCCC", split(/\./, $ip)); my $mask_bpack = pack("CCCC", split(/\./, $mask)); my $net_bits .= unpack("B*", $ip_bpack & (~$mask_bpack)); my $broad_bits .= unpack("B*", $ip_bpack | $mask_bpack); if(($net_bits =~ /^0+$/) or ($broad_bits =~ /^1+$/)){ $error = 1; } if ($error) { if ($name_ip) { throw EBox::Exceptions::InvalidData ('data' => $name_ip . "/" . $name_mask, 'value' => $ip . "/" . $mask); } else { return undef; } } return 1; } # Function: checkPort # # Check if the given port is valid # # Parameters: # # port - port number # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid port, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - ip/mask is incorrect # sub checkPort # (port, name?) { my $pnumber = shift; my $name = shift; unless($pnumber =~/^\d+$/){ if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $pnumber); } else { return undef; } } if (($pnumber > 0) and ($pnumber <= 65535)) { return 1; } else { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $pnumber); } else { return undef; } } } # # Function: checkVlanID # # Checks if the given vlan identifier is valid. The valid identifers are # numbers betwwen 01 and 4096 (both included) # # Parameters: # # id - vlan idintifier # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid vlan id, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - id is incorrect # sub checkVlanID # (id, name?) { my $id = shift; my $name = shift; unless($id =~/^\d+$/){ if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $id, 'advice' => __('Must be a number between 1 and 4096') ); } else { return undef; } } if (($id > 0) && ($id <= 4096)) { return 1; } else { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $id, 'advice' => __('Must be a number between 1 and 4096') ); } else { return undef; } } } # Function: checkProtocol # # Checks if the given protocol is valid (tcp or udp) # # Parameters: # # proto - protocolo's name # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid protocol , false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - protocol is incorrect # sub checkProtocol # (protocol, name?) { my $proto = shift; my $name = shift; # FIXME: Ask for them to -> Double dependency if ($proto eq 'tcp' ) { return 1; } elsif ($proto eq 'udp' ) { return 1; } elsif ($proto eq 'all' ) { return 1; } elsif ($proto eq 'icmp') { return 1; } elsif ($proto eq 'gre' ) { return 1; } else { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $proto); } else { return undef; } } } # # Function: checkMAC # # Checks if the given mac address is valid # # Parameters: # # mac - mac address # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid mac address, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - protocol is incorrect # sub checkMAC # (mac, name?) { my ($origMac, $name) = @_; my $mac = $origMac . ':'; unless ($mac =~ /^([0-9a-fA-F]{2}:){6}$/) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $origMac); } else { return undef; } } return 1; } # Function: checkVifaceName # # Checks if a virtual interface name is correct. The whole name's length # (real + virtual interface) must be no longer than IFMASIZ. Only # alphanumeric characters are allowed. # # Parameters: # # real - real interface (i.e: eth0, eth1..) # virtual - virtual interface (i.e: foo, bar) # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid virtual interface, false otherwise # # Exceptions: # # If name is passed an exception could be raised # # InvalidData - protocol is incorrect # sub checkVifaceName # (real, virtual, name?) { my $iface = shift; my $viface = shift; my $name = shift; my $fullname = $iface . ":" . $viface; unless (($viface =~ /^\w+$/) and (length($fullname) < IFNAMSIZ)){ if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $viface); } else { return undef; } } return 1; } # Function: checkName # # Checks if a given name is valid. # # To be a valid name it must fulfil these requirements # # - starts with a letter # - contains only letters, numbers and '_' # - isn't longer than 20 characters # # Parameters: # # name - name to check # # Returns: # # boolean - True if it is a valid name, false otherwise # sub checkName # (name) { my $name = shift; (length($name) <= 20) or return undef; (length($name) > 0) or return undef; ($name =~ /^[\d_]/) and return undef; ($name =~ /^\w/) or return undef; ($name =~ /\W/) and return undef; return 1; } # TODO: Remove this once the call from the mail wizard is changed # to the checkDomainName public function sub _checkDomainName { my ($domain) = @_; $domain =~ s/\.$//; return is_hostname($domain); } # Function: checkDomainName # # Checks if a given domain name is valid. # # Parameters: # # domain - domain to check # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if it is a valid domain name, false otherwise # sub checkDomainName # (domain, name?) { my ($domain, $name) = @_; # According to RFC underscores are forbidden in "hostnames" but not "domainnames" my $options = { domain_allow_underscore => 1 }; $domain =~ s/\.$//; unless (is_hostname($domain, $options)) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $domain); } else { return undef; } } return 1; } # Function: checkHost # # Checks if a given host is valid. It is considered valid either a valid # no-CIDR IP address or a valid hostname # # # Parameters: # # host - host to check # name - Data's name to be used when throwing an Exception. # # Returns: # # boolean - True if it is a valid domain name, false otherwise # sub checkHost # (domain, name?) { my ($host, $name) = @_; # if the host is made only of numbers and points we check it # as a IP address otherwise we check it as a hostname if ( $host =~ m/^[\d.]+$/ ) { return checkIP($host, $name); } else { return checkDomainName($host, $name); } } # Function: checkEmailAddress # # Check the validity for a given FQDN email address # # Parameters: # # address - email address to check # name - Data's name to be used when throwing an Exception # # Returns: # # boolean - True if the address is correct. False on failure when # parameter name is NOT defined # # Exceptions: # # If name is passed an exception will be raised on failure # # - address is incorrect # sub checkEmailAddress { my ($address, $name) = @_; unless (Mail::RFC822::Address::valid($address)) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $address); } else { return undef; } } return 1; } # Function: isPrivateDir # # Check if the given directory is private and owned by the current user # # Parameters: # # dir - The directory # throwException - wether to throw a exception if the check fails (default: false) # # Returns: # true if the parameter is a number, undef otherwise. # sub isPrivateDir { my ($dir, $throwException) = @_; my @stat = stat($dir) ; if (@stat == 0) { throw EBox::Exceptions::External (__x("Cannot stat dir: {dir}. This may mean that the directory does not exist or the permissions forbid access to it", dir => $dir)) if $throwException; return undef; } if ($< != $stat[4]) { throw EBox::Exceptions::External(__x('The directory {dir} is not private; because it is owned by another user', dir => $dir)) if $throwException; } my $perm = sprintf ("%04o\n", $stat[2] & 07777); unless ($perm =~ /.700/) { throw EBox::Exceptions::External(('The directory {dir} is not private; because it has not restrictive permissions', dir => $dir)) if $throwException; return undef; } } # Function: isANumber # # Check if the parameter is a number. # # Parameters: # # value - The parameter to test. # # Returns # true if the parameter is a number, undef otherwise. # sub isANumber # (value) { my $value = shift; ($value =~ /^-?[\d]+$/) and return 1; return undef; } # Function: isZeroOrNaturalNumber # # Check if the parameter is a positive number or zero. # # Parameters: # # value - The parameter to test. # # Returns: # true if the parameter is a postive number, undef otherwise. # sub isZeroOrNaturalNumber # (value) { my $value = shift; ($value =~ /^[\d]+$/) and return 1; return undef; } # Function: checkFilePath # # checks if a given file path is sintaxically correct # # Parameters: # $filePath - file path to check # $name - if this parameter is present we will throw a exception when given a non-correct path using this as name of the data # # Returns: # true if the parameter is sintaxically correct, undef otherwise. sub checkFilePath # (filePath, name) { my ($filePath, $name) = @_; # see Regexp::Common::URI::RFC1738 in CPAN for inspiration in the regex my $fpart = q{[:alpha:\-\$_.+!*(),][|\#]+ }; # there are missing character but this will suffice for now... my $fPathRegex = "($fpart)?(/$fpart)*"; if ( $filePath =~ m/$fPathRegex/ ) { return 1; } else { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $filePath, 'advice' => __("The file path supplied is not valid. (Currently not all of the valid file's characters are supported) ") ); } else { return undef; } } } # Function: checkAbsoluteFilePath # # checks if a given absolute file path is sintaxically correct # # Parameters: # $filePath - file path to check # $name - if this parameter is present we will throw a exception when given a non-correct path using this as name of the data # # Returns: # true if the parameter is sintaxically correct and an absolute path, undef otherwise. sub checkAbsoluteFilePath { my ($filePath, $name) = @_; my $isValidPath = checkFilePath($filePath, $name); $isValidPath or return undef; if ( ( $filePath =~ m{^[^/]} ) or ( $filePath =~ m{/\.+/} ) ) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $filePath, 'advice' => __("The file path must be absolute") ); } else { return undef; } } return 1; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Config.pm0000664000000000000000000001505112017102227016276 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Config; use EBox::Exceptions::External; use EBox::Gettext; use Config::Tiny; my $ref = {}; $ref->{prefix} = "/usr"; $ref->{datadir} = "/usr/share"; $ref->{sysconfdir} = "/etc"; $ref->{localstatedir} = "/var"; $ref->{libdir} = "/var/lib"; for my $key (keys(%{$ref})) { if (substr($ref->{$key},-1) ne '/') { $ref->{$key} = ($ref->{$key} . '/'); } } $ref->{version} = "@VERSION@"; $ref->{perlpath} = '/usr/share/perl5/'; my @confFiles; my %cachedFiles; sub refreshConfFiles { @confFiles = glob (EBox::Config::etc() . '*.conf'); } sub etc { return $ref->{sysconfdir} . 'zentyal/'; } sub var { return $ref->{localstatedir}; } # Function: configkeyFromFile # # Get a configuration key from the specified file # # Parameters: # # key - String the configuration key # file - String the configuration file path # # Returns: # # String - the configuration value for that key if found # # undef - if the configuration key is not in the configuration file # # Exceptions: # # - thrown if the file cannot be # opened # sub configkeyFromFile # (key, file) { my ($key, $file) = @_; my $configKeys = configKeysFromFile($file); return $configKeys->{$key}; } sub configkey # (key) { my ($key) = @_; unless (@confFiles) { refreshConfFiles(); } my $value = undef; foreach my $file (@confFiles) { $value = configkeyFromFile($key, $file); last if defined ($value); } if (defined ($value)) { return $value; } else { return ''; } } sub boolean { my ($key) = @_; return (configkey($key) eq 'yes'); } sub configkeys # (key) { my ($key) = @_; unless (@confFiles) { refreshConfFiles(); } my @values; foreach my $file (@confFiles) { my $value = configkeyFromFile($key, $file); push (@values, $value) if defined ($value); } return \@values; } # Function: configKeysFromFile # # Get all configuration keys from a file # # Parameters: # # file - String the configuration file path # # Returns: # # hash ref - the keys with their values as it follows: # # key - String the key name # value - String the value for that key # # Exceptions: # # - thrown if the file cannot be # opened # sub configKeysFromFile # (file) { my ($file) = @_; unless (exists $cachedFiles{$file}) { $cachedFiles{$file} = Config::Tiny->read($file) or throw EBox::Exceptions::External( __x('Could not open the config file {file}.', file => $file)); } return $cachedFiles{$file}->{_}; } sub user { my $user = configkey('user'); $user or throw EBox::Exceptions::External( __('The ebox user has not been set in the config file.')); return $user; } sub gids { my $user = user(); my $gids = `id -G $user`; chomp ($gids); return $gids; } sub uid { my $uid = getpwnam(user()); return $uid; } sub group { my $value = configkey('egroup'); $value or throw EBox::Exceptions::External('The ebox group has not '. 'been set in the config file.'); return $value; } sub home { my $user = user(); my ($name,$passwd,$uid,$gid, $quota,$comment,$gcos,$dir,$shell,$expire) = getpwnam($user); return $dir; } sub prefix { return $ref->{prefix}; } sub share { return $ref->{datadir}; } # FIXME: is this used? sub lib { return $ref->{libdir}; } sub scripts { my ($module) = @_; if (defined $module) { return $ref->{datadir} . "zentyal-$module/"; } else { return $ref->{datadir} . 'zentyal/'; } } sub locale { return $ref->{datadir} . 'locale/'; } sub conf { return $ref->{localstatedir} . 'lib/zentyal/conf/'; } sub tmp { return $ref->{localstatedir} . 'lib/zentyal/tmp/'; } sub shm { return '/run/shm/zentyal'; } # Method: downloads # # Get the path of the directory where the files to be downloaded are put # # Returns: # # String - the path to that directory sub downloads { return tmp(); } sub passwd { return $ref->{localstatedir} . 'lib/zentyal/conf/ebox.passwd'; } # Method: sessionid # # Get the path where Web session identifier is stored # # Returns: # # String - the path to that file sub sessionid { return $ref->{localstatedir} . 'lib/zentyal/conf/ebox.sid'; } # Method: scriptSession # # Get the path where the script session identifier is stored # # Returns: # # String - the path to that file # sub scriptSession { return $ref->{localstatedir} . 'lib/zentyal/conf/ebox.script-sid'; } sub log { return $ref->{localstatedir} . 'log/zentyal/'; } sub logfile { return $ref->{localstatedir} . 'log/zentyal/zentyal.log'; } sub modules { return $ref->{datadir} . 'zentyal/modules/'; } sub stubs { return $ref->{datadir} . 'zentyal/stubs/'; } sub cgi { return $ref->{datadir} . 'zentyal/cgi/'; } sub templates { return $ref->{datadir} . 'zentyal/templates/'; } sub schemas { return $ref->{datadir} . 'zentyal/schemas/'; } sub www { return $ref->{datadir} . 'zentyal/www/'; } sub css { return $ref->{datadir} . 'zentyal/www/css/'; } sub images { return $ref->{datadir} . 'zentyal/www/images/'; } sub dynamicwww { return $ref->{localstatedir} . 'lib/zentyal/dynamicwww/'; } sub dynamicwwwSubdirs { return [ dynamicimages(), dynamicRSS() ]; } sub dynamicimages { return dynamicwww() . 'images/'; } sub dynamicRSS { return dynamicwww() . 'feed/'; } sub version { return $ref->{version}; } sub lang { return $ref->{lang}; } # Method: perlPath # # Get the PERL path where the perl modules lying on (Static # method). # # Returns: # # String - the perl path # sub perlPath { return $ref->{perlpath}; } sub hideExternalLinks { return configkey('custom_prefix'); } 1; zentyal-common-2.3.9+quantal1/src/EBox/TestStub.pm0000664000000000000000000000346612017102227016655 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::TestStub; # Description: Test stub for EBox perl package. # It changes the log process to use stdout instead of a file just writable by ebox # use strict; use warnings; use EBox; use Test::MockObject; use Log::Log4perl qw(:easy); my $logLevel; sub fake { my ($minLogLevel) = @_; (defined $minLogLevel) or $minLogLevel = 'debug'; my %logLevelsByName = ( 'debug' => $DEBUG, 'info' => $INFO, 'warn' => $WARN, 'error' => $ERROR, 'fatal' => $FATAL, ); (exists $logLevelsByName{$minLogLevel}) or die "Incorrect log level: $minLogLevel"; $logLevel = $logLevelsByName{$minLogLevel}; Test::MockObject->fake_module('EBox', logger => \&_mockedLogger, ); } sub unfake { delete $INC{'EBox.pm'}; eval 'use EBox'; ($@) and die "Error unfaking EBox: $@"; } my $loginit; sub _mockedLogger { my ($cat) = @_; defined($cat) or $cat = caller; unless ($loginit) { Log::Log4perl->easy_init( { level => $logLevel, layout => '# [EBox log]%d %m%n', } ); $loginit = 1; } return Log::Log4perl->get_logger($cat); } 1; zentyal-common-2.3.9+quantal1/src/EBox/Sudo/0000775000000000000000000000000012017102227015443 5ustar zentyal-common-2.3.9+quantal1/src/EBox/Sudo/TestStub.pm0000664000000000000000000000273212017102227017562 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Sudo::TestStub; # Description: # use strict; use warnings; use EBox::Sudo; use File::Temp qw(tempfile); # XXX there are unclear situation with comamnds containig ';' but this is also de case of EBox::Sudo use Readonly; Readonly::Scalar our $GOOD_SUDO_PATH => $EBox::Sudo::SUDO_PATH; Readonly::Scalar our $FAKE_SUDO_PATH => ''; Readonly::Scalar our $GOOD_STDERR_FILE => $EBox::Sudo::STDERR_FILE; my ($fh,$tmpfile) = tempfile(); close $fh; Readonly::Scalar our $FAKE_STDERR_FILE => $tmpfile; sub fake { *EBox::Sudo::SUDO_PATH = \$FAKE_SUDO_PATH; *EBox::Sudo::STDERR_FILE = \$FAKE_STDERR_FILE; } sub unfake { *EBox::Sudo::SUDO_PATH = \$GOOD_SUDO_PATH; *EBox::Sudo::STDERR_FILE = \$GOOD_STDERR_FILE; } sub isFaked { return $EBox::Sudo::SUDO_PATH ne $GOOD_SUDO_PATH; } 1; zentyal-common-2.3.9+quantal1/src/EBox/Config/0000775000000000000000000000000012017102227015736 5ustar zentyal-common-2.3.9+quantal1/src/EBox/Config/TestStub.pm0000664000000000000000000000553412017102227020060 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::Config::TestStub; # Description: # use strict; use warnings; use Test::MockObject; use Perl6::Junction qw(all); use EBox::Config; use Error qw(:try); # XXX: Derivated paths are ttoally decoupled from their base path (datadir, sysconfdir, localstatedir, libdir) # possible solution 1: rewrite EBox::Config so the derivated elements use a sub to get the needed element # possible solution 2: rewrite this package to have specialized fakes for those subs my %config = _defaultConfig(); # this hash hold the configuration items sub _defaultConfig { my @defaultConfig; my @configKeys = qw(prefix etc var user group share libexec locale conf tmp passwd sessionid log logfile stubs cgi templates schemas www css images version lang ); foreach my $key (@configKeys) { my $configKeySub_r = EBox::Config->can($key); defined $configKeySub_r or die "Can not find $key sub in EBox::Config module"; my $value; try { $value = $configKeySub_r->(); } otherwise { # ignore systems where configuration files are not installed $value = undef; print "\n\nFailed: $key \n";; }; push @defaultConfig, ($key => $value ); } return @defaultConfig; } sub fake { my @fakedConfig = @_; if ( @fakedConfig > 0) { setConfigKeys(@fakedConfig); } } sub _checkFakeParams { my %params = @_; } sub unfake { delete $INC{'EBox/Config.pm'}; eval 'use EBox::Config'; $@ and die "Error reloading EBox::Config: $@"; } sub _checkConfigKeysParameters { my %params = @_; # check parameters... if (@_ == 0) { die "setConfigKeys called without parameters"; } my $allCorrectParam = all (keys %config); my @incorrectParams = grep { $_ ne $allCorrectParam } keys %params; if (@incorrectParams) { die "called with the following incorrect config key names: @incorrectParams"; } } sub setConfigKeys { my %fakedConfig = @_; print "checkConfigKey\n\n"; _checkConfigKeysParameters(@_); my @fakeSubs;; while ( my ($configKey, $fakedResult) = each %fakedConfig ) { push @fakeSubs, ($configKey => sub { return $fakedResult }); } Test::MockObject->fake_module('EBox::Config', @fakeSubs ); } 1; zentyal-common-2.3.9+quantal1/src/EBox/ColourRange.pm0000664000000000000000000000372412017102227017315 0ustar # Copyright (C) 2008-2012 eBox Technologies S.L. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package EBox::ColourRange; # Class: EBox::ColourRange # # This class is intended to return a range of colours in RGB # which are similar and no kick in the head because of their # combination # use strict; use warnings; my @colours = ( '000000', #black '00BFFF', # deep sky blue '5C4033', # dark brown '2F4F2F', # dark green 'FF8C00', # dark orange 'FF1493', # deep pink '9932CC', # darok orchid 'D9D919', # bright gold 'C0C0C0', # silver grey '000080', # navy blue 'DEB887', # burlywood 'ADFF2F', # green yellow 'FF2400', # orange red 'FFB6C1', # light pink 'DDA0DD', # plum 'B8860B', # DarkGoldenrod '856363', # green cooper ); # Function: range # # Return a range of colours in RGB format. # # The number of colours is limited. So if you asked for more # colours, a loop will be done and reuse the same colours again # # Parameters: # # n - Int the number of colours # # Returns: # # Array ref - the colours in the range, its number will 'n' # sub range { my ($n) = @_; my @c; while ($n > @colours) { push @c, @colours; $n = $n - @colours; } push @c, @colours[0 .. ($n -1)]; return \@c; } 1; zentyal-common-2.3.9+quantal1/src/EBox/interactiveTests/0000775000000000000000000000000012017102227020071 5ustar zentyal-common-2.3.9+quantal1/src/EBox/interactiveTests/Sudo.t0000664000000000000000000000102612017102227021167 0ustar # Description: use strict; use warnings; use Test::More tests => 1; use Test::Exception; use Error qw(:try); use lib '../..'; use EBox::Sudo::TestStub; use EBox::TestStub; EBox::TestStub::fake(); # to covert log in logfiel to msg into stderr exceptionTest(); sub exceptionTest { diag "The following check assummes that the current user is not in the sudoers file"; throws_ok { EBox::Sudo::root("/bin/ls /") } 'EBox::Exceptions::Sudo::Wrapper', "Checking that Wrapper exception is raised when sudo itself failed"; } 1; zentyal-common-2.3.9+quantal1/extra/0000775000000000000000000000000012017102227014230 5ustar zentyal-common-2.3.9+quantal1/extra/eboxlog.conf0000664000000000000000000000052712017102227016542 0ustar log4perl.logger.EBox=DEBUG, A1 log4perl.appender.A1=Log::Log4perl::Appender::File log4perl.appender.A1.filename=/var/log/zentyal/zentyal.log log4perl.appender.A1.mode=append log4perl.appender.A1.owner=ebox log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n zentyal-common-2.3.9+quantal1/extra/files.list0000664000000000000000000000004312017102227016224 0ustar eboxlog.conf /var/lib/zentyal/conf zentyal-common-2.3.9+quantal1/TESTING0000664000000000000000000000201212017102227014140 0ustar TEST DEPENDENCIES ------------ + Debian packages: # apt-get install + libtest-exception-perl + libtest-tester-perl + libtest-mockobject-perl + libtest-differences-perl + modules from cpan + Test::Output + Test::File TEST DEPENDENCIES WITH EBOX --------------------------- The following libebox's tests need ebox installed to run: + src/EBox/t/Sudo.t + src/EBox/Config/t/TestStub.t TEST DIRECTORIES ----------- 1.- 't' The tests in this directory will been executed by 'make check'. Of course, you may execute them manually using the Perl interpreter or the prove tool 2.- 'rootTests' The tests in this directory requires root permissions. So they won't be executed automatically with 'make check'; you must gain root status and execute them manually 3.- 'interactiveTests' The tests in this directory needs user interaction and some of them root permissions. They won't be executed by 'make check'; you must execute the manually and, in some cases, with root status zentyal-common-2.3.9+quantal1/ChangeLog0000664000000000000000000004015612017102227014665 0ustar 2.3.9 + Add uid function to return the uid of the zentyal user + Added EBox::FileSystem::unusedFileName() to find free file names 2.3.8 + Added new EBox::trace() method to easily log stack traces when debugging 2.3.7 + Added method EBox::FileSystem::isDirEmpty + Better logging of sudo commands in debug including process name and PID + Better exclusion of non-device filesystems in EBox::FileSystem::partitionsFileSystems 2.3.6 + External commands called through EBox::Sudo are logged in debug mode + Added new EBox::Config::shm() to get Zentyal shared memory dir 2.3.5 + Added additional() and TO_JSON() to EBox::Event + Allow underscores in domain names 2.3.4 + Temporary download files are now stored in tmp directory + EBox::FileSystem ignore all fuse daemon filesystem (type begins with 'fuse.') 2.3.3 + Packaging fixes for precise 2.3.2 + Updated Standards-Version to 3.9.2 2.3.1 + New EBox::Config::boolean() to avoid string comparisons all over the code to check if the key is set to 'yes' or 'no' + Add conflicts with sudo-ldap on debian/control. + EBox::FileSystem::partitionsFileSystems ignores more pseudo file systems. File systems without mount point are always ignored. 2.3 + Set debug = yes by default for beta series + Workaround to silence some permission denied errors caused by loading the GD library after the user has changed to ebox + Cache list of ifaces to improve performance + Delete useless EBox::Config::package() method + Add duration attribute to EBox::Event + Ignore by default bind filesystems in EBox::FileSystem method + Bugfix: MAC validation now forbids parts with only one character + Replaced autotools with zbuildtools 2.2.2 + Ignore last dot if exists when validating domain names 2.2.1 + Do not log debug messages unless debug = yes is set in zentyal.conf + New hideExternalLinks method added to EBox::Config 2.1.10 + Avoid wrong translations of empty strings + Add the __p and __px for zentyal-prof gettext domain 2.1.9 + Do not use set -e in EBox::Sudo::root when there is only one command + Make MissingArgument exception text translatable + Avoid UTF8 double-encoding problems in some exceptions 2.1.8 + EBox::Gettext::langs() inits now languages if requested instead of doing it on everytime the module is load, also use english locale instead of C when config key is defined + EBox::FileSystem::partitionsFileSystems more tolerant to avoid false negatives + Fixed problems in FileSystem with directories containing spaces + EBox::Sudo::root fails when any command fails, not only the last one 2.1.7 + Do not crash when "du" gives permission denied on mount points like .gvfs + Added new dump_exceptions confkey disabled by default so the debug confkey can be set to yes again to harvest useful info in the logs 2.1.6 + Set debug=no by default for the release candidates and the final 2.2 2.1.5 + Better implementation of EBox::FileSystem::dirFileSystem more straightforward and without symlink problems 2.1.4 + Added ip_mac method to NetWrappers 2.1.3 + Bugfix: list_ifaces() only returns real ifaces now + Call EBox::Config::refreshConfFiles only when needed + Use all user groups on EBox::init() gid change 2.1.2 + Improved performance of the NetWrappers::list_ifaces method 2.1.1 + Deleted useless methods in NetWrappers + New EBox::Config::refreshConfFiles to avoid problem restoring backups + Added new NotConnected exception + Properly encode sudo command list to avoid wide character errors + Added Thai language + Added getFreePort method to EBox::NetWrappers + Moved partitionsFileSystems method to EBox::FileSystem, added parameter to include file systems in /media + Remote device file systems appear now in partitionsFileSystems 2.1 + New EBox::Config::modules() for /usr/share/zentyal/modules + New EBox::Config::scripts() to replace EBox::Config::libexec and EBox::Config::pkgdata, accepting module name as argument + Replace /etc/ebox/99ebox.conf with /etc/zentyal/zentyal.conf + Do not read configuration files everytime, config keys are now cached with their values + New /var/log/zentyal replaces /var/log/ebox + Added Greek language 2.0.7 + Added compMessage field to EBox::Event + Bugfix: actionCell parameters are now passed correctly 2.0.6 + Added link to download software.log in unexpected error page 2.0.5 + Removed error message on file tests + Workaround for POST params validation with webkit based browsers + Added support for printableActionName in DataTable's + Better behaviour of read-only rows with up/down arrows + Add missing semicolon to HTML entities 2.0.4 + Aesthetic improvement in modal boxes + Bugfix: Escape ' and " as HTML entities in gettext to fix problems with the dashboard in some languages + Fixed error when trying to read an undefined configkey 2.0.3 + Validation of domain names using Data::Validate::Domain + Added Bengali language + Added Simplified Chinese to language selection + Added two icons for ebox-software 2.0.2 + Fixed a backward compatibility issue when checking if a network interface is up 2.0.1 + Use sysfs to retrieve network interfaces information + Added permanent messages to composite viewer + Bugfix: Show permanent messages and message below page title if the model has pageTitle property + Added Lithuanian language + Added Romanian to the language selection 1.5.10 + Improved reload icon + Remove duplicated action in EBox::Sudo::_root + Added bps and millisecond types to format monitor graphs 1.5.9 + Zentyal rebranding + Added web page favicon + Add new methods __s and __sx for official strings for subscriptions + Give support for HTML::Mason exceptions in error page 1.5.8 + Added Ukranian locale (uk_UA) + Added missing CIDR values between /16 and /8 + New function orderRow(field, order) added to table_order.js + Fixed problem with icons in tableorderer header 1.5.7 + New method for escaping strings in mason, fixes problems with non-latin encodings + Redis as configuration backend (instead of gconf) + Bug fix: Error in table_orderer search and order 1.5.6 + Added bg.gif asc.gif desc.gif required for tableorderer + Moved tableorderer.css to talbeorderer.css.mas in the ebox package 1.5.5 + Added table_orderer.js and tableorderer.css required for new ebox-software 1.5.4 + GUI improvements in search box + Override user modifications by default + Fixed usercorner dbus init 1.5.3 + Removed annoying _validateReferer debug message 1.5.2 + Security [ESN-1-1]: Added _validateReferer method needed for CSRF fix + Improved error page with instructions on how to report the problem 1.5.1 + Added Czech language + Add field help to old-school templates with MVC + Add optional text to old-school templates with MVC + Updated translations: de, et, hu, id, it, nb, nl, pt, pt_BR, ru, sk, sr 1.5 + Use external libraries: scriptaculous and prototype and don't ship them as third-party stuff + Bugfix: Show help text from DataForm + Set override_user_modification to no 1.4.2 + Added Estonian language 1.4.1 + Updated translations: es, ru, nb 1.4 + Added Hungarian as an available language + Bug fix: i18n + Add -k__dx to extract i18n strings 1.3.14 + Renamed Castilian to Spanish + Add tableBodyWithoutEdit.mas 1.3.13 + Added warning when we can't get lock for service + Bug fix: keep menu folders open during page reloads + Add booleanInPlaceViewer.mas + Add sendInPlaceBooleanValue() to table-helper.js + eval() response from sendInPlaceBooleanValue() to set "Save Changes" button properly + Accept 255.255.255.255 in checkIPNetmask as valid (needed for PPPoE) 1.3.12 + Change look&feel of readOnly row to make it obvious they are read-only 1.3.11 + Set the active tab using hash from the location browser + Add suport for silent exceptions. In a few places we use exceptions for flow control (which is wrong). This exceptions shouldn't be logged. + fixed bug in network address setter that allowed to choose 24 bits as valid netmask + Add support for breadcrumbs on the UI 1.3.10 + Don't ask when a user modification is found by default + Set HOME environment variable in EBox::init() 1.3.7 + Add support for permanent messages 1.3.6 + Change default logger and set default creation owner to ebox + Bugfix: EBox::Sudo::root() not longer letfs behind a .cmd file after each call 1.3.5 + moved public.css and login.css to ebox package + Support customFilter in models for big tables 1.3.4 + bugfix: EBox::Sudo::sudo wasn't working properly + use ebox-dbus-check to test if we can actually connect to dbus 1.1.41 + bugfix: use encodeURIComponent to fetch data from fields using Ajax 1.1.30 + Menu entries are now grouped by functionality + Fixed order of items in menu (no more 'random' order) + Added missing netmask values for network addresses between 16 and 32 + Fixed regression with already used values in select types 1.1.20 + Support for custom view + Fix in netwrappers: iface methofd now retuns the ifcaes sorted 1.1.10 + UI improvement: submit Ajax forms by pressing return 1.1 + Fixing bogus div and missing items to make eBox Web UI more w3c complaint + Added generic JS graph class using flotr with mouse tracking and legend + Added remote services link button + Added support for `additionalParameters` to `EBox.TabMenu` JS prototype + Added `configKeysFromFile` to `EBox::Config` + Bugfix: make boolean setter honour editable attribute + Change tableBody to fetch each row instead of all rows at the same time + Place pager on the bottom-right corner of the table + Bugfix: hide trailing text when there's a change on a union select 0.12.101 + Bugfix: Remove bogus mason tags + Bugfix: Use 'window' as variable instead of 'Window' since it is more portable 0.12.100 + Remove bogus div end tag + Fix items list for titles with single quotes + Fix: precondition fail message is not showed when it does not exist 0.12.99 + Add new table view without actions + Add javascript library to generate report charts + Fixing redirect URL coming from proxy + Added Chinese from Taiwan and Galician translations 0.12.2 + Bugfix: Fix an issue with javascript and the union type that prevented things like samba share UI from working ok 0.12.1 + Bugfix: Get logger from EBox category if it is not set explicity to allow external programs to log using eBox log helper functions 0.12 + Added .field_help class in public.css + Add field help to modelView.mas + Stripe tables in hang table + Use again the loading gif when switching tabs + Add completedAjaxRequest and startAjaxRequest to be used as helpers for automated testing with ANSTE + Fix port validation with "<=" 65535 + Display 24 as default value in `IPNetwork` default setter + Comment out some debug + Bugfix. Create redirection URLs using client headers and guessing checking the protocol (HTTP or HTTPS) + Add spinner gif to modalbox window + Make EBox::Config::configKeyFromFile non-greedy to parse values properly + IPNetwork control has a default mas kvalue of 24 0.11.102 + Added `override_user_modification` configuration parameter to avoid user modification checkings and override them without asking + Use the new EBox::Model::Row api 0.11.101 + Bugfix: Minor bugfix when checking uniqueness in Select type + Added Japanese translation 0.11.100 + Add groups() to set groups eBox belongs to: ebox, adm, lp... + Use eBox tmp directory to create std* files + Fix an annoying warning found when interpoling undef values + Fix an annoying warning found when interpoling undef values 0.11.99 + Fix rendering bug in hasMany viewer closing an open tag + Added `EBox::ColourRange` to handle colour ranges + Enhanced look&feel on model viewers 0.11 + New release 0.10.99 + New upstream release 0.10 + Changes on generic table: css, pager, icons 0.9.100 + Improvements on ajax table + Add table page + Add table filter + Added generic ajax form + Add SOAP session file + Add EBox::Event class to support events in eBox + Upgrade to PrototypeJS 1.5.1.1 0.9.99 + Enhanced HTML mason templates 0.9.3 + New release 0.9.2 + New upload method 0.9.1 + Add JS functions to show/hide elements 0.9 + Generic multitable with AJAX to handle 3D tables (used in trafficshaping module) + More mason components and better support for testing mason components + Added Aragonese translation + Added Dutch translation + Added German translation + Added Portuguese translation 0.8.1 + New release 0.8 + New release 0.7.99 + Add test stubs for ease testing + Add setters for EBox::CGI::Base + Add default _process with parameters validation behaviour to EBox::CGI::Base + New sudo handling with custom exceptions + Mason templates for common controls and form tables + Some API extensions and bug-fixing + Refactored and increased test coverture 0.7.1 + GUI improvements + Change "save changes" button color when changes are unsaved 0.7 + First public release 0.6 + Move common code to common/libebox + Add support for __d + API documented using naturaldocs + Update debian scripts 0.5.1 + New menu system + New firewall filtering rules + 802.1q support 0.5 + New bug-free menus (actually Internet Explorer is the buggy piece of... software that caused the reimplementation) + Lots of small bugfixes + Firewall: apply rules with no destination address to packets routed through external interfaces only + New debianize script + Firewall: do not require port and protocol parameters as they are now optional. + Include SSL stuff in the dist tarball + Let modules block changes in the network interfaces configuration if they have references to the network config in their config. + Debian network configuration import script + Fix the init.d script: it catches exceptions thrown by modules so that it can try to start/stop all of them if an exception is thrown. + Firewall: fix default policy bug in INPUT chains. + Restore textdomain in exceptions + New services section in the summary + Added Error item to Summary. Catch exceptions from modules in summary and generate error item + Fix several errors with redirections and error handling in CGIs + Several data validation functions were fixed, and a few others added + Prevent the global module from keeping a reference to itself. And make the read-only/read-write behavior of the factory consistent. + Stop using ifconfig-wrapper and implement our own NetWrapper module with wrappers for ifconfig and ip. + Start/stop apache, network and firewall modules in first place. + Ignore some network interface names such as irda, sit0, etc. + The summary page uses read-only module instances. + New DataInUse exception, old one renamed to DataExists. + Network: do not overwrite resolv.conf if there are nameservers given via dhcp. + Do not set a default global policy for the ssh service. + Check for forbiden characters when the parameter value is requested by the CGI, this allows CGI's to handle the error, and make some decissions before it happens. + Create an "edit object" template and remove the object edition stuff from the main objects page. + Fix the apache restarting code. + Network: Remove the route reordering feature, the kernel handles that automatically. + Fix tons of bugs in the network restarting code. + Network: removed the 3rd nameserver configuration. + Network: Get gateway info in the dhcp hook. + Network: Removed default configuration from the gconf schema. + New function for config-file generation + New functions for pid file handling 0.4 + debian package + added module to export/import configuration + changes in firewall's API + Added content filter based on dansguardian + Added French translation + Added Catalan translation + Sudoers file is generated automatically based on module's needs + Apache config file is generated by ebox now + Use SSL + Added ebox.conf file + Added module template generator 0.3 + Supports i18n + API name consistency + Use Mason for templates + added tips to GUI + added dhcp hooks + administration port configuration + Fixed bugs to IE compliant + Revoke changes after logout + Several bugfixes 0.2 + All modules are now based on gconf. + Removed dependencies on xml-simple, xerces and xpath + New MAC address field in Object members. + Several bugfixes. 0.1 + Initial release zentyal-common-2.3.9+quantal1/AUTHORS0000664000000000000000000000024012017102227014151 0ustar Copyright (C) 2004-2012 eBox Technologies S.L. For an updated list of the current and past developers please visit: http://trac.zentyal.org/wiki/Contributors