/* WARNING: This file was generated by dkct. Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: itadmin.ctr */ /* Copyright (C) 2012-2017, Dirk Krause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above opyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** @file itadmin.c The itadmin module. */ #line 1755 "itadmin.ctr" #include "dk3all.h" #include "itadmin.h" #if 0 #include "dkt-version.h" #endif #include "dk4vers.h" #line 1766 "itadmin.ctr" /** Keywords used by the program, not localized. */ static dkChar const * const itadmin_kw_noloc[] = { /* 0 */ dkT("dktools"), /* 1 */ dkT("itadmin.str"), /* 2 */ dkT("itadmin "), /* 3 */ dkT("itadmin.txt"), /* 4 */ dkT("itadmin.conf"), NULL #line 1794 "itadmin.ctr" }; /** Localized message texts. */ static dkChar const * const itadmin_kw[] = { /* 0 */ dkT("Network documentation"), /* 1 */ dkT("Network documentation"), /* 2 */ dkT(""), /* 3 */ dkT("Hosts"), /* 4 */ dkT("Other hosts"), /* 5 */ dkT("Overview"), /* 6 */ dkT("Purpose:"), /* 7 */ dkT("Inventory ID:"), /* 8 */ dkT("Serial no:"), /* 9 */ dkT("not specified"), /* 10 */ dkT("Main user:"), /* 11 */ dkT("Place:"), /* 12 */ dkT("Network"), /* 13 */ dkT("IP address:"), /* 14 */ dkT("DNS domain:"), /* 15 */ dkT("MAC address:"), /* 16 */ dkT("Ethernet socket:"), /* 17 */ dkT("DHCP class:"), /* 18 */ dkT("DHCP group:"), /* 19 */ dkT("Netgroups"), /* 20 */ dkT("IP address from DHCP pool, dynamically assigned to DHCP clients"), /* 21 */ dkT("BYOD DHCP"), /* 22 */ dkT("Bring your own device, use DHCP"), /* 23 */ dkT("This is a ``bring your own device'' system, not owned by our organizational"), /* 24 */ dkT("unit."), /* 25 */ dkT("This host is not owned by our organizational unit, it is a computer outside."), /* 26 */ dkT("It is listed in configuration files and documentation because there is a"), /* 27 */ dkT("need for communication between our computers and this system."), /* 28 */ dkT("IP address dynamically assigned to computers."), /* 29 */ dkT("Parent groups"), /* 30 */ dkT("Subgroups"), /* 31 */ dkT("Additional network interface."), /* 32 */ dkT("Member hosts"), /* 33 */ dkT("DHCP pools"), /* 34 */ dkT("Start address:"), /* 35 */ dkT("End address:"), /* 36 */ dkT("Allow unknown clients:"), /* 37 */ dkT("Deny unknown clients:"), /* 38 */ dkT("Allow class:"), /* 39 */ dkT("yes"), /* 40 */ dkT("no"), /* 41 */ dkT("DHCP classes"), /* 42 */ dkT("Ethernet connectors"), /* 43 */ dkT("Connector"), /* 44 */ dkT("Room"), /* 45 */ dkT("VLAN"), /* 46 */ dkT("Speed"), /* 47 */ dkT("Hub port"), /* 48 */ dkT("Available licenses"), /* 49 */ dkT("The licenses listed here were purchased by the organizational unit"), /* 50 */ dkT("but not (yet) assigned to a user or computer."), /* 51 */ dkT("License report"), /* 52 */ dkT("licenses"), /* 53 */ dkT("Single computer license"), /* 54 */ dkT("Purchase process ID:"), /* 55 */ dkT("Delivery date:"), /* 56 */ dkT("Delivery note ID:"), /* 57 */ dkT("Invoice date:"), /* 58 */ dkT("Invoice ID:"), /* 59 */ dkT("Complete license list"), /* 60 */ dkT("Host unknown"), /* 61 */ dkT("Assignment to host not specified"), /* 62 */ dkT("Other people's hosts"), /* 63 */ dkT("Licenses used on other people's hosts"), /* 64 */ dkT("The licenses listed in this section were assigned to the user."), /* 65 */ dkT("There is no information available (yet) on which computers the licenses"), /* 66 */ dkT("are used."), /* 67 */ dkT("The licenses listed in this section were assigned to the user."), /* 68 */ dkT("At this time they are used on computers other people are"), /* 69 */ dkT("responsible for."), /* 70 */ dkT("Note:"), /* 71 */ dkT("These licenses are listed twice in the license report:"), /* 72 */ dkT("Once in the section for the host and once again here."), /* 73 */ dkT("This special situation is indicated in the host licenses section by"), /* 74 */ dkT("the license owner name written in an"), /* 75 */ dkT("italic font."), /* 76 */ dkT("-"), /* 77 */ dkT("Expanding netgroup dependencies."), /* 78 */ dkT("Writing \"hosts\" file."), /* 79 */ dkT("Writing \"hosts.ldif\" file."), /* 80 */ dkT("Writing \"ethers\" files."), /* 81 */ dkT("Writing \"ethers.ldif\" file."), /* 82 */ dkT("Writing \"netgroup.ldif\" file."), /* 83 */ dkT("Writing \"dhcpd.conf\" file."), /* 84 */ dkT("Writing \"netdocu.tex\" file."), /* 85 */ dkT("Writing \"licenses.tex\" file."), /* 86 */ dkT("Finished writing output files."), /* 87 */ dkT("Reading users table."), /* 88 */ dkT("Reading buildings table."), /* 89 */ dkT("Reading network speed types table."), /* 90 */ dkT("Reading VLANs table."), /* 91 */ dkT("Reading ethernet connectors table."), /* 92 */ dkT("Reading netgroups table."), /* 93 */ dkT("Reading netgroup dependencies table."), /* 94 */ dkT("Reading networks table."), /* 95 */ dkT("Reading DHCP classes table."), /* 96 */ dkT("Reading DHCP groups table."), /* 97 */ dkT("Reading DHCP pools table."), /* 98 */ dkT("Reading hosts table."), /* 99 */ dkT("Reading host name aliases table."), /* 100 */ dkT("Reading DHCP options table."), /* 101 */ dkT("Reading software manufacturers table."), /* 102 */ dkT("Reading software products table."), /* 103 */ dkT("Reading license types table."), /* 104 */ dkT("Reading licenses table."), /* 105 */ dkT("Finished reading input from database."), /* 106 */ dkT("Not a boolean value: \""), /* 107 */ dkT("\"!"), /* 108 */ dkT("Configuration value text \""), /* 109 */ dkT("\" too long!"), /* 110 */ dkT("No such database type: \""), /* 111 */ dkT("\"!"), /* 112 */ dkT("A value text is required!"), /* 113 */ dkT("Unknown configuration option \""), /* 114 */ dkT("\"!"), /* 115 */ dkT("Syntax error - \"=\" and value required!"), /* 116 */ dkT("Input line too long!"), /* 117 */ dkT("Missing end of section name!"), /* 118 */ dkT("File name \""), /* 119 */ dkT("\"\ncontains wildcards, this is not allowed!"), /* 120 */ dkT("File name \""), /* 121 */ dkT("\"\nis not an absolute path name!"), /* 122 */ dkT("Missing database host name!"), /* 123 */ dkT("Missing database name!"), /* 124 */ dkT("Missing DHCP VLAN name!"), /* 125 */ dkT("Missing organization name!"), /* 126 */ dkT("Missing organizational unit name!"), /* 127 */ dkT("Missing administrator name!"), /* 128 */ dkT("Missing database credentials file name!"), /* 129 */ dkT("Missing database user name!"), /* 130 */ dkT("Missing database user password!"), /* 131 */ dkT("No configuration file(s) \"itadmin.conf\" found!#"), /* 132 */ dkT("Configuration problems,\nplease check the itadmin.conf configuration files!"), /* 133 */ dkT("Unsupported database type!"), /* 134 */ dkT("DHCP pool \""), /* 135 */ dkT("\": Inconsistent setup!\nUnknown clients can be allowed or denied to use a pool, not both!"), /* 136 */ dkT("DHCP class \""), /* 137 */ dkT("\" assigned to pools in different networks!"), /* 138 */ dkT("\": Missing allowed DHCP class name!"), /* 139 */ dkT("No such VLAN: \""), /* 140 */ dkT("\"!"), /* 141 */ dkT("Failed to obtain results list for database query!"), /* 142 */ dkT("Failed to query database!"), /* 143 */ dkT("Table \"licenses\", record "), /* 144 */ dkT(" Primary key is not numeric!"), /* 145 */ dkT(" Missing primary key!"), /* 146 */ dkT("License type \""), /* 147 */ dkT("\": Not a number \""), /* 148 */ dkT("\"!"), /* 149 */ dkT("Table \"swmanufacturers\" record "), /* 150 */ dkT(" Missing primary key!"), /* 151 */ dkT("Table \"dhcpoptions\" record "), /* 152 */ dkT(" Primary key is not numeric!"), /* 153 */ dkT(" Missing primary key!"), /* 154 */ dkT("Failed to set database encoding!"), /* 155 */ dkT("Failed to connect to database \""), /* 156 */ dkT("\" at host \""), /* 157 */ dkT("\"!"), /* 158 */ dkT("Illegal database name: \""), /* 159 */ dkT("\"!"), /* 160 */ dkT("Failed to convert database user passwort to UTF-8!"), /* 161 */ dkT("Failed to convert database user name \""), /* 162 */ dkT("\" to UTF-8!"), /* 163 */ dkT("Failed to convert database host name \""), /* 164 */ dkT("\" to UTF-8!"), /* 165 */ dkT("Failed to initialize MySQL client object!"), /* 166 */ dkT("Failed to initialize MySQL client library!"), /* 167 */ dkT("MySQL database support not available!"), /* 168 */ dkT("User name \""), /* 169 */ dkT("\": Duplicated entry!"), /* 170 */ dkT("Building \""), /* 171 */ dkT("\": Duplicated entry!"), /* 172 */ dkT("Ethernet speed setting \""), /* 173 */ dkT("\": Duplicated entry!"), /* 174 */ dkT("VLAN \""), /* 175 */ dkT("\": Duplicated entry!"), /* 176 */ dkT("Computer \""), /* 177 */ dkT("\": Duplicated entry!"), /* 178 */ dkT("Software manufacturer \""), /* 179 */ dkT("\": Duplicated entry!"), /* 180 */ dkT("Netgroup \""), /* 181 */ dkT("\": Duplicated entry!"), /* 182 */ dkT("Netgroup \""), /* 183 */ dkT("\" not defined!"), /* 184 */ dkT("Ethernet connector \""), /* 185 */ dkT("\": Duplicated entry!"), /* 186 */ dkT("Ethernet speed setting \""), /* 187 */ dkT("\" not defined!"), /* 188 */ dkT("VLAN \""), /* 189 */ dkT("\" not defined!"), /* 190 */ dkT("Building \""), /* 191 */ dkT("\" not defined!"), /* 192 */ dkT("Failed to convert net mask \""), /* 193 */ dkT("\"!"), /* 194 */ dkT("Using default net mask 255.255.255.0!"), /* 195 */ dkT("Failed to convert default gateway \""), /* 196 */ dkT("\"!"), /* 197 */ dkT("Using default gateway "), /* 198 */ dkT("."), /* 199 */ dkT("Failed to convert broadcast address \""), /* 200 */ dkT("\"!"), /* 201 */ dkT("Network \""), /* 202 */ dkT("\": Duplicated entry!"), /* 203 */ dkT("Attempt to define IP network without specifying an IP address!"), /* 204 */ dkT("DHCP class \""), /* 205 */ dkT("\": Duplicated entry!"), /* 206 */ dkT("DHCP group \""), /* 207 */ dkT("\": Duplicated entry!"), /* 208 */ dkT("Invalid network address \""), /* 209 */ dkT("\"!"), /* 210 */ dkT("DHCP class \""), /* 211 */ dkT("\" not defined!"), /* 212 */ dkT("Network \""), /* 213 */ dkT("\" not defined!"), /* 214 */ dkT("DHCP pool \""), /* 215 */ dkT("\": Invalid end address!"), /* 216 */ dkT("DHCP pool \""), /* 217 */ dkT("\": Missing end address!"), /* 218 */ dkT("DHCP pool \""), /* 219 */ dkT("\": Invalid start address!"), /* 220 */ dkT("DHCP pool definition attempted with empty start address!"), /* 221 */ dkT("Computer \""), /* 222 */ dkT("\": Illegal MAC address!"), /* 223 */ dkT("Computer \""), /* 224 */ dkT("\": MAC address too long!"), /* 225 */ dkT("Computer \""), /* 226 */ dkT("\": User \""), /* 227 */ dkT("\" not defined!"), /* 228 */ dkT("Computer \""), /* 229 */ dkT("\": Netgroup \""), /* 230 */ dkT("\" not defined!"), /* 231 */ dkT("Computer \""), /* 232 */ dkT("\": DHCP class \""), /* 233 */ dkT("\" not defined!"), /* 234 */ dkT("Computer \""), /* 235 */ dkT("\": DHCP group \""), /* 236 */ dkT("\" not defined!"), /* 237 */ dkT("Computer \""), /* 238 */ dkT("\": Ethernet connector \""), /* 239 */ dkT("\" not defined!"), /* 240 */ dkT("Computer \""), /* 241 */ dkT("\": Building \""), /* 242 */ dkT("\" not defined!"), /* 243 */ dkT("Computer \""), /* 244 */ dkT("\": Both DHCP class and IP address specified!"), /* 245 */ dkT("Computer \""), /* 246 */ dkT("\": DHCP class specified, but MAC address is missing!"), /* 247 */ dkT("Computer \""), /* 248 */ dkT("\": Netgroup specified, but IP address is missing!"), /* 249 */ dkT("Computer \""), /* 250 */ dkT("\": Netgroup specified, but DNS domain is missing!"), /* 251 */ dkT("Computer \""), /* 252 */ dkT("\": FQDN first flag set, but DNS domain is missing!"), /* 253 */ dkT("Computer \""), /* 254 */ dkT("\": Over expiration date, should be removed!"), /* 255 */ dkT("Attempt to define a computer without a host name!"), /* 256 */ dkT("Alias \""), /* 257 */ dkT("\": Computer \""), /* 258 */ dkT("\" not defined!"), /* 259 */ dkT("DHCP option "), /* 260 */ dkT(": VLAN \""), /* 261 */ dkT("\" not defined!"), /* 262 */ dkT("DHCP option "), /* 263 */ dkT(": Network \""), /* 264 */ dkT("\" not defined!"), /* 265 */ dkT("DHCP option "), /* 266 */ dkT(": DHCP group \""), /* 267 */ dkT("\" not defined!"), /* 268 */ dkT("DHCP option "), /* 269 */ dkT(": DHCP pool \""), /* 270 */ dkT("\" not defined!"), /* 271 */ dkT("DHCP option "), /* 272 */ dkT(": Computer \""), /* 273 */ dkT("\" not defined!"), /* 274 */ dkT("DHCP option "), /* 275 */ dkT(": Unknown scope type name \""), /* 276 */ dkT("\"!"), /* 277 */ dkT("Software product \""), /* 278 */ dkT("\": Duplicated entry!"), /* 279 */ dkT("Software product \""), /* 280 */ dkT("\": Software manufacturer \""), /* 281 */ dkT("\" not defined!"), /* 282 */ dkT("License type \""), /* 283 */ dkT("\": Duplicated entry!"), /* 284 */ dkT("License "), /* 285 */ dkT(": Duplicated entry!"), /* 286 */ dkT("License "), /* 287 */ dkT(": User \""), /* 288 */ dkT("\" not defined!"), /* 289 */ dkT("License "), /* 290 */ dkT(": Computer \""), /* 291 */ dkT("\" not defined!"), /* 292 */ dkT("License "), /* 293 */ dkT(": License type \""), /* 294 */ dkT("\" not defined!"), /* 295 */ dkT("License "), /* 296 */ dkT(" assigned to computer \""), /* 297 */ dkT("\" but no user specified!"), /* 298 */ dkT("License "), /* 299 */ dkT(": No software product specified!"), /* 300 */ dkT("Illegal date specification \""), /* 301 */ dkT("\"!"), /* 302 */ dkT("Users from Europe - especially from Germany - should consider using koma-script."), /* 303 */ dkT("Illegal software manufacturer (short name): \""), /* 304 */ dkT("\"!"), /* 305 */ dkT("Illegal software (short name): \""), /* 306 */ dkT("\"!"), /* 307 */ dkT("Illegal license type (short name): \""), /* 308 */ dkT("\"!"), /* 309 */ dkT("Failed to reset sensitive memory range!"), NULL #line 2764 "itadmin.ctr" }; /** License text written for --license option. */ static dkChar const * const itadmin_license_overview[] = { dkT(""), dkT("Overview"), dkT("========"), dkT("This software uses code from the following projects, either directly or"), dkT("by linking a library:"), dkT(""), dkT("dktools\t\tDK tools and libraries"), dkT("\t\tSee http://dktools.sourceforge.net for information."), dkT(""), dkT("MySQL\t\tMySQL client library."), dkT("\t\tSee http://www.mysql.com for information."), dkT(""), NULL #line 2785 "itadmin.ctr" }; /** License for the dktools project. */ static dkChar const * const itadmin_license_dktools[] = { dkT(""), dkT("License conditions for DK tools and libraries"), dkT("============================================="), dkT("Copyright (c) 2012-2016, Dirk Krause"), dkT("All rights reserved."), dkT(""), dkT("Redistribution and use in source and binary forms, with or without"), dkT("modification, are permitted provided that the following conditions are met:"), dkT(""), dkT("* Redistributions of source code must retain the above copyright notice,"), dkT(" this list of conditions and the following disclaimer."), dkT("* Redistributions in binary form must reproduce the above copyright"), dkT(" notice, this list of conditions and the following disclaimer in the"), dkT(" documentation and/or other materials provided with the distribution."), dkT("* Neither the name of the copyright holder(s) nor the names of"), dkT(" contributors may be used to endorse or promote products derived from "), dkT(" this software without specific prior written permission."), dkT(""), dkT("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"), dkT("\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT"), dkT("LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR"), dkT("A PARTICULAR PURPOSE ARE DISCLAIMED."), dkT(""), dkT("IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY"), dkT("DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL"), dkT("DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS"), dkT("OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)"), dkT("HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,"), dkT("STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING"), dkT("IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE"), dkT("POSSIBILITY OF SUCH DAMAGE."), dkT(""), NULL #line 2826 "itadmin.ctr" }; /** License for the MySQL client library (GPL + FLOSS exception). */ static dkChar const * const itadmin_license_mysql[] = { dkT("License conditions for the MySQL client library"), dkT("==============================================="), dkT(""), dkT("GNU General Public License"), dkT("--------------------------"), dkT(""), dkT("\t\t GNU GENERAL PUBLIC LICENSE"), dkT("\t\t Version 2, June 1991"), dkT(""), dkT(" Copyright (C) 1989, 1991 Free Software Foundation, Inc.,"), dkT(" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"), dkT(" Everyone is permitted to copy and distribute verbatim copies"), dkT(" of this license document, but changing it is not allowed."), dkT(""), dkT("\t\t\t Preamble"), dkT(""), dkT(" The licenses for most software are designed to take away your"), dkT("freedom to share and change it. By contrast, the GNU General Public"), dkT("License is intended to guarantee your freedom to share and change free"), dkT("software--to make sure the software is free for all its users. This"), dkT("General Public License applies to most of the Free Software"), dkT("Foundation's software and to any other program whose authors commit to"), dkT("using it. (Some other Free Software Foundation software is covered by"), dkT("the GNU Lesser General Public License instead.) You can apply it to"), dkT("your programs, too."), dkT(""), dkT(" When we speak of free software, we are referring to freedom, not"), dkT("price. Our General Public Licenses are designed to make sure that you"), dkT("have the freedom to distribute copies of free software (and charge for"), dkT("this service if you wish), that you receive source code or can get it"), dkT("if you want it, that you can change the software or use pieces of it"), dkT("in new free programs; and that you know you can do these things."), dkT(""), dkT(" To protect your rights, we need to make restrictions that forbid"), dkT("anyone to deny you these rights or to ask you to surrender the rights."), dkT("These restrictions translate to certain responsibilities for you if you"), dkT("distribute copies of the software, or if you modify it."), dkT(""), dkT(" For example, if you distribute copies of such a program, whether"), dkT("gratis or for a fee, you must give the recipients all the rights that"), dkT("you have. You must make sure that they, too, receive or can get the"), dkT("source code. And you must show them these terms so they know their"), dkT("rights."), dkT(""), dkT(" We protect your rights with two steps: (1) copyright the software, and"), dkT("(2) offer you this license which gives you legal permission to copy,"), dkT("distribute and/or modify the software."), dkT(""), dkT(" Also, for each author's protection and ours, we want to make certain"), dkT("that everyone understands that there is no warranty for this free"), dkT("software. If the software is modified by someone else and passed on, we"), dkT("want its recipients to know that what they have is not the original, so"), dkT("that any problems introduced by others will not reflect on the original"), dkT("authors' reputations."), dkT(""), dkT(" Finally, any free program is threatened constantly by software"), dkT("patents. We wish to avoid the danger that redistributors of a free"), dkT("program will individually obtain patent licenses, in effect making the"), dkT("program proprietary. To prevent this, we have made it clear that any"), dkT("patent must be licensed for everyone's free use or not licensed at all."), dkT(""), dkT(" The precise terms and conditions for copying, distribution and"), dkT("modification follow."), dkT(""), dkT("\t\t GNU GENERAL PUBLIC LICENSE"), dkT(" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION"), dkT(""), dkT(" 0. This License applies to any program or other work which contains"), dkT("a notice placed by the copyright holder saying it may be distributed"), dkT("under the terms of this General Public License. The \"Program\", below,"), dkT("refers to any such program or work, and a \"work based on the Program\""), dkT("means either the Program or any derivative work under copyright law:"), dkT("that is to say, a work containing the Program or a portion of it,"), dkT("either verbatim or with modifications and/or translated into another"), dkT("language. (Hereinafter, translation is included without limitation in"), dkT("the term \"modification\".) Each licensee is addressed as \"you\"."), dkT(""), dkT("Activities other than copying, distribution and modification are not"), dkT("covered by this License; they are outside its scope. The act of"), dkT("running the Program is not restricted, and the output from the Program"), dkT("is covered only if its contents constitute a work based on the"), dkT("Program (independent of having been made by running the Program)."), dkT("Whether that is true depends on what the Program does."), dkT(""), dkT(" 1. You may copy and distribute verbatim copies of the Program's"), dkT("source code as you receive it, in any medium, provided that you"), dkT("conspicuously and appropriately publish on each copy an appropriate"), dkT("copyright notice and disclaimer of warranty; keep intact all the"), dkT("notices that refer to this License and to the absence of any warranty;"), dkT("and give any other recipients of the Program a copy of this License"), dkT("along with the Program."), dkT(""), dkT("You may charge a fee for the physical act of transferring a copy, and"), dkT("you may at your option offer warranty protection in exchange for a fee."), dkT(""), dkT(" 2. You may modify your copy or copies of the Program or any portion"), dkT("of it, thus forming a work based on the Program, and copy and"), dkT("distribute such modifications or work under the terms of Section 1"), dkT("above, provided that you also meet all of these conditions:"), dkT(""), dkT(" a) You must cause the modified files to carry prominent notices"), dkT(" stating that you changed the files and the date of any change."), dkT(""), dkT(" b) You must cause any work that you distribute or publish, that in"), dkT(" whole or in part contains or is derived from the Program or any"), dkT(" part thereof, to be licensed as a whole at no charge to all third"), dkT(" parties under the terms of this License."), dkT(""), dkT(" c) If the modified program normally reads commands interactively"), dkT(" when run, you must cause it, when started running for such"), dkT(" interactive use in the most ordinary way, to print or display an"), dkT(" announcement including an appropriate copyright notice and a"), dkT(" notice that there is no warranty (or else, saying that you provide"), dkT(" a warranty) and that users may redistribute the program under"), dkT(" these conditions, and telling the user how to view a copy of this"), dkT(" License. (Exception: if the Program itself is interactive but"), dkT(" does not normally print such an announcement, your work based on"), dkT(" the Program is not required to print an announcement.)"), dkT(""), dkT("These requirements apply to the modified work as a whole. If"), dkT("identifiable sections of that work are not derived from the Program,"), dkT("and can be reasonably considered independent and separate works in"), dkT("themselves, then this License, and its terms, do not apply to those"), dkT("sections when you distribute them as separate works. But when you"), dkT("distribute the same sections as part of a whole which is a work based"), dkT("on the Program, the distribution of the whole must be on the terms of"), dkT("this License, whose permissions for other licensees extend to the"), dkT("entire whole, and thus to each and every part regardless of who wrote it."), dkT(""), dkT("Thus, it is not the intent of this section to claim rights or contest"), dkT("your rights to work written entirely by you; rather, the intent is to"), dkT("exercise the right to control the distribution of derivative or"), dkT("collective works based on the Program."), dkT(""), dkT("In addition, mere aggregation of another work not based on the Program"), dkT("with the Program (or with a work based on the Program) on a volume of"), dkT("a storage or distribution medium does not bring the other work under"), dkT("the scope of this License."), dkT(""), dkT(" 3. You may copy and distribute the Program (or a work based on it,"), dkT("under Section 2) in object code or executable form under the terms of"), dkT("Sections 1 and 2 above provided that you also do one of the following:"), dkT(""), dkT(" a) Accompany it with the complete corresponding machine-readable"), dkT(" source code, which must be distributed under the terms of Sections"), dkT(" 1 and 2 above on a medium customarily used for software interchange;"), dkT(" or,"), dkT(""), dkT(" b) Accompany it with a written offer, valid for at least three"), dkT(" years, to give any third party, for a charge no more than your"), dkT(" cost of physically performing source distribution, a complete"), dkT(" machine-readable copy of the corresponding source code, to be"), dkT(" distributed under the terms of Sections 1 and 2 above on a medium"), dkT(" customarily used for software interchange; or,"), dkT(""), dkT(" c) Accompany it with the information you received as to the offer"), dkT(" to distribute corresponding source code. (This alternative is"), dkT(" allowed only for noncommercial distribution and only if you"), dkT(" received the program in object code or executable form with such"), dkT(" an offer, in accord with Subsection b above.)"), dkT(""), dkT("The source code for a work means the preferred form of the work for"), dkT("making modifications to it. For an executable work, complete source"), dkT("code means all the source code for all modules it contains, plus any"), dkT("associated interface definition files, plus the scripts used to"), dkT("control compilation and installation of the executable. However, as a"), dkT("special exception, the source code distributed need not include"), dkT("anything that is normally distributed (in either source or binary"), dkT("form) with the major components (compiler, kernel, and so on) of the"), dkT("operating system on which the executable runs, unless that component"), dkT("itself accompanies the executable."), dkT(""), dkT("If distribution of executable or object code is made by offering"), dkT("access to copy from a designated place, then offering equivalent"), dkT("access to copy the source code from the same place counts as"), dkT("distribution of the source code, even though third parties are not"), dkT("compelled to copy the source along with the object code."), dkT(""), dkT(" 4. You may not copy, modify, sublicense, or distribute the Program"), dkT("except as expressly provided under this License. Any attempt"), dkT("otherwise to copy, modify, sublicense or distribute the Program is"), dkT("void, and will automatically terminate your rights under this License."), dkT("However, parties who have received copies, or rights, from you under"), dkT("this License will not have their licenses terminated so long as such"), dkT("parties remain in full compliance."), dkT(""), dkT(" 5. You are not required to accept this License, since you have not"), dkT("signed it. However, nothing else grants you permission to modify or"), dkT("distribute the Program or its derivative works. These actions are"), dkT("prohibited by law if you do not accept this License. Therefore, by"), dkT("modifying or distributing the Program (or any work based on the"), dkT("Program), you indicate your acceptance of this License to do so, and"), dkT("all its terms and conditions for copying, distributing or modifying"), dkT("the Program or works based on it."), dkT(""), dkT(" 6. Each time you redistribute the Program (or any work based on the"), dkT("Program), the recipient automatically receives a license from the"), dkT("original licensor to copy, distribute or modify the Program subject to"), dkT("these terms and conditions. You may not impose any further"), dkT("restrictions on the recipients' exercise of the rights granted herein."), dkT("You are not responsible for enforcing compliance by third parties to"), dkT("this License."), dkT(""), dkT(" 7. If, as a consequence of a court judgment or allegation of patent"), dkT("infringement or for any other reason (not limited to patent issues),"), dkT("conditions are imposed on you (whether by court order, agreement or"), dkT("otherwise) that contradict the conditions of this License, they do not"), dkT("excuse you from the conditions of this License. If you cannot"), dkT("distribute so as to satisfy simultaneously your obligations under this"), dkT("License and any other pertinent obligations, then as a consequence you"), dkT("may not distribute the Program at all. For example, if a patent"), dkT("license would not permit royalty-free redistribution of the Program by"), dkT("all those who receive copies directly or indirectly through you, then"), dkT("the only way you could satisfy both it and this License would be to"), dkT("refrain entirely from distribution of the Program."), dkT(""), dkT("If any portion of this section is held invalid or unenforceable under"), dkT("any particular circumstance, the balance of the section is intended to"), dkT("apply and the section as a whole is intended to apply in other"), dkT("circumstances."), dkT(""), dkT("It is not the purpose of this section to induce you to infringe any"), dkT("patents or other property right claims or to contest validity of any"), dkT("such claims; this section has the sole purpose of protecting the"), dkT("integrity of the free software distribution system, which is"), dkT("implemented by public license practices. Many people have made"), dkT("generous contributions to the wide range of software distributed"), dkT("through that system in reliance on consistent application of that"), dkT("system; it is up to the author/donor to decide if he or she is willing"), dkT("to distribute software through any other system and a licensee cannot"), dkT("impose that choice."), dkT(""), dkT("This section is intended to make thoroughly clear what is believed to"), dkT("be a consequence of the rest of this License."), dkT(""), dkT(" 8. If the distribution and/or use of the Program is restricted in"), dkT("certain countries either by patents or by copyrighted interfaces, the"), dkT("original copyright holder who places the Program under this License"), dkT("may add an explicit geographical distribution limitation excluding"), dkT("those countries, so that distribution is permitted only in or among"), dkT("countries not thus excluded. In such case, this License incorporates"), dkT("the limitation as if written in the body of this License."), dkT(""), dkT(" 9. The Free Software Foundation may publish revised and/or new versions"), dkT("of the General Public License from time to time. Such new versions will"), dkT("be similar in spirit to the present version, but may differ in detail to"), dkT("address new problems or concerns."), dkT(""), dkT("Each version is given a distinguishing version number. If the Program"), dkT("specifies a version number of this License which applies to it and \"any"), dkT("later version\", you have the option of following the terms and conditions"), dkT("either of that version or of any later version published by the Free"), dkT("Software Foundation. If the Program does not specify a version number of"), dkT("this License, you may choose any version ever published by the Free Software"), dkT("Foundation."), dkT(""), dkT(" 10. If you wish to incorporate parts of the Program into other free"), dkT("programs whose distribution conditions are different, write to the author"), dkT("to ask for permission. For software which is copyrighted by the Free"), dkT("Software Foundation, write to the Free Software Foundation; we sometimes"), dkT("make exceptions for this. Our decision will be guided by the two goals"), dkT("of preserving the free status of all derivatives of our free software and"), dkT("of promoting the sharing and reuse of software generally."), dkT(""), dkT("\t\t\t NO WARRANTY"), dkT(""), dkT(" 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY"), dkT("FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN"), dkT("OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES"), dkT("PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED"), dkT("OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF"), dkT("MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS"), dkT("TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE"), dkT("PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,"), dkT("REPAIR OR CORRECTION."), dkT(""), dkT(" 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING"), dkT("WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR"), dkT("REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,"), dkT("INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING"), dkT("OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED"), dkT("TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY"), dkT("YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER"), dkT("PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE"), dkT("POSSIBILITY OF SUCH DAMAGES."), dkT(""), dkT("\t\t END OF TERMS AND CONDITIONS"), dkT(""), dkT("\t How to Apply These Terms to Your New Programs"), dkT(""), dkT(" If you develop a new program, and you want it to be of the greatest"), dkT("possible use to the public, the best way to achieve this is to make it"), dkT("free software which everyone can redistribute and change under these terms."), dkT(""), dkT(" To do so, attach the following notices to the program. It is safest"), dkT("to attach them to the start of each source file to most effectively"), dkT("convey the exclusion of warranty; and each file should have at least"), dkT("the \"copyright\" line and a pointer to where the full notice is found."), dkT(""), dkT(" "), dkT(" Copyright (C) "), dkT(""), dkT(" This program is free software; you can redistribute it and/or modify"), dkT(" it under the terms of the GNU General Public License as published by"), dkT(" the Free Software Foundation; either version 2 of the License, or"), dkT(" (at your option) any later version."), dkT(""), dkT(" This program is distributed in the hope that it will be useful,"), dkT(" but WITHOUT ANY WARRANTY; without even the implied warranty of"), dkT(" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"), dkT(" GNU General Public License for more details."), dkT(""), dkT(" You should have received a copy of the GNU General Public License along"), dkT(" with this program; if not, write to the Free Software Foundation, Inc.,"), dkT(" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."), dkT(""), dkT("Also add information on how to contact you by electronic and paper mail."), dkT(""), dkT("If the program is interactive, make it output a short notice like this"), dkT("when it starts in an interactive mode:"), dkT(""), dkT(" Gnomovision version 69, Copyright (C) year name of author"), dkT(" Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'."), dkT(" This is free software, and you are welcome to redistribute it"), dkT(" under certain conditions; type `show c' for details."), dkT(""), dkT("The hypothetical commands `show w' and `show c' should show the appropriate"), dkT("parts of the General Public License. Of course, the commands you use may"), dkT("be called something other than `show w' and `show c'; they could even be"), dkT("mouse-clicks or menu items--whatever suits your program."), dkT(""), dkT("You should also get your employer (if you work as a programmer) or your"), dkT("school, if any, to sign a \"copyright disclaimer\" for the program, if"), dkT("necessary. Here is a sample; alter the names:"), dkT(""), dkT(" Yoyodyne, Inc., hereby disclaims all copyright interest in the program"), dkT(" `Gnomovision' (which makes passes at compilers) written by James Hacker."), dkT(""), dkT(" , 1 April 1989"), dkT(" Ty Coon, President of Vice"), dkT(""), dkT("This General Public License does not permit incorporating your program into"), dkT("proprietary programs. If your program is a subroutine library, you may"), dkT("consider it more useful to permit linking proprietary applications with the"), dkT("library. If this is what you want to do, use the GNU Lesser General"), dkT("Public License instead of this License."), dkT(""), dkT("MySQL FLOSS License Exception"), dkT("-----------------------------"), dkT(""), dkT("MySQL FLOSS License Exception"), dkT(""), dkT("The MySQL AB Exception for Free/Libre and Open Source Software-only"), dkT("Applications Using MySQL Client Libraries (the \"FLOSS Exception\")."), dkT(""), dkT("Version 0.6, 7 March 2007"), dkT(""), dkT("Exception Intent"), dkT(""), dkT("We want specified Free/Libre and Open Source Software (``FLOSS'')"), dkT("applications to be able to use specified GPL-licensed MySQL client"), dkT("libraries (the ``Program'') despite the fact that not all FLOSS"), dkT("licenses are compatible with version 2 of the GNU General Public"), dkT("License (the ``GPL'')."), dkT(""), dkT("Legal Terms and Conditions"), dkT(""), dkT("As a special exception to the terms and conditions of version 2.0"), dkT("of the GPL:"), dkT(""), dkT(" 1. You are free to distribute a Derivative Work that is formed"), dkT(" entirely from the Program and one or more works (each, a"), dkT(" \"FLOSS Work\") licensed under one or more of the licenses"), dkT(" listed below in section 1, as long as:"), dkT(" a. You obey the GPL in all respects for the Program and the"), dkT(" Derivative Work, except for identifiable sections of the"), dkT(" Derivative Work which are not derived from the Program,"), dkT(" and which can reasonably be considered independent and"), dkT(" separate works in themselves,"), dkT(" b. all identifiable sections of the Derivative Work which"), dkT(" are not derived from the Program, and which can"), dkT(" reasonably be considered independent and separate works"), dkT(" in themselves,"), dkT(" i. are distributed subject to one of the FLOSS licenses"), dkT(" listed below, and"), dkT(" ii. the object code or executable form of those sections"), dkT(" are accompanied by the complete corresponding"), dkT(" machine-readable source code for those sections on"), dkT(" the same medium and under the same FLOSS license as"), dkT(" the corresponding object code or executable forms of"), dkT(" those sections, and"), dkT(" c. any works which are aggregated with the Program or with a"), dkT(" Derivative Work on a volume of a storage or distribution"), dkT(" medium in accordance with the GPL, can reasonably be"), dkT(" considered independent and separate works in themselves"), dkT(" which are not derivatives of either the Program, a"), dkT(" Derivative Work or a FLOSS Work."), dkT(" If the above conditions are not met, then the Program may only"), dkT(" be copied, modified, distributed or used under the terms and"), dkT(" conditions of the GPL or another valid licensing option from"), dkT(" MySQL AB."), dkT(""), dkT(" 2. FLOSS License List"), dkT(""), dkT("License name Version(s)/Copyright Date"), dkT("Academic Free License 2.0"), dkT("Apache Software License 1.0/1.1/2.0"), dkT("Apple Public Source License 2.0"), dkT("Artistic license From Perl 5.8.0"), dkT("BSD license \"July 22 1999\""), dkT("Common Development and Distribution License (CDDL) 1.0"), dkT("Common Public License 1.0"), dkT("Eclipse Public License 1.0"), dkT("GNU Library or \"Lesser\" General Public License (LGPL) 2.0/2.1"), dkT("Jabber Open Source License 1.0"), dkT("MIT license (As listed in file MIT-License.txt) ---"), dkT("Mozilla Public License (MPL) 1.0/1.1"), dkT("Open Software License 2.0"), dkT("OpenSSL license (with original SSLeay license) \"2003\" (\"1998\")"), dkT("PHP License 3.0"), dkT("Python license (CNRI Python License) ---"), dkT("Python Software Foundation License 2.1.1"), dkT("Sleepycat License \"1999\""), dkT("University of Illinois/NCSA Open Source License ---"), dkT("W3C License \"2001\""), dkT("X11 License \"2001\""), dkT("Zlib/libpng License ---"), dkT("Zope Public License 2.0"), dkT(""), dkT(" Due to the many variants of some of the above licenses, we"), dkT(" require that any version follow the 2003 version of the Free"), dkT(" Software Foundation's Free Software Definition"), dkT(" (http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of"), dkT(" the Open Source Definition by the Open Source Initiative"), dkT(" (http://www.opensource.org/docs/definition.php)."), dkT(""), dkT(" 3. Definitions"), dkT(""), dkT(" a. Terms used, but not defined, herein shall have the"), dkT(" meaning provided in the GPL."), dkT(" b. Derivative Work means a derivative work under copyright"), dkT(" law."), dkT(""), dkT(" 4. Applicability: This FLOSS Exception applies to all Programs"), dkT(" that contain a notice placed by MySQL AB saying that the"), dkT(" Program may be distributed under the terms of this FLOSS"), dkT(" Exception. If you create or distribute a work which is a"), dkT(" Derivative Work of both the Program and any other work"), dkT(" licensed under the GPL, then this FLOSS Exception is not"), dkT(" available for that work; thus, you must remove the FLOSS"), dkT(" Exception notice from that work and comply with the GPL in all"), dkT(" respects, including by retaining all GPL notices. You may"), dkT(" choose to redistribute a copy of the Program exclusively under"), dkT(" the terms of the GPL by removing the FLOSS Exception notice"), dkT(" from that copy of the Program, provided that the copy has"), dkT(" never been modified by you or any third party."), dkT(""), dkT("Appendix A. Qualified Libraries and Packages"), dkT(""), dkT("The following is a non-exhaustive list of libraries and packages"), dkT("which are covered by the FLOSS License Exception. Please note that"), dkT("this appendix is provided merely as an additional service to"), dkT("specific FLOSS projects wishing to simplify licensing information"), dkT("for their users. Compliance with one of the licenses noted under"), dkT("the \"FLOSS license list\" section remains a prerequisite."), dkT(""), dkT("Package Name Qualifying License and Version"), dkT("Apache Portable Runtime (APR) Apache Software License 2.0"), dkT(""), NULL #line 3304 "itadmin.ctr" }; /** Help text shown for --help. */ static dkChar const * const itadmin_help_text[] = { dkT(""), dkT("NAME"), dkT(""), dkT(" itadmin - IT administration using databases"), dkT(""), dkT("SYNOPSIS"), dkT(""), dkT(" itadmin [] []"), dkT(""), dkT("DESCRIPTION"), dkT(""), dkT("The program reads IT-related information from a database and creates"), dkT("configuration files, a network documentation, and a license report."), dkT("A configuration file can be specified as argument, the program searches"), dkT("for itadmin.conf files if no configuration file is specified."), dkT(""), dkT("OPTIONS"), dkT(""), dkT("-c"), dkT("--configuration"), dkT("\tCreate configuration files and network documentation."), dkT(""), dkT("-l"), dkT("--licenses"), dkT("\tCreate license report."), dkT("\tIf none of -c and -l is used the program creates all output"), dkT("\t(same as both -c and -l used)."), dkT(""), dkT("-h"), dkT("--help"), dkT("\tShow a help text."), dkT(""), dkT("-v"), dkT("--version"), dkT("\tShow version information."), dkT(""), dkT("-L"), dkT("--license-terms"), dkT("\tShow license terms."), dkT(""), dkT("EXIT STATUS"), dkT(""), dkT("0 on success, all other exit status codes indicate an error."), dkT(""), dkT("FILES"), dkT(""), dkT("itadmin.conf"), dkT("\tThe itadmin.conf file contains the configuration information"), dkT("\tused by the program. The file consists of key=value pairs, one"), dkT("\tper line. Keys can consist of multiple words."), dkT("\tLines started by '#' are comments."), dkT("\tThe following key=value pairs can be used:"), dkT(""), dkT("\tdatabase host\t\t\t=\t"), dkT("\tdatabase name\t\t\t=\t"), dkT("\tdatabase credentials file\t=\t"), dkT("\tdhcpd.conf vlan\t\t\t=\t"), dkT("\torganization\t\t\t=\t"), dkT("\torganizational unit\t\t=\t"), dkT("\tadministrator name\t\t=\t"), dkT(""), dkT("AUTHOR"), dkT(""), dkT("Dirk Krause"), dkT(""), dkT("HISTORY"), dkT(""), dkT("The itadmin program replaces the hostsadm script found in previous"), dkT("versions of dktools."), dkT(""), dkT("COPYRIGHT AND LICENSE"), dkT(""), dkT("Run"), dkT(" itadmin --license-terms"), dkT("to see the license conditions."), dkT(""), dkT("SEE ALSO"), dkT(""), dkT("http://dktools.sourceforge.net"), dkT(""), NULL #line 3393 "itadmin.ctr" }; /** Options for the itadmin program. */ static dk3_option_t const itadmin_options[] = { { dkT('h'), dkT("help"), 0 }, { dkT('v'), dkT("version"), 0 }, { dkT('L'), dkT("license-terms"), 0 }, { dkT('c'), dkT("configuration"), 0 }, { dkT('l'), dkT("licenses"), 0 }, }; /** Number of elements in itadmin_options. */ static size_t itadmin_sz_options = (sizeof(itadmin_options)/sizeof(dk3_option_t)); int itadmin_job_do_network(itadmin_job *job) { int back = 0; if(job) { if((job->cmd) & ITADMIN_CMD_CONFIG) { back = 1; } } return back; } int itadmin_job_do_dhcp(itadmin_job *job) { int back = 0; if(itadmin_job_do_network(job)) { if(job->f_dh) { back = 1; } } return back; } int itadmin_job_do_licenses(itadmin_job *job) { int back = 0; if(job) { if((job->cmd) & ITADMIN_CMD_LICENSES) { back = 1; } } return back; } /** Clean up a storage, destroy contained objects. @param s Storage to clean up. @param i Iterator through storage. @param f Function to use on each object. */ static void itadmin_clean_storage( dk3_sto_t **s, dk3_sto_it_t **i, itadmin_obj_del *f ) { void *v; if(*s) { if(*i) { dk3sto_it_reset(*i); while((v = dk3sto_it_next(*i)) != NULL) { (*f)(v); } dk3sto_it_close(*i); } dk3sto_close(*s); } *s = NULL; *i = NULL; } /** Initialize job structure. @param job Job structure to initialize. @param app Application structure for diagnostics. @param msg Localized message texts. @param noloc Texts, not localized. */ static void itadmin_job_init( itadmin_job *job, dk3_app_t *app, dkChar const * const *msg, dkChar const * const *noloc ) { job->app = app; job->opt = NULL; job->msg = msg; job->noloc = noloc; job->exval = 1; job->cmd = 0; job->ec = 0; job->f_dh = 0; job->dbt = DK3_SQLDB_TYPE_MYSQL; job->dbhn = NULL; job->uc2l = NULL; job->dbn = NULL; job->dbcf = NULL; job->dbus = NULL; job->dbpw = NULL; job->vlan = NULL; job->org = NULL; job->ou = NULL; job->admn = NULL; job->ldapb = NULL; job->ngdep = NULL; job->nng = 0; job->s_us = NULL; job->i_us = NULL; job->s_usn = NULL; job->i_usn = NULL; job->s_bu = NULL; job->i_bu = NULL; job->s_sp = NULL; job->i_sp = NULL; job->s_vl = NULL; job->i_vl = NULL; job->s_pa = NULL; job->i_pa = NULL; job->s_nw = NULL; job->i_nw = NULL; job->s_ng = NULL; job->i_ng = NULL; job->s_nd = NULL; job->i_nd = NULL; job->s_dc = NULL; job->i_dc = NULL; job->s_dp = NULL; job->i_dp = NULL; job->s_dg = NULL; job->i_dg = NULL; job->s_ho = NULL; job->i_ho = NULL; job->s_hoi = NULL; job->i_hoi = NULL; job->s_sm = NULL; job->i_sm = NULL; job->s_sw = NULL; job->i_sw = NULL; job->s_lt = NULL; job->i_lt = NULL; job->s_lc = NULL; job->i_lc = NULL; job->s_lf = NULL; job->i_lf = NULL; job->s_do = NULL; job->i_do = NULL; job->dbptr = NULL; job->gdate = 0; job->hlh = 0; job->ukoma = 0; job->rel = 0; if(*(msg[76]) == dkT('.')) { job->gdate = 1; } } /** Prepare a storage/iterator pair. @param job Job structure. @param s Address of storage pointer. @param i Address if iterator pointer. @param f Object comparison function for storage. @param cr Comparison criteria. @param ok Pointer to OK flag, reset on errors. */ static void itadmin_job_prepare_storage( itadmin_job *job, dk3_sto_t **s, dk3_sto_it_t **i, dk3_fct_comp_t *f, int cr, int *ok ) { *s = NULL; *i = NULL; *s = dk3sto_open_app(job->app); if(*s) { *i = dk3sto_it_open(*s); if(*i) { if(f) { dk3sto_set_comp(*s, f, cr); } } else { *ok = 0; } } else { *ok = 0; } } /** Prepare all data structures for a job. @param job Job structure. @return 1 on success, 0 on error. */ static int itadmin_job_up(itadmin_job *job) { dk3_time_t ct; dk3_tm_t tm; int back = 1; int f_utf8 = 0; (job->today).y = 0; (job->today).m = 0; (job->today).d = 0; if(dk3sf_time(&ct)) { if(dk3sf_localtime_app(&tm, &ct, job->app)) { (job->today).y = tm.Y; (job->today).m = tm.M; (job->today).d = tm.D; } } itadmin_job_prepare_storage( job, &(job->s_us), &(job->i_us), itadmin_comp_user, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_usn), &(job->i_usn), itadmin_comp_user, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_bu), &(job->i_bu), itadmin_comp_building, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_sp), &(job->i_sp), itadmin_comp_speed, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_vl), &(job->i_vl), itadmin_comp_vlan, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_pa), &(job->i_pa), itadmin_comp_connect, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_nw), &(job->i_nw), itadmin_comp_network, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_ng), &(job->i_ng), itadmin_comp_netgroup, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_nd), &(job->i_nd), NULL, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dc), &(job->i_dc), itadmin_comp_dhcp_class, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dp), &(job->i_dp), itadmin_comp_dhcp_pool, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dg), &(job->i_dg), itadmin_comp_dhcp_group, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_ho), &(job->i_ho), itadmin_comp_host, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_hoi), &(job->i_hoi), itadmin_comp_host, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_sm), &(job->i_sm), itadmin_comp_swman, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_sw), &(job->i_sw), itadmin_comp_swprod, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lt), &(job->i_lt), itadmin_comp_lictype, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lc), &(job->i_lc), itadmin_comp_license, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lf), &(job->i_lf), itadmin_comp_license, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_do), &(job->i_do), itadmin_comp_dhcp_option, 0, &back ); f_utf8 = 0; if(DK3_ENCODING_UTF8 == dk3app_get_encoding(job->app)) { f_utf8 = 1; } job->uc2l = dk3uc2lat_open_app(NULL, 0, f_utf8, job->app); if(!(job->uc2l)) { back = 0; } return back; } /** Clean up job structure. @param job Job structure to clean up. */ static void itadmin_job_cleanup(itadmin_job *job) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ size_t sz; size_t i; int ok = 1; #endif if(job->opt) { dk3opt_close(job->opt); } job->opt = NULL; if(job->uc2l) { dk3uc2lat_close(job->uc2l); } job->uc2l = NULL; #line 3704 "itadmin.ctr" #line 3705 "itadmin.ctr" #line 3706 "itadmin.ctr" #line 3707 "itadmin.ctr" #line 3708 "itadmin.ctr" dk3_release(job->dbhn); #line 3710 "itadmin.ctr" #line 3711 "itadmin.ctr" #line 3712 "itadmin.ctr" #line 3713 "itadmin.ctr" #line 3714 "itadmin.ctr" dk3_release(job->dbn); #line 3716 "itadmin.ctr" #line 3717 "itadmin.ctr" #line 3718 "itadmin.ctr" #line 3719 "itadmin.ctr" #line 3720 "itadmin.ctr" dk3_release(job->dbcf); #line 3722 "itadmin.ctr" #line 3723 "itadmin.ctr" #line 3724 "itadmin.ctr" #line 3725 "itadmin.ctr" #line 3726 "itadmin.ctr" if(job->dbus) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ dk3mem_res((void *)(job->dbus), dk3str_c8_len(job->dbus)); #endif (void)dk3mem_reset_secure((void *)(job->dbus), dk3str_c8_len(job->dbus)); } dk3_release(job->dbus); #line 3737 "itadmin.ctr" #if 0 #line 3739 "itadmin.ctr" #line 3740 "itadmin.ctr" #line 3741 "itadmin.ctr" #endif #line 3743 "itadmin.ctr" if(job->dbpw) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ sz = dk3str_c8_len(job->dbpw); dk3mem_res((void *)(job->dbpw), dk3str_c8_len(job->dbpw)); /* Static code analysis: Dead assignment ok = 0 */ /* The purpose of the following instruction is to avoid */ /* optimizing out the memory reset in the instruction before. */ for (i = 0; i < sz; i++) { if('\0' != (job->dbpw)[i]) { ok = 0; } } if (1 != ok) { dk3app_log_1(job->app, DK3_LL_ERROR, job->msg, 309); } #endif (void)dk3mem_reset_secure((void *)(job->dbpw), dk3str_c8_len(job->dbpw)); } dk3_release(job->dbpw); #line 3762 "itadmin.ctr" #line 3763 "itadmin.ctr" #line 3764 "itadmin.ctr" #line 3765 "itadmin.ctr" #line 3766 "itadmin.ctr" dk3_release(job->vlan); #line 3768 "itadmin.ctr" #line 3769 "itadmin.ctr" #line 3770 "itadmin.ctr" #line 3771 "itadmin.ctr" #line 3772 "itadmin.ctr" dk3_release(job->org); #line 3774 "itadmin.ctr" #line 3775 "itadmin.ctr" #line 3776 "itadmin.ctr" #line 3777 "itadmin.ctr" #line 3778 "itadmin.ctr" dk3_release(job->ou); #line 3780 "itadmin.ctr" #line 3781 "itadmin.ctr" #line 3782 "itadmin.ctr" #line 3783 "itadmin.ctr" #line 3784 "itadmin.ctr" dk3_release(job->admn); #line 3786 "itadmin.ctr" #line 3787 "itadmin.ctr" #line 3788 "itadmin.ctr" #line 3789 "itadmin.ctr" #line 3790 "itadmin.ctr" dk3_release(job->ldapb); itadmin_clean_storage(&(job->s_us), &(job->i_us), itadmin_mem_user_del); itadmin_clean_storage(&(job->s_bu), &(job->i_bu), itadmin_mem_building_del); itadmin_clean_storage(&(job->s_sp), &(job->i_sp), itadmin_mem_speed_del); itadmin_clean_storage(&(job->s_vl), &(job->i_vl), itadmin_mem_vlan_del); itadmin_clean_storage(&(job->s_pa), &(job->i_pa), itadmin_mem_connect_del); itadmin_clean_storage(&(job->s_nw), &(job->i_nw), itadmin_mem_network_del); itadmin_clean_storage(&(job->s_ng), &(job->i_ng), itadmin_mem_netgroup_del); itadmin_clean_storage(&(job->s_nd), &(job->i_nd), itadmin_mem_ngdep_del); itadmin_clean_storage(&(job->s_dc), &(job->i_dc), itadmin_mem_dhcp_class_del); itadmin_clean_storage(&(job->s_dp), &(job->i_dp), itadmin_mem_dhcp_pool_del); itadmin_clean_storage(&(job->s_dg), &(job->i_dg), itadmin_mem_dhcp_group_del); if(job->s_hoi) { if(job->i_hoi) { dk3sto_it_close(job->i_hoi); } dk3sto_close(job->s_hoi); } job->s_hoi = NULL; job->i_hoi = NULL; if(job->s_usn) { if(job->i_usn) { dk3sto_it_close(job->i_usn); } dk3sto_close(job->s_usn); } job->s_usn = NULL; job->i_usn = NULL; itadmin_clean_storage(&(job->s_ho), &(job->i_ho), itadmin_mem_host_del); itadmin_clean_storage(&(job->s_sm), &(job->i_sm), itadmin_mem_sw_man_del); itadmin_clean_storage(&(job->s_sw), &(job->i_sw), itadmin_mem_software_del); itadmin_clean_storage(&(job->s_lt), &(job->i_lt), itadmin_mem_lic_type_del); if(job->s_lf) { if(job->i_lf) { dk3sto_it_close(job->i_lf); } dk3sto_close(job->s_lf); } job->s_lf = NULL; job->i_lf = NULL; itadmin_clean_storage(&(job->s_lc), &(job->i_lc), itadmin_mem_license_del); itadmin_clean_storage(&(job->s_do),&(job->i_do),itadmin_mem_dhcp_option_del); if(job->ngdep) { dk3bm_close(job->ngdep); job->ngdep = NULL; } } /** Process command line arguments. @param job Job structure. @return 1 on success (can continue), 0 on error. */ static int itadmin_process_arguments(itadmin_job *job) { dkChar const * const *xargv = NULL; int xargc = 0; int back = 0; #line 3849 "itadmin.ctr" xargc = dk3app_get_argc(job->app); xargv = dk3app_get_argv(job->app); xargv++; xargc--; job->opt = dk3opt_open_app( itadmin_options, itadmin_sz_options, dkT('\0'), NULL, xargc, xargv, job->app ); if(job->opt) { if(0 == dk3opt_get_error_code(job->opt)) { back = 1; if(dk3opt_is_set(job->opt, dkT('c'))) { job->cmd |= ITADMIN_CMD_CONFIG; } if(dk3opt_is_set(job->opt, dkT('l'))) { job->cmd |= ITADMIN_CMD_LICENSES; } if(dk3opt_is_set(job->opt, dkT('h'))) { job->cmd |= ITADMIN_CMD_HELP; } if(dk3opt_is_set(job->opt, dkT('v'))) { job->cmd |= ITADMIN_CMD_VERSION; } if(dk3opt_is_set(job->opt, dkT('L'))) { job->cmd |= ITADMIN_CMD_LICENSE_TERMS; } } else { #line 3877 "itadmin.ctr" } } else { #line 3879 "itadmin.ctr" } #line 3881 "itadmin.ctr" return back; } /** Show version number. @param job Job structure. */ static void itadmin_show_version(itadmin_job *job) { dk3sf_fputs(itadmin_kw_noloc[2], stdout); dk3sf_fputs(DKT_VERSION_DK, stdout); dk3sf_fputc(dkT('\n'), stdout); #if !(DK3_HAVE_MYSQL_MYSQL_H || DK3_HAVE_MYSQL_H) dk3app_log_1(job->app, DK3_LL_ERROR, job->msg, 167); #endif } /** Show help text. @param job Job structure. */ static void itadmin_show_help(itadmin_job *job) { dk3app_help(job->app, itadmin_kw_noloc[3], itadmin_help_text); } /** Show one text section, used to show license terms. @param job Job structure. @param ltxt License text to show. */ static void itadmin_show_license_section(itadmin_job *job, dkChar const * const *ltxt) { dkChar const * const *sptr; sptr = ltxt; while(*sptr) { dk3sf_fputs(*(sptr++), stdout); dk3sf_fputc(dkT('\n'), stdout); } } /** Show license conditions. @param job Job structure. */ static void itadmin_show_license(itadmin_job *job) { itadmin_show_license_section(job, itadmin_license_overview); itadmin_show_license_section(job, itadmin_license_dktools); itadmin_show_license_section(job, itadmin_license_mysql); } /** Run the tasks. @param job Job structure. */ static void itadmin_run(itadmin_job *job) { int success = 0; if(itadmin_config_read(job)) { if(itadmin_data_read(job)) { /* PROGRESS: Expanding netgroup dependencies. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 77); if(itadmin_netgroup_expand(job)) { success = 1; if(itadmin_job_do_network(job)) { /* Hosts */ /* PROGRESS: Writing hosts file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 78); if(!itadmin_hosts_output(job)) { #line 3968 "itadmin.ctr" success = 0; } if(job->ldapb) { /* PROGRESS: Writing hosts.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 79); if(!itadmin_hosts_ldif_output(job)) { #line 3974 "itadmin.ctr" success = 0; } } /* Ethers */ /* PROGRESS: Writing ethers file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 80); if(!itadmin_ethers_output(job)) { #line 3983 "itadmin.ctr" success = 0; } if(job->ldapb) { /* PROGRESS: Writing ethers.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 81); if(!itadmin_ethers_ldif_output(job)) { #line 3989 "itadmin.ctr" success = 0; } } /* Netgroups */ /* PROGRESS: Writing netgroup.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 82); if(!itadmin_netgroup_ldif_output(job)) { #line 3998 "itadmin.ctr" success = 0; } /* DHCP configuration */ if(itadmin_job_do_dhcp(job)) { /* PROGRESS: Writing dhcpd.conf file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 83); if(!itadmin_dhcpd_conf_output(job)) { #line 4007 "itadmin.ctr" success = 0; } } /* Network documentation */ /* PROGRESS: Writing netdocu.tex file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 84); if(!itadmin_netdocu(job)) { #line 4016 "itadmin.ctr" success = 0; } } if(itadmin_job_do_licenses(job)) { /* Write license report. */ /* PROGRESS: Writing licenses.tex file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 85); if(!itadmin_license_report(job)) { #line 4026 "itadmin.ctr" success = 0; } } } /* PROGRESS: Finished writing output. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 86); } } if(success) { job->exval = 0; } else { #line 4037 "itadmin.ctr" } } /** Run program or print help/license/version. @param job Job structure. */ static void itadmin_run_or_help(itadmin_job *job) { #line 4050 "itadmin.ctr" if((job->cmd) & (~(ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES))) { #line 4051 "itadmin.ctr" job->exval = 0; dk3sf_initialize_stdout(); if((job->cmd) & ITADMIN_CMD_VERSION) { #line 4054 "itadmin.ctr" itadmin_show_version(job); } if((job->cmd) & ITADMIN_CMD_LICENSE_TERMS) { #line 4057 "itadmin.ctr" itadmin_show_license(job); } if((job->cmd) & ITADMIN_CMD_HELP) { #line 4060 "itadmin.ctr" itadmin_show_help(job); } } else { #line 4063 "itadmin.ctr" if(!((job->cmd) & (ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES))) { job->cmd = (ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES); } itadmin_run(job); } #line 4068 "itadmin.ctr" } /** Entry point of the program. @param argc Number of command line arguments. @param argv Command line arguments array. @return 0 on success, any other value indicates an error. */ DK3_MAIN { itadmin_job job; /* Job structure. */ dk3_app_t *app; /* Application structure. */ dkChar const * const *msg; /* Localized message texts. */ int exval = 1; /* Exit status code. */ #line 4084 "itadmin.ctr" #line 4085 "itadmin.ctr" #if DK3_HAVE_TZSET tzset(); #endif job.exval = 1; app = dk3app_open_command( argc, (dkChar const * const *)argv, itadmin_kw_noloc[0] ); if(app) { msg = dk3app_messages(app,itadmin_kw_noloc[1],(dkChar const **)itadmin_kw); if(msg) { itadmin_job_init(&job, app, msg, itadmin_kw_noloc); if(itadmin_job_up(&job)) { if(itadmin_process_arguments(&job)) { itadmin_run_or_help(&job); } } itadmin_job_cleanup(&job); } else { /* BUG: Should not happen as dk3app_messages() returns the default string array if there is any error. */ } dk3app_close(app); } else { /* ERROR: Memory */ fprintf( stderr, "ERROR: Not enough memory\n" ); fflush(stderr); } exval = job.exval; #line 4119 "itadmin.ctr" #line 4120 "itadmin.ctr" fflush(stdout); exit(exval); return exval; }