├── .gitignore ├── AUTHORS ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile.am ├── NEWS ├── NOTICE ├── README.md ├── aclocal.m4 ├── autogen.sh ├── config.guess ├── config.sub ├── configure.in ├── depcomp ├── distribute.sh.in ├── doc ├── Makefile.am ├── Makefile.in ├── examples │ └── viewssld.conf ├── manual-ru.doc ├── manual-ru.pdf └── viewssld.8 ├── install-sh ├── missing └── src ├── Makefile ├── Makefile.am ├── utils.c ├── utils.h ├── viewssld.c └── viewssld.h /.gitignore: -------------------------------------------------------------------------------- 1 | configure 2 | config.log 3 | autom4te.cache/ 4 | config.status 5 | .deps 6 | Makefile 7 | Makefile.in 8 | distribute.sh 9 | doc/Makefile 10 | doc/Makefile.in 11 | src/Makefile 12 | src/Makefile.in 13 | *.o 14 | *.lo 15 | *.la 16 | src/viewssld 17 | compile 18 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Dzmitry Plashchynski 2 | Alec Waters 3 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2008-05-29 Dzmitry Plashchynski 2 | 3 | * viewssld: initial version. 4 | 5 | 2011-06-19 Alec Waters 6 | 7 | * Outputting a fake 3-way TCP handshake for the decrypted traffic 8 | * Outputting the decrypted server replies as well as the client requests, keeping the (fake) TCP sequence numbers properly up to date 9 | * Outputting a fake RST at the end of each session 10 | * Using an easily-searchable IP Ident number for all the fake frames so you can tell which ones were output by viewssld (54609 == 0xd551 == DSSL J ) 11 | * Outputting the decrypted frames on a different port to which they were captured on (e.g. 443->80, 465->25, 993->143, etc.) 12 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 5 | 2006 Free Software Foundation, Inc. 6 | 7 | This file is free documentation; the Free Software Foundation gives 8 | unlimited permission to copy, distribute and modify it. 9 | 10 | Basic Installation 11 | ================== 12 | 13 | Briefly, the shell commands `./configure; make; make install' should 14 | configure, build, and install this package. The following 15 | more-detailed instructions are generic; see the `README' file for 16 | instructions specific to this package. 17 | 18 | The `configure' shell script attempts to guess correct values for 19 | various system-dependent variables used during compilation. It uses 20 | those values to create a `Makefile' in each directory of the package. 21 | It may also create one or more `.h' files containing system-dependent 22 | definitions. Finally, it creates a shell script `config.status' that 23 | you can run in the future to recreate the current configuration, and a 24 | file `config.log' containing compiler output (useful mainly for 25 | debugging `configure'). 26 | 27 | It can also use an optional file (typically called `config.cache' 28 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 29 | the results of its tests to speed up reconfiguring. Caching is 30 | disabled by default to prevent problems with accidental use of stale 31 | cache files. 32 | 33 | If you need to do unusual things to compile the package, please try 34 | to figure out how `configure' could check whether to do them, and mail 35 | diffs or instructions to the address given in the `README' so they can 36 | be considered for the next release. If you are using the cache, and at 37 | some point `config.cache' contains results you don't want to keep, you 38 | may remove or edit it. 39 | 40 | The file `configure.ac' (or `configure.in') is used to create 41 | `configure' by a program called `autoconf'. You need `configure.ac' if 42 | you want to change it or regenerate `configure' using a newer version 43 | of `autoconf'. 44 | 45 | The simplest way to compile this package is: 46 | 47 | 1. `cd' to the directory containing the package's source code and type 48 | `./configure' to configure the package for your system. 49 | 50 | Running `configure' might take a while. While running, it prints 51 | some messages telling which features it is checking for. 52 | 53 | 2. Type `make' to compile the package. 54 | 55 | 3. Optionally, type `make check' to run any self-tests that come with 56 | the package. 57 | 58 | 4. Type `make install' to install the programs and any data files and 59 | documentation. 60 | 61 | 5. You can remove the program binaries and object files from the 62 | source code directory by typing `make clean'. To also remove the 63 | files that `configure' created (so you can compile the package for 64 | a different kind of computer), type `make distclean'. There is 65 | also a `make maintainer-clean' target, but that is intended mainly 66 | for the package's developers. If you use it, you may have to get 67 | all sorts of other programs in order to regenerate files that came 68 | with the distribution. 69 | 70 | Compilers and Options 71 | ===================== 72 | 73 | Some systems require unusual options for compilation or linking that the 74 | `configure' script does not know about. Run `./configure --help' for 75 | details on some of the pertinent environment variables. 76 | 77 | You can give `configure' initial values for configuration parameters 78 | by setting variables in the command line or in the environment. Here 79 | is an example: 80 | 81 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 82 | 83 | *Note Defining Variables::, for more details. 84 | 85 | Compiling For Multiple Architectures 86 | ==================================== 87 | 88 | You can compile the package for more than one kind of computer at the 89 | same time, by placing the object files for each architecture in their 90 | own directory. To do this, you can use GNU `make'. `cd' to the 91 | directory where you want the object files and executables to go and run 92 | the `configure' script. `configure' automatically checks for the 93 | source code in the directory that `configure' is in and in `..'. 94 | 95 | With a non-GNU `make', it is safer to compile the package for one 96 | architecture at a time in the source code directory. After you have 97 | installed the package for one architecture, use `make distclean' before 98 | reconfiguring for another architecture. 99 | 100 | Installation Names 101 | ================== 102 | 103 | By default, `make install' installs the package's commands under 104 | `/usr/local/bin', include files under `/usr/local/include', etc. You 105 | can specify an installation prefix other than `/usr/local' by giving 106 | `configure' the option `--prefix=PREFIX'. 107 | 108 | You can specify separate installation prefixes for 109 | architecture-specific files and architecture-independent files. If you 110 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 111 | PREFIX as the prefix for installing programs and libraries. 112 | Documentation and other data files still use the regular prefix. 113 | 114 | In addition, if you use an unusual directory layout you can give 115 | options like `--bindir=DIR' to specify different values for particular 116 | kinds of files. Run `configure --help' for a list of the directories 117 | you can set and what kinds of files go in them. 118 | 119 | If the package supports it, you can cause programs to be installed 120 | with an extra prefix or suffix on their names by giving `configure' the 121 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 122 | 123 | Optional Features 124 | ================= 125 | 126 | Some packages pay attention to `--enable-FEATURE' options to 127 | `configure', where FEATURE indicates an optional part of the package. 128 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 129 | is something like `gnu-as' or `x' (for the X Window System). The 130 | `README' should mention any `--enable-' and `--with-' options that the 131 | package recognizes. 132 | 133 | For packages that use the X Window System, `configure' can usually 134 | find the X include and library files automatically, but if it doesn't, 135 | you can use the `configure' options `--x-includes=DIR' and 136 | `--x-libraries=DIR' to specify their locations. 137 | 138 | Specifying the System Type 139 | ========================== 140 | 141 | There may be some features `configure' cannot figure out automatically, 142 | but needs to determine by the type of machine the package will run on. 143 | Usually, assuming the package is built to be run on the _same_ 144 | architectures, `configure' can figure that out, but if it prints a 145 | message saying it cannot guess the machine type, give it the 146 | `--build=TYPE' option. TYPE can either be a short name for the system 147 | type, such as `sun4', or a canonical name which has the form: 148 | 149 | CPU-COMPANY-SYSTEM 150 | 151 | where SYSTEM can have one of these forms: 152 | 153 | OS KERNEL-OS 154 | 155 | See the file `config.sub' for the possible values of each field. If 156 | `config.sub' isn't included in this package, then this package doesn't 157 | need to know the machine type. 158 | 159 | If you are _building_ compiler tools for cross-compiling, you should 160 | use the option `--target=TYPE' to select the type of system they will 161 | produce code for. 162 | 163 | If you want to _use_ a cross compiler, that generates code for a 164 | platform different from the build platform, you should specify the 165 | "host" platform (i.e., that on which the generated programs will 166 | eventually be run) with `--host=TYPE'. 167 | 168 | Sharing Defaults 169 | ================ 170 | 171 | If you want to set default values for `configure' scripts to share, you 172 | can create a site shell script called `config.site' that gives default 173 | values for variables like `CC', `cache_file', and `prefix'. 174 | `configure' looks for `PREFIX/share/config.site' if it exists, then 175 | `PREFIX/etc/config.site' if it exists. Or, you can set the 176 | `CONFIG_SITE' environment variable to the location of the site script. 177 | A warning: not all `configure' scripts look for a site script. 178 | 179 | Defining Variables 180 | ================== 181 | 182 | Variables not defined in a site shell script can be set in the 183 | environment passed to `configure'. However, some packages may run 184 | configure again during the build, and the customized values of these 185 | variables may be lost. In order to avoid this problem, you should set 186 | them in the `configure' command line, using `VAR=value'. For example: 187 | 188 | ./configure CC=/usr/local2/bin/gcc 189 | 190 | causes the specified `gcc' to be used as the C compiler (unless it is 191 | overridden in the site shell script). 192 | 193 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to 194 | an Autoconf bug. Until the bug is fixed you can use this workaround: 195 | 196 | CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash 197 | 198 | `configure' Invocation 199 | ====================== 200 | 201 | `configure' recognizes the following options to control how it operates. 202 | 203 | `--help' 204 | `-h' 205 | Print a summary of the options to `configure', and exit. 206 | 207 | `--version' 208 | `-V' 209 | Print the version of Autoconf used to generate the `configure' 210 | script, and exit. 211 | 212 | `--cache-file=FILE' 213 | Enable the cache: use and save the results of the tests in FILE, 214 | traditionally `config.cache'. FILE defaults to `/dev/null' to 215 | disable caching. 216 | 217 | `--config-cache' 218 | `-C' 219 | Alias for `--cache-file=config.cache'. 220 | 221 | `--quiet' 222 | `--silent' 223 | `-q' 224 | Do not print messages saying which checks are being made. To 225 | suppress all normal output, redirect it to `/dev/null' (any error 226 | messages will still be shown). 227 | 228 | `--srcdir=DIR' 229 | Look for the package's source code in directory DIR. Usually 230 | `configure' can determine that directory automatically. 231 | 232 | `configure' also accepts some other, not widely useful, options. Run 233 | `configure --help' for more details. 234 | 235 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2007 Dzmitry Plashchynski 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | SUBDIRS = src doc 3 | CLEANFILES = distribute.sh Makefile src/Makefile src/*~ 4 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plashchynski/viewssld/3dda94d4bc3fc3294392568b6931084cc48879cb/NEWS -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2007 Dzmitry Plashchynski 2 | Licensed under the Apache License, Version 2.0 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | viewssld — SSL decryption daemon for Snort 2 | -------------------- 3 | viewssld is a free, open source, non-terminating SSLv2/SSLv3/TLS traffic decryption daemon for Snort, and other Network Intrusion Detection Systems (IDS). 4 | 5 | ### Disclaimer 6 | Before carrying on working on getting it compiled, it’s worth thinking about this: 7 | The issue that viewssld faces in today’s world is that more and more SSL/TLS servers are using some form of perfect forward secrecy (“PFS”, usually a flavour of Diffie-Hellman) for key agreement, rather than using the server’s private key to encrypt the pre-master secret. There’s lots of maths ‘n’ stuff here: http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html 8 | 9 | 10 | The bottom line is that viewssld’s days are numbered unless you cripple your server’s SSL/TLS configuration to not use PFS (thereby scoring poorly on the SSL Labs test !), so it (viewssld) doesn’t have much of a future outside of some very specific cases. I guess that in a PFS world the best way to do this would be to terminate SSL/TLS on a box in front of your servers and have your NSM tap on the unencrypted link between the two? 11 | 12 | by @alecrwaters 13 | 14 | ### Requirements 15 | * libpcap 16 | * libssl (openssl) 17 | * libdssl, you can download it from here: https://github.com/downloads/plashchynski/viewssld/libdssl-2.1.1.tar.gz 18 | 19 | ### Installation and Usage 20 | See http://resources.infosecinstitute.com/ssl-decryption/ for more details. Please note that libdssl is no longer available at the atomiclabs svn archive so the libdssl download link in the article doesn't work. You can download libdssl here: https://github.com/downloads/plashchynski/viewssld/libdssl-2.1.1.tar.gz 21 | 22 | ### Support 23 | Need some help? Feel free to create an issue https://github.com/plashchynski/viewssld/issues 24 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | ACLOCAL=${ACLOCAL:-aclocal} 5 | AUTOMAKE=${AUTOMAKE:-automake} 6 | AUTOMAKE_FLAGS="--add-missing --copy" 7 | AUTOCONF=${AUTOCONF:-autoconf} 8 | 9 | ARGV0=$0 10 | 11 | set -e 12 | 13 | 14 | run() { 15 | echo "$ARGV0: running \`$@'" 16 | $@ 17 | } 18 | 19 | run $ACLOCAL $ACLOCAL_FLAGS 20 | run $AUTOMAKE $AUTOMAKE_FLAGS 21 | run $AUTOCONF 22 | echo "Now type './configure ...' and 'make' to compile." 23 | -------------------------------------------------------------------------------- /config.sub: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Configuration validation subroutine script. 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 | # Inc. 6 | 7 | timestamp='2006-07-02' 8 | 9 | # This file is (in principle) common to ALL GNU software. 10 | # The presence of a machine in this file suggests that SOME GNU software 11 | # can handle that machine. It does not imply ALL GNU software can. 12 | # 13 | # This file is free software; you can redistribute it and/or modify 14 | # it under the terms of the GNU General Public License as published by 15 | # the Free Software Foundation; either version 2 of the License, or 16 | # (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | # GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public License 24 | # along with this program; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 26 | # 02110-1301, USA. 27 | # 28 | # As a special exception to the GNU General Public License, if you 29 | # distribute this file as part of a program that contains a 30 | # configuration script generated by Autoconf, you may include it under 31 | # the same distribution terms that you use for the rest of that program. 32 | 33 | 34 | # Please send patches to . Submit a context 35 | # diff and a properly formatted ChangeLog entry. 36 | # 37 | # Configuration subroutine to validate and canonicalize a configuration type. 38 | # Supply the specified configuration type as an argument. 39 | # If it is invalid, we print an error message on stderr and exit with code 1. 40 | # Otherwise, we print the canonical config type on stdout and succeed. 41 | 42 | # This file is supposed to be the same for all GNU packages 43 | # and recognize all the CPU types, system types and aliases 44 | # that are meaningful with *any* GNU software. 45 | # Each package is responsible for reporting which valid configurations 46 | # it does not support. The user should be able to distinguish 47 | # a failure to support a valid configuration from a meaningless 48 | # configuration. 49 | 50 | # The goal of this file is to map all the various variations of a given 51 | # machine specification into a single specification in the form: 52 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 53 | # or in some cases, the newer four-part form: 54 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 55 | # It is wrong to echo any other type of specification. 56 | 57 | me=`echo "$0" | sed -e 's,.*/,,'` 58 | 59 | usage="\ 60 | Usage: $0 [OPTION] CPU-MFR-OPSYS 61 | $0 [OPTION] ALIAS 62 | 63 | Canonicalize a configuration name. 64 | 65 | Operation modes: 66 | -h, --help print this help, then exit 67 | -t, --time-stamp print date of last modification, then exit 68 | -v, --version print version number, then exit 69 | 70 | Report bugs and patches to ." 71 | 72 | version="\ 73 | GNU config.sub ($timestamp) 74 | 75 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 76 | Free Software Foundation, Inc. 77 | 78 | This is free software; see the source for copying conditions. There is NO 79 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 80 | 81 | help=" 82 | Try \`$me --help' for more information." 83 | 84 | # Parse command line 85 | while test $# -gt 0 ; do 86 | case $1 in 87 | --time-stamp | --time* | -t ) 88 | echo "$timestamp" ; exit ;; 89 | --version | -v ) 90 | echo "$version" ; exit ;; 91 | --help | --h* | -h ) 92 | echo "$usage"; exit ;; 93 | -- ) # Stop option processing 94 | shift; break ;; 95 | - ) # Use stdin as input. 96 | break ;; 97 | -* ) 98 | echo "$me: invalid option $1$help" 99 | exit 1 ;; 100 | 101 | *local*) 102 | # First pass through any local machine types. 103 | echo $1 104 | exit ;; 105 | 106 | * ) 107 | break ;; 108 | esac 109 | done 110 | 111 | case $# in 112 | 0) echo "$me: missing argument$help" >&2 113 | exit 1;; 114 | 1) ;; 115 | *) echo "$me: too many arguments$help" >&2 116 | exit 1;; 117 | esac 118 | 119 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 120 | # Here we must recognize all the valid KERNEL-OS combinations. 121 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 122 | case $maybe_os in 123 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ 124 | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ 125 | storm-chaos* | os2-emx* | rtmk-nova*) 126 | os=-$maybe_os 127 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 128 | ;; 129 | *) 130 | basic_machine=`echo $1 | sed 's/-[^-]*$//'` 131 | if [ $basic_machine != $1 ] 132 | then os=`echo $1 | sed 's/.*-/-/'` 133 | else os=; fi 134 | ;; 135 | esac 136 | 137 | ### Let's recognize common machines as not being operating systems so 138 | ### that things like config.sub decstation-3100 work. We also 139 | ### recognize some manufacturers as not being operating systems, so we 140 | ### can provide default operating systems below. 141 | case $os in 142 | -sun*os*) 143 | # Prevent following clause from handling this invalid input. 144 | ;; 145 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 146 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 147 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ 148 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ 149 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 150 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 151 | -apple | -axis | -knuth | -cray) 152 | os= 153 | basic_machine=$1 154 | ;; 155 | -sim | -cisco | -oki | -wec | -winbond) 156 | os= 157 | basic_machine=$1 158 | ;; 159 | -scout) 160 | ;; 161 | -wrs) 162 | os=-vxworks 163 | basic_machine=$1 164 | ;; 165 | -chorusos*) 166 | os=-chorusos 167 | basic_machine=$1 168 | ;; 169 | -chorusrdb) 170 | os=-chorusrdb 171 | basic_machine=$1 172 | ;; 173 | -hiux*) 174 | os=-hiuxwe2 175 | ;; 176 | -sco6) 177 | os=-sco5v6 178 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 179 | ;; 180 | -sco5) 181 | os=-sco3.2v5 182 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 183 | ;; 184 | -sco4) 185 | os=-sco3.2v4 186 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 187 | ;; 188 | -sco3.2.[4-9]*) 189 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 190 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 191 | ;; 192 | -sco3.2v[4-9]*) 193 | # Don't forget version if it is 3.2v4 or newer. 194 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 195 | ;; 196 | -sco5v6*) 197 | # Don't forget version if it is 3.2v4 or newer. 198 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 199 | ;; 200 | -sco*) 201 | os=-sco3.2v2 202 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 203 | ;; 204 | -udk*) 205 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 206 | ;; 207 | -isc) 208 | os=-isc2.2 209 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 210 | ;; 211 | -clix*) 212 | basic_machine=clipper-intergraph 213 | ;; 214 | -isc*) 215 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 216 | ;; 217 | -lynx*) 218 | os=-lynxos 219 | ;; 220 | -ptx*) 221 | basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` 222 | ;; 223 | -windowsnt*) 224 | os=`echo $os | sed -e 's/windowsnt/winnt/'` 225 | ;; 226 | -psos*) 227 | os=-psos 228 | ;; 229 | -mint | -mint[0-9]*) 230 | basic_machine=m68k-atari 231 | os=-mint 232 | ;; 233 | esac 234 | 235 | # Decode aliases for certain CPU-COMPANY combinations. 236 | case $basic_machine in 237 | # Recognize the basic CPU types without company name. 238 | # Some are omitted here because they have special meanings below. 239 | 1750a | 580 \ 240 | | a29k \ 241 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ 242 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ 243 | | am33_2.0 \ 244 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ 245 | | bfin \ 246 | | c4x | clipper \ 247 | | d10v | d30v | dlx | dsp16xx \ 248 | | fr30 | frv \ 249 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 250 | | i370 | i860 | i960 | ia64 \ 251 | | ip2k | iq2000 \ 252 | | m32c | m32r | m32rle | m68000 | m68k | m88k \ 253 | | maxq | mb | microblaze | mcore \ 254 | | mips | mipsbe | mipseb | mipsel | mipsle \ 255 | | mips16 \ 256 | | mips64 | mips64el \ 257 | | mips64vr | mips64vrel \ 258 | | mips64orion | mips64orionel \ 259 | | mips64vr4100 | mips64vr4100el \ 260 | | mips64vr4300 | mips64vr4300el \ 261 | | mips64vr5000 | mips64vr5000el \ 262 | | mips64vr5900 | mips64vr5900el \ 263 | | mipsisa32 | mipsisa32el \ 264 | | mipsisa32r2 | mipsisa32r2el \ 265 | | mipsisa64 | mipsisa64el \ 266 | | mipsisa64r2 | mipsisa64r2el \ 267 | | mipsisa64sb1 | mipsisa64sb1el \ 268 | | mipsisa64sr71k | mipsisa64sr71kel \ 269 | | mipstx39 | mipstx39el \ 270 | | mn10200 | mn10300 \ 271 | | mt \ 272 | | msp430 \ 273 | | nios | nios2 \ 274 | | ns16k | ns32k \ 275 | | or32 \ 276 | | pdp10 | pdp11 | pj | pjl \ 277 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ 278 | | pyramid \ 279 | | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ 280 | | sh64 | sh64le \ 281 | | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ 282 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ 283 | | spu | strongarm \ 284 | | tahoe | thumb | tic4x | tic80 | tron \ 285 | | v850 | v850e \ 286 | | we32k \ 287 | | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ 288 | | z8k) 289 | basic_machine=$basic_machine-unknown 290 | ;; 291 | m6811 | m68hc11 | m6812 | m68hc12) 292 | # Motorola 68HC11/12. 293 | basic_machine=$basic_machine-unknown 294 | os=-none 295 | ;; 296 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) 297 | ;; 298 | ms1) 299 | basic_machine=mt-unknown 300 | ;; 301 | 302 | # We use `pc' rather than `unknown' 303 | # because (1) that's what they normally are, and 304 | # (2) the word "unknown" tends to confuse beginning users. 305 | i*86 | x86_64) 306 | basic_machine=$basic_machine-pc 307 | ;; 308 | # Object if more than one company name word. 309 | *-*-*) 310 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 311 | exit 1 312 | ;; 313 | # Recognize the basic CPU types with company name. 314 | 580-* \ 315 | | a29k-* \ 316 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ 317 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ 318 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ 319 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ 320 | | avr-* | avr32-* \ 321 | | bfin-* | bs2000-* \ 322 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ 323 | | clipper-* | craynv-* | cydra-* \ 324 | | d10v-* | d30v-* | dlx-* \ 325 | | elxsi-* \ 326 | | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ 327 | | h8300-* | h8500-* \ 328 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ 329 | | i*86-* | i860-* | i960-* | ia64-* \ 330 | | ip2k-* | iq2000-* \ 331 | | m32c-* | m32r-* | m32rle-* \ 332 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ 333 | | m88110-* | m88k-* | maxq-* | mcore-* \ 334 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ 335 | | mips16-* \ 336 | | mips64-* | mips64el-* \ 337 | | mips64vr-* | mips64vrel-* \ 338 | | mips64orion-* | mips64orionel-* \ 339 | | mips64vr4100-* | mips64vr4100el-* \ 340 | | mips64vr4300-* | mips64vr4300el-* \ 341 | | mips64vr5000-* | mips64vr5000el-* \ 342 | | mips64vr5900-* | mips64vr5900el-* \ 343 | | mipsisa32-* | mipsisa32el-* \ 344 | | mipsisa32r2-* | mipsisa32r2el-* \ 345 | | mipsisa64-* | mipsisa64el-* \ 346 | | mipsisa64r2-* | mipsisa64r2el-* \ 347 | | mipsisa64sb1-* | mipsisa64sb1el-* \ 348 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \ 349 | | mipstx39-* | mipstx39el-* \ 350 | | mmix-* \ 351 | | mt-* \ 352 | | msp430-* \ 353 | | nios-* | nios2-* \ 354 | | none-* | np1-* | ns16k-* | ns32k-* \ 355 | | orion-* \ 356 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ 357 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ 358 | | pyramid-* \ 359 | | romp-* | rs6000-* \ 360 | | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ 361 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ 362 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ 363 | | sparclite-* \ 364 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ 365 | | tahoe-* | thumb-* \ 366 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ 367 | | tron-* \ 368 | | v850-* | v850e-* | vax-* \ 369 | | we32k-* \ 370 | | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ 371 | | xstormy16-* | xtensa-* \ 372 | | ymp-* \ 373 | | z8k-*) 374 | ;; 375 | # Recognize the various machine names and aliases which stand 376 | # for a CPU type and a company and sometimes even an OS. 377 | 386bsd) 378 | basic_machine=i386-unknown 379 | os=-bsd 380 | ;; 381 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 382 | basic_machine=m68000-att 383 | ;; 384 | 3b*) 385 | basic_machine=we32k-att 386 | ;; 387 | a29khif) 388 | basic_machine=a29k-amd 389 | os=-udi 390 | ;; 391 | abacus) 392 | basic_machine=abacus-unknown 393 | ;; 394 | adobe68k) 395 | basic_machine=m68010-adobe 396 | os=-scout 397 | ;; 398 | alliant | fx80) 399 | basic_machine=fx80-alliant 400 | ;; 401 | altos | altos3068) 402 | basic_machine=m68k-altos 403 | ;; 404 | am29k) 405 | basic_machine=a29k-none 406 | os=-bsd 407 | ;; 408 | amd64) 409 | basic_machine=x86_64-pc 410 | ;; 411 | amd64-*) 412 | basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` 413 | ;; 414 | amdahl) 415 | basic_machine=580-amdahl 416 | os=-sysv 417 | ;; 418 | amiga | amiga-*) 419 | basic_machine=m68k-unknown 420 | ;; 421 | amigaos | amigados) 422 | basic_machine=m68k-unknown 423 | os=-amigaos 424 | ;; 425 | amigaunix | amix) 426 | basic_machine=m68k-unknown 427 | os=-sysv4 428 | ;; 429 | apollo68) 430 | basic_machine=m68k-apollo 431 | os=-sysv 432 | ;; 433 | apollo68bsd) 434 | basic_machine=m68k-apollo 435 | os=-bsd 436 | ;; 437 | aux) 438 | basic_machine=m68k-apple 439 | os=-aux 440 | ;; 441 | balance) 442 | basic_machine=ns32k-sequent 443 | os=-dynix 444 | ;; 445 | c90) 446 | basic_machine=c90-cray 447 | os=-unicos 448 | ;; 449 | convex-c1) 450 | basic_machine=c1-convex 451 | os=-bsd 452 | ;; 453 | convex-c2) 454 | basic_machine=c2-convex 455 | os=-bsd 456 | ;; 457 | convex-c32) 458 | basic_machine=c32-convex 459 | os=-bsd 460 | ;; 461 | convex-c34) 462 | basic_machine=c34-convex 463 | os=-bsd 464 | ;; 465 | convex-c38) 466 | basic_machine=c38-convex 467 | os=-bsd 468 | ;; 469 | cray | j90) 470 | basic_machine=j90-cray 471 | os=-unicos 472 | ;; 473 | craynv) 474 | basic_machine=craynv-cray 475 | os=-unicosmp 476 | ;; 477 | cr16c) 478 | basic_machine=cr16c-unknown 479 | os=-elf 480 | ;; 481 | crds | unos) 482 | basic_machine=m68k-crds 483 | ;; 484 | crisv32 | crisv32-* | etraxfs*) 485 | basic_machine=crisv32-axis 486 | ;; 487 | cris | cris-* | etrax*) 488 | basic_machine=cris-axis 489 | ;; 490 | crx) 491 | basic_machine=crx-unknown 492 | os=-elf 493 | ;; 494 | da30 | da30-*) 495 | basic_machine=m68k-da30 496 | ;; 497 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) 498 | basic_machine=mips-dec 499 | ;; 500 | decsystem10* | dec10*) 501 | basic_machine=pdp10-dec 502 | os=-tops10 503 | ;; 504 | decsystem20* | dec20*) 505 | basic_machine=pdp10-dec 506 | os=-tops20 507 | ;; 508 | delta | 3300 | motorola-3300 | motorola-delta \ 509 | | 3300-motorola | delta-motorola) 510 | basic_machine=m68k-motorola 511 | ;; 512 | delta88) 513 | basic_machine=m88k-motorola 514 | os=-sysv3 515 | ;; 516 | djgpp) 517 | basic_machine=i586-pc 518 | os=-msdosdjgpp 519 | ;; 520 | dpx20 | dpx20-*) 521 | basic_machine=rs6000-bull 522 | os=-bosx 523 | ;; 524 | dpx2* | dpx2*-bull) 525 | basic_machine=m68k-bull 526 | os=-sysv3 527 | ;; 528 | ebmon29k) 529 | basic_machine=a29k-amd 530 | os=-ebmon 531 | ;; 532 | elxsi) 533 | basic_machine=elxsi-elxsi 534 | os=-bsd 535 | ;; 536 | encore | umax | mmax) 537 | basic_machine=ns32k-encore 538 | ;; 539 | es1800 | OSE68k | ose68k | ose | OSE) 540 | basic_machine=m68k-ericsson 541 | os=-ose 542 | ;; 543 | fx2800) 544 | basic_machine=i860-alliant 545 | ;; 546 | genix) 547 | basic_machine=ns32k-ns 548 | ;; 549 | gmicro) 550 | basic_machine=tron-gmicro 551 | os=-sysv 552 | ;; 553 | go32) 554 | basic_machine=i386-pc 555 | os=-go32 556 | ;; 557 | h3050r* | hiux*) 558 | basic_machine=hppa1.1-hitachi 559 | os=-hiuxwe2 560 | ;; 561 | h8300hms) 562 | basic_machine=h8300-hitachi 563 | os=-hms 564 | ;; 565 | h8300xray) 566 | basic_machine=h8300-hitachi 567 | os=-xray 568 | ;; 569 | h8500hms) 570 | basic_machine=h8500-hitachi 571 | os=-hms 572 | ;; 573 | harris) 574 | basic_machine=m88k-harris 575 | os=-sysv3 576 | ;; 577 | hp300-*) 578 | basic_machine=m68k-hp 579 | ;; 580 | hp300bsd) 581 | basic_machine=m68k-hp 582 | os=-bsd 583 | ;; 584 | hp300hpux) 585 | basic_machine=m68k-hp 586 | os=-hpux 587 | ;; 588 | hp3k9[0-9][0-9] | hp9[0-9][0-9]) 589 | basic_machine=hppa1.0-hp 590 | ;; 591 | hp9k2[0-9][0-9] | hp9k31[0-9]) 592 | basic_machine=m68000-hp 593 | ;; 594 | hp9k3[2-9][0-9]) 595 | basic_machine=m68k-hp 596 | ;; 597 | hp9k6[0-9][0-9] | hp6[0-9][0-9]) 598 | basic_machine=hppa1.0-hp 599 | ;; 600 | hp9k7[0-79][0-9] | hp7[0-79][0-9]) 601 | basic_machine=hppa1.1-hp 602 | ;; 603 | hp9k78[0-9] | hp78[0-9]) 604 | # FIXME: really hppa2.0-hp 605 | basic_machine=hppa1.1-hp 606 | ;; 607 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 608 | # FIXME: really hppa2.0-hp 609 | basic_machine=hppa1.1-hp 610 | ;; 611 | hp9k8[0-9][13679] | hp8[0-9][13679]) 612 | basic_machine=hppa1.1-hp 613 | ;; 614 | hp9k8[0-9][0-9] | hp8[0-9][0-9]) 615 | basic_machine=hppa1.0-hp 616 | ;; 617 | hppa-next) 618 | os=-nextstep3 619 | ;; 620 | hppaosf) 621 | basic_machine=hppa1.1-hp 622 | os=-osf 623 | ;; 624 | hppro) 625 | basic_machine=hppa1.1-hp 626 | os=-proelf 627 | ;; 628 | i370-ibm* | ibm*) 629 | basic_machine=i370-ibm 630 | ;; 631 | # I'm not sure what "Sysv32" means. Should this be sysv3.2? 632 | i*86v32) 633 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 634 | os=-sysv32 635 | ;; 636 | i*86v4*) 637 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 638 | os=-sysv4 639 | ;; 640 | i*86v) 641 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 642 | os=-sysv 643 | ;; 644 | i*86sol2) 645 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 646 | os=-solaris2 647 | ;; 648 | i386mach) 649 | basic_machine=i386-mach 650 | os=-mach 651 | ;; 652 | i386-vsta | vsta) 653 | basic_machine=i386-unknown 654 | os=-vsta 655 | ;; 656 | iris | iris4d) 657 | basic_machine=mips-sgi 658 | case $os in 659 | -irix*) 660 | ;; 661 | *) 662 | os=-irix4 663 | ;; 664 | esac 665 | ;; 666 | isi68 | isi) 667 | basic_machine=m68k-isi 668 | os=-sysv 669 | ;; 670 | m88k-omron*) 671 | basic_machine=m88k-omron 672 | ;; 673 | magnum | m3230) 674 | basic_machine=mips-mips 675 | os=-sysv 676 | ;; 677 | merlin) 678 | basic_machine=ns32k-utek 679 | os=-sysv 680 | ;; 681 | mingw32) 682 | basic_machine=i386-pc 683 | os=-mingw32 684 | ;; 685 | miniframe) 686 | basic_machine=m68000-convergent 687 | ;; 688 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) 689 | basic_machine=m68k-atari 690 | os=-mint 691 | ;; 692 | mips3*-*) 693 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` 694 | ;; 695 | mips3*) 696 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown 697 | ;; 698 | monitor) 699 | basic_machine=m68k-rom68k 700 | os=-coff 701 | ;; 702 | morphos) 703 | basic_machine=powerpc-unknown 704 | os=-morphos 705 | ;; 706 | msdos) 707 | basic_machine=i386-pc 708 | os=-msdos 709 | ;; 710 | ms1-*) 711 | basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` 712 | ;; 713 | mvs) 714 | basic_machine=i370-ibm 715 | os=-mvs 716 | ;; 717 | ncr3000) 718 | basic_machine=i486-ncr 719 | os=-sysv4 720 | ;; 721 | netbsd386) 722 | basic_machine=i386-unknown 723 | os=-netbsd 724 | ;; 725 | netwinder) 726 | basic_machine=armv4l-rebel 727 | os=-linux 728 | ;; 729 | news | news700 | news800 | news900) 730 | basic_machine=m68k-sony 731 | os=-newsos 732 | ;; 733 | news1000) 734 | basic_machine=m68030-sony 735 | os=-newsos 736 | ;; 737 | news-3600 | risc-news) 738 | basic_machine=mips-sony 739 | os=-newsos 740 | ;; 741 | necv70) 742 | basic_machine=v70-nec 743 | os=-sysv 744 | ;; 745 | next | m*-next ) 746 | basic_machine=m68k-next 747 | case $os in 748 | -nextstep* ) 749 | ;; 750 | -ns2*) 751 | os=-nextstep2 752 | ;; 753 | *) 754 | os=-nextstep3 755 | ;; 756 | esac 757 | ;; 758 | nh3000) 759 | basic_machine=m68k-harris 760 | os=-cxux 761 | ;; 762 | nh[45]000) 763 | basic_machine=m88k-harris 764 | os=-cxux 765 | ;; 766 | nindy960) 767 | basic_machine=i960-intel 768 | os=-nindy 769 | ;; 770 | mon960) 771 | basic_machine=i960-intel 772 | os=-mon960 773 | ;; 774 | nonstopux) 775 | basic_machine=mips-compaq 776 | os=-nonstopux 777 | ;; 778 | np1) 779 | basic_machine=np1-gould 780 | ;; 781 | nsr-tandem) 782 | basic_machine=nsr-tandem 783 | ;; 784 | op50n-* | op60c-*) 785 | basic_machine=hppa1.1-oki 786 | os=-proelf 787 | ;; 788 | openrisc | openrisc-*) 789 | basic_machine=or32-unknown 790 | ;; 791 | os400) 792 | basic_machine=powerpc-ibm 793 | os=-os400 794 | ;; 795 | OSE68000 | ose68000) 796 | basic_machine=m68000-ericsson 797 | os=-ose 798 | ;; 799 | os68k) 800 | basic_machine=m68k-none 801 | os=-os68k 802 | ;; 803 | pa-hitachi) 804 | basic_machine=hppa1.1-hitachi 805 | os=-hiuxwe2 806 | ;; 807 | paragon) 808 | basic_machine=i860-intel 809 | os=-osf 810 | ;; 811 | pbd) 812 | basic_machine=sparc-tti 813 | ;; 814 | pbb) 815 | basic_machine=m68k-tti 816 | ;; 817 | pc532 | pc532-*) 818 | basic_machine=ns32k-pc532 819 | ;; 820 | pc98) 821 | basic_machine=i386-pc 822 | ;; 823 | pc98-*) 824 | basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` 825 | ;; 826 | pentium | p5 | k5 | k6 | nexgen | viac3) 827 | basic_machine=i586-pc 828 | ;; 829 | pentiumpro | p6 | 6x86 | athlon | athlon_*) 830 | basic_machine=i686-pc 831 | ;; 832 | pentiumii | pentium2 | pentiumiii | pentium3) 833 | basic_machine=i686-pc 834 | ;; 835 | pentium4) 836 | basic_machine=i786-pc 837 | ;; 838 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 839 | basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` 840 | ;; 841 | pentiumpro-* | p6-* | 6x86-* | athlon-*) 842 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 843 | ;; 844 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 845 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 846 | ;; 847 | pentium4-*) 848 | basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` 849 | ;; 850 | pn) 851 | basic_machine=pn-gould 852 | ;; 853 | power) basic_machine=power-ibm 854 | ;; 855 | ppc) basic_machine=powerpc-unknown 856 | ;; 857 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` 858 | ;; 859 | ppcle | powerpclittle | ppc-le | powerpc-little) 860 | basic_machine=powerpcle-unknown 861 | ;; 862 | ppcle-* | powerpclittle-*) 863 | basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` 864 | ;; 865 | ppc64) basic_machine=powerpc64-unknown 866 | ;; 867 | ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` 868 | ;; 869 | ppc64le | powerpc64little | ppc64-le | powerpc64-little) 870 | basic_machine=powerpc64le-unknown 871 | ;; 872 | ppc64le-* | powerpc64little-*) 873 | basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` 874 | ;; 875 | ps2) 876 | basic_machine=i386-ibm 877 | ;; 878 | pw32) 879 | basic_machine=i586-unknown 880 | os=-pw32 881 | ;; 882 | rdos) 883 | basic_machine=i386-pc 884 | os=-rdos 885 | ;; 886 | rom68k) 887 | basic_machine=m68k-rom68k 888 | os=-coff 889 | ;; 890 | rm[46]00) 891 | basic_machine=mips-siemens 892 | ;; 893 | rtpc | rtpc-*) 894 | basic_machine=romp-ibm 895 | ;; 896 | s390 | s390-*) 897 | basic_machine=s390-ibm 898 | ;; 899 | s390x | s390x-*) 900 | basic_machine=s390x-ibm 901 | ;; 902 | sa29200) 903 | basic_machine=a29k-amd 904 | os=-udi 905 | ;; 906 | sb1) 907 | basic_machine=mipsisa64sb1-unknown 908 | ;; 909 | sb1el) 910 | basic_machine=mipsisa64sb1el-unknown 911 | ;; 912 | sei) 913 | basic_machine=mips-sei 914 | os=-seiux 915 | ;; 916 | sequent) 917 | basic_machine=i386-sequent 918 | ;; 919 | sh) 920 | basic_machine=sh-hitachi 921 | os=-hms 922 | ;; 923 | sh64) 924 | basic_machine=sh64-unknown 925 | ;; 926 | sparclite-wrs | simso-wrs) 927 | basic_machine=sparclite-wrs 928 | os=-vxworks 929 | ;; 930 | sps7) 931 | basic_machine=m68k-bull 932 | os=-sysv2 933 | ;; 934 | spur) 935 | basic_machine=spur-unknown 936 | ;; 937 | st2000) 938 | basic_machine=m68k-tandem 939 | ;; 940 | stratus) 941 | basic_machine=i860-stratus 942 | os=-sysv4 943 | ;; 944 | sun2) 945 | basic_machine=m68000-sun 946 | ;; 947 | sun2os3) 948 | basic_machine=m68000-sun 949 | os=-sunos3 950 | ;; 951 | sun2os4) 952 | basic_machine=m68000-sun 953 | os=-sunos4 954 | ;; 955 | sun3os3) 956 | basic_machine=m68k-sun 957 | os=-sunos3 958 | ;; 959 | sun3os4) 960 | basic_machine=m68k-sun 961 | os=-sunos4 962 | ;; 963 | sun4os3) 964 | basic_machine=sparc-sun 965 | os=-sunos3 966 | ;; 967 | sun4os4) 968 | basic_machine=sparc-sun 969 | os=-sunos4 970 | ;; 971 | sun4sol2) 972 | basic_machine=sparc-sun 973 | os=-solaris2 974 | ;; 975 | sun3 | sun3-*) 976 | basic_machine=m68k-sun 977 | ;; 978 | sun4) 979 | basic_machine=sparc-sun 980 | ;; 981 | sun386 | sun386i | roadrunner) 982 | basic_machine=i386-sun 983 | ;; 984 | sv1) 985 | basic_machine=sv1-cray 986 | os=-unicos 987 | ;; 988 | symmetry) 989 | basic_machine=i386-sequent 990 | os=-dynix 991 | ;; 992 | t3e) 993 | basic_machine=alphaev5-cray 994 | os=-unicos 995 | ;; 996 | t90) 997 | basic_machine=t90-cray 998 | os=-unicos 999 | ;; 1000 | tic54x | c54x*) 1001 | basic_machine=tic54x-unknown 1002 | os=-coff 1003 | ;; 1004 | tic55x | c55x*) 1005 | basic_machine=tic55x-unknown 1006 | os=-coff 1007 | ;; 1008 | tic6x | c6x*) 1009 | basic_machine=tic6x-unknown 1010 | os=-coff 1011 | ;; 1012 | tx39) 1013 | basic_machine=mipstx39-unknown 1014 | ;; 1015 | tx39el) 1016 | basic_machine=mipstx39el-unknown 1017 | ;; 1018 | toad1) 1019 | basic_machine=pdp10-xkl 1020 | os=-tops20 1021 | ;; 1022 | tower | tower-32) 1023 | basic_machine=m68k-ncr 1024 | ;; 1025 | tpf) 1026 | basic_machine=s390x-ibm 1027 | os=-tpf 1028 | ;; 1029 | udi29k) 1030 | basic_machine=a29k-amd 1031 | os=-udi 1032 | ;; 1033 | ultra3) 1034 | basic_machine=a29k-nyu 1035 | os=-sym1 1036 | ;; 1037 | v810 | necv810) 1038 | basic_machine=v810-nec 1039 | os=-none 1040 | ;; 1041 | vaxv) 1042 | basic_machine=vax-dec 1043 | os=-sysv 1044 | ;; 1045 | vms) 1046 | basic_machine=vax-dec 1047 | os=-vms 1048 | ;; 1049 | vpp*|vx|vx-*) 1050 | basic_machine=f301-fujitsu 1051 | ;; 1052 | vxworks960) 1053 | basic_machine=i960-wrs 1054 | os=-vxworks 1055 | ;; 1056 | vxworks68) 1057 | basic_machine=m68k-wrs 1058 | os=-vxworks 1059 | ;; 1060 | vxworks29k) 1061 | basic_machine=a29k-wrs 1062 | os=-vxworks 1063 | ;; 1064 | w65*) 1065 | basic_machine=w65-wdc 1066 | os=-none 1067 | ;; 1068 | w89k-*) 1069 | basic_machine=hppa1.1-winbond 1070 | os=-proelf 1071 | ;; 1072 | xbox) 1073 | basic_machine=i686-pc 1074 | os=-mingw32 1075 | ;; 1076 | xps | xps100) 1077 | basic_machine=xps100-honeywell 1078 | ;; 1079 | ymp) 1080 | basic_machine=ymp-cray 1081 | os=-unicos 1082 | ;; 1083 | z8k-*-coff) 1084 | basic_machine=z8k-unknown 1085 | os=-sim 1086 | ;; 1087 | none) 1088 | basic_machine=none-none 1089 | os=-none 1090 | ;; 1091 | 1092 | # Here we handle the default manufacturer of certain CPU types. It is in 1093 | # some cases the only manufacturer, in others, it is the most popular. 1094 | w89k) 1095 | basic_machine=hppa1.1-winbond 1096 | ;; 1097 | op50n) 1098 | basic_machine=hppa1.1-oki 1099 | ;; 1100 | op60c) 1101 | basic_machine=hppa1.1-oki 1102 | ;; 1103 | romp) 1104 | basic_machine=romp-ibm 1105 | ;; 1106 | mmix) 1107 | basic_machine=mmix-knuth 1108 | ;; 1109 | rs6000) 1110 | basic_machine=rs6000-ibm 1111 | ;; 1112 | vax) 1113 | basic_machine=vax-dec 1114 | ;; 1115 | pdp10) 1116 | # there are many clones, so DEC is not a safe bet 1117 | basic_machine=pdp10-unknown 1118 | ;; 1119 | pdp11) 1120 | basic_machine=pdp11-dec 1121 | ;; 1122 | we32k) 1123 | basic_machine=we32k-att 1124 | ;; 1125 | sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) 1126 | basic_machine=sh-unknown 1127 | ;; 1128 | sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) 1129 | basic_machine=sparc-sun 1130 | ;; 1131 | cydra) 1132 | basic_machine=cydra-cydrome 1133 | ;; 1134 | orion) 1135 | basic_machine=orion-highlevel 1136 | ;; 1137 | orion105) 1138 | basic_machine=clipper-highlevel 1139 | ;; 1140 | mac | mpw | mac-mpw) 1141 | basic_machine=m68k-apple 1142 | ;; 1143 | pmac | pmac-mpw) 1144 | basic_machine=powerpc-apple 1145 | ;; 1146 | *-unknown) 1147 | # Make sure to match an already-canonicalized machine name. 1148 | ;; 1149 | *) 1150 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 1151 | exit 1 1152 | ;; 1153 | esac 1154 | 1155 | # Here we canonicalize certain aliases for manufacturers. 1156 | case $basic_machine in 1157 | *-digital*) 1158 | basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` 1159 | ;; 1160 | *-commodore*) 1161 | basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` 1162 | ;; 1163 | *) 1164 | ;; 1165 | esac 1166 | 1167 | # Decode manufacturer-specific aliases for certain operating systems. 1168 | 1169 | if [ x"$os" != x"" ] 1170 | then 1171 | case $os in 1172 | # First match some system type aliases 1173 | # that might get confused with valid system types. 1174 | # -solaris* is a basic system type, with this one exception. 1175 | -solaris1 | -solaris1.*) 1176 | os=`echo $os | sed -e 's|solaris1|sunos4|'` 1177 | ;; 1178 | -solaris) 1179 | os=-solaris2 1180 | ;; 1181 | -svr4*) 1182 | os=-sysv4 1183 | ;; 1184 | -unixware*) 1185 | os=-sysv4.2uw 1186 | ;; 1187 | -gnu/linux*) 1188 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` 1189 | ;; 1190 | # First accept the basic system types. 1191 | # The portable systems comes first. 1192 | # Each alternative MUST END IN A *, to match a version number. 1193 | # -sysv* is not here because it comes later, after sysvr4. 1194 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ 1195 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ 1196 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ 1197 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ 1198 | | -aos* \ 1199 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ 1200 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ 1201 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ 1202 | | -openbsd* | -solidbsd* \ 1203 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ 1204 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ 1205 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ 1206 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ 1207 | | -chorusos* | -chorusrdb* \ 1208 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ 1209 | | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ 1210 | | -uxpv* | -beos* | -mpeix* | -udk* \ 1211 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ 1212 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ 1213 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ 1214 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ 1215 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ 1216 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ 1217 | | -skyos* | -haiku* | -rdos* | -toppers*) 1218 | # Remember, each alternative MUST END IN *, to match a version number. 1219 | ;; 1220 | -qnx*) 1221 | case $basic_machine in 1222 | x86-* | i*86-*) 1223 | ;; 1224 | *) 1225 | os=-nto$os 1226 | ;; 1227 | esac 1228 | ;; 1229 | -nto-qnx*) 1230 | ;; 1231 | -nto*) 1232 | os=`echo $os | sed -e 's|nto|nto-qnx|'` 1233 | ;; 1234 | -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ 1235 | | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ 1236 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) 1237 | ;; 1238 | -mac*) 1239 | os=`echo $os | sed -e 's|mac|macos|'` 1240 | ;; 1241 | -linux-dietlibc) 1242 | os=-linux-dietlibc 1243 | ;; 1244 | -linux*) 1245 | os=`echo $os | sed -e 's|linux|linux-gnu|'` 1246 | ;; 1247 | -sunos5*) 1248 | os=`echo $os | sed -e 's|sunos5|solaris2|'` 1249 | ;; 1250 | -sunos6*) 1251 | os=`echo $os | sed -e 's|sunos6|solaris3|'` 1252 | ;; 1253 | -opened*) 1254 | os=-openedition 1255 | ;; 1256 | -os400*) 1257 | os=-os400 1258 | ;; 1259 | -wince*) 1260 | os=-wince 1261 | ;; 1262 | -osfrose*) 1263 | os=-osfrose 1264 | ;; 1265 | -osf*) 1266 | os=-osf 1267 | ;; 1268 | -utek*) 1269 | os=-bsd 1270 | ;; 1271 | -dynix*) 1272 | os=-bsd 1273 | ;; 1274 | -acis*) 1275 | os=-aos 1276 | ;; 1277 | -atheos*) 1278 | os=-atheos 1279 | ;; 1280 | -syllable*) 1281 | os=-syllable 1282 | ;; 1283 | -386bsd) 1284 | os=-bsd 1285 | ;; 1286 | -ctix* | -uts*) 1287 | os=-sysv 1288 | ;; 1289 | -nova*) 1290 | os=-rtmk-nova 1291 | ;; 1292 | -ns2 ) 1293 | os=-nextstep2 1294 | ;; 1295 | -nsk*) 1296 | os=-nsk 1297 | ;; 1298 | # Preserve the version number of sinix5. 1299 | -sinix5.*) 1300 | os=`echo $os | sed -e 's|sinix|sysv|'` 1301 | ;; 1302 | -sinix*) 1303 | os=-sysv4 1304 | ;; 1305 | -tpf*) 1306 | os=-tpf 1307 | ;; 1308 | -triton*) 1309 | os=-sysv3 1310 | ;; 1311 | -oss*) 1312 | os=-sysv3 1313 | ;; 1314 | -svr4) 1315 | os=-sysv4 1316 | ;; 1317 | -svr3) 1318 | os=-sysv3 1319 | ;; 1320 | -sysvr4) 1321 | os=-sysv4 1322 | ;; 1323 | # This must come after -sysvr4. 1324 | -sysv*) 1325 | ;; 1326 | -ose*) 1327 | os=-ose 1328 | ;; 1329 | -es1800*) 1330 | os=-ose 1331 | ;; 1332 | -xenix) 1333 | os=-xenix 1334 | ;; 1335 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1336 | os=-mint 1337 | ;; 1338 | -aros*) 1339 | os=-aros 1340 | ;; 1341 | -kaos*) 1342 | os=-kaos 1343 | ;; 1344 | -zvmoe) 1345 | os=-zvmoe 1346 | ;; 1347 | -none) 1348 | ;; 1349 | *) 1350 | # Get rid of the `-' at the beginning of $os. 1351 | os=`echo $os | sed 's/[^-]*-//'` 1352 | echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 1353 | exit 1 1354 | ;; 1355 | esac 1356 | else 1357 | 1358 | # Here we handle the default operating systems that come with various machines. 1359 | # The value should be what the vendor currently ships out the door with their 1360 | # machine or put another way, the most popular os provided with the machine. 1361 | 1362 | # Note that if you're going to try to match "-MANUFACTURER" here (say, 1363 | # "-sun"), then you have to tell the case statement up towards the top 1364 | # that MANUFACTURER isn't an operating system. Otherwise, code above 1365 | # will signal an error saying that MANUFACTURER isn't an operating 1366 | # system, and we'll never get to this point. 1367 | 1368 | case $basic_machine in 1369 | spu-*) 1370 | os=-elf 1371 | ;; 1372 | *-acorn) 1373 | os=-riscix1.2 1374 | ;; 1375 | arm*-rebel) 1376 | os=-linux 1377 | ;; 1378 | arm*-semi) 1379 | os=-aout 1380 | ;; 1381 | c4x-* | tic4x-*) 1382 | os=-coff 1383 | ;; 1384 | # This must come before the *-dec entry. 1385 | pdp10-*) 1386 | os=-tops20 1387 | ;; 1388 | pdp11-*) 1389 | os=-none 1390 | ;; 1391 | *-dec | vax-*) 1392 | os=-ultrix4.2 1393 | ;; 1394 | m68*-apollo) 1395 | os=-domain 1396 | ;; 1397 | i386-sun) 1398 | os=-sunos4.0.2 1399 | ;; 1400 | m68000-sun) 1401 | os=-sunos3 1402 | # This also exists in the configure program, but was not the 1403 | # default. 1404 | # os=-sunos4 1405 | ;; 1406 | m68*-cisco) 1407 | os=-aout 1408 | ;; 1409 | mips*-cisco) 1410 | os=-elf 1411 | ;; 1412 | mips*-*) 1413 | os=-elf 1414 | ;; 1415 | or32-*) 1416 | os=-coff 1417 | ;; 1418 | *-tti) # must be before sparc entry or we get the wrong os. 1419 | os=-sysv3 1420 | ;; 1421 | sparc-* | *-sun) 1422 | os=-sunos4.1.1 1423 | ;; 1424 | *-be) 1425 | os=-beos 1426 | ;; 1427 | *-haiku) 1428 | os=-haiku 1429 | ;; 1430 | *-ibm) 1431 | os=-aix 1432 | ;; 1433 | *-knuth) 1434 | os=-mmixware 1435 | ;; 1436 | *-wec) 1437 | os=-proelf 1438 | ;; 1439 | *-winbond) 1440 | os=-proelf 1441 | ;; 1442 | *-oki) 1443 | os=-proelf 1444 | ;; 1445 | *-hp) 1446 | os=-hpux 1447 | ;; 1448 | *-hitachi) 1449 | os=-hiux 1450 | ;; 1451 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1452 | os=-sysv 1453 | ;; 1454 | *-cbm) 1455 | os=-amigaos 1456 | ;; 1457 | *-dg) 1458 | os=-dgux 1459 | ;; 1460 | *-dolphin) 1461 | os=-sysv3 1462 | ;; 1463 | m68k-ccur) 1464 | os=-rtu 1465 | ;; 1466 | m88k-omron*) 1467 | os=-luna 1468 | ;; 1469 | *-next ) 1470 | os=-nextstep 1471 | ;; 1472 | *-sequent) 1473 | os=-ptx 1474 | ;; 1475 | *-crds) 1476 | os=-unos 1477 | ;; 1478 | *-ns) 1479 | os=-genix 1480 | ;; 1481 | i370-*) 1482 | os=-mvs 1483 | ;; 1484 | *-next) 1485 | os=-nextstep3 1486 | ;; 1487 | *-gould) 1488 | os=-sysv 1489 | ;; 1490 | *-highlevel) 1491 | os=-bsd 1492 | ;; 1493 | *-encore) 1494 | os=-bsd 1495 | ;; 1496 | *-sgi) 1497 | os=-irix 1498 | ;; 1499 | *-siemens) 1500 | os=-sysv4 1501 | ;; 1502 | *-masscomp) 1503 | os=-rtu 1504 | ;; 1505 | f30[01]-fujitsu | f700-fujitsu) 1506 | os=-uxpv 1507 | ;; 1508 | *-rom68k) 1509 | os=-coff 1510 | ;; 1511 | *-*bug) 1512 | os=-coff 1513 | ;; 1514 | *-apple) 1515 | os=-macos 1516 | ;; 1517 | *-atari*) 1518 | os=-mint 1519 | ;; 1520 | *) 1521 | os=-none 1522 | ;; 1523 | esac 1524 | fi 1525 | 1526 | # Here we handle the case where we know the os, and the CPU type, but not the 1527 | # manufacturer. We pick the logical manufacturer. 1528 | vendor=unknown 1529 | case $basic_machine in 1530 | *-unknown) 1531 | case $os in 1532 | -riscix*) 1533 | vendor=acorn 1534 | ;; 1535 | -sunos*) 1536 | vendor=sun 1537 | ;; 1538 | -aix*) 1539 | vendor=ibm 1540 | ;; 1541 | -beos*) 1542 | vendor=be 1543 | ;; 1544 | -hpux*) 1545 | vendor=hp 1546 | ;; 1547 | -mpeix*) 1548 | vendor=hp 1549 | ;; 1550 | -hiux*) 1551 | vendor=hitachi 1552 | ;; 1553 | -unos*) 1554 | vendor=crds 1555 | ;; 1556 | -dgux*) 1557 | vendor=dg 1558 | ;; 1559 | -luna*) 1560 | vendor=omron 1561 | ;; 1562 | -genix*) 1563 | vendor=ns 1564 | ;; 1565 | -mvs* | -opened*) 1566 | vendor=ibm 1567 | ;; 1568 | -os400*) 1569 | vendor=ibm 1570 | ;; 1571 | -ptx*) 1572 | vendor=sequent 1573 | ;; 1574 | -tpf*) 1575 | vendor=ibm 1576 | ;; 1577 | -vxsim* | -vxworks* | -windiss*) 1578 | vendor=wrs 1579 | ;; 1580 | -aux*) 1581 | vendor=apple 1582 | ;; 1583 | -hms*) 1584 | vendor=hitachi 1585 | ;; 1586 | -mpw* | -macos*) 1587 | vendor=apple 1588 | ;; 1589 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1590 | vendor=atari 1591 | ;; 1592 | -vos*) 1593 | vendor=stratus 1594 | ;; 1595 | esac 1596 | basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` 1597 | ;; 1598 | esac 1599 | 1600 | echo $basic_machine$os 1601 | exit 1602 | 1603 | # Local variables: 1604 | # eval: (add-hook 'write-file-hooks 'time-stamp) 1605 | # time-stamp-start: "timestamp='" 1606 | # time-stamp-format: "%:y-%02m-%02d" 1607 | # time-stamp-end: "'" 1608 | # End: 1609 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.57) 2 | AC_INIT(viewssld, 0.7.0, plashchynski@gmail.com) 3 | AC_CONFIG_SRCDIR([src/viewssld.c]) 4 | 5 | AC_CANONICAL_TARGET 6 | AM_INIT_AUTOMAKE 7 | 8 | AC_PROG_INSTALL 9 | AC_PROG_CC 10 | 11 | AC_HEADER_STDC 12 | AC_HEADER_SYS_WAIT 13 | AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h syslog.h unistd.h]) 14 | AC_OUTPUT(Makefile src/Makefile doc/Makefile distribute.sh,[chmod +x distribute.sh],) 15 | AC_CHECK_HEADER([pcap.h],,[AC_MSG_ERROR([libpcap header file not found. Install libpcap-dev package.])]) 16 | AC_CHECK_HEADER([openssl/ssl.h],,[AC_MSG_ERROR([libssl header file not found. Install libssl-dev package.])]) 17 | AC_CHECK_HEADER([dssl/sslcap.h],,[AC_MSG_ERROR([libdssl header file not found. https://github.com/downloads/plashchynski/viewssld/libdssl-2.1.1.tar.gz])], 18 | [[#ifdef HAVE_SSLCAP_H 19 | # include 20 | #endif 21 | ]]) 22 | AC_CHECK_HEADER([libnet.h],,[AC_MSG_ERROR([libnet header file not found. Install libnet-dev package.])]) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # depcomp - compile a program generating dependencies as side-effects 3 | 4 | scriptversion=2006-10-15.18 5 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software 7 | # Foundation, Inc. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | # 02110-1301, USA. 23 | 24 | # As a special exception to the GNU General Public License, if you 25 | # distribute this file as part of a program that contains a 26 | # configuration script generated by Autoconf, you may include it under 27 | # the same distribution terms that you use for the rest of that program. 28 | 29 | # Originally written by Alexandre Oliva . 30 | 31 | case $1 in 32 | '') 33 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 34 | exit 1; 35 | ;; 36 | -h | --h*) 37 | cat <<\EOF 38 | Usage: depcomp [--help] [--version] PROGRAM [ARGS] 39 | 40 | Run PROGRAMS ARGS to compile a file, generating dependencies 41 | as side-effects. 42 | 43 | Environment variables: 44 | depmode Dependency tracking mode. 45 | source Source file read by `PROGRAMS ARGS'. 46 | object Object file output by `PROGRAMS ARGS'. 47 | DEPDIR directory where to store dependencies. 48 | depfile Dependency file to output. 49 | tmpdepfile Temporary file to use when outputing dependencies. 50 | libtool Whether libtool is used (yes/no). 51 | 52 | Report bugs to . 53 | EOF 54 | exit $? 55 | ;; 56 | -v | --v*) 57 | echo "depcomp $scriptversion" 58 | exit $? 59 | ;; 60 | esac 61 | 62 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 63 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 64 | exit 1 65 | fi 66 | 67 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 68 | depfile=${depfile-`echo "$object" | 69 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 70 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 71 | 72 | rm -f "$tmpdepfile" 73 | 74 | # Some modes work just like other modes, but use different flags. We 75 | # parameterize here, but still list the modes in the big case below, 76 | # to make depend.m4 easier to write. Note that we *cannot* use a case 77 | # here, because this file can only contain one case statement. 78 | if test "$depmode" = hp; then 79 | # HP compiler uses -M and no extra arg. 80 | gccflag=-M 81 | depmode=gcc 82 | fi 83 | 84 | if test "$depmode" = dashXmstdout; then 85 | # This is just like dashmstdout with a different argument. 86 | dashmflag=-xM 87 | depmode=dashmstdout 88 | fi 89 | 90 | case "$depmode" in 91 | gcc3) 92 | ## gcc 3 implements dependency tracking that does exactly what 93 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 94 | ## it if -MD -MP comes after the -MF stuff. Hmm. 95 | ## Unfortunately, FreeBSD c89 acceptance of flags depends upon 96 | ## the command line argument order; so add the flags where they 97 | ## appear in depend2.am. Note that the slowdown incurred here 98 | ## affects only configure: in makefiles, %FASTDEP% shortcuts this. 99 | for arg 100 | do 101 | case $arg in 102 | -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 103 | *) set fnord "$@" "$arg" ;; 104 | esac 105 | shift # fnord 106 | shift # $arg 107 | done 108 | "$@" 109 | stat=$? 110 | if test $stat -eq 0; then : 111 | else 112 | rm -f "$tmpdepfile" 113 | exit $stat 114 | fi 115 | mv "$tmpdepfile" "$depfile" 116 | ;; 117 | 118 | gcc) 119 | ## There are various ways to get dependency output from gcc. Here's 120 | ## why we pick this rather obscure method: 121 | ## - Don't want to use -MD because we'd like the dependencies to end 122 | ## up in a subdir. Having to rename by hand is ugly. 123 | ## (We might end up doing this anyway to support other compilers.) 124 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 125 | ## -MM, not -M (despite what the docs say). 126 | ## - Using -M directly means running the compiler twice (even worse 127 | ## than renaming). 128 | if test -z "$gccflag"; then 129 | gccflag=-MD, 130 | fi 131 | "$@" -Wp,"$gccflag$tmpdepfile" 132 | stat=$? 133 | if test $stat -eq 0; then : 134 | else 135 | rm -f "$tmpdepfile" 136 | exit $stat 137 | fi 138 | rm -f "$depfile" 139 | echo "$object : \\" > "$depfile" 140 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 141 | ## The second -e expression handles DOS-style file names with drive letters. 142 | sed -e 's/^[^:]*: / /' \ 143 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 144 | ## This next piece of magic avoids the `deleted header file' problem. 145 | ## The problem is that when a header file which appears in a .P file 146 | ## is deleted, the dependency causes make to die (because there is 147 | ## typically no way to rebuild the header). We avoid this by adding 148 | ## dummy dependencies for each header file. Too bad gcc doesn't do 149 | ## this for us directly. 150 | tr ' ' ' 151 | ' < "$tmpdepfile" | 152 | ## Some versions of gcc put a space before the `:'. On the theory 153 | ## that the space means something, we add a space to the output as 154 | ## well. 155 | ## Some versions of the HPUX 10.20 sed can't process this invocation 156 | ## correctly. Breaking it into two sed invocations is a workaround. 157 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 158 | rm -f "$tmpdepfile" 159 | ;; 160 | 161 | hp) 162 | # This case exists only to let depend.m4 do its work. It works by 163 | # looking at the text of this script. This case will never be run, 164 | # since it is checked for above. 165 | exit 1 166 | ;; 167 | 168 | sgi) 169 | if test "$libtool" = yes; then 170 | "$@" "-Wp,-MDupdate,$tmpdepfile" 171 | else 172 | "$@" -MDupdate "$tmpdepfile" 173 | fi 174 | stat=$? 175 | if test $stat -eq 0; then : 176 | else 177 | rm -f "$tmpdepfile" 178 | exit $stat 179 | fi 180 | rm -f "$depfile" 181 | 182 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 183 | echo "$object : \\" > "$depfile" 184 | 185 | # Clip off the initial element (the dependent). Don't try to be 186 | # clever and replace this with sed code, as IRIX sed won't handle 187 | # lines with more than a fixed number of characters (4096 in 188 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 189 | # the IRIX cc adds comments like `#:fec' to the end of the 190 | # dependency line. 191 | tr ' ' ' 192 | ' < "$tmpdepfile" \ 193 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 194 | tr ' 195 | ' ' ' >> $depfile 196 | echo >> $depfile 197 | 198 | # The second pass generates a dummy entry for each header file. 199 | tr ' ' ' 200 | ' < "$tmpdepfile" \ 201 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 202 | >> $depfile 203 | else 204 | # The sourcefile does not contain any dependencies, so just 205 | # store a dummy comment line, to avoid errors with the Makefile 206 | # "include basename.Plo" scheme. 207 | echo "#dummy" > "$depfile" 208 | fi 209 | rm -f "$tmpdepfile" 210 | ;; 211 | 212 | aix) 213 | # The C for AIX Compiler uses -M and outputs the dependencies 214 | # in a .u file. In older versions, this file always lives in the 215 | # current directory. Also, the AIX compiler puts `$object:' at the 216 | # start of each line; $object doesn't have directory information. 217 | # Version 6 uses the directory in both cases. 218 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 219 | tmpdepfile="$stripped.u" 220 | if test "$libtool" = yes; then 221 | "$@" -Wc,-M 222 | else 223 | "$@" -M 224 | fi 225 | stat=$? 226 | 227 | if test -f "$tmpdepfile"; then : 228 | else 229 | stripped=`echo "$stripped" | sed 's,^.*/,,'` 230 | tmpdepfile="$stripped.u" 231 | fi 232 | 233 | if test $stat -eq 0; then : 234 | else 235 | rm -f "$tmpdepfile" 236 | exit $stat 237 | fi 238 | 239 | if test -f "$tmpdepfile"; then 240 | outname="$stripped.o" 241 | # Each line is of the form `foo.o: dependent.h'. 242 | # Do two passes, one to just change these to 243 | # `$object: dependent.h' and one to simply `dependent.h:'. 244 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 245 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 246 | else 247 | # The sourcefile does not contain any dependencies, so just 248 | # store a dummy comment line, to avoid errors with the Makefile 249 | # "include basename.Plo" scheme. 250 | echo "#dummy" > "$depfile" 251 | fi 252 | rm -f "$tmpdepfile" 253 | ;; 254 | 255 | icc) 256 | # Intel's C compiler understands `-MD -MF file'. However on 257 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 258 | # ICC 7.0 will fill foo.d with something like 259 | # foo.o: sub/foo.c 260 | # foo.o: sub/foo.h 261 | # which is wrong. We want: 262 | # sub/foo.o: sub/foo.c 263 | # sub/foo.o: sub/foo.h 264 | # sub/foo.c: 265 | # sub/foo.h: 266 | # ICC 7.1 will output 267 | # foo.o: sub/foo.c sub/foo.h 268 | # and will wrap long lines using \ : 269 | # foo.o: sub/foo.c ... \ 270 | # sub/foo.h ... \ 271 | # ... 272 | 273 | "$@" -MD -MF "$tmpdepfile" 274 | stat=$? 275 | if test $stat -eq 0; then : 276 | else 277 | rm -f "$tmpdepfile" 278 | exit $stat 279 | fi 280 | rm -f "$depfile" 281 | # Each line is of the form `foo.o: dependent.h', 282 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 283 | # Do two passes, one to just change these to 284 | # `$object: dependent.h' and one to simply `dependent.h:'. 285 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 286 | # Some versions of the HPUX 10.20 sed can't process this invocation 287 | # correctly. Breaking it into two sed invocations is a workaround. 288 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 289 | sed -e 's/$/ :/' >> "$depfile" 290 | rm -f "$tmpdepfile" 291 | ;; 292 | 293 | hp2) 294 | # The "hp" stanza above does not work with aCC (C++) and HP's ia64 295 | # compilers, which have integrated preprocessors. The correct option 296 | # to use with these is +Maked; it writes dependencies to a file named 297 | # 'foo.d', which lands next to the object file, wherever that 298 | # happens to be. 299 | # Much of this is similar to the tru64 case; see comments there. 300 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 301 | test "x$dir" = "x$object" && dir= 302 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 303 | if test "$libtool" = yes; then 304 | tmpdepfile1=$dir$base.d 305 | tmpdepfile2=$dir.libs/$base.d 306 | "$@" -Wc,+Maked 307 | else 308 | tmpdepfile1=$dir$base.d 309 | tmpdepfile2=$dir$base.d 310 | "$@" +Maked 311 | fi 312 | stat=$? 313 | if test $stat -eq 0; then : 314 | else 315 | rm -f "$tmpdepfile1" "$tmpdepfile2" 316 | exit $stat 317 | fi 318 | 319 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 320 | do 321 | test -f "$tmpdepfile" && break 322 | done 323 | if test -f "$tmpdepfile"; then 324 | sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 325 | # Add `dependent.h:' lines. 326 | sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" 327 | else 328 | echo "#dummy" > "$depfile" 329 | fi 330 | rm -f "$tmpdepfile" "$tmpdepfile2" 331 | ;; 332 | 333 | tru64) 334 | # The Tru64 compiler uses -MD to generate dependencies as a side 335 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 336 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 337 | # dependencies in `foo.d' instead, so we check for that too. 338 | # Subdirectories are respected. 339 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 340 | test "x$dir" = "x$object" && dir= 341 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 342 | 343 | if test "$libtool" = yes; then 344 | # With Tru64 cc, shared objects can also be used to make a 345 | # static library. This mechanism is used in libtool 1.4 series to 346 | # handle both shared and static libraries in a single compilation. 347 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 348 | # 349 | # With libtool 1.5 this exception was removed, and libtool now 350 | # generates 2 separate objects for the 2 libraries. These two 351 | # compilations output dependencies in $dir.libs/$base.o.d and 352 | # in $dir$base.o.d. We have to check for both files, because 353 | # one of the two compilations can be disabled. We should prefer 354 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 355 | # automatically cleaned when .libs/ is deleted, while ignoring 356 | # the former would cause a distcleancheck panic. 357 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 358 | tmpdepfile2=$dir$base.o.d # libtool 1.5 359 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 360 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 361 | "$@" -Wc,-MD 362 | else 363 | tmpdepfile1=$dir$base.o.d 364 | tmpdepfile2=$dir$base.d 365 | tmpdepfile3=$dir$base.d 366 | tmpdepfile4=$dir$base.d 367 | "$@" -MD 368 | fi 369 | 370 | stat=$? 371 | if test $stat -eq 0; then : 372 | else 373 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 374 | exit $stat 375 | fi 376 | 377 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 378 | do 379 | test -f "$tmpdepfile" && break 380 | done 381 | if test -f "$tmpdepfile"; then 382 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 383 | # That's a tab and a space in the []. 384 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 385 | else 386 | echo "#dummy" > "$depfile" 387 | fi 388 | rm -f "$tmpdepfile" 389 | ;; 390 | 391 | #nosideeffect) 392 | # This comment above is used by automake to tell side-effect 393 | # dependency tracking mechanisms from slower ones. 394 | 395 | dashmstdout) 396 | # Important note: in order to support this mode, a compiler *must* 397 | # always write the preprocessed file to stdout, regardless of -o. 398 | "$@" || exit $? 399 | 400 | # Remove the call to Libtool. 401 | if test "$libtool" = yes; then 402 | while test $1 != '--mode=compile'; do 403 | shift 404 | done 405 | shift 406 | fi 407 | 408 | # Remove `-o $object'. 409 | IFS=" " 410 | for arg 411 | do 412 | case $arg in 413 | -o) 414 | shift 415 | ;; 416 | $object) 417 | shift 418 | ;; 419 | *) 420 | set fnord "$@" "$arg" 421 | shift # fnord 422 | shift # $arg 423 | ;; 424 | esac 425 | done 426 | 427 | test -z "$dashmflag" && dashmflag=-M 428 | # Require at least two characters before searching for `:' 429 | # in the target name. This is to cope with DOS-style filenames: 430 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 431 | "$@" $dashmflag | 432 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 433 | rm -f "$depfile" 434 | cat < "$tmpdepfile" > "$depfile" 435 | tr ' ' ' 436 | ' < "$tmpdepfile" | \ 437 | ## Some versions of the HPUX 10.20 sed can't process this invocation 438 | ## correctly. Breaking it into two sed invocations is a workaround. 439 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 440 | rm -f "$tmpdepfile" 441 | ;; 442 | 443 | dashXmstdout) 444 | # This case only exists to satisfy depend.m4. It is never actually 445 | # run, as this mode is specially recognized in the preamble. 446 | exit 1 447 | ;; 448 | 449 | makedepend) 450 | "$@" || exit $? 451 | # Remove any Libtool call 452 | if test "$libtool" = yes; then 453 | while test $1 != '--mode=compile'; do 454 | shift 455 | done 456 | shift 457 | fi 458 | # X makedepend 459 | shift 460 | cleared=no 461 | for arg in "$@"; do 462 | case $cleared in 463 | no) 464 | set ""; shift 465 | cleared=yes ;; 466 | esac 467 | case "$arg" in 468 | -D*|-I*) 469 | set fnord "$@" "$arg"; shift ;; 470 | # Strip any option that makedepend may not understand. Remove 471 | # the object too, otherwise makedepend will parse it as a source file. 472 | -*|$object) 473 | ;; 474 | *) 475 | set fnord "$@" "$arg"; shift ;; 476 | esac 477 | done 478 | obj_suffix="`echo $object | sed 's/^.*\././'`" 479 | touch "$tmpdepfile" 480 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 481 | rm -f "$depfile" 482 | cat < "$tmpdepfile" > "$depfile" 483 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 484 | ' | \ 485 | ## Some versions of the HPUX 10.20 sed can't process this invocation 486 | ## correctly. Breaking it into two sed invocations is a workaround. 487 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 488 | rm -f "$tmpdepfile" "$tmpdepfile".bak 489 | ;; 490 | 491 | cpp) 492 | # Important note: in order to support this mode, a compiler *must* 493 | # always write the preprocessed file to stdout. 494 | "$@" || exit $? 495 | 496 | # Remove the call to Libtool. 497 | if test "$libtool" = yes; then 498 | while test $1 != '--mode=compile'; do 499 | shift 500 | done 501 | shift 502 | fi 503 | 504 | # Remove `-o $object'. 505 | IFS=" " 506 | for arg 507 | do 508 | case $arg in 509 | -o) 510 | shift 511 | ;; 512 | $object) 513 | shift 514 | ;; 515 | *) 516 | set fnord "$@" "$arg" 517 | shift # fnord 518 | shift # $arg 519 | ;; 520 | esac 521 | done 522 | 523 | "$@" -E | 524 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 525 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 526 | sed '$ s: \\$::' > "$tmpdepfile" 527 | rm -f "$depfile" 528 | echo "$object : \\" > "$depfile" 529 | cat < "$tmpdepfile" >> "$depfile" 530 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 531 | rm -f "$tmpdepfile" 532 | ;; 533 | 534 | msvisualcpp) 535 | # Important note: in order to support this mode, a compiler *must* 536 | # always write the preprocessed file to stdout, regardless of -o, 537 | # because we must use -o when running libtool. 538 | "$@" || exit $? 539 | IFS=" " 540 | for arg 541 | do 542 | case "$arg" in 543 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 544 | set fnord "$@" 545 | shift 546 | shift 547 | ;; 548 | *) 549 | set fnord "$@" "$arg" 550 | shift 551 | shift 552 | ;; 553 | esac 554 | done 555 | "$@" -E | 556 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 557 | rm -f "$depfile" 558 | echo "$object : \\" > "$depfile" 559 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 560 | echo " " >> "$depfile" 561 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 562 | rm -f "$tmpdepfile" 563 | ;; 564 | 565 | none) 566 | exec "$@" 567 | ;; 568 | 569 | *) 570 | echo "Unknown depmode $depmode" 1>&2 571 | exit 1 572 | ;; 573 | esac 574 | 575 | exit 0 576 | 577 | # Local Variables: 578 | # mode: shell-script 579 | # sh-indentation: 2 580 | # eval: (add-hook 'write-file-hooks 'time-stamp) 581 | # time-stamp-start: "scriptversion=" 582 | # time-stamp-format: "%:y-%02m-%02d.%02H" 583 | # time-stamp-end: "$" 584 | # End: 585 | -------------------------------------------------------------------------------- /distribute.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PACKAGE=@PACKAGE_TARNAME@ 3 | VERSION=@VERSION@ 4 | NAME=@PACKAGE_TARNAME@-@VERSION@ 5 | 6 | make clean 7 | cd .. 8 | rm -rf ${NAME} 9 | cp -R viewssld ${NAME} 10 | rm -f ${NAME}.tar 11 | tar -c ${NAME} > ${NAME}.tar 12 | rm -f ${NAME}.tar.bz2 13 | bzip2 -z -k -f ${NAME}.tar 14 | rm -f ${NAME}.tar.gz 15 | gzip ${NAME}.tar 16 | rm -rf ${NAME} 17 | cd viewssld 18 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | DOCS = manual.pdf 2 | dist_man8_MANS = viewssld.8 3 | EXTRA_DIST = viewssld.conf $(DOCS) 4 | 5 | install-data-local: 6 | test -z "/etc/viewssld.conf" || $(INSTALL) -m 600 examples/viewssld.conf /etc/viewssld.conf 7 | 8 | -------------------------------------------------------------------------------- /doc/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.15 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994-2014 Free Software Foundation, Inc. 5 | 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | VPATH = @srcdir@ 17 | am__is_gnu_make = { \ 18 | if test -z '$(MAKELEVEL)'; then \ 19 | false; \ 20 | elif test -n '$(MAKE_HOST)'; then \ 21 | true; \ 22 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 23 | true; \ 24 | else \ 25 | false; \ 26 | fi; \ 27 | } 28 | am__make_running_with_option = \ 29 | case $${target_option-} in \ 30 | ?) ;; \ 31 | *) echo "am__make_running_with_option: internal error: invalid" \ 32 | "target option '$${target_option-}' specified" >&2; \ 33 | exit 1;; \ 34 | esac; \ 35 | has_opt=no; \ 36 | sane_makeflags=$$MAKEFLAGS; \ 37 | if $(am__is_gnu_make); then \ 38 | sane_makeflags=$$MFLAGS; \ 39 | else \ 40 | case $$MAKEFLAGS in \ 41 | *\\[\ \ ]*) \ 42 | bs=\\; \ 43 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ 44 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ 45 | esac; \ 46 | fi; \ 47 | skip_next=no; \ 48 | strip_trailopt () \ 49 | { \ 50 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ 51 | }; \ 52 | for flg in $$sane_makeflags; do \ 53 | test $$skip_next = yes && { skip_next=no; continue; }; \ 54 | case $$flg in \ 55 | *=*|--*) continue;; \ 56 | -*I) strip_trailopt 'I'; skip_next=yes;; \ 57 | -*I?*) strip_trailopt 'I';; \ 58 | -*O) strip_trailopt 'O'; skip_next=yes;; \ 59 | -*O?*) strip_trailopt 'O';; \ 60 | -*l) strip_trailopt 'l'; skip_next=yes;; \ 61 | -*l?*) strip_trailopt 'l';; \ 62 | -[dEDm]) skip_next=yes;; \ 63 | -[JT]) skip_next=yes;; \ 64 | esac; \ 65 | case $$flg in \ 66 | *$$target_option*) has_opt=yes; break;; \ 67 | esac; \ 68 | done; \ 69 | test $$has_opt = yes 70 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) 71 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 72 | pkgdatadir = $(datadir)/@PACKAGE@ 73 | pkgincludedir = $(includedir)/@PACKAGE@ 74 | pkglibdir = $(libdir)/@PACKAGE@ 75 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 77 | install_sh_DATA = $(install_sh) -c -m 644 78 | install_sh_PROGRAM = $(install_sh) -c 79 | install_sh_SCRIPT = $(install_sh) -c 80 | INSTALL_HEADER = $(INSTALL_DATA) 81 | transform = $(program_transform_name) 82 | NORMAL_INSTALL = : 83 | PRE_INSTALL = : 84 | POST_INSTALL = : 85 | NORMAL_UNINSTALL = : 86 | PRE_UNINSTALL = : 87 | POST_UNINSTALL = : 88 | build_triplet = @build@ 89 | host_triplet = @host@ 90 | target_triplet = @target@ 91 | subdir = doc 92 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 93 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 94 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 95 | $(ACLOCAL_M4) 96 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 97 | mkinstalldirs = $(install_sh) -d 98 | CONFIG_CLEAN_FILES = 99 | CONFIG_CLEAN_VPATH_FILES = 100 | AM_V_P = $(am__v_P_@AM_V@) 101 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 102 | am__v_P_0 = false 103 | am__v_P_1 = : 104 | AM_V_GEN = $(am__v_GEN_@AM_V@) 105 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) 106 | am__v_GEN_0 = @echo " GEN " $@; 107 | am__v_GEN_1 = 108 | AM_V_at = $(am__v_at_@AM_V@) 109 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) 110 | am__v_at_0 = @ 111 | am__v_at_1 = 112 | SOURCES = 113 | DIST_SOURCES = 114 | am__can_run_installinfo = \ 115 | case $$AM_UPDATE_INFO_DIR in \ 116 | n|no|NO) false;; \ 117 | *) (install-info --version) >/dev/null 2>&1;; \ 118 | esac 119 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 120 | am__vpath_adj = case $$p in \ 121 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 122 | *) f=$$p;; \ 123 | esac; 124 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 125 | am__install_max = 40 126 | am__nobase_strip_setup = \ 127 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 128 | am__nobase_strip = \ 129 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 130 | am__nobase_list = $(am__nobase_strip_setup); \ 131 | for p in $$list; do echo "$$p $$p"; done | \ 132 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 133 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 134 | if (++n[$$2] == $(am__install_max)) \ 135 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 136 | END { for (dir in files) print dir, files[dir] }' 137 | am__base_list = \ 138 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 139 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 140 | am__uninstall_files_from_dir = { \ 141 | test -z "$$files" \ 142 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ 143 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ 144 | $(am__cd) "$$dir" && rm -f $$files; }; \ 145 | } 146 | man8dir = $(mandir)/man8 147 | am__installdirs = "$(DESTDIR)$(man8dir)" 148 | NROFF = nroff 149 | MANS = $(dist_man8_MANS) 150 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 151 | am__DIST_COMMON = $(dist_man8_MANS) $(srcdir)/Makefile.in 152 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 153 | ACLOCAL = @ACLOCAL@ 154 | AMTAR = @AMTAR@ 155 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 156 | AUTOCONF = @AUTOCONF@ 157 | AUTOHEADER = @AUTOHEADER@ 158 | AUTOMAKE = @AUTOMAKE@ 159 | AWK = @AWK@ 160 | CC = @CC@ 161 | CCDEPMODE = @CCDEPMODE@ 162 | CFLAGS = @CFLAGS@ 163 | CPP = @CPP@ 164 | CPPFLAGS = @CPPFLAGS@ 165 | CYGPATH_W = @CYGPATH_W@ 166 | DEFS = @DEFS@ 167 | DEPDIR = @DEPDIR@ 168 | ECHO_C = @ECHO_C@ 169 | ECHO_N = @ECHO_N@ 170 | ECHO_T = @ECHO_T@ 171 | EGREP = @EGREP@ 172 | EXEEXT = @EXEEXT@ 173 | GREP = @GREP@ 174 | INSTALL = @INSTALL@ 175 | INSTALL_DATA = @INSTALL_DATA@ 176 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 177 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 178 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 179 | LDFLAGS = @LDFLAGS@ 180 | LIBOBJS = @LIBOBJS@ 181 | LIBS = @LIBS@ 182 | LTLIBOBJS = @LTLIBOBJS@ 183 | MAKEINFO = @MAKEINFO@ 184 | MKDIR_P = @MKDIR_P@ 185 | OBJEXT = @OBJEXT@ 186 | PACKAGE = @PACKAGE@ 187 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 188 | PACKAGE_NAME = @PACKAGE_NAME@ 189 | PACKAGE_STRING = @PACKAGE_STRING@ 190 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 191 | PACKAGE_URL = @PACKAGE_URL@ 192 | PACKAGE_VERSION = @PACKAGE_VERSION@ 193 | PATH_SEPARATOR = @PATH_SEPARATOR@ 194 | SET_MAKE = @SET_MAKE@ 195 | SHELL = @SHELL@ 196 | STRIP = @STRIP@ 197 | VERSION = @VERSION@ 198 | abs_builddir = @abs_builddir@ 199 | abs_srcdir = @abs_srcdir@ 200 | abs_top_builddir = @abs_top_builddir@ 201 | abs_top_srcdir = @abs_top_srcdir@ 202 | ac_ct_CC = @ac_ct_CC@ 203 | am__include = @am__include@ 204 | am__leading_dot = @am__leading_dot@ 205 | am__quote = @am__quote@ 206 | am__tar = @am__tar@ 207 | am__untar = @am__untar@ 208 | bindir = @bindir@ 209 | build = @build@ 210 | build_alias = @build_alias@ 211 | build_cpu = @build_cpu@ 212 | build_os = @build_os@ 213 | build_vendor = @build_vendor@ 214 | builddir = @builddir@ 215 | datadir = @datadir@ 216 | datarootdir = @datarootdir@ 217 | docdir = @docdir@ 218 | dvidir = @dvidir@ 219 | exec_prefix = @exec_prefix@ 220 | host = @host@ 221 | host_alias = @host_alias@ 222 | host_cpu = @host_cpu@ 223 | host_os = @host_os@ 224 | host_vendor = @host_vendor@ 225 | htmldir = @htmldir@ 226 | includedir = @includedir@ 227 | infodir = @infodir@ 228 | install_sh = @install_sh@ 229 | libdir = @libdir@ 230 | libexecdir = @libexecdir@ 231 | localedir = @localedir@ 232 | localstatedir = @localstatedir@ 233 | mandir = @mandir@ 234 | mkdir_p = @mkdir_p@ 235 | oldincludedir = @oldincludedir@ 236 | pdfdir = @pdfdir@ 237 | prefix = @prefix@ 238 | program_transform_name = @program_transform_name@ 239 | psdir = @psdir@ 240 | sbindir = @sbindir@ 241 | sharedstatedir = @sharedstatedir@ 242 | srcdir = @srcdir@ 243 | sysconfdir = @sysconfdir@ 244 | target = @target@ 245 | target_alias = @target_alias@ 246 | target_cpu = @target_cpu@ 247 | target_os = @target_os@ 248 | target_vendor = @target_vendor@ 249 | top_build_prefix = @top_build_prefix@ 250 | top_builddir = @top_builddir@ 251 | top_srcdir = @top_srcdir@ 252 | DOCS = manual.pdf 253 | dist_man8_MANS = viewssld.8 254 | EXTRA_DIST = viewssld.conf $(DOCS) 255 | all: all-am 256 | 257 | .SUFFIXES: 258 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 259 | @for dep in $?; do \ 260 | case '$(am__configure_deps)' in \ 261 | *$$dep*) \ 262 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 263 | && { if test -f $@; then exit 0; else break; fi; }; \ 264 | exit 1;; \ 265 | esac; \ 266 | done; \ 267 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ 268 | $(am__cd) $(top_srcdir) && \ 269 | $(AUTOMAKE) --gnu doc/Makefile 270 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 271 | @case '$?' in \ 272 | *config.status*) \ 273 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 274 | *) \ 275 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 276 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 277 | esac; 278 | 279 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 280 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 281 | 282 | $(top_srcdir)/configure: $(am__configure_deps) 283 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 284 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 285 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 286 | $(am__aclocal_m4_deps): 287 | install-man8: $(dist_man8_MANS) 288 | @$(NORMAL_INSTALL) 289 | @list1='$(dist_man8_MANS)'; \ 290 | list2=''; \ 291 | test -n "$(man8dir)" \ 292 | && test -n "`echo $$list1$$list2`" \ 293 | || exit 0; \ 294 | echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ 295 | $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ 296 | { for i in $$list1; do echo "$$i"; done; \ 297 | if test -n "$$list2"; then \ 298 | for i in $$list2; do echo "$$i"; done \ 299 | | sed -n '/\.8[a-z]*$$/p'; \ 300 | fi; \ 301 | } | while read p; do \ 302 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 303 | echo "$$d$$p"; echo "$$p"; \ 304 | done | \ 305 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 306 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ 307 | sed 'N;N;s,\n, ,g' | { \ 308 | list=; while read file base inst; do \ 309 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ 310 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ 311 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ 312 | fi; \ 313 | done; \ 314 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ 315 | while read files; do \ 316 | test -z "$$files" || { \ 317 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ 318 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ 319 | done; } 320 | 321 | uninstall-man8: 322 | @$(NORMAL_UNINSTALL) 323 | @list='$(dist_man8_MANS)'; test -n "$(man8dir)" || exit 0; \ 324 | files=`{ for i in $$list; do echo "$$i"; done; \ 325 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 326 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ 327 | dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) 328 | tags TAGS: 329 | 330 | ctags CTAGS: 331 | 332 | cscope cscopelist: 333 | 334 | 335 | distdir: $(DISTFILES) 336 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 337 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 338 | list='$(DISTFILES)'; \ 339 | dist_files=`for file in $$list; do echo $$file; done | \ 340 | sed -e "s|^$$srcdirstrip/||;t" \ 341 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 342 | case $$dist_files in \ 343 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 344 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 345 | sort -u` ;; \ 346 | esac; \ 347 | for file in $$dist_files; do \ 348 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 349 | if test -d $$d/$$file; then \ 350 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 351 | if test -d "$(distdir)/$$file"; then \ 352 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 353 | fi; \ 354 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 355 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 356 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 357 | fi; \ 358 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 359 | else \ 360 | test -f "$(distdir)/$$file" \ 361 | || cp -p $$d/$$file "$(distdir)/$$file" \ 362 | || exit 1; \ 363 | fi; \ 364 | done 365 | check-am: all-am 366 | check: check-am 367 | all-am: Makefile $(MANS) 368 | installdirs: 369 | for dir in "$(DESTDIR)$(man8dir)"; do \ 370 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 371 | done 372 | install: install-am 373 | install-exec: install-exec-am 374 | install-data: install-data-am 375 | uninstall: uninstall-am 376 | 377 | install-am: all-am 378 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 379 | 380 | installcheck: installcheck-am 381 | install-strip: 382 | if test -z '$(STRIP)'; then \ 383 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 384 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 385 | install; \ 386 | else \ 387 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 388 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 389 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 390 | fi 391 | mostlyclean-generic: 392 | 393 | clean-generic: 394 | 395 | distclean-generic: 396 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 397 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 398 | 399 | maintainer-clean-generic: 400 | @echo "This command is intended for maintainers to use" 401 | @echo "it deletes files that may require special tools to rebuild." 402 | clean: clean-am 403 | 404 | clean-am: clean-generic mostlyclean-am 405 | 406 | distclean: distclean-am 407 | -rm -f Makefile 408 | distclean-am: clean-am distclean-generic 409 | 410 | dvi: dvi-am 411 | 412 | dvi-am: 413 | 414 | html: html-am 415 | 416 | html-am: 417 | 418 | info: info-am 419 | 420 | info-am: 421 | 422 | install-data-am: install-data-local install-man 423 | 424 | install-dvi: install-dvi-am 425 | 426 | install-dvi-am: 427 | 428 | install-exec-am: 429 | 430 | install-html: install-html-am 431 | 432 | install-html-am: 433 | 434 | install-info: install-info-am 435 | 436 | install-info-am: 437 | 438 | install-man: install-man8 439 | 440 | install-pdf: install-pdf-am 441 | 442 | install-pdf-am: 443 | 444 | install-ps: install-ps-am 445 | 446 | install-ps-am: 447 | 448 | installcheck-am: 449 | 450 | maintainer-clean: maintainer-clean-am 451 | -rm -f Makefile 452 | maintainer-clean-am: distclean-am maintainer-clean-generic 453 | 454 | mostlyclean: mostlyclean-am 455 | 456 | mostlyclean-am: mostlyclean-generic 457 | 458 | pdf: pdf-am 459 | 460 | pdf-am: 461 | 462 | ps: ps-am 463 | 464 | ps-am: 465 | 466 | uninstall-am: uninstall-man 467 | 468 | uninstall-man: uninstall-man8 469 | 470 | .MAKE: install-am install-strip 471 | 472 | .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ 473 | ctags-am distclean distclean-generic distdir dvi dvi-am html \ 474 | html-am info info-am install install-am install-data \ 475 | install-data-am install-data-local install-dvi install-dvi-am \ 476 | install-exec install-exec-am install-html install-html-am \ 477 | install-info install-info-am install-man install-man8 \ 478 | install-pdf install-pdf-am install-ps install-ps-am \ 479 | install-strip installcheck installcheck-am installdirs \ 480 | maintainer-clean maintainer-clean-generic mostlyclean \ 481 | mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ 482 | uninstall-am uninstall-man uninstall-man8 483 | 484 | .PRECIOUS: Makefile 485 | 486 | 487 | install-data-local: 488 | test -z "/etc/viewssld.conf" || $(INSTALL) -m 600 examples/viewssld.conf /etc/viewssld.conf 489 | 490 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 491 | # Otherwise a system limit (for SysV at least) may be exceeded. 492 | .NOEXPORT: 493 | -------------------------------------------------------------------------------- /doc/examples/viewssld.conf: -------------------------------------------------------------------------------- 1 | # example configuration file for viewssld 2 | 3 | # PID-file path (default: /var/run/viewssld.pid) 4 | #pid = /var/run/viewssld.pid 5 | 6 | # daemonize? on/off (default: off) 7 | #daemon = off 8 | 9 | # loglevel 0-10 (default: 0) 10 | #loglevel = 1 11 | 12 | # server 1 configuration 13 | [server1] 14 | src = eth0 15 | dst = dummy0 16 | ip = 10.0.2.15 17 | port = 443 18 | key = /etc/ssl/ca.key 19 | 20 | # server 2 configuration 21 | [server2] 22 | src = eth0 23 | dst = eth0 24 | ip = 10.0.2.15 25 | port = 443 26 | key = /etc/ssl/ca.key 27 | 28 | # server 3 configuration 29 | [server3] 30 | src = dummy0 31 | dst = eth0 32 | ip = 10.0.2.15 33 | port = 443 34 | key = /etc/ssl/ca.key 35 | -------------------------------------------------------------------------------- /doc/manual-ru.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plashchynski/viewssld/3dda94d4bc3fc3294392568b6931084cc48879cb/doc/manual-ru.doc -------------------------------------------------------------------------------- /doc/manual-ru.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plashchynski/viewssld/3dda94d4bc3fc3294392568b6931084cc48879cb/doc/manual-ru.pdf -------------------------------------------------------------------------------- /doc/viewssld.8: -------------------------------------------------------------------------------- 1 | .TH viewssld 8 "" 2 | .SH NAME 3 | viewssld \- an open source SSL decryption daemon for Snort and other network Intrusion Detection System (IDS). 4 | .SH SYNOPSIS 5 | \fBviewssld\fP [\fIoptions\fP] 6 | .SH DESCRIPTION 7 | \fBviewssld\fP <.....> 8 | .SH OPTIONS 9 | .TP 12 10 | .BI \-c "\fR, \fP" \--config " directory" 11 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2006-10-14.15 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. 43 | 44 | nl=' 45 | ' 46 | IFS=" "" $nl" 47 | 48 | # set DOITPROG to echo to test this script 49 | 50 | # Don't use :- since 4.3BSD and earlier shells don't like it. 51 | doit="${DOITPROG-}" 52 | if test -z "$doit"; then 53 | doit_exec=exec 54 | else 55 | doit_exec=$doit 56 | fi 57 | 58 | # Put in absolute file names if you don't have them in your path; 59 | # or use environment vars. 60 | 61 | mvprog="${MVPROG-mv}" 62 | cpprog="${CPPROG-cp}" 63 | chmodprog="${CHMODPROG-chmod}" 64 | chownprog="${CHOWNPROG-chown}" 65 | chgrpprog="${CHGRPPROG-chgrp}" 66 | stripprog="${STRIPPROG-strip}" 67 | rmprog="${RMPROG-rm}" 68 | mkdirprog="${MKDIRPROG-mkdir}" 69 | 70 | posix_glob= 71 | posix_mkdir= 72 | 73 | # Desired mode of installed file. 74 | mode=0755 75 | 76 | chmodcmd=$chmodprog 77 | chowncmd= 78 | chgrpcmd= 79 | stripcmd= 80 | rmcmd="$rmprog -f" 81 | mvcmd="$mvprog" 82 | src= 83 | dst= 84 | dir_arg= 85 | dstarg= 86 | no_target_directory= 87 | 88 | usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 89 | or: $0 [OPTION]... SRCFILES... DIRECTORY 90 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 91 | or: $0 [OPTION]... -d DIRECTORIES... 92 | 93 | In the 1st form, copy SRCFILE to DSTFILE. 94 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 95 | In the 4th, create DIRECTORIES. 96 | 97 | Options: 98 | -c (ignored) 99 | -d create directories instead of installing files. 100 | -g GROUP $chgrpprog installed files to GROUP. 101 | -m MODE $chmodprog installed files to MODE. 102 | -o USER $chownprog installed files to USER. 103 | -s $stripprog installed files. 104 | -t DIRECTORY install into DIRECTORY. 105 | -T report an error if DSTFILE is a directory. 106 | --help display this help and exit. 107 | --version display version info and exit. 108 | 109 | Environment variables override the default commands: 110 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 111 | " 112 | 113 | while test $# -ne 0; do 114 | case $1 in 115 | -c) shift 116 | continue;; 117 | 118 | -d) dir_arg=true 119 | shift 120 | continue;; 121 | 122 | -g) chgrpcmd="$chgrpprog $2" 123 | shift 124 | shift 125 | continue;; 126 | 127 | --help) echo "$usage"; exit $?;; 128 | 129 | -m) mode=$2 130 | shift 131 | shift 132 | case $mode in 133 | *' '* | *' '* | *' 134 | '* | *'*'* | *'?'* | *'['*) 135 | echo "$0: invalid mode: $mode" >&2 136 | exit 1;; 137 | esac 138 | continue;; 139 | 140 | -o) chowncmd="$chownprog $2" 141 | shift 142 | shift 143 | continue;; 144 | 145 | -s) stripcmd=$stripprog 146 | shift 147 | continue;; 148 | 149 | -t) dstarg=$2 150 | shift 151 | shift 152 | continue;; 153 | 154 | -T) no_target_directory=true 155 | shift 156 | continue;; 157 | 158 | --version) echo "$0 $scriptversion"; exit $?;; 159 | 160 | --) shift 161 | break;; 162 | 163 | -*) echo "$0: invalid option: $1" >&2 164 | exit 1;; 165 | 166 | *) break;; 167 | esac 168 | done 169 | 170 | if test $# -ne 0 && test -z "$dir_arg$dstarg"; then 171 | # When -d is used, all remaining arguments are directories to create. 172 | # When -t is used, the destination is already specified. 173 | # Otherwise, the last argument is the destination. Remove it from $@. 174 | for arg 175 | do 176 | if test -n "$dstarg"; then 177 | # $@ is not empty: it contains at least $arg. 178 | set fnord "$@" "$dstarg" 179 | shift # fnord 180 | fi 181 | shift # arg 182 | dstarg=$arg 183 | done 184 | fi 185 | 186 | if test $# -eq 0; then 187 | if test -z "$dir_arg"; then 188 | echo "$0: no input file specified." >&2 189 | exit 1 190 | fi 191 | # It's OK to call `install-sh -d' without argument. 192 | # This can happen when creating conditional directories. 193 | exit 0 194 | fi 195 | 196 | if test -z "$dir_arg"; then 197 | trap '(exit $?); exit' 1 2 13 15 198 | 199 | # Set umask so as not to create temps with too-generous modes. 200 | # However, 'strip' requires both read and write access to temps. 201 | case $mode in 202 | # Optimize common cases. 203 | *644) cp_umask=133;; 204 | *755) cp_umask=22;; 205 | 206 | *[0-7]) 207 | if test -z "$stripcmd"; then 208 | u_plus_rw= 209 | else 210 | u_plus_rw='% 200' 211 | fi 212 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 213 | *) 214 | if test -z "$stripcmd"; then 215 | u_plus_rw= 216 | else 217 | u_plus_rw=,u+rw 218 | fi 219 | cp_umask=$mode$u_plus_rw;; 220 | esac 221 | fi 222 | 223 | for src 224 | do 225 | # Protect names starting with `-'. 226 | case $src in 227 | -*) src=./$src ;; 228 | esac 229 | 230 | if test -n "$dir_arg"; then 231 | dst=$src 232 | dstdir=$dst 233 | test -d "$dstdir" 234 | dstdir_status=$? 235 | else 236 | 237 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 238 | # might cause directories to be created, which would be especially bad 239 | # if $src (and thus $dsttmp) contains '*'. 240 | if test ! -f "$src" && test ! -d "$src"; then 241 | echo "$0: $src does not exist." >&2 242 | exit 1 243 | fi 244 | 245 | if test -z "$dstarg"; then 246 | echo "$0: no destination specified." >&2 247 | exit 1 248 | fi 249 | 250 | dst=$dstarg 251 | # Protect names starting with `-'. 252 | case $dst in 253 | -*) dst=./$dst ;; 254 | esac 255 | 256 | # If destination is a directory, append the input filename; won't work 257 | # if double slashes aren't ignored. 258 | if test -d "$dst"; then 259 | if test -n "$no_target_directory"; then 260 | echo "$0: $dstarg: Is a directory" >&2 261 | exit 1 262 | fi 263 | dstdir=$dst 264 | dst=$dstdir/`basename "$src"` 265 | dstdir_status=0 266 | else 267 | # Prefer dirname, but fall back on a substitute if dirname fails. 268 | dstdir=` 269 | (dirname "$dst") 2>/dev/null || 270 | expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 271 | X"$dst" : 'X\(//\)[^/]' \| \ 272 | X"$dst" : 'X\(//\)$' \| \ 273 | X"$dst" : 'X\(/\)' \| . 2>/dev/null || 274 | echo X"$dst" | 275 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 276 | s//\1/ 277 | q 278 | } 279 | /^X\(\/\/\)[^/].*/{ 280 | s//\1/ 281 | q 282 | } 283 | /^X\(\/\/\)$/{ 284 | s//\1/ 285 | q 286 | } 287 | /^X\(\/\).*/{ 288 | s//\1/ 289 | q 290 | } 291 | s/.*/./; q' 292 | ` 293 | 294 | test -d "$dstdir" 295 | dstdir_status=$? 296 | fi 297 | fi 298 | 299 | obsolete_mkdir_used=false 300 | 301 | if test $dstdir_status != 0; then 302 | case $posix_mkdir in 303 | '') 304 | # Create intermediate dirs using mode 755 as modified by the umask. 305 | # This is like FreeBSD 'install' as of 1997-10-28. 306 | umask=`umask` 307 | case $stripcmd.$umask in 308 | # Optimize common cases. 309 | *[2367][2367]) mkdir_umask=$umask;; 310 | .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 311 | 312 | *[0-7]) 313 | mkdir_umask=`expr $umask + 22 \ 314 | - $umask % 100 % 40 + $umask % 20 \ 315 | - $umask % 10 % 4 + $umask % 2 316 | `;; 317 | *) mkdir_umask=$umask,go-w;; 318 | esac 319 | 320 | # With -d, create the new directory with the user-specified mode. 321 | # Otherwise, rely on $mkdir_umask. 322 | if test -n "$dir_arg"; then 323 | mkdir_mode=-m$mode 324 | else 325 | mkdir_mode= 326 | fi 327 | 328 | posix_mkdir=false 329 | case $umask in 330 | *[123567][0-7][0-7]) 331 | # POSIX mkdir -p sets u+wx bits regardless of umask, which 332 | # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 333 | ;; 334 | *) 335 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 336 | trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 337 | 338 | if (umask $mkdir_umask && 339 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 340 | then 341 | if test -z "$dir_arg" || { 342 | # Check for POSIX incompatibilities with -m. 343 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 344 | # other-writeable bit of parent directory when it shouldn't. 345 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 346 | ls_ld_tmpdir=`ls -ld "$tmpdir"` 347 | case $ls_ld_tmpdir in 348 | d????-?r-*) different_mode=700;; 349 | d????-?--*) different_mode=755;; 350 | *) false;; 351 | esac && 352 | $mkdirprog -m$different_mode -p -- "$tmpdir" && { 353 | ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 354 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 355 | } 356 | } 357 | then posix_mkdir=: 358 | fi 359 | rmdir "$tmpdir/d" "$tmpdir" 360 | else 361 | # Remove any dirs left behind by ancient mkdir implementations. 362 | rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 363 | fi 364 | trap '' 0;; 365 | esac;; 366 | esac 367 | 368 | if 369 | $posix_mkdir && ( 370 | umask $mkdir_umask && 371 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 372 | ) 373 | then : 374 | else 375 | 376 | # The umask is ridiculous, or mkdir does not conform to POSIX, 377 | # or it failed possibly due to a race condition. Create the 378 | # directory the slow way, step by step, checking for races as we go. 379 | 380 | case $dstdir in 381 | /*) prefix=/ ;; 382 | -*) prefix=./ ;; 383 | *) prefix= ;; 384 | esac 385 | 386 | case $posix_glob in 387 | '') 388 | if (set -f) 2>/dev/null; then 389 | posix_glob=true 390 | else 391 | posix_glob=false 392 | fi ;; 393 | esac 394 | 395 | oIFS=$IFS 396 | IFS=/ 397 | $posix_glob && set -f 398 | set fnord $dstdir 399 | shift 400 | $posix_glob && set +f 401 | IFS=$oIFS 402 | 403 | prefixes= 404 | 405 | for d 406 | do 407 | test -z "$d" && continue 408 | 409 | prefix=$prefix$d 410 | if test -d "$prefix"; then 411 | prefixes= 412 | else 413 | if $posix_mkdir; then 414 | (umask=$mkdir_umask && 415 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 416 | # Don't fail if two instances are running concurrently. 417 | test -d "$prefix" || exit 1 418 | else 419 | case $prefix in 420 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 421 | *) qprefix=$prefix;; 422 | esac 423 | prefixes="$prefixes '$qprefix'" 424 | fi 425 | fi 426 | prefix=$prefix/ 427 | done 428 | 429 | if test -n "$prefixes"; then 430 | # Don't fail if two instances are running concurrently. 431 | (umask $mkdir_umask && 432 | eval "\$doit_exec \$mkdirprog $prefixes") || 433 | test -d "$dstdir" || exit 1 434 | obsolete_mkdir_used=true 435 | fi 436 | fi 437 | fi 438 | 439 | if test -n "$dir_arg"; then 440 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 441 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 442 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 443 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 444 | else 445 | 446 | # Make a couple of temp file names in the proper directory. 447 | dsttmp=$dstdir/_inst.$$_ 448 | rmtmp=$dstdir/_rm.$$_ 449 | 450 | # Trap to clean up those temp files at exit. 451 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 452 | 453 | # Copy the file name to the temp name. 454 | (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 455 | 456 | # and set any options; do chmod last to preserve setuid bits. 457 | # 458 | # If any of these fail, we abort the whole thing. If we want to 459 | # ignore errors from any of these, just make sure not to ignore 460 | # errors from the above "$doit $cpprog $src $dsttmp" command. 461 | # 462 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 463 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 464 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 465 | && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 466 | 467 | # Now rename the file to the real destination. 468 | { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ 469 | || { 470 | # The rename failed, perhaps because mv can't rename something else 471 | # to itself, or perhaps because mv is so ancient that it does not 472 | # support -f. 473 | 474 | # Now remove or move aside any old file at destination location. 475 | # We try this two ways since rm can't unlink itself on some 476 | # systems and the destination file might be busy for other 477 | # reasons. In this case, the final cleanup might fail but the new 478 | # file should still install successfully. 479 | { 480 | if test -f "$dst"; then 481 | $doit $rmcmd -f "$dst" 2>/dev/null \ 482 | || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ 483 | && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ 484 | || { 485 | echo "$0: cannot unlink or rename $dst" >&2 486 | (exit 1); exit 1 487 | } 488 | else 489 | : 490 | fi 491 | } && 492 | 493 | # Now rename the file to the real destination. 494 | $doit $mvcmd "$dsttmp" "$dst" 495 | } 496 | } || exit 1 497 | 498 | trap '' 0 499 | fi 500 | done 501 | 502 | # Local variables: 503 | # eval: (add-hook 'write-file-hooks 'time-stamp) 504 | # time-stamp-start: "scriptversion=" 505 | # time-stamp-format: "%:y-%02m-%02d.%02H" 506 | # time-stamp-end: "$" 507 | # End: 508 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2006-05-10.23 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | # 02110-1301, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 37 | sed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38 | 39 | # In the cases where this matters, `missing' is being run in the 40 | # srcdir already. 41 | if test -f configure.ac; then 42 | configure_ac=configure.ac 43 | else 44 | configure_ac=configure.in 45 | fi 46 | 47 | msg="missing on your system" 48 | 49 | case $1 in 50 | --run) 51 | # Try to run requested program, and just exit if it succeeds. 52 | run= 53 | shift 54 | "$@" && exit 0 55 | # Exit code 63 means version mismatch. This often happens 56 | # when the user try to use an ancient version of a tool on 57 | # a file that requires a minimum version. In this case we 58 | # we should proceed has if the program had been absent, or 59 | # if --run hadn't been passed. 60 | if test $? = 63; then 61 | run=: 62 | msg="probably too old" 63 | fi 64 | ;; 65 | 66 | -h|--h|--he|--hel|--help) 67 | echo "\ 68 | $0 [OPTION]... PROGRAM [ARGUMENT]... 69 | 70 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71 | error status if there is no known handling for PROGRAM. 72 | 73 | Options: 74 | -h, --help display this help and exit 75 | -v, --version output version information and exit 76 | --run try to run the given command, and emulate it if it fails 77 | 78 | Supported PROGRAM values: 79 | aclocal touch file \`aclocal.m4' 80 | autoconf touch file \`configure' 81 | autoheader touch file \`config.h.in' 82 | autom4te touch the output file, or create a stub one 83 | automake touch all \`Makefile.in' files 84 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 85 | flex create \`lex.yy.c', if possible, from existing .c 86 | help2man touch the output file 87 | lex create \`lex.yy.c', if possible, from existing .c 88 | makeinfo touch the output file 89 | tar try tar, gnutar, gtar, then tar without non-portable flags 90 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91 | 92 | Send bug reports to ." 93 | exit $? 94 | ;; 95 | 96 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97 | echo "missing $scriptversion (GNU Automake)" 98 | exit $? 99 | ;; 100 | 101 | -*) 102 | echo 1>&2 "$0: Unknown \`$1' option" 103 | echo 1>&2 "Try \`$0 --help' for more information" 104 | exit 1 105 | ;; 106 | 107 | esac 108 | 109 | # Now exit if we have it, but it failed. Also exit now if we 110 | # don't have it and --version was passed (most likely to detect 111 | # the program). 112 | case $1 in 113 | lex|yacc) 114 | # Not GNU programs, they don't have --version. 115 | ;; 116 | 117 | tar) 118 | if test -n "$run"; then 119 | echo 1>&2 "ERROR: \`tar' requires --run" 120 | exit 1 121 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122 | exit 1 123 | fi 124 | ;; 125 | 126 | *) 127 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128 | # We have it, but it failed. 129 | exit 1 130 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131 | # Could not run --version or --help. This is probably someone 132 | # running `$TOOL --version' or `$TOOL --help' to check whether 133 | # $TOOL exists and not knowing $TOOL uses missing. 134 | exit 1 135 | fi 136 | ;; 137 | esac 138 | 139 | # If it does not exist, or fails to run (possibly an outdated version), 140 | # try to emulate it. 141 | case $1 in 142 | aclocal*) 143 | echo 1>&2 "\ 144 | WARNING: \`$1' is $msg. You should only need it if 145 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146 | to install the \`Automake' and \`Perl' packages. Grab them from 147 | any GNU archive site." 148 | touch aclocal.m4 149 | ;; 150 | 151 | autoconf) 152 | echo 1>&2 "\ 153 | WARNING: \`$1' is $msg. You should only need it if 154 | you modified \`${configure_ac}'. You might want to install the 155 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156 | archive site." 157 | touch configure 158 | ;; 159 | 160 | autoheader) 161 | echo 1>&2 "\ 162 | WARNING: \`$1' is $msg. You should only need it if 163 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 164 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 165 | from any GNU archive site." 166 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167 | test -z "$files" && files="config.h" 168 | touch_files= 169 | for f in $files; do 170 | case $f in 171 | *:*) touch_files="$touch_files "`echo "$f" | 172 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173 | *) touch_files="$touch_files $f.in";; 174 | esac 175 | done 176 | touch $touch_files 177 | ;; 178 | 179 | automake*) 180 | echo 1>&2 "\ 181 | WARNING: \`$1' is $msg. You should only need it if 182 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183 | You might want to install the \`Automake' and \`Perl' packages. 184 | Grab them from any GNU archive site." 185 | find . -type f -name Makefile.am -print | 186 | sed 's/\.am$/.in/' | 187 | while read f; do touch "$f"; done 188 | ;; 189 | 190 | autom4te) 191 | echo 1>&2 "\ 192 | WARNING: \`$1' is needed, but is $msg. 193 | You might have modified some files without having the 194 | proper tools for further handling them. 195 | You can get \`$1' as part of \`Autoconf' from any GNU 196 | archive site." 197 | 198 | file=`echo "$*" | sed -n "$sed_output"` 199 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200 | if test -f "$file"; then 201 | touch $file 202 | else 203 | test -z "$file" || exec >$file 204 | echo "#! /bin/sh" 205 | echo "# Created by GNU Automake missing as a replacement of" 206 | echo "# $ $@" 207 | echo "exit 0" 208 | chmod +x $file 209 | exit 1 210 | fi 211 | ;; 212 | 213 | bison|yacc) 214 | echo 1>&2 "\ 215 | WARNING: \`$1' $msg. You should only need it if 216 | you modified a \`.y' file. You may need the \`Bison' package 217 | in order for those modifications to take effect. You can get 218 | \`Bison' from any GNU archive site." 219 | rm -f y.tab.c y.tab.h 220 | if test $# -ne 1; then 221 | eval LASTARG="\${$#}" 222 | case $LASTARG in 223 | *.y) 224 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 225 | if test -f "$SRCFILE"; then 226 | cp "$SRCFILE" y.tab.c 227 | fi 228 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 229 | if test -f "$SRCFILE"; then 230 | cp "$SRCFILE" y.tab.h 231 | fi 232 | ;; 233 | esac 234 | fi 235 | if test ! -f y.tab.h; then 236 | echo >y.tab.h 237 | fi 238 | if test ! -f y.tab.c; then 239 | echo 'main() { return 0; }' >y.tab.c 240 | fi 241 | ;; 242 | 243 | lex|flex) 244 | echo 1>&2 "\ 245 | WARNING: \`$1' is $msg. You should only need it if 246 | you modified a \`.l' file. You may need the \`Flex' package 247 | in order for those modifications to take effect. You can get 248 | \`Flex' from any GNU archive site." 249 | rm -f lex.yy.c 250 | if test $# -ne 1; then 251 | eval LASTARG="\${$#}" 252 | case $LASTARG in 253 | *.l) 254 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 255 | if test -f "$SRCFILE"; then 256 | cp "$SRCFILE" lex.yy.c 257 | fi 258 | ;; 259 | esac 260 | fi 261 | if test ! -f lex.yy.c; then 262 | echo 'main() { return 0; }' >lex.yy.c 263 | fi 264 | ;; 265 | 266 | help2man) 267 | echo 1>&2 "\ 268 | WARNING: \`$1' is $msg. You should only need it if 269 | you modified a dependency of a manual page. You may need the 270 | \`Help2man' package in order for those modifications to take 271 | effect. You can get \`Help2man' from any GNU archive site." 272 | 273 | file=`echo "$*" | sed -n "$sed_output"` 274 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 275 | if test -f "$file"; then 276 | touch $file 277 | else 278 | test -z "$file" || exec >$file 279 | echo ".ab help2man is required to generate this page" 280 | exit 1 281 | fi 282 | ;; 283 | 284 | makeinfo) 285 | echo 1>&2 "\ 286 | WARNING: \`$1' is $msg. You should only need it if 287 | you modified a \`.texi' or \`.texinfo' file, or any other file 288 | indirectly affecting the aspect of the manual. The spurious 289 | call might also be the consequence of using a buggy \`make' (AIX, 290 | DU, IRIX). You might want to install the \`Texinfo' package or 291 | the \`GNU make' package. Grab either from any GNU archive site." 292 | # The file to touch is that specified with -o ... 293 | file=`echo "$*" | sed -n "$sed_output"` 294 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295 | if test -z "$file"; then 296 | # ... or it is the one specified with @setfilename ... 297 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 298 | file=`sed -n ' 299 | /^@setfilename/{ 300 | s/.* \([^ ]*\) *$/\1/ 301 | p 302 | q 303 | }' $infile` 304 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 305 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306 | fi 307 | # If the file does not exist, the user really needs makeinfo; 308 | # let's fail without touching anything. 309 | test -f $file || exit 1 310 | touch $file 311 | ;; 312 | 313 | tar) 314 | shift 315 | 316 | # We have already tried tar in the generic part. 317 | # Look for gnutar/gtar before invocation to avoid ugly error 318 | # messages. 319 | if (gnutar --version > /dev/null 2>&1); then 320 | gnutar "$@" && exit 0 321 | fi 322 | if (gtar --version > /dev/null 2>&1); then 323 | gtar "$@" && exit 0 324 | fi 325 | firstarg="$1" 326 | if shift; then 327 | case $firstarg in 328 | *o*) 329 | firstarg=`echo "$firstarg" | sed s/o//` 330 | tar "$firstarg" "$@" && exit 0 331 | ;; 332 | esac 333 | case $firstarg in 334 | *h*) 335 | firstarg=`echo "$firstarg" | sed s/h//` 336 | tar "$firstarg" "$@" && exit 0 337 | ;; 338 | esac 339 | fi 340 | 341 | echo 1>&2 "\ 342 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 343 | You may want to install GNU tar or Free paxutils, or check the 344 | command line arguments." 345 | exit 1 346 | ;; 347 | 348 | *) 349 | echo 1>&2 "\ 350 | WARNING: \`$1' is needed, and is $msg. 351 | You might have modified some files without having the 352 | proper tools for further handling them. Check the \`README' file, 353 | it often tells you about the needed prerequisites for installing 354 | this package. You may also peek at any GNU archive site, in case 355 | some other package would contain this missing \`$1' program." 356 | exit 1 357 | ;; 358 | esac 359 | 360 | exit 0 361 | 362 | # Local variables: 363 | # eval: (add-hook 'write-file-hooks 'time-stamp) 364 | # time-stamp-start: "scriptversion=" 365 | # time-stamp-format: "%:y-%02m-%02d.%02H" 366 | # time-stamp-end: "$" 367 | # End: 368 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.15 from Makefile.am. 2 | # src/Makefile. Generated from Makefile.in by configure. 3 | 4 | # Copyright (C) 1994-2014 Free Software Foundation, Inc. 5 | 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | 16 | 17 | 18 | am__is_gnu_make = { \ 19 | if test -z '$(MAKELEVEL)'; then \ 20 | false; \ 21 | elif test -n '$(MAKE_HOST)'; then \ 22 | true; \ 23 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 | true; \ 25 | else \ 26 | false; \ 27 | fi; \ 28 | } 29 | am__make_running_with_option = \ 30 | case $${target_option-} in \ 31 | ?) ;; \ 32 | *) echo "am__make_running_with_option: internal error: invalid" \ 33 | "target option '$${target_option-}' specified" >&2; \ 34 | exit 1;; \ 35 | esac; \ 36 | has_opt=no; \ 37 | sane_makeflags=$$MAKEFLAGS; \ 38 | if $(am__is_gnu_make); then \ 39 | sane_makeflags=$$MFLAGS; \ 40 | else \ 41 | case $$MAKEFLAGS in \ 42 | *\\[\ \ ]*) \ 43 | bs=\\; \ 44 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ 45 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ 46 | esac; \ 47 | fi; \ 48 | skip_next=no; \ 49 | strip_trailopt () \ 50 | { \ 51 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ 52 | }; \ 53 | for flg in $$sane_makeflags; do \ 54 | test $$skip_next = yes && { skip_next=no; continue; }; \ 55 | case $$flg in \ 56 | *=*|--*) continue;; \ 57 | -*I) strip_trailopt 'I'; skip_next=yes;; \ 58 | -*I?*) strip_trailopt 'I';; \ 59 | -*O) strip_trailopt 'O'; skip_next=yes;; \ 60 | -*O?*) strip_trailopt 'O';; \ 61 | -*l) strip_trailopt 'l'; skip_next=yes;; \ 62 | -*l?*) strip_trailopt 'l';; \ 63 | -[dEDm]) skip_next=yes;; \ 64 | -[JT]) skip_next=yes;; \ 65 | esac; \ 66 | case $$flg in \ 67 | *$$target_option*) has_opt=yes; break;; \ 68 | esac; \ 69 | done; \ 70 | test $$has_opt = yes 71 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) 72 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 73 | pkgdatadir = $(datadir)/viewssld 74 | pkgincludedir = $(includedir)/viewssld 75 | pkglibdir = $(libdir)/viewssld 76 | pkglibexecdir = $(libexecdir)/viewssld 77 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 78 | install_sh_DATA = $(install_sh) -c -m 644 79 | install_sh_PROGRAM = $(install_sh) -c 80 | install_sh_SCRIPT = $(install_sh) -c 81 | INSTALL_HEADER = $(INSTALL_DATA) 82 | transform = $(program_transform_name) 83 | NORMAL_INSTALL = : 84 | PRE_INSTALL = : 85 | POST_INSTALL = : 86 | NORMAL_UNINSTALL = : 87 | PRE_UNINSTALL = : 88 | POST_UNINSTALL = : 89 | build_triplet = i386-apple-darwin14.1.0 90 | host_triplet = i386-apple-darwin14.1.0 91 | target_triplet = i386-apple-darwin14.1.0 92 | sbin_PROGRAMS = viewssld$(EXEEXT) 93 | subdir = src 94 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 95 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 96 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 97 | $(ACLOCAL_M4) 98 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 99 | mkinstalldirs = $(install_sh) -d 100 | CONFIG_CLEAN_FILES = 101 | CONFIG_CLEAN_VPATH_FILES = 102 | am__installdirs = "$(DESTDIR)$(sbindir)" 103 | PROGRAMS = $(sbin_PROGRAMS) 104 | am_viewssld_OBJECTS = viewssld.$(OBJEXT) utils.$(OBJEXT) 105 | viewssld_OBJECTS = $(am_viewssld_OBJECTS) 106 | viewssld_DEPENDENCIES = 107 | AM_V_P = $(am__v_P_$(V)) 108 | am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) 109 | am__v_P_0 = false 110 | am__v_P_1 = : 111 | AM_V_GEN = $(am__v_GEN_$(V)) 112 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) 113 | am__v_GEN_0 = @echo " GEN " $@; 114 | am__v_GEN_1 = 115 | AM_V_at = $(am__v_at_$(V)) 116 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) 117 | am__v_at_0 = @ 118 | am__v_at_1 = 119 | DEFAULT_INCLUDES = -I. 120 | depcomp = $(SHELL) $(top_srcdir)/depcomp 121 | am__depfiles_maybe = depfiles 122 | am__mv = mv -f 123 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 124 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 125 | AM_V_CC = $(am__v_CC_$(V)) 126 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) 127 | am__v_CC_0 = @echo " CC " $@; 128 | am__v_CC_1 = 129 | CCLD = $(CC) 130 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 131 | AM_V_CCLD = $(am__v_CCLD_$(V)) 132 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) 133 | am__v_CCLD_0 = @echo " CCLD " $@; 134 | am__v_CCLD_1 = 135 | SOURCES = $(viewssld_SOURCES) 136 | DIST_SOURCES = $(viewssld_SOURCES) 137 | am__can_run_installinfo = \ 138 | case $$AM_UPDATE_INFO_DIR in \ 139 | n|no|NO) false;; \ 140 | *) (install-info --version) >/dev/null 2>&1;; \ 141 | esac 142 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 143 | # Read a list of newline-separated strings from the standard input, 144 | # and print each of them once, without duplicates. Input order is 145 | # *not* preserved. 146 | am__uniquify_input = $(AWK) '\ 147 | BEGIN { nonempty = 0; } \ 148 | { items[$$0] = 1; nonempty = 1; } \ 149 | END { if (nonempty) { for (i in items) print i; }; } \ 150 | ' 151 | # Make sure the list of sources is unique. This is necessary because, 152 | # e.g., the same source file might be shared among _SOURCES variables 153 | # for different programs/libraries. 154 | am__define_uniq_tagged_files = \ 155 | list='$(am__tagged_files)'; \ 156 | unique=`for i in $$list; do \ 157 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 158 | done | $(am__uniquify_input)` 159 | ETAGS = etags 160 | CTAGS = ctags 161 | am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp 162 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 163 | ACLOCAL = aclocal-1.15 164 | AMTAR = $${TAR-tar} 165 | AM_DEFAULT_VERBOSITY = 1 166 | AUTOCONF = autoconf 167 | AUTOHEADER = autoheader 168 | AUTOMAKE = automake-1.15 169 | AWK = awk 170 | CC = gcc 171 | CCDEPMODE = depmode=gcc3 172 | CFLAGS = -g -O2 173 | CPP = gcc -E 174 | CPPFLAGS = 175 | CYGPATH_W = echo 176 | DEFS = -DPACKAGE_NAME=\"viewssld\" -DPACKAGE_TARNAME=\"viewssld\" -DPACKAGE_VERSION=\"0.7.0\" -DPACKAGE_STRING=\"viewssld\ 0.7.0\" -DPACKAGE_BUGREPORT=\"plashchynski@gmail.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"viewssld\" -DVERSION=\"0.7.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 177 | DEPDIR = .deps 178 | ECHO_C = \c 179 | ECHO_N = 180 | ECHO_T = 181 | EGREP = /usr/bin/grep -E 182 | EXEEXT = 183 | GREP = /usr/bin/grep 184 | INSTALL = /usr/bin/install -c 185 | INSTALL_DATA = ${INSTALL} -m 644 186 | INSTALL_PROGRAM = ${INSTALL} 187 | INSTALL_SCRIPT = ${INSTALL} 188 | INSTALL_STRIP_PROGRAM = $(install_sh) -c -s 189 | LDFLAGS = 190 | LIBOBJS = 191 | LIBS = 192 | LTLIBOBJS = 193 | MAKEINFO = makeinfo 194 | MKDIR_P = .././install-sh -c -d 195 | OBJEXT = o 196 | PACKAGE = viewssld 197 | PACKAGE_BUGREPORT = plashchynski@gmail.com 198 | PACKAGE_NAME = viewssld 199 | PACKAGE_STRING = viewssld 0.7.0 200 | PACKAGE_TARNAME = viewssld 201 | PACKAGE_URL = 202 | PACKAGE_VERSION = 0.7.0 203 | PATH_SEPARATOR = : 204 | SET_MAKE = 205 | SHELL = /bin/sh 206 | STRIP = 207 | VERSION = 0.7.0 208 | abs_builddir = /Users/daniel/src/viewssld/src 209 | abs_srcdir = /Users/daniel/src/viewssld/src 210 | abs_top_builddir = /Users/daniel/src/viewssld 211 | abs_top_srcdir = /Users/daniel/src/viewssld 212 | ac_ct_CC = gcc 213 | am__include = include 214 | am__leading_dot = . 215 | am__quote = 216 | am__tar = $${TAR-tar} chof - "$$tardir" 217 | am__untar = $${TAR-tar} xf - 218 | bindir = ${exec_prefix}/bin 219 | build = i386-apple-darwin14.1.0 220 | build_alias = 221 | build_cpu = i386 222 | build_os = darwin14.1.0 223 | build_vendor = apple 224 | builddir = . 225 | datadir = ${datarootdir} 226 | datarootdir = ${prefix}/share 227 | docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} 228 | dvidir = ${docdir} 229 | exec_prefix = ${prefix} 230 | host = i386-apple-darwin14.1.0 231 | host_alias = 232 | host_cpu = i386 233 | host_os = darwin14.1.0 234 | host_vendor = apple 235 | htmldir = ${docdir} 236 | includedir = ${prefix}/include 237 | infodir = ${datarootdir}/info 238 | install_sh = ${SHELL} /Users/daniel/src/viewssld/install-sh 239 | libdir = ${exec_prefix}/lib 240 | libexecdir = ${exec_prefix}/libexec 241 | localedir = ${datarootdir}/locale 242 | localstatedir = ${prefix}/var 243 | mandir = ${datarootdir}/man 244 | mkdir_p = $(MKDIR_P) 245 | oldincludedir = /usr/include 246 | pdfdir = ${docdir} 247 | prefix = /usr/local 248 | program_transform_name = s,x,x, 249 | psdir = ${docdir} 250 | sbindir = ${exec_prefix}/sbin 251 | sharedstatedir = ${prefix}/com 252 | srcdir = . 253 | sysconfdir = ${prefix}/etc 254 | target = i386-apple-darwin14.1.0 255 | target_alias = 256 | target_cpu = i386 257 | target_os = darwin14.1.0 258 | target_vendor = apple 259 | top_build_prefix = ../ 260 | top_builddir = .. 261 | top_srcdir = .. 262 | viewssld_SOURCES = viewssld.c utils.c 263 | viewssld_LDADD = -lpcap -lssl -lnet -ldssl 264 | all: all-am 265 | 266 | .SUFFIXES: 267 | .SUFFIXES: .c .o .obj 268 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 269 | @for dep in $?; do \ 270 | case '$(am__configure_deps)' in \ 271 | *$$dep*) \ 272 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 273 | && { if test -f $@; then exit 0; else break; fi; }; \ 274 | exit 1;; \ 275 | esac; \ 276 | done; \ 277 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 278 | $(am__cd) $(top_srcdir) && \ 279 | $(AUTOMAKE) --gnu src/Makefile 280 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 281 | @case '$?' in \ 282 | *config.status*) \ 283 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 284 | *) \ 285 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 286 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 287 | esac; 288 | 289 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 290 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 291 | 292 | $(top_srcdir)/configure: $(am__configure_deps) 293 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 294 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 295 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 296 | $(am__aclocal_m4_deps): 297 | install-sbinPROGRAMS: $(sbin_PROGRAMS) 298 | @$(NORMAL_INSTALL) 299 | @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ 300 | if test -n "$$list"; then \ 301 | echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ 302 | $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ 303 | fi; \ 304 | for p in $$list; do echo "$$p $$p"; done | \ 305 | sed 's/$(EXEEXT)$$//' | \ 306 | while read p p1; do if test -f $$p \ 307 | ; then echo "$$p"; echo "$$p"; else :; fi; \ 308 | done | \ 309 | sed -e 'p;s,.*/,,;n;h' \ 310 | -e 's|.*|.|' \ 311 | -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ 312 | sed 'N;N;N;s,\n, ,g' | \ 313 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ 314 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ 315 | if ($$2 == $$4) files[d] = files[d] " " $$1; \ 316 | else { print "f", $$3 "/" $$4, $$1; } } \ 317 | END { for (d in files) print "f", d, files[d] }' | \ 318 | while read type dir files; do \ 319 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ 320 | test -z "$$files" || { \ 321 | echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ 322 | $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ 323 | } \ 324 | ; done 325 | 326 | uninstall-sbinPROGRAMS: 327 | @$(NORMAL_UNINSTALL) 328 | @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ 329 | files=`for p in $$list; do echo "$$p"; done | \ 330 | sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ 331 | -e 's/$$/$(EXEEXT)/' \ 332 | `; \ 333 | test -n "$$list" || exit 0; \ 334 | echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ 335 | cd "$(DESTDIR)$(sbindir)" && rm -f $$files 336 | 337 | clean-sbinPROGRAMS: 338 | -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) 339 | 340 | viewssld$(EXEEXT): $(viewssld_OBJECTS) $(viewssld_DEPENDENCIES) $(EXTRA_viewssld_DEPENDENCIES) 341 | @rm -f viewssld$(EXEEXT) 342 | $(AM_V_CCLD)$(LINK) $(viewssld_OBJECTS) $(viewssld_LDADD) $(LIBS) 343 | 344 | mostlyclean-compile: 345 | -rm -f *.$(OBJEXT) 346 | 347 | distclean-compile: 348 | -rm -f *.tab.c 349 | 350 | include ./$(DEPDIR)/utils.Po 351 | include ./$(DEPDIR)/viewssld.Po 352 | 353 | .c.o: 354 | $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 355 | $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 356 | # $(AM_V_CC)source='$<' object='$@' libtool=no \ 357 | # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 358 | # $(AM_V_CC_no)$(COMPILE) -c -o $@ $< 359 | 360 | .c.obj: 361 | $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 362 | $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 363 | # $(AM_V_CC)source='$<' object='$@' libtool=no \ 364 | # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 365 | # $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 366 | 367 | ID: $(am__tagged_files) 368 | $(am__define_uniq_tagged_files); mkid -fID $$unique 369 | tags: tags-am 370 | TAGS: tags 371 | 372 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 373 | set x; \ 374 | here=`pwd`; \ 375 | $(am__define_uniq_tagged_files); \ 376 | shift; \ 377 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 378 | test -n "$$unique" || unique=$$empty_fix; \ 379 | if test $$# -gt 0; then \ 380 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 381 | "$$@" $$unique; \ 382 | else \ 383 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 384 | $$unique; \ 385 | fi; \ 386 | fi 387 | ctags: ctags-am 388 | 389 | CTAGS: ctags 390 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 391 | $(am__define_uniq_tagged_files); \ 392 | test -z "$(CTAGS_ARGS)$$unique" \ 393 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 394 | $$unique 395 | 396 | GTAGS: 397 | here=`$(am__cd) $(top_builddir) && pwd` \ 398 | && $(am__cd) $(top_srcdir) \ 399 | && gtags -i $(GTAGS_ARGS) "$$here" 400 | cscopelist: cscopelist-am 401 | 402 | cscopelist-am: $(am__tagged_files) 403 | list='$(am__tagged_files)'; \ 404 | case "$(srcdir)" in \ 405 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ 406 | *) sdir=$(subdir)/$(srcdir) ;; \ 407 | esac; \ 408 | for i in $$list; do \ 409 | if test -f "$$i"; then \ 410 | echo "$(subdir)/$$i"; \ 411 | else \ 412 | echo "$$sdir/$$i"; \ 413 | fi; \ 414 | done >> $(top_builddir)/cscope.files 415 | 416 | distclean-tags: 417 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 418 | 419 | distdir: $(DISTFILES) 420 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 421 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 422 | list='$(DISTFILES)'; \ 423 | dist_files=`for file in $$list; do echo $$file; done | \ 424 | sed -e "s|^$$srcdirstrip/||;t" \ 425 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 426 | case $$dist_files in \ 427 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 428 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 429 | sort -u` ;; \ 430 | esac; \ 431 | for file in $$dist_files; do \ 432 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 433 | if test -d $$d/$$file; then \ 434 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 435 | if test -d "$(distdir)/$$file"; then \ 436 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 437 | fi; \ 438 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 439 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 440 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 441 | fi; \ 442 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 443 | else \ 444 | test -f "$(distdir)/$$file" \ 445 | || cp -p $$d/$$file "$(distdir)/$$file" \ 446 | || exit 1; \ 447 | fi; \ 448 | done 449 | check-am: all-am 450 | check: check-am 451 | all-am: Makefile $(PROGRAMS) 452 | installdirs: 453 | for dir in "$(DESTDIR)$(sbindir)"; do \ 454 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 455 | done 456 | install: install-am 457 | install-exec: install-exec-am 458 | install-data: install-data-am 459 | uninstall: uninstall-am 460 | 461 | install-am: all-am 462 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 463 | 464 | installcheck: installcheck-am 465 | install-strip: 466 | if test -z '$(STRIP)'; then \ 467 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 468 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 469 | install; \ 470 | else \ 471 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 472 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 473 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 474 | fi 475 | mostlyclean-generic: 476 | 477 | clean-generic: 478 | 479 | distclean-generic: 480 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 481 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 482 | 483 | maintainer-clean-generic: 484 | @echo "This command is intended for maintainers to use" 485 | @echo "it deletes files that may require special tools to rebuild." 486 | clean: clean-am 487 | 488 | clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am 489 | 490 | distclean: distclean-am 491 | -rm -rf ./$(DEPDIR) 492 | -rm -f Makefile 493 | distclean-am: clean-am distclean-compile distclean-generic \ 494 | distclean-tags 495 | 496 | dvi: dvi-am 497 | 498 | dvi-am: 499 | 500 | html: html-am 501 | 502 | html-am: 503 | 504 | info: info-am 505 | 506 | info-am: 507 | 508 | install-data-am: 509 | 510 | install-dvi: install-dvi-am 511 | 512 | install-dvi-am: 513 | 514 | install-exec-am: install-sbinPROGRAMS 515 | 516 | install-html: install-html-am 517 | 518 | install-html-am: 519 | 520 | install-info: install-info-am 521 | 522 | install-info-am: 523 | 524 | install-man: 525 | 526 | install-pdf: install-pdf-am 527 | 528 | install-pdf-am: 529 | 530 | install-ps: install-ps-am 531 | 532 | install-ps-am: 533 | 534 | installcheck-am: 535 | 536 | maintainer-clean: maintainer-clean-am 537 | -rm -rf ./$(DEPDIR) 538 | -rm -f Makefile 539 | maintainer-clean-am: distclean-am maintainer-clean-generic 540 | 541 | mostlyclean: mostlyclean-am 542 | 543 | mostlyclean-am: mostlyclean-compile mostlyclean-generic 544 | 545 | pdf: pdf-am 546 | 547 | pdf-am: 548 | 549 | ps: ps-am 550 | 551 | ps-am: 552 | 553 | uninstall-am: uninstall-sbinPROGRAMS 554 | 555 | .MAKE: install-am install-strip 556 | 557 | .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ 558 | clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ 559 | distclean-compile distclean-generic distclean-tags distdir dvi \ 560 | dvi-am html html-am info info-am install install-am \ 561 | install-data install-data-am install-dvi install-dvi-am \ 562 | install-exec install-exec-am install-html install-html-am \ 563 | install-info install-info-am install-man install-pdf \ 564 | install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ 565 | install-strip installcheck installcheck-am installdirs \ 566 | maintainer-clean maintainer-clean-generic mostlyclean \ 567 | mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ 568 | tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS 569 | 570 | .PRECIOUS: Makefile 571 | 572 | 573 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 574 | # Otherwise a system limit (for SysV at least) may be exceeded. 575 | .NOEXPORT: 576 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | sbin_PROGRAMS = viewssld 2 | viewssld_SOURCES = viewssld.c utils.c 3 | viewssld_LDADD = -lpcap -lssl -lnet -ldssl 4 | -------------------------------------------------------------------------------- /src/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of viewssld package. 3 | * 4 | * Copyright 2007 Dzmitry Plashchynski 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "viewssld.h" 35 | #include "utils.h" 36 | 37 | 38 | extern struct _config config; 39 | 40 | static void rmspace(char *str); 41 | static char *tolow(char *str); 42 | //static void AddressToString(uint32_t ip, uint16_t port, char *buff); 43 | 44 | void errorlog(char *message) 45 | { 46 | if (config.daemon) 47 | syslog(LOG_DAEMON|LOG_ERR, message); 48 | else 49 | { 50 | fprintf(stderr, message); 51 | putchar('\n'); 52 | } 53 | 54 | exit(EXIT_FAILURE); 55 | } 56 | 57 | /*static void AddressToString(uint32_t ip, uint16_t port, char *buff) 58 | { 59 | struct in_addr addr; 60 | addr.s_addr = ip; 61 | sprintf(buff, "%s:%d", inet_ntoa(addr), (int) port); 62 | }*/ 63 | 64 | static void rmspace(char *str) 65 | { 66 | char *buff = malloc((MAX_CONFIG_STR_LEN+1) * sizeof(char)); 67 | register int i, j = 0; 68 | 69 | for (i=0; str[i]; i++) 70 | { 71 | if (str[i] == '\\') 72 | { 73 | if (isspace(str[i+1])) 74 | buff[j++] = str[i+1]; 75 | else if (str[i+1] == '\\') 76 | buff[j++] = str[i+1]; 77 | } 78 | else if (!isspace(str[i])) 79 | buff[j++] = str[i]; 80 | 81 | if (i >= MAX_CONFIG_STR_LEN) 82 | break; 83 | } 84 | 85 | buff[j] = '\0'; 86 | 87 | strcpy(str, buff); 88 | free(buff); 89 | } 90 | 91 | static char *tolow(char *str) 92 | { 93 | register int i=0; 94 | char *buf = malloc((strlen(str)+1) * sizeof(char)); 95 | 96 | while (str[i]) 97 | { 98 | buf[i]=tolower(str[i]); 99 | i++; 100 | } 101 | buf[i] = '\0'; 102 | 103 | return buf; 104 | } 105 | 106 | /*const char *SessionToString(const TcpSession *sess) 107 | { 108 | static char buff[512]; 109 | char addr1[32], addr2[32]; 110 | 111 | addr1[0] = 0; 112 | addr2[0] = 0; 113 | 114 | AddressToString(sess->serverStream.ip_addr, sess->serverStream.port, addr1); 115 | AddressToString(sess->clientStream.ip_addr, sess->clientStream.port, addr2); 116 | 117 | sprintf(buff, "%s<->%s", addr1, addr2); 118 | return buff; 119 | } 120 | */ 121 | 122 | /* Format and dump the data on the screen */ 123 | void DumpData(const u_char* data, uint32_t sz) 124 | { 125 | register uint32_t i; 126 | 127 | for (i = 0; i < sz; i++) 128 | { 129 | if (isprint(data[i]) || data[i] == '\n' || data[i] == '\t' || data[i] == '\r') 130 | putc(data[i], stdout); 131 | else 132 | putc('.', stdout); 133 | } 134 | } 135 | 136 | /* Getting MAC */ 137 | int getmac(const char *name, u_int8_t *mac) 138 | { 139 | int ctl_sk = -1; 140 | int r; 141 | struct ifreq ifr; 142 | 143 | ctl_sk = socket(AF_INET, SOCK_DGRAM, 0); 144 | 145 | memset(&ifr,0,sizeof(struct ifreq)); 146 | strcpy(ifr.ifr_name, name); 147 | r = ioctl(ctl_sk, SIOCGIFHWADDR, &ifr); 148 | memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); 149 | return r; 150 | } 151 | 152 | /* for load config */ 153 | int load_config(const char *path, struct _config *config) 154 | { 155 | char strbuf[MAXSTRLEN]; 156 | FILE *fd = NULL; 157 | int n = 0, line = 0, block = 0, index=0; 158 | 159 | fd = fopen(path, "r"); 160 | 161 | if (fd == NULL) 162 | { 163 | fprintf(stderr, "ERROR: Can't open config file \"%s\".\n", path); 164 | return(-1); 165 | } 166 | 167 | while(!feof(fd)) 168 | { 169 | register char *p = strbuf; 170 | register char *key = malloc((KEYLEN+1) * sizeof(char)); 171 | register char *val = malloc((VALLEN+1) * sizeof(char)); 172 | char title[TITLELEN]; 173 | 174 | *key = '\0'; 175 | *val = '\0'; 176 | *title = '\0'; 177 | 178 | line++; 179 | 180 | if (fgets(strbuf, sizeof(strbuf)-1, fd) == NULL) 181 | continue; 182 | 183 | rmspace(p); 184 | 185 | /* blank lines and comments get ignored */ 186 | if (!*p || *p == '#') 187 | continue; 188 | 189 | if (p[0] == '[' && p[strlen(p)-1] == ']') 190 | { 191 | sscanf(p, "[%255[^]]", title); 192 | block = 1; 193 | index = config->index; 194 | 195 | config->cap[index] = malloc(sizeof(struct _cap)); 196 | if (config->index == 0) 197 | memset(config->cap[index],0,sizeof(struct _cap)); 198 | else 199 | { 200 | memcpy(config->cap[index],config->cap[index-1],sizeof(struct _cap)); 201 | memset(config->cap[index],0,sizeof(struct _cap)); 202 | } 203 | 204 | strcpy(config->cap[index]->title, title); 205 | 206 | config->cmdl=0; 207 | config->index++; 208 | continue; 209 | } 210 | 211 | /* parse */ 212 | n = sscanf(p, "%255[^=\n\r\t]=%255[^\n\r\t]", key, val); 213 | 214 | if (n != 2) 215 | { 216 | fprintf(stderr, "ERROR: Can't parse config file %s at line %d.\n", path, line); 217 | continue; 218 | } 219 | 220 | key = tolow(key); 221 | 222 | if (!strcmp(key,"src")) 223 | { 224 | if (getmac(val, config->cap[index]->src_interface_mac) != -1) 225 | strcpy(config->cap[index]->src_interface, val); 226 | else 227 | { 228 | fprintf(stderr, "ERROR: %s fetching interface information error: Device not found.\n", val); 229 | return(-1); 230 | } 231 | } 232 | else if (!strcmp(key,"dst")) 233 | { 234 | if (getmac(val, config->cap[index]->dst_interface_mac) != -1) 235 | strcpy(config->cap[index]->dst_interface, val); 236 | else 237 | { 238 | fprintf(stderr, "ERROR: %s fetching interface information error: Device not found.\n", val); 239 | return(-1); 240 | } 241 | } 242 | else if (!strcmp(key,"ip")) 243 | { 244 | if (inet_aton(val, &config->cap[index]->server_ip) == 0) 245 | { 246 | fprintf(stderr, "Invalid IP address format \"%s\".\n", val); 247 | return(-1); 248 | } 249 | } 250 | else if (!strcmp(key,"port")) 251 | { 252 | config->cap[index]->port = (uint16_t) atoi(val); 253 | if (config->cap[index]->port == 0) // it will always < 65535 due to limited range of data type 254 | { 255 | fprintf(stderr, "Invalid TCP port value \"%d\".\n", config->cap[index]->port); 256 | return(-1); 257 | } 258 | } 259 | else if (!strcmp(key,"dsslport")) 260 | { 261 | config->cap[index]->dsslport = (uint16_t) atoi(val); 262 | if (config->cap[index]->dsslport == 0) // it will always < 65535 due to limited range of data type 263 | { 264 | fprintf(stderr, "Invalid TCP dsslport value \"%d\".\n", config->cap[index]->dsslport); 265 | return(-1); 266 | } 267 | } 268 | else if (!strcmp(key,"key")) 269 | { 270 | strcpy(config->cap[index]->keyfile, val); 271 | } 272 | else if (!strcmp(key,"pwd")) 273 | { 274 | strcpy(config->cap[index]->pwd, val); 275 | } 276 | // common options 277 | else if (!strcmp(key,"loglevel")) 278 | { 279 | if (block) 280 | fprintf(stderr,"WARNING: The option \"loglevel\" is common and must placed not in block \"[title]\".\n"); 281 | config->loglevel = atoi(val); 282 | } 283 | else if (!strcmp(key,"daemon")) 284 | { 285 | if (block) 286 | fprintf(stderr,"WARNING: The option \"daemon\" is common and must placed not in block \"[title]\".\n"); 287 | if (!strcmp(tolow(val),"off")) 288 | config->daemon = 0; 289 | else if (!strcmp(tolow(val),"on")) 290 | config->daemon = 1; 291 | else 292 | fprintf(stderr, "Invalid value in config in option \"%s\".\n", key); 293 | } 294 | else if (!strcmp(key,"pid")) 295 | { 296 | if (block) 297 | fprintf(stderr,"WARNING: The option \"pid\" is common and must placed not in block \"[title]\".\n"); 298 | strcpy(config->pidfilename, val); 299 | } 300 | 301 | free(key); 302 | free(val); 303 | 304 | } // while 305 | 306 | fclose(fd); 307 | return(0); 308 | 309 | } 310 | 311 | 312 | void print_config(struct _config *cfg) 313 | { 314 | int index; 315 | 316 | puts ("\n\t+---------------------------------------------------+"); 317 | printf("\t| Common config |\n"); 318 | puts ("\t+---------------------------------------------------+"); 319 | printf("\t| Config file: %-37s|\n", cfg->config); 320 | printf("\t| PID file: %-40s|\n", cfg->pidfilename); 321 | printf("\t| loglevel: %-40d|\n", cfg->loglevel); 322 | printf("\t| daemon: %-42s|\n", cfg->daemon ? "on" : "off"); 323 | printf("\t+---------------------------------------------------+\n\n\n"); 324 | 325 | 326 | for (index=0; indexindex; index++) 327 | { 328 | puts ("\t+---------------------------------------------------+"); 329 | printf("\t| Config capture %-35s|\n",cfg->cap[index]->title); 330 | puts ("\t+---------------------------------------------------+"); 331 | printf("\t| Keyfile: %-41s|\n", cfg->cap[index]->keyfile); 332 | printf("\t| Source Interface: %-32s|\n", cfg->cap[index]->src_interface); 333 | printf("\t| Destination Interface: %-27s|\n", cfg->cap[index]->dst_interface); 334 | printf("\t| Server IP address: %-31s|\n", inet_ntoa(cfg->cap[index]->server_ip)); 335 | printf("\t| TCP Port: %-40d|\n",cfg->cap[index]->port); 336 | printf("\t| TCP DSSL Port: %-35d|\n",cfg->cap[index]->dsslport); 337 | printf("\t+---------------------------------------------------+\n\n"); 338 | } 339 | 340 | } 341 | 342 | char *dssl_error(int n) 343 | { 344 | switch(n) 345 | { 346 | case DSSL_E_OUT_OF_MEMORY: 347 | return("Out of memory"); 348 | /* case DSSL_E_SSL_LOAD_CERTIFICATE: 349 | return("SSL certificate load error");*/ 350 | case DSSL_E_SSL_LOAD_PRIVATE_KEY: 351 | return("SSL private key load error"); 352 | case DSSL_E_SSL_UNKNOWN_VERSION: 353 | return("Unknown version of SSL"); 354 | case DSSL_E_SSL_PROTOCOL_ERROR: 355 | return("SSL Protocol error"); 356 | case DSSL_E_SSL_INVALID_RECORD_LENGTH: 357 | return("SSL Invalid record length"); 358 | case DSSL_E_UNSPECIFIED_ERROR: 359 | return("Unspecified error"); 360 | case DSSL_E_NOT_IMPL: 361 | return("Not IMPL"); 362 | case DSSL_E_SSL_SERVER_KEY_UNKNOWN: 363 | return("SSL Server key unknown"); 364 | case DSSL_E_SSL_CANNOT_DECRYPT: 365 | return("SSL: An undecryptable ciphersuite has been chosen"); 366 | case DSSL_E_SSL_CORRUPTED_PMS: 367 | return("SSL: Invalid Pre Master Secret"); 368 | case DSSL_E_SSL_PMS_VERSION_ROLLBACK: 369 | return("SSL: Protocol version rollback detected (SSL attack?)"); 370 | case DSSL_E_SSL_DECRYPTION_ERROR: 371 | return("SSL: Generic decrytion error"); 372 | case DSSL_E_SSL_BAD_FINISHED_DIGEST: 373 | return("SSL Protocol error: Bad Finished message digest"); 374 | case DSSL_E_TCP_CANT_REASSEMBLE: 375 | return("TCP reassembly error"); 376 | case DSSL_E_SSL_UNEXPECTED_TRANSMISSION: 377 | return("Unexpected transmission - session is already closed or aborted"); 378 | case DSSL_E_SSL_INVALID_MAC: 379 | return("Message Authentification Code check failed"); 380 | case DSSL_E_SSL_SESSION_NOT_IN_CACHE: 381 | return("Session renegotiation detected, but the previous session data is not cached - decryption impossible"); 382 | case DSSL_E_SSL_PRIVATE_KEY_FILE_OPEN: 383 | return("Failed to open the private key file"); 384 | case DSSL_E_SSL_INVALID_CERTIFICATE_RECORD: 385 | return("SSL Protocol error: invalid certificate list length"); 386 | case DSSL_E_SSL_INVALID_CERTIFICATE_LENGTH: 387 | return("SSL Protocol error: invalid certificate length"); 388 | case DSSL_E_SSL_BAD_CERTIFICATE: 389 | return("Bad server certificate detected"); 390 | case DSSL_E_UNINITIALIZED_ARGUMENT: 391 | return("SSL: ephemeral keys cannot be decrypted"); 392 | case DSSL_E_SSL_CANNOT_DECRYPT_EPHEMERAL: 393 | return("SSL: ephemeral keys cannot be decrypted"); 394 | case DSSL_E_SSL_CANNOT_DECRYPT_NON_RSA: 395 | return("SSL: Only RSA keys can be used with viewssl"); 396 | case DSSL_E_SSL_CERTIFICATE_KEY_MISMATCH: 397 | return("SSL: Server's certificate is signed with the key different than the one passed to CapEnvSetSSL_ServerInfo or DSSL_EnvSetServerInfo"); 398 | case DSSL_E_UNSUPPORTED_COMPRESSION: 399 | return("viewssl unsupported compression"); 400 | case DSSL_E_DECOMPRESSION_ERROR: 401 | return("decompression error"); 402 | default: 403 | return("Unspecified error"); 404 | } 405 | } 406 | 407 | int check_config(struct _config *cfg) 408 | { 409 | register int optchk = 0; 410 | int index = 0; 411 | 412 | for(index = 0; index < cfg->index; index++) { 413 | if (strlen(cfg->cap[index]->src_interface) < 1) 414 | { 415 | if (cfg->cmdl) 416 | puts("Please, define source interface name: option \"-s\" (or \"--src-interface\") is obligatory."); 417 | else 418 | printf("Please, define source interface name: key \"src\" in config file in section [\"%s\"] is obligatory.",cfg->cap[index]->title); 419 | optchk = 1; 420 | } 421 | 422 | if (strlen(cfg->cap[index]->dst_interface) < 1) 423 | { 424 | if (cfg->cmdl) 425 | puts("Please, define destination interface name: option \"-d\" (or \"--dst-interface\") is obligatory."); 426 | else 427 | printf("Please, define destination interface name: key \"dst\" in config file in section [\"%s\"] is obligatory.",cfg->cap[index]->title); 428 | optchk = 1; 429 | } 430 | 431 | if( ( strcmp(cfg->cap[index]->dst_interface, cfg->cap[index]->src_interface) == 0 ) && ( cfg->cap[index]->dsslport == 0 ) ) 432 | { 433 | if (cfg->cmdl) 434 | puts("Please, define DSSL port if source and destination interfaces are the same: option \"-D\" (or \"--dssl-port\")."); 435 | else 436 | printf("Please, define DSSL port if source and destination interfaces are the same: key \"dsslport\" in config file in section [\"%s\"]",cfg->cap[index]->title); 437 | optchk = 1; 438 | } 439 | 440 | 441 | if (cfg->cap[index]->server_ip.s_addr == 0) 442 | { 443 | if (cfg->cmdl) 444 | puts("Please, define server ip address: option \"-i\" (or \"--ip\") is obligatory."); 445 | else 446 | printf("Please, define source ip address: key \"ip\" in config file in section [\"%s\"] is obligatory.",cfg->cap[index]->title); 447 | optchk = 1; 448 | } 449 | 450 | if (cfg->cap[index]->port == 0) 451 | { 452 | if (cfg->cmdl) 453 | puts("Please, define port number: option \"-p\" (or \"--port\" is obligatory."); 454 | else 455 | printf("Please, define port number: key \"port\" in config file in section [\"%s\"] is obligatory.",cfg->cap[index]->title); 456 | optchk = 1; 457 | } 458 | 459 | if (strlen(cfg->cap[index]->keyfile) < 1) 460 | { 461 | if (cfg->cmdl) 462 | puts("Please, define keyfile path: option \"-k\" (or \"--key\") is obligatory."); 463 | else 464 | printf("Please, define keyfile path: key \"key\" in config file in section [\"%s\"] is obligatory.",cfg->cap[index]->title); 465 | optchk = 1; 466 | } 467 | } 468 | if (optchk) 469 | return(1); 470 | else 471 | return(0); 472 | } 473 | 474 | void usage (void) 475 | { 476 | printf ("Usage: %s -c [config] | -l -k -n -port -d [-w][-n][-v][-f][-h]\n" \ 477 | "Available options:\n" 478 | " --config (-c) [path]\t: viewssld config file.\n" \ 479 | " --key (-k) \t: server's private key file path.\n" \ 480 | " --pwd (-w) \t: private key passphrase.\n" \ 481 | " --ip (-i) \t: server IP address.\n" \ 482 | " --port (-p) \t: server port number. Port 443 is used if not specified directly.\n" \ 483 | " --dsslport (-D) \t: port number to use for decrypted traffic. Port number specified by --port is used if not specified directly.\n" \ 484 | " --src-interface (-s) : capture and decrypt data from network link .\n" \ 485 | " --dst-interface (-d) : write decrypted data to network link .\n" \ 486 | " --no-daemon (-n)\t: do not daemonize (for debugging).\n" \ 487 | " --verbose (-v)\t: for verbose output.\n" \ 488 | " --pid file (-f)\t: for define alternate pid-file.\n" \ 489 | " --help (-h)\t\t: this help page.\n" \ 490 | " --version\t\t: print version info.\n\n" \ 491 | , config.imagefile); 492 | } 493 | 494 | /* 495 | * Get time as string 496 | */ 497 | char *gettime(void) 498 | { 499 | time_t tm; 500 | time(&tm); 501 | return ctime(&tm); 502 | } 503 | 504 | /* 505 | * Comand line arguments parsing 506 | */ 507 | int optparse(struct _config *config, char argc, char ** argv, char ** envp) 508 | { 509 | int option_index = 0; 510 | char optac; 511 | int longopt, rc = 0; 512 | 513 | struct option long_options[] = { 514 | {"version",0,&longopt,1}, 515 | {"config",1,0,'c'}, 516 | {"no-daemon",0,0,'n'}, 517 | {"verbose",0,0,'v'}, 518 | {"help",0,0,'h'}, 519 | {"pid",1,0,'f'}, 520 | {"key",1,0,'k'}, 521 | {"pwd",1,0,'w'}, 522 | {"port",1,0,'p'}, 523 | {"dsslport",1,0,'D'}, 524 | {"ip",1,0,'i'}, 525 | {"src-interface",1,0,'s'}, 526 | {"dst-interface",1,0,'d'}, 527 | {0,0,0,0} 528 | }; 529 | 530 | while ((optac = getopt_long (argc,argv,"vnhw:f:k:s:d:p:D:i:c::",long_options,&option_index)) != -1) 531 | switch (optac) 532 | { 533 | case 'c': 534 | if (optarg == NULL) 535 | strcpy(config->config, DEFAULT_CONFIG_FILE); 536 | else 537 | strcpy(config->config, optarg); 538 | 539 | if (load_config(config->config, config) == -1) 540 | { 541 | fprintf(stderr,"ERROR: Can't load config file \"%s\".", config->config); 542 | return(-1); 543 | } 544 | break; 545 | case 'v': 546 | config->loglevel = 1; 547 | break; 548 | case 'n': 549 | config->daemon = 0; 550 | break; 551 | case 'h': 552 | usage(); 553 | return(1); 554 | break; 555 | case 'f': 556 | strcpy(config->pidfilename, optarg); 557 | break; 558 | case 0: 559 | if (longopt == 1) 560 | { 561 | versioninfo(); 562 | exit(EXIT_SUCCESS); 563 | } 564 | longopt = 0; 565 | break; 566 | default: 567 | 568 | if (!config->cmdl) 569 | { 570 | usage(); 571 | return(-1); 572 | } 573 | 574 | if (config->index == 0) 575 | { 576 | config->cap[0] = malloc(sizeof(struct _cap)); 577 | memset(config->cap[0],0,sizeof(struct _cap)); 578 | config->index=1; 579 | } 580 | 581 | switch (optac) 582 | { 583 | case 'k': 584 | strcpy(config->cap[0]->keyfile, optarg); 585 | break; 586 | case 'w': 587 | strcpy(config->cap[0]->pwd, optarg); 588 | break; 589 | case 's': 590 | if (getmac(optarg, config->cap[0]->src_interface_mac) != -1) 591 | { 592 | strcpy(config->cap[0]->src_interface, optarg); 593 | } else 594 | { 595 | fprintf(stderr,"ERROR: %s fetching interface information error: " \ 596 | "Device not found.\n", optarg); 597 | return(-1); 598 | } 599 | break; 600 | case 'd': 601 | if (getmac(optarg, config->cap[0]->dst_interface_mac) != -1) 602 | strcpy(config->cap[0]->dst_interface, optarg); 603 | else 604 | { 605 | fprintf(stderr, "ERROR: %s fetching interface information error: " \ 606 | "Device not found.\n", optarg); 607 | return(-1); 608 | } 609 | break; 610 | case 'p': 611 | config->cap[0]->port = (uint16_t) atoi(optarg); 612 | if (config->cap[0]->port == 0) // it will always < 65535 due to limited range of data type 613 | { 614 | fprintf(stderr, "Invalid TCP port value \"%d\".\n", \ 615 | config->cap[0]->port); 616 | return(-1); 617 | } 618 | break; 619 | case 'D': 620 | config->cap[0]->dsslport = (uint16_t) atoi(optarg); 621 | if (config->cap[0]->dsslport == 0) // it will always < 65535 due to limited range of data type 622 | { 623 | fprintf(stderr, "Invalid DSSL TCP port value \"%d\".\n", \ 624 | config->cap[0]->dsslport); 625 | return(-1); 626 | } 627 | break; 628 | case 'i': 629 | if (inet_aton(optarg, &config->cap[0]->server_ip) == 0) 630 | { 631 | fprintf(stderr, "Invalid IP address format \"%s\".\n", optarg); 632 | return(-1); 633 | } 634 | break; 635 | default: 636 | usage(); 637 | return(-1); 638 | } 639 | 640 | 641 | break; 642 | } 643 | return(0); 644 | } 645 | 646 | 647 | void versioninfo(void) 648 | { 649 | printf("viewssld version %s\n" \ 650 | "Build-Date: %s %s\n" \ 651 | ,PACKAGE_VERSION,__DATE__,__TIME__); 652 | } 653 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of viewssld package. 3 | * 4 | * Copyright 2007 Dzmitry Plashchynski 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | */ 19 | 20 | #ifndef __UTILS_H__ 21 | #define __UTILS_H__ 22 | 23 | #include "viewssld.h" 24 | 25 | //const char *SessionToString(const TcpSession *sess); 26 | void DumpData(const u_char *data, uint32_t pkt_size); 27 | int getmac(const char *name, u_int8_t *mac); 28 | int load_config(const char *path, struct _config *config); 29 | void print_config(struct _config *config); 30 | int check_config(struct _config *config); 31 | void usage(void); 32 | char *gettime(void); 33 | char *dssl_error(int n); 34 | int optparse(struct _config *config, char argc, char *argv[], char *envp[]); 35 | void versioninfo(void); 36 | void errorlog(char *message); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/viewssld.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of viewssld package. 3 | * 4 | * Copyright 2007 Dzmitry Plashchynski 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "viewssld.h" 38 | #include "utils.h" 39 | 40 | struct _config config; 41 | static struct _errorbuf errbuf; 42 | static struct _childs childs; 43 | 44 | static void before_exit(void); 45 | static void fsignal(int sig); 46 | static int proceed(void); 47 | static void session_event_handler(CapEnv* env, TcpSession* sess, char event); 48 | static void data_callback_proc(NM_PacketDir dir, void* user_data, u_char* pkt_payload, uint32_t pkt_size, DSSL_Pkt* last_packet); 49 | static void error_callback_proc(void* user_data, int error_code); 50 | static void SIGCHLD_act(int signal, siginfo_t *siginfo, void *hz); 51 | int sendEmptyTCPSegment( libnet_t *libnet_c, TcpSession *sess, u_int32_t seq, u_int32_t ack, u_int8_t control, NM_PacketDir dir ); 52 | 53 | #define MISSING_PACKET_COUNT 100 54 | #define MISSING_PACKET_TIMEOUT 10 55 | 56 | static int parent; 57 | static int capindex; 58 | 59 | int main(int argc, char *argv[], char *envp[]) 60 | { 61 | register int i=0; // for counter 62 | int rc = 0; 63 | char *logtitle; // for syslog title 64 | pid_t pid; 65 | 66 | // Initialization area 67 | config.loglevel = 0; 68 | config.daemon = 1; 69 | config.cmdl = 1; 70 | config.index = 0; 71 | 72 | strcpy(config.pidfilename, DEFAULT_PID_FILE); 73 | strcpy(config.imagefile, argv[0]); 74 | 75 | // Initialize buffers for errors 76 | *errbuf.common = '\0'; 77 | *errbuf.libnet = '\0'; 78 | capindex = 0; 79 | 80 | if ((rc = optparse(&config, argc, argv, envp)) != 0) 81 | switch (rc) 82 | { 83 | case -1: 84 | exit(EXIT_FAILURE); 85 | case 1: 86 | exit(EXIT_SUCCESS); 87 | default: 88 | exit(rc); 89 | } 90 | 91 | if (config.index == 0) 92 | { 93 | fprintf(stderr,"You must define all obligatory parameters in running arguments or in configuration file.\n"); 94 | usage(); 95 | exit(EXIT_FAILURE); 96 | } 97 | 98 | if (check_config(&config)) 99 | exit (EXIT_FAILURE); 100 | 101 | if (config.loglevel > 0) 102 | print_config(&config); 103 | 104 | if (getuid() != 0) 105 | { 106 | fprintf(stderr, "%s, you must be root to run this program.\n", getlogin()); 107 | exit (EXIT_FAILURE); 108 | } 109 | 110 | config.pidfile = fopen (config.pidfilename, "w"); 111 | if (config.pidfile == NULL) 112 | { 113 | fprintf (stderr, "Error to create pid-file \"%s\".\n", config.pidfilename); 114 | fprintf (stderr, "Try %s -f ", config.imagefile); 115 | exit (EXIT_FAILURE); 116 | } 117 | 118 | if (config.daemon) 119 | { 120 | if (daemon(1,1) != 0) 121 | { 122 | fprintf(stderr,"Daemonize error, running in interactive mode.\n"); 123 | config.daemon = 0; 124 | } 125 | } 126 | 127 | // Write PID to PID-file 128 | fprintf(config.pidfile, "%d\n", getpid()); 129 | fclose(config.pidfile); 130 | 131 | atexit(before_exit); 132 | 133 | if (config.index > 1) 134 | { 135 | struct sigaction sact; 136 | 137 | sact.sa_sigaction = SIGCHLD_act; 138 | sact.sa_flags = SA_RESTART | SA_NOMASK | SA_SIGINFO; 139 | sigaction(SIGCHLD, &sact, NULL); 140 | 141 | childs.index = 0; 142 | parent = 1; 143 | for (i=0; ititle)+24) * sizeof(char)); 154 | parent = 0; 155 | capindex = i; 156 | 157 | sprintf(logtitle, "viewssl daemon child [%s]", config.cap[capindex]->title); 158 | 159 | openlog(logtitle, LOG_PID, LOG_DAEMON); 160 | syslog(LOG_NOTICE,"started at %s",gettime()); 161 | break; 162 | 163 | default: // in parent 164 | childs.pid[childs.index] = pid; 165 | childs.title[childs.index] = malloc((strlen(config.cap[childs.index]->title)+1)*sizeof(char)); 166 | strcpy(childs.title[childs.index],config.cap[childs.index]->title); 167 | childs.index++; 168 | break; 169 | } // switch(pid) 170 | 171 | if (!parent) 172 | break; 173 | } // for (i=0;i 1) 230 | else 231 | { // one thread 232 | openlog("viewssl daemon", LOG_PID, LOG_DAEMON); 233 | } 234 | 235 | SSL_library_init(); 236 | OpenSSL_add_all_ciphers(); 237 | OpenSSL_add_all_digests(); 238 | 239 | rc = proceed(); 240 | 241 | EVP_cleanup(); 242 | CRYPTO_cleanup_all_ex_data(); 243 | 244 | if (rc != 0) 245 | exit(EXIT_FAILURE); 246 | else 247 | exit(EXIT_SUCCESS); // end childs 248 | } 249 | 250 | static void SIGCHLD_act(int signal, siginfo_t *siginfo, void *hz) 251 | { 252 | register int j; 253 | 254 | if (signal != SIGCHLD) 255 | return; 256 | 257 | for (j=0; jsi_pid) 259 | break; 260 | 261 | if (j != childs.index) 262 | syslog(LOG_NOTICE, "child [%s] has been stopped at %s", childs.title[j], gettime()); 263 | else 264 | syslog(LOG_NOTICE, "child pid - %d has been stopped at %s", siginfo->si_pid, gettime()); 265 | 266 | waitpid(siginfo->si_pid, NULL, 0); 267 | } 268 | 269 | /* 270 | Signals handler 271 | */ 272 | static void fsignal(int sig) 273 | { 274 | register int i=0; 275 | 276 | switch(sig) 277 | { 278 | case SIGTERM: 279 | case SIGINT: 280 | case SIGQUIT: 281 | if (parent) 282 | { 283 | for (i=0;isrc_interface, 1550, 1, 500, errbuf.common); 315 | if (!p) 316 | { 317 | if (config.daemon) 318 | syslog(LOG_CRIT, "pcap_open_live error: %s", errbuf.common); 319 | else 320 | fprintf(stderr, "ERROR: pcap_open_live error: %s\n", errbuf.common); 321 | return(-1); 322 | } 323 | 324 | sprintf( filter_exp, "ip host %s and tcp port %d", inet_ntoa(config.cap[capindex]->server_ip), config.cap[capindex]->port ); 325 | 326 | if (pcap_compile(p, &fp, filter_exp, 0, 0) == -1) 327 | { 328 | fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(p)); 329 | return(-1); 330 | } 331 | if (pcap_setfilter(p, &fp) == -1) 332 | { 333 | fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(p)); 334 | return(-1); 335 | } 336 | 337 | // 255 is sessionTableSize 338 | // First 0 means use default key_timeout_interval - libdssl 2.1.1 will use 3600 here 339 | // Second 0 means use default tcp_timeout_interval - libdssl 2.1.1 will use 180 here 340 | env = CapEnvCreate(p, 255, 0, 0); 341 | 342 | rc = CapEnvSetSSL_ServerInfo(env, &config.cap[capindex]->server_ip, config.cap[capindex]->port, 343 | config.cap[capindex]->keyfile, config.cap[capindex]->pwd); 344 | 345 | if (rc != 0) 346 | { 347 | if (config.daemon) 348 | syslog(LOG_CRIT, "CapEnvSetSSL_ServerInfo() failed, code %d: %s", \ 349 | rc, dssl_error(rc)); 350 | else 351 | fprintf(stderr,"ERROR: CapEnvSetSSL_ServerInfo() failed, code %d.\n", rc); 352 | return(-1); 353 | } 354 | 355 | CapEnvSetSessionCallback(env, session_event_handler, NULL); 356 | 357 | rc = CapEnvCapture(env); 358 | if (rc != 0) 359 | { 360 | if (config.daemon) 361 | syslog(LOG_CRIT, "CapEnvCapture() failed."); 362 | else 363 | fprintf(stderr,"CapEnvCapture() failed.\n"); 364 | return(-1); 365 | } 366 | 367 | if (env) 368 | { 369 | CapEnvDestroy(env); 370 | env = NULL; 371 | } 372 | 373 | if (p) 374 | { 375 | pcap_close(p); 376 | p = NULL; 377 | } 378 | 379 | return(rc); 380 | } 381 | 382 | // Missing packet handler 383 | static int missing_packet_callback(NM_PacketDir dir, void* user_data, uint32_t pkt_seq, uint32_t pkt_size) 384 | { 385 | if (config.daemon) 386 | syslog(LOG_CRIT, "Missing packet(s) detected."); 387 | else 388 | fprintf(stderr,"Missing packet(s) detected; missing segment size %u", pkt_size); 389 | 390 | return 1; /* skip and continue */ 391 | } 392 | 393 | // TCP session state for fake stream of decrypted packets 394 | typedef struct _FakeSessionState 395 | { 396 | u_int32_t clientSeq; 397 | u_int32_t serverSeq; 398 | u_int8_t handshakeSent; 399 | libnet_t* ln; // libnet context 400 | } FakeSessionState; 401 | 402 | // Initialise fake TCP session state 403 | int init_fake_session_state( FakeSessionState* fakeSess ) 404 | { 405 | // Init libnet context 406 | fakeSess->ln = libnet_init( 407 | LIBNET_LINK, 408 | config.cap[capindex]->dst_interface, 409 | errbuf.libnet 410 | ); 411 | 412 | if( fakeSess->ln == NULL ) 413 | { 414 | if (config.daemon) 415 | syslog(LOG_ERR, "error opening libnet context: %s", errbuf.libnet); 416 | else 417 | fprintf(stderr, "Error opening libnet context: %s.\n", errbuf.libnet); 418 | 419 | return( -1 ); 420 | } 421 | 422 | if( libnet_seed_prand( fakeSess->ln ) == -1 ) 423 | { 424 | if (config.daemon) 425 | syslog(LOG_ERR, "error seeding libnet prand: %s", errbuf.libnet); 426 | else 427 | fprintf(stderr, "Error seeding libnet prand: %s.\n", errbuf.libnet); 428 | 429 | libnet_destroy( fakeSess->ln ); 430 | return( -1 ); 431 | } 432 | 433 | // Initialise other member variables 434 | fakeSess->handshakeSent = 0; 435 | fakeSess->clientSeq = libnet_get_prand (LIBNET_PRu16); 436 | fakeSess->serverSeq = libnet_get_prand (LIBNET_PRu16); 437 | 438 | return( 1 ); 439 | } 440 | 441 | // Handles session startup and teardown 442 | static void session_event_handler(CapEnv* env, TcpSession* sess, char event) 443 | { 444 | char buff[512]; 445 | SessionToString(sess, buff); 446 | FakeSessionState* mySession; 447 | 448 | switch(event) 449 | { 450 | case DSSL_EVENT_NEW_SESSION: 451 | if (config.loglevel > 0) 452 | { 453 | if (config.daemon) 454 | syslog(LOG_INFO, "=> New Session: %s", buff); 455 | else 456 | fprintf(stderr, "\n=> New Session: %s", buff); 457 | } 458 | 459 | if( ( mySession = malloc( sizeof( FakeSessionState ) ) ) != NULL ) 460 | { 461 | if( init_fake_session_state( mySession ) != -1 ) 462 | { 463 | SessionSetCallback(sess, data_callback_proc, error_callback_proc, sess); 464 | sess->user_data = mySession; 465 | SessionSetMissingPacketCallback( sess, missing_packet_callback, MISSING_PACKET_COUNT, 466 | MISSING_PACKET_TIMEOUT ); 467 | } 468 | else 469 | { 470 | if (config.loglevel > 0) 471 | { 472 | if (config.daemon) 473 | syslog(LOG_INFO, "error: cannot init fake session: %s", buff); 474 | else 475 | fprintf(stderr, "Error: cannot init fake session: %s", buff); 476 | } 477 | } 478 | } 479 | else 480 | { 481 | if (config.loglevel > 0) 482 | { 483 | if (config.daemon) 484 | syslog(LOG_INFO, "error: cannot allocate memory for fake session: %s", buff); 485 | else 486 | fprintf(stderr, "Error: cannot allocate memory for fake session: %s", buff); 487 | } 488 | } 489 | 490 | break; 491 | 492 | case DSSL_EVENT_SESSION_CLOSING: 493 | if (config.loglevel > 0) 494 | { 495 | // Get stats 496 | struct pcap_stat myStats; 497 | pcap_stats(env->pcap_adapter, &myStats); 498 | 499 | if (config.daemon) 500 | syslog(LOG_INFO, "<= Session closing: %s\tpkts recv: %d pkts drop: %d", buff, myStats.ps_recv, myStats.ps_drop ); 501 | else 502 | fprintf(stderr, "\n<= Session closing: %s\tpkts recv: %d pkts drop: %d", buff, myStats.ps_recv, myStats.ps_drop ); 503 | } 504 | // Terminate session 505 | mySession = (FakeSessionState*)sess->user_data; 506 | if( mySession->handshakeSent ) 507 | sendEmptyTCPSegment( mySession->ln, sess, mySession->serverSeq, mySession->clientSeq, TH_RST | TH_ACK, ePacketDirFromServer ); 508 | // Clean up libnet and fake session object 509 | libnet_destroy( mySession->ln ); 510 | free( sess->user_data ); 511 | break; 512 | 513 | default: 514 | if (config.daemon) 515 | syslog(LOG_ERR, "unknown session event code (%d).", (int)event); 516 | else 517 | fprintf(stderr, "ERROR: Unknown session event code (%d).\n", (int)event); 518 | break; 519 | } 520 | } 521 | 522 | // Sends an empty TCP segment with the specified parameters 523 | int sendEmptyTCPSegment( libnet_t *libnet_c, 524 | TcpSession *sess, 525 | u_int32_t seq, 526 | u_int32_t ack, 527 | u_int8_t control, 528 | NM_PacketDir dir ) 529 | { 530 | libnet_ptag_t tcp, ip, ethernet; 531 | tcp = ip = ethernet = 0; 532 | 533 | tcp = libnet_build_tcp( 534 | ( dir == ePacketDirFromClient ) ? sess->clientStream.port : ( config.cap[capindex]->dsslport ? config.cap[capindex]->dsslport: sess->serverStream.port ), /* source port */ 535 | ( dir == ePacketDirFromClient ) ? ( config.cap[capindex]->dsslport ? config.cap[capindex]->dsslport: sess->serverStream.port ) : sess->clientStream.port, /* destination port */ 536 | seq, /* sequence number */ 537 | ack, /* acknowledgement num */ 538 | control, /* control flags */ 539 | 32767, /* window size */ 540 | 0, /* checksum */ 541 | 10, /* urgent pointer */ 542 | LIBNET_TCP_H, /* TCP packet size */ 543 | NULL, /* payload */ 544 | 0, /* payload size */ 545 | libnet_c, /* libnet handle */ 546 | 0); /* libnet id */ 547 | 548 | if (tcp == -1) 549 | { 550 | if (config.daemon) 551 | syslog(LOG_ERR, "Can't build TCP header: %s", libnet_geterror(libnet_c)); 552 | else 553 | fprintf(stderr, "Can't build TCP header: %s.\n", libnet_geterror(libnet_c)); 554 | return( -1 ); 555 | } 556 | 557 | ip = libnet_build_ipv4( 558 | LIBNET_IPV4_H + LIBNET_TCP_H, /* length */ 559 | 0, /* TOS */ 560 | 54609, /* IP ID */ 561 | 0, /* IP Frag */ 562 | 64, /* TTL */ 563 | IPPROTO_TCP, /* protocol */ 564 | 0, /* checksum */ 565 | ( dir == ePacketDirFromClient ) ? sess->clientStream.ip_addr : sess->serverStream.ip_addr, /* source IP */ 566 | ( dir == ePacketDirFromClient ) ? sess->serverStream.ip_addr : sess->clientStream.ip_addr, /* destination IP */ 567 | NULL, /* payload */ 568 | 0, /* payload size */ 569 | libnet_c, /* libnet handle */ 570 | 0); /* libnet id */ 571 | 572 | if (ip == -1) 573 | { 574 | if (config.daemon) 575 | syslog(LOG_ERR, "Can't build IP header: %s", libnet_geterror(libnet_c)); 576 | else 577 | fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(libnet_c)); 578 | return( -1 ); 579 | } 580 | 581 | ethernet = libnet_build_ethernet( 582 | ( dir == ePacketDirFromClient ) ? config.cap[capindex]->dst_interface_mac : config.cap[capindex]->src_interface_mac, /* ethernet dest */ 583 | ( dir == ePacketDirFromClient ) ? config.cap[capindex]->src_interface_mac : config.cap[capindex]->dst_interface_mac, /* ethernet source */ 584 | ETHERTYPE_IP, /* protocol type */ 585 | NULL, /* payload */ 586 | 0, /* payload size */ 587 | libnet_c, /* libnet handle */ 588 | 0); /* libnet id */ 589 | 590 | if (ethernet == -1) 591 | { 592 | if (config.daemon) 593 | syslog(LOG_ERR, "Can't build ethernet header: %s", libnet_geterror(libnet_c)); 594 | else 595 | fprintf(stderr, "Can't build ethernet header: %s.\n", libnet_geterror(libnet_c)); 596 | return( -1 ); 597 | } 598 | 599 | if (libnet_write(libnet_c) == -1) 600 | { 601 | if (config.daemon) 602 | syslog(LOG_ERR, "write error: %s", libnet_geterror(libnet_c)); 603 | else 604 | fprintf(stderr, "Write error: %s.\n", libnet_geterror(libnet_c)); 605 | return( -1 ); 606 | } 607 | 608 | libnet_clear_packet(libnet_c); 609 | 610 | return( 1 ); 611 | } 612 | 613 | // Sends a SYN/SYN-ACK/ACK triplet 614 | int sendTCPHandshake( libnet_t *libnet_c, 615 | TcpSession *sess, 616 | FakeSessionState *mySession ) 617 | { 618 | if( sendEmptyTCPSegment( libnet_c, sess, mySession->clientSeq, 0, TH_SYN, ePacketDirFromClient ) == -1 ) 619 | return( -1 ); 620 | mySession->clientSeq++; 621 | if ( sendEmptyTCPSegment( libnet_c, sess, mySession->serverSeq, mySession->clientSeq, TH_SYN | TH_ACK, ePacketDirFromServer ) == -1 ) 622 | return( -1 ); 623 | mySession->serverSeq++; 624 | if( sendEmptyTCPSegment( libnet_c, sess, mySession->clientSeq, mySession->serverSeq, TH_ACK, ePacketDirFromClient ) == -1 ) 625 | return( -1 ); 626 | 627 | return( 1 ); 628 | } 629 | 630 | // Handles decrypted data from libdssl 631 | static void data_callback_proc(NM_PacketDir dir, void* user_data, u_char* pkt_payload, uint32_t pkt_size, DSSL_Pkt* last_packet) 632 | { 633 | libnet_ptag_t tcp, ip, ethernet; 634 | register libnet_t *libnet_c; 635 | TcpSession *sess = (TcpSession*) user_data; 636 | uint32_t bytes_written, bytes_to_write; 637 | u_char* payload_ptr; 638 | FakeSessionState *mySession = (FakeSessionState*) sess->user_data; 639 | 640 | // Initialise byte counter and payload pointer 641 | bytes_written = 0; 642 | payload_ptr = pkt_payload; 643 | tcp = ip = ethernet = 0; 644 | 645 | if (config.loglevel > 0 && !config.daemon) 646 | { 647 | switch(dir) 648 | { 649 | case ePacketDirFromClient: 650 | fprintf(stderr, "\nC->S: %d bytes\n", pkt_size ); 651 | break; 652 | case ePacketDirFromServer: 653 | fprintf(stderr, "S->C: %d bytes\n", pkt_size ); 654 | break; 655 | default: 656 | fprintf(stderr, "\nUnknown packet direction!"); 657 | break; 658 | } 659 | } 660 | 661 | // Get libnet context 662 | libnet_c = mySession->ln; 663 | 664 | // Send handshake if necessary 665 | if( mySession->handshakeSent == 0 ) 666 | { 667 | sendTCPHandshake( libnet_c, sess, mySession ); 668 | mySession->handshakeSent = 1; 669 | } 670 | 671 | // Split pkt_payload into a 1460 byte MSS 672 | while( bytes_written < pkt_size ) 673 | { 674 | // Work out how many bytes to write on this pass 675 | bytes_to_write = ( ( pkt_size - bytes_written ) < 1460 ) ? ( pkt_size - bytes_written ) : 1460; 676 | 677 | tcp = libnet_build_tcp( 678 | ( dir == ePacketDirFromClient ) ? sess->clientStream.port : ( config.cap[capindex]->dsslport ? config.cap[capindex]->dsslport: sess->serverStream.port ), /* source port */ 679 | ( dir == ePacketDirFromClient ) ? ( config.cap[capindex]->dsslport ? config.cap[capindex]->dsslport: sess->serverStream.port ) : sess->clientStream.port, /* destination port */ 680 | ( dir == ePacketDirFromClient ) ? mySession->clientSeq : mySession->serverSeq, /* sequence number */ 681 | ( dir == ePacketDirFromClient ) ? mySession->serverSeq : mySession->clientSeq, /* acknowledgement num */ 682 | TH_ACK, /* control flags */ 683 | 32767, /* window size */ 684 | 0, /* checksum */ 685 | 10, /* urgent pointer */ 686 | LIBNET_TCP_H + bytes_to_write, /* TCP packet size */ 687 | payload_ptr, /* payload */ 688 | bytes_to_write, /* payload size */ 689 | libnet_c, /* libnet handle */ 690 | 0); /* libnet id */ 691 | 692 | // Increment count of bytes written 693 | bytes_written += bytes_to_write; 694 | if( dir == ePacketDirFromClient ) 695 | mySession->clientSeq += bytes_to_write; 696 | else 697 | mySession->serverSeq += bytes_to_write; 698 | 699 | // Increment payload_ptr 700 | payload_ptr += bytes_to_write; 701 | 702 | if (tcp == -1) 703 | { 704 | if (config.daemon) 705 | syslog(LOG_ERR, "Can't build TCP header: %s", libnet_geterror(libnet_c)); 706 | else 707 | fprintf(stderr, "Can't build TCP header: %s.\n", libnet_geterror(libnet_c)); 708 | } 709 | else 710 | { 711 | ip = libnet_build_ipv4( 712 | LIBNET_IPV4_H + LIBNET_TCP_H + bytes_to_write, /* length */ 713 | 0, /* TOS */ 714 | 54609, /* IP ID */ 715 | 0, /* IP Frag */ 716 | 64, /* TTL */ 717 | IPPROTO_TCP, /* protocol */ 718 | 0, /* checksum */ 719 | ( dir == ePacketDirFromClient ) ? sess->clientStream.ip_addr : sess->serverStream.ip_addr, /* source IP */ 720 | ( dir == ePacketDirFromClient ) ? sess->serverStream.ip_addr : sess->clientStream.ip_addr, /* destination IP */ 721 | NULL, /* payload */ 722 | 0, /* payload size */ 723 | libnet_c, /* libnet handle */ 724 | 0); /* libnet id */ 725 | 726 | if (ip == -1) 727 | { 728 | if (config.daemon) 729 | syslog(LOG_ERR, "Can't build IP header: %s", libnet_geterror(libnet_c)); 730 | else 731 | fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(libnet_c)); 732 | } 733 | else 734 | { 735 | ethernet = libnet_build_ethernet( 736 | ( dir == ePacketDirFromClient ) ? config.cap[capindex]->dst_interface_mac : config.cap[capindex]->src_interface_mac, /* ethernet destination */ 737 | ( dir == ePacketDirFromClient ) ? config.cap[capindex]->src_interface_mac : config.cap[capindex]->dst_interface_mac, /* ethernet source */ 738 | ETHERTYPE_IP, /* protocol type */ 739 | NULL, /* payload */ 740 | 0, /* payload size */ 741 | libnet_c, /* libnet handle */ 742 | 0); /* libnet id */ 743 | 744 | if (ethernet == -1) 745 | { 746 | if (config.daemon) 747 | syslog(LOG_ERR, "Can't build ethernet header: %s", libnet_geterror(libnet_c)); 748 | else 749 | fprintf(stderr, "Can't build ethernet header: %s.\n", libnet_geterror(libnet_c)); 750 | } 751 | else 752 | { 753 | if (libnet_write(libnet_c) == -1) 754 | { 755 | if (config.daemon) 756 | syslog(LOG_ERR, "write error: %s", libnet_geterror(libnet_c)); 757 | else 758 | fprintf(stderr, "Write error: %s.\n", libnet_geterror(libnet_c)); 759 | } 760 | } 761 | } 762 | } 763 | libnet_clear_packet(libnet_c); 764 | } 765 | } 766 | 767 | // Error handler 768 | static void error_callback_proc(void* user_data, int error_code) 769 | { 770 | if (config.loglevel > 0) 771 | { 772 | TcpSession* sess = (TcpSession*) user_data; 773 | char buff[512]; 774 | SessionToString(sess, buff); 775 | 776 | if (config.daemon) 777 | { 778 | syslog(LOG_ERR, "SSL session: %s, error code: %d: %s", \ 779 | buff, error_code, dssl_error(error_code)); 780 | } 781 | else 782 | { 783 | fprintf(stderr, "\nERROR: SSL session: %s, error code: %d: %s.\n", \ 784 | buff, error_code, dssl_error(error_code)); 785 | } 786 | } 787 | } 788 | -------------------------------------------------------------------------------- /src/viewssld.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of viewssld package. 3 | * 4 | * Copyright 2007 Dzmitry Plashchynski 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | */ 19 | 20 | #ifndef __SSLUNCRYPT_H__ 21 | #define __SSLUNCRYPT_H__ 22 | 23 | #include 24 | 25 | 26 | #define CHAR_PER_LINE 80 27 | #define MAXSTRLEN 1024 28 | #define VALLEN 256 29 | #define KEYLEN 256 30 | #define TITLELEN 256 31 | #define MAX_CAP 1024 32 | #define DEFAULT_PID_FILE "/var/run/viewssl.pid" 33 | #define DEFAULT_CONFIG_FILE "/etc/viewssld.conf" 34 | #define MAX_CONFIG_STR_LEN 1024 35 | #define SOCKPATH "/var/run/viewssl.socket" 36 | #define MAX_PWD_LEN 256 37 | #define ERROR_BUF_LEN 2048 38 | #define TCP_OPTIONS_LEN 20 39 | 40 | 41 | struct _cap { 42 | char title[TITLELEN]; 43 | char keyfile[FILENAME_MAX]; 44 | char src_interface[FILENAME_MAX]; 45 | u_int8_t src_interface_mac[6]; 46 | char dst_interface[FILENAME_MAX]; 47 | u_int8_t dst_interface_mac[6]; 48 | char pwd[MAX_PWD_LEN]; 49 | struct in_addr server_ip; 50 | uint16_t port; 51 | uint16_t dsslport; 52 | int ch[6]; 53 | }; 54 | 55 | struct _config { 56 | int loglevel; 57 | char pidfilename[FILENAME_MAX]; 58 | char imagefile[FILENAME_MAX]; 59 | char config[FILENAME_MAX]; 60 | FILE *pidfile; 61 | int daemon; 62 | int index; 63 | struct _cap *cap[MAX_CAP]; 64 | int cmdl; 65 | }; 66 | 67 | struct _errorbuf { 68 | char common[ERROR_BUF_LEN]; 69 | char libnet[LIBNET_ERRBUF_SIZE]; 70 | }; 71 | 72 | struct _childs { 73 | int index; 74 | pid_t pid[MAX_CAP]; 75 | char *title[MAX_CAP]; 76 | }; 77 | 78 | #endif 79 | --------------------------------------------------------------------------------