]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Remove grabbitmqproxy and certtool from tar installer, OSPs and open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:45 +0000 (13:19 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:45 +0000 (13:19 -0800)
18 files changed:
open-vm-tools/Makefile.am
open-vm-tools/configure.ac
open-vm-tools/guestproxycerttool/COPYING [deleted file]
open-vm-tools/guestproxycerttool/Makefile.am [deleted file]
open-vm-tools/guestproxycerttool/cert_key.c [deleted file]
open-vm-tools/guestproxycerttool/cert_key.h [deleted file]
open-vm-tools/guestproxycerttool/cert_tool.c [deleted file]
open-vm-tools/guestproxycerttool/cert_tool_version.h [deleted file]
open-vm-tools/guestproxycerttool/cert_util.c [deleted file]
open-vm-tools/guestproxycerttool/cert_util.h [deleted file]
open-vm-tools/lib/sslDirect/Makefile.am
open-vm-tools/libvmtools/Makefile.am
open-vm-tools/scripts/Makefile.am
open-vm-tools/services/plugins/Makefile.am
open-vm-tools/services/plugins/grabbitmqProxy/COPYING [deleted file]
open-vm-tools/services/plugins/grabbitmqProxy/Makefile.am [deleted file]
open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c [deleted file]
open-vm-tools/services/plugins/grabbitmqProxy/rabbitmqProxyConst.h [deleted file]

index 5922981b80214c9997f27ae3c055115bddb27435..9389a94e50ebd43ea9b1cdc445757ca71f68a67f 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2007-2016,2018 VMware, Inc.  All rights reserved.
+### Copyright (C) 2007-2018 VMware, Inc.  All rights reserved.
 ###
 ### Top-level Makefile for building the VMware OSS Tools.
 ###
@@ -40,9 +40,6 @@ if ENABLE_DEPLOYPKG
 endif
 SUBDIRS += rpctool
 SUBDIRS += namespacetool
-if ENABLE_GRABBITMQPROXY
-   SUBDIRS += guestproxycerttool
-endif
 SUBDIRS += scripts
 SUBDIRS += services
 SUBDIRS += toolbox
index eb250eaa5b4e9dbc973eecbddd045ec305f6a633..8e3cef9ae7d9b6513377370b149882392e2ac1bf 100644 (file)
@@ -414,18 +414,6 @@ AC_ARG_ENABLE([libappmonitor],
     enable_libappmonitor=no
    ])
 
-AC_ARG_ENABLE([grabbitmqproxy],
-   [AS_HELP_STRING([--disable-grabbitmqproxy],
-     [do not build grabbitmqproxy plugin.])],
-   [],
-   [
-    if test "$os" = "linux"; then
-       enable_grabbitmqproxy=yes
-    else
-       enable_grabbitmqproxy=no
-    fi
-   ])
-
 #
 # Check for glib 2.6.14 or greater.
 #
@@ -552,9 +540,8 @@ AC_ARG_ENABLE([xmlsecurity],
 #
 AC_ARG_WITH([ssl],
    [AS_HELP_STRING([--without-ssl],
-     [compiles without openssl support (disables grabbitmqproxy and vgauth).])],
+     [compiles without openssl support (disables vgauth).])],
    [
-     enable_grabbitmqproxy=no
      enable_vgauth=no
    ],
    [with_ssl=yes])
@@ -592,7 +579,7 @@ AC_ARG_WITH([tirpc],
 # Make sure we are building with openssl 1.0.1 and above so that
 # we use only TLSv1_2.
 
-if test "$enable_vgauth" = "yes" -o "$enable_grabbitmqproxy" = "yes"; then
+if test "$enable_vgauth" = "yes" ; then
    AC_VMW_DEFAULT_FLAGS([SSL])
    AC_VMW_CHECK_LIB([ssl],
                     [SSL],
@@ -1431,7 +1418,6 @@ AM_CONDITIONAL(HAVE_GTKMM, test "$have_x" = "yes" -a \( "$with_gtkmm" = "yes" -o
 AM_CONDITIONAL(HAVE_PAM, test "$with_pam" = "yes")
 AM_CONDITIONAL(USE_SLASH_PROC, test "$os" = "linux")
 AM_CONDITIONAL(ENABLE_DEPLOYPKG, test "$enable_deploypkg" = "yes")
-AM_CONDITIONAL(ENABLE_GRABBITMQPROXY, test "$enable_grabbitmqproxy" = "yes")
 AM_CONDITIONAL(ENABLE_VGAUTH, test "$enable_vgauth" = "yes")
 AM_CONDITIONAL(USE_XMLSEC1, test "$use_xmlsec1" = "yes")
 AM_CONDITIONAL(HAVE_VSOCK, test "$os" = "linux")
@@ -1601,7 +1587,6 @@ AC_CONFIG_FILES([                      \
    services/plugins/Makefile           \
    services/plugins/desktopEvents/Makefile \
    services/plugins/dndcp/Makefile     \
-   services/plugins/grabbitmqProxy/Makefile \
    services/plugins/guestInfo/Makefile \
    services/plugins/hgfsServer/Makefile \
    services/plugins/powerOps/Makefile  \
@@ -1617,7 +1602,6 @@ AC_CONFIG_FILES([                      \
    hgfsmounter/Makefile                \
    checkvm/Makefile                    \
    rpctool/Makefile                    \
-   guestproxycerttool/Makefile         \
    vgauth/Makefile                     \
    vgauth/lib/Makefile                 \
    namespacetool/Makefile              \
diff --git a/open-vm-tools/guestproxycerttool/COPYING b/open-vm-tools/guestproxycerttool/COPYING
deleted file mode 100644 (file)
index 09f465a..0000000
+++ /dev/null
@@ -1,502 +0,0 @@
-                 GNU LESSER GENERAL PUBLIC LICENSE
-                      Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-                 GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                           NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/open-vm-tools/guestproxycerttool/Makefile.am b/open-vm-tools/guestproxycerttool/Makefile.am
deleted file mode 100644 (file)
index f33e83f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-################################################################################
-### Copyright (C) 2014-2016 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-bin_PROGRAMS = vmware-guestproxycerttool
-
-vmware_guestproxycerttool_LDADD =
-vmware_guestproxycerttool_LDADD += @SSL_LIBS@
-vmware_guestproxycerttool_LDADD += -lcrypto
-vmware_guestproxycerttool_LDADD += @GLIB2_LIBS@
-
-vmware_guestproxycerttool_CPPFLAGS =
-vmware_guestproxycerttool_CPPFLAGS += @SSL_CPPFLAGS@
-vmware_guestproxycerttool_CPPFLAGS += @GLIB2_CPPFLAGS@
-
-vmware_guestproxycerttool_SOURCES =
-vmware_guestproxycerttool_SOURCES += cert_key.c
-vmware_guestproxycerttool_SOURCES += cert_util.c
-vmware_guestproxycerttool_SOURCES += cert_tool.c
-
-if HAVE_ICU
-   vmware_guestproxycerttool_LDADD += @ICU_LIBS@
-   vmware_guestproxycerttool_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
-                            $(LIBTOOLFLAGS) --mode=link $(CXX) \
-                            $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
-                            $(LDFLAGS) -o $@
-else
-   vmware_guestproxycerttool_LINK = $(LINK)
-endif
diff --git a/open-vm-tools/guestproxycerttool/cert_key.c b/open-vm-tools/guestproxycerttool/cert_key.c
deleted file mode 100644 (file)
index 53baeba..0000000
+++ /dev/null
@@ -1,729 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2016 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * certKey.c --
- *
- *    Utilities to handle key and certificate generation.
- */
-
-#include <openssl/pem.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/asn1.h>
-#include <openssl/err.h>
-#include <openssl/conf.h>
-#include <openssl/rand.h>
-#include <openssl/safestack.h>
-#include <openssl/evp.h>
-#include <string.h>
-#include <errno.h>
-#include "cert_util.h"
-#include "cert_key.h"
-
-#define BSIZE 4096
-
-/*
- *----------------------------------------------------------------------
- *
- * GetSSLError --
- *
- *    Get the latest human readable error message from SSL library.
- *
- * Results:
- *    Return the error message. Callers should free the returned
- *    error message.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gchar *
-GetSSLError(gchar **errorStr)                    // OUT
-{
-   unsigned long code;
-   GString *str = g_string_new(NULL);
-   gboolean first = TRUE;
-   char buf[BSIZE];
-
-   while ((code = ERR_get_error()) != 0) {
-      ERR_error_string_n(code, buf, sizeof buf);
-      g_string_append_printf(str, "%s%s", first ? "" : ", ", buf);
-      first = FALSE;
-   }
-
-   *errorStr = g_string_free(str, FALSE);
-
-   return *errorStr;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertKey_InitOpenSSLLib --
- *
- *    Initialize OpenSSL for key and certificate generation.
- *
- * Results:
- *    None.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-CertKey_InitOpenSSLLib(void)
-{
-   ERR_load_crypto_strings();
-   OpenSSL_add_all_digests();
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertKey_ComputeCertPemFileHash --
- *
- *    Compute the certificate subject name hash.
- *
- * Results:
- *    Return the computed hash string. Callers should free the returned
- *    string.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gchar *
-CertKey_ComputeCertPemFileHash(const gchar *certPemFile) // IN
-{
-   FILE *file;
-   gchar *hash = NULL;
-   X509 *cert = NULL;
-   gchar *err = NULL;
-
-   file = g_fopen(certPemFile, "r");
-   if (!file) {
-      Error("Failed to open %s: %s.\n", certPemFile, strerror(errno));
-      goto exit;
-   }
-
-   cert = PEM_read_X509(file, NULL, NULL, NULL);
-   if (!cert) {
-      Error("Error reading certificate file %s: %s.\n",
-            certPemFile, GetSSLError(&err));
-      goto exit;
-   }
-
-   hash = g_strdup_printf("%08lx", X509_subject_name_hash(cert));
-
-exit:
-   if (file) {
-      fclose(file);
-   }
-   X509_free(cert);
-   g_free(err);
-
-   return hash;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * SetCertSerialNumber --
- *
- *    Set the certificate serial number.
- *
- * Results:
- *    Return TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-SetCertSerialNumber(X509 *cert)                  // IN
-{
-   BIGNUM *btmp = NULL;
-   ASN1_INTEGER *sno;
-   gboolean ret = FALSE;
-   gchar *err = NULL;
-
-   sno = ASN1_INTEGER_new();
-   if (!sno) {
-      Error("Failed to allocate an ASN1 integer.\n");
-      goto exit;
-   }
-
-   btmp = BN_new();
-   if (!btmp) {
-      Error("Failed to allocate a BIGNUM structure.\n");
-      goto exit;
-   }
-
-   if (!BN_rand(btmp, 64, 0, 0)) {
-      Error("Failed to generate random number: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   if (!BN_to_ASN1_INTEGER(btmp, sno)) {
-      Error("Failed to convert from BIGNUM to ASN1_INTEGER: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   if (!X509_set_serialNumber(cert, sno)) {
-      Error("Failed to set the certificate serial number: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   ret = TRUE;
-
-exit:
-   BN_free(btmp);
-   ASN1_INTEGER_free(sno);
-   g_free(err);
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * LoadOpenSSLConf --
- *
- *    Loading the OpenSSL configuration file.
- *
- * Results:
- *    Return the configuration structure if success, otherwise NULL.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static CONF *
-LoadOpenSSLConf(const gchar *fname)              // IN
-{
-   CONF *config;
-   const char *mask;
-   gboolean ret = FALSE;
-   gchar *err = NULL;
-
-   config = NCONF_new(NULL);
-   if (!config) {
-      Error("Failed to allocate the OpenSSL config.\n");
-      goto exit;
-   }
-
-   if (!NCONF_load(config, fname, NULL)) {
-      Error("Failed to load the configuration file %s: %s.\n",
-            fname, GetSSLError(&err));
-      goto exit;
-   }
-
-   OPENSSL_load_builtin_modules();
-
-   if (!CONF_modules_load(config, NULL, 0)) {
-      Error("Error configuring OpenSSL modules: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   mask = NCONF_get_string(config, "req", "string_mask");
-   if (mask) {
-      ASN1_STRING_set_default_mask_asc(mask);
-   }
-
-   ret = TRUE;
-
-exit:
-   if (!ret) {
-      NCONF_free(config);
-      config = NULL;
-   }
-   g_free(err);
-
-   return config;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateRSAKeyPair --
- *
- *    Interface to OpenSSL library to create RSA key pair.
- *
- * Results:
- *    Return the generated RSA key structure if success,
- *    otherwise NULL.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static RSA *
-GenerateRSAKeyPair(int bits)                     // IN
-{
-   BIGNUM *bn;
-   RSA *rsa = NULL;
-   gchar *err = NULL;
-
-   bn = BN_new();
-   if (!bn) {
-      Error("Failed to allocate a BIGNUM.\n");
-      goto exit;
-   }
-
-   if (!BN_set_word(bn, RSA_F4)) {
-      Error("Failed to assign a value to BIGNUM: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   rsa = RSA_new();
-   if (!rsa) {
-      Error("Failed to allocate a RSA structure.\n");
-      goto exit;
-   }
-
-   if (!RSA_generate_key_ex(rsa, bits, bn, NULL)) {
-      Error("Error generating RSA key pair: %s.\n",
-            GetSSLError(&err));
-      RSA_free(rsa);
-      rsa = NULL;
-   }
-
-exit:
-   BN_free(bn);
-   g_free(err);
-
-   return rsa;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateRSAPrivateKey --
- *
- *    Create the RSA private key structure.
- *
- * Results:
- *    Return the generated RSA private key structure if success,
- *    otherwise NULL.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static EVP_PKEY *
-GenerateRSAPrivateKey(int bits)                  // IN
-{
-   RSA *rsa;
-   EVP_PKEY *pkey = NULL;
-
-   rsa = GenerateRSAKeyPair(bits);
-   if (!rsa) {
-      goto exit;
-   }
-
-   pkey = EVP_PKEY_new();
-   if (!pkey) {
-      Error("Failed to allocate a private key structure.\n");
-      goto exit;
-   }
-
-   EVP_PKEY_assign_RSA(pkey, rsa);
-   rsa = NULL;
-
-exit:
-   RSA_free(rsa);
-
-   return pkey;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * ConfigX509CertReq --
- *
- *    Configure the X509 certificate request.
- *
- * Results:
- *    Return TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-ConfigX509CertReq(X509_REQ *req,                 // OUT
-                  CONF *config)                  // IN
-{
-   int idx;
-   X509_NAME *subject;
-   gboolean ret = FALSE;
-   const char *dname;
-   gchar *err = NULL;
-
-   if (!X509_REQ_set_version(req, 0L)) {
-      Error("Failed to set the certificate request version: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   subject = X509_REQ_get_subject_name(req);
-   if (!subject) {
-      Error("Failed to get the certificate request subject name: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   dname = NCONF_get_string(config, "req", "distinguished_name");
-   if (dname) {
-      STACK_OF(CONF_VALUE) *dn_sk = NCONF_get_section(config, dname);
-      if (!dn_sk) {
-         Error("Failed to get section %s: %s.\n",
-               dname, GetSSLError(&err));
-         goto exit;
-      }
-
-      for (idx = 0; idx < sk_CONF_VALUE_num(dn_sk); idx++) {
-         CONF_VALUE *v = sk_CONF_VALUE_value(dn_sk, idx);
-
-         if (!X509_NAME_add_entry_by_txt(subject, v->name, MBSTRING_ASC,
-                                         v->value, -1, -1, 0)) {
-            Error("Failed to set certificate request pair %s/%s: %s.\n",
-                  v->name, v->value, GetSSLError(&err));
-            goto exit;
-         }
-      }
-   }
-
-   ret = TRUE;
-
-exit:
-   g_free(err);
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateX509CertReq --
- *
- *    Create X509 certificate request.
- *
- * Results:
- *    Return the generated X509 request if success, otherwise NULL.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static X509_REQ *
-GenerateX509CertReq(EVP_PKEY **pkey,             // OUT
-                    CONF *config,                // IN
-                    int bits)                    // IN
-{
-   X509_REQ *req = NULL;
-   gboolean ret = FALSE;
-   gchar *err = NULL;
-
-   *pkey = GenerateRSAPrivateKey(bits);
-   if (!*pkey) {
-      goto exit;
-   }
-
-   req = X509_REQ_new();
-   if (!req) {
-      Error("Failed to allocate a X509 certificate request.\n");
-      goto exit;
-   }
-
-   if (!ConfigX509CertReq(req, config)) {
-      goto exit;
-   }
-
-   if (!X509_REQ_set_pubkey(req, *pkey)) {
-      Error("Failed to set certificate request public key: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   ret = TRUE;
-
-exit:
-   if (!ret) {
-      X509_REQ_free(req);
-      req = NULL;
-   }
-   g_free(err);
-
-   return req;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * GenerateX509Cert --
- *
- *    Generate a X509 certificate.
- *
- * Results:
- *    Return a X509 structure if success, otherwise NULL.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static X509 *
-GenerateX509Cert(X509_REQ *req,                  // IN
-                 CONF *config,                   // IN
-                 int days)                       // IN
-{
-   X509 *cert;
-   X509V3_CTX ctx;
-   char *extensions;
-   gboolean ret = FALSE;
-   gchar *err = NULL;
-
-   cert = X509_new();
-   if (!cert) {
-      Error("Failed to allocate a X509 certificate: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   if (!SetCertSerialNumber(cert)) {
-      goto exit;
-   }
-
-   if (!X509_set_issuer_name(cert, X509_REQ_get_subject_name(req))    ||
-       !X509_gmtime_adj(X509_get_notBefore(cert), 0)                  ||
-       !X509_gmtime_adj(X509_get_notAfter(cert), (long)60*60*24*days) ||
-       !X509_set_subject_name(cert, X509_REQ_get_subject_name(req))) {
-      Error("Failed to configure the X509 certificate: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   X509V3_set_ctx(&ctx, cert, cert, NULL, NULL, 0);
-   X509V3_set_nconf(&ctx, config);
-
-   extensions = NCONF_get_string(config, "req", "x509_extensions");
-   if (extensions) {
-      if (!X509_set_version(cert, 2)) {
-         Error("Failed to set the certificate version: %s.\n",
-               GetSSLError(&err));
-         goto exit;
-      }
-
-      if (!X509V3_EXT_add_nconf(config, &ctx, extensions, cert)) {
-         Error("Error loading extension section %s: %s.\n",
-               extensions, GetSSLError(&err));
-         goto exit;
-      }
-   }
-
-   ret = TRUE;
-
-exit:
-   if (!ret) {
-      X509_free(cert);
-      cert = NULL;
-   }
-   g_free(err);
-
-   return cert;
-}
-
-
-#ifndef _WIN32
-/*
- *----------------------------------------------------------------------
- *
- * WritePemFile --
- *
- *    Output RSA private key and X509 certificate in PEM format.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-WritePemFile(EVP_PKEY *pkey,                     // IN
-             const gchar *keyFile,               // IN
-             X509 *cert,                         // IN
-             const gchar *certFile)              // IN
-{
-   FILE *file;
-   gboolean ret = FALSE;
-   gchar *err = NULL;
-   mode_t mode;
-
-   mode = umask(066);
-   file = g_fopen(keyFile, "w");
-   if (!file) {
-      Error("Failed to open %s: %s.\n", keyFile, strerror(errno));
-      goto exit;
-   }
-
-   if (!PEM_write_PrivateKey(file, pkey, NULL, NULL, 0, NULL, NULL)) {
-      Error("Failed to write the private key file %s: %s.\n",
-            keyFile, GetSSLError(&err));
-      goto exit;
-   }
-
-   fclose(file);
-
-   umask(022);
-   file = g_fopen(certFile, "w");
-   if (!file) {
-      Error("Failed to open %s: %s.\n", certFile, strerror(errno));
-      goto exit;
-   }
-
-   if (!PEM_write_X509(file, cert)) {
-      Error("Failed to write the certificate file %s: %s.\n",
-            certFile, GetSSLError(&err));
-      goto exit;
-   }
-
-   ret = TRUE;
-
-exit:
-   if (file) {
-      fclose(file);
-   }
-   g_free(err);
-   umask(mode);
-
-   return ret;
-}
-#endif
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertKey_GenerateKeyCert --
- *
- *    Generate the server key and certificate files.
- *
- * Results:
- *    TRUE if success, otherwise FALSE. When success, key and
- *    certificate files are generated.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-CertKey_GenerateKeyCert(int bits,                 // IN
-                        int days,                 // IN
-                        const gchar *confFile,    // IN
-                        const gchar *keyFile,     // IN
-                        const gchar *certFile)    // IN
-{
-   gboolean ret = FALSE;
-   X509 *cert = NULL;
-   X509_REQ *req = NULL;
-   EVP_PKEY *pkey = NULL;
-   CONF *config;
-   gchar *err = NULL;
-
-   config = LoadOpenSSLConf(confFile);
-   if (!config) {
-      goto exit;
-   }
-
-   req = GenerateX509CertReq(&pkey, config, bits);
-   if (!req) {
-      goto exit;
-   }
-
-   cert = GenerateX509Cert(req, config, days);
-   if (!cert) {
-      goto exit;
-   }
-
-   if (!X509_set_pubkey(cert, pkey)) {
-      Error("Failed to set certificate public key: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   if (!X509_sign(cert, pkey, EVP_sha256())) {
-      Error("Failed to sign the X509 certificate: %s.\n",
-            GetSSLError(&err));
-      goto exit;
-   }
-
-   /*
-    * Write private key and certificate PEM files.
-    */
-   if (WritePemFile(pkey, keyFile, cert, certFile)) {
-      ret = TRUE;
-   }
-
-exit:
-   g_free(err);
-   NCONF_free(config);
-   EVP_PKEY_free(pkey);
-   X509_REQ_free(req);
-   X509_free(cert);
-
-   return ret;
-}
diff --git a/open-vm-tools/guestproxycerttool/cert_key.h b/open-vm-tools/guestproxycerttool/cert_key.h
deleted file mode 100644 (file)
index 771a945..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2017 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-#ifndef _CERT_KEY_H_
-#define _CERT_KEY_H_
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <openssl/evp.h>
-
-gchar *
-CertKey_ComputeCertPemFileHash(const gchar *certPemFile); // IN
-
-gboolean
-CertKey_GenerateKeyCert(int bits,                         // IN
-                        int days,                         // IN
-                        const gchar *confFile,            // IN
-                        const gchar *keyFile,             // IN
-                        const gchar *certFile);           // IN
-
-void
-CertKey_InitOpenSSLLib(void);
-
-gboolean
-WritePemFile(EVP_PKEY *pkey,                     // IN
-             const gchar *keyFile,               // IN
-             X509 *cert,                         // IN
-             const gchar *certFile);             // IN
-
-gchar *
-GetSSLError(gchar **errorStr);                   // OUT
-
-#ifdef _WIN32
-gboolean
-CheckKeyFile(const gchar *keyFile);
-#endif
-#endif // #ifndef _CERT_KEY_H_
diff --git a/open-vm-tools/guestproxycerttool/cert_tool.c b/open-vm-tools/guestproxycerttool/cert_tool.c
deleted file mode 100644 (file)
index a09894c..0000000
+++ /dev/null
@@ -1,672 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2017 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * cert_tool.c --
- *
- *    Utility to manage the certificates for 'rabbitmqproxy'
- *    plugin in 'VMware Tools'.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#include "cert_util.h"
-#include "cert_key.h"
-#include "cert_tool_version.h"
-#ifdef _WIN32
-#include "common_win.h"
-#endif
-
-#include "vm_version.h"
-#include "embed_version.h"
-VM_EMBED_VERSION(GUESTPROXYCERTTOOL_VERSION_STRING);
-
-/*
- * The following variables are set up during the validation of system
- * environment. They are initialized only once and are not freed until
- * the program exits.
- */
-static gboolean  initialized = FALSE;
-static gchar    *guestProxyDir;
-static gchar    *guestProxyServerDir;
-static gchar    *guestProxyTrustedDir;
-static gchar    *guestProxySslConf;
-
-#define RSA_KEY_LENGTH       2048
-#define CERT_EXPIRED_IN_DAYS (365 * 10)
-
-
-gboolean gIsLogEnabled = FALSE;
-
-/*
- *----------------------------------------------------------------------
- *
- * PrintUsage --
- *
- *    Print command usage information.
- *
- * Results:
- *    None.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-PrintUsage(const gchar *cmd)                      // IN
-{
-   fprintf(stderr, "Guest Proxy Certificate Management Tool.\n");
-   fprintf(stderr, "Usage: %s [OPTION] [ARGUMENTS]\n\n", cmd);
-   fprintf(stderr, "Options\n"
-           "  -h, --help                Prints the usage information.\n\n"
-           "  -v, --verbose             Prints additional log messages.\n\n"
-           "  -f, --force               Forces to regenerate the new server key/cert\n"
-           "                            when used with -g.\n\n"
-           "  -g, --generate_key_cert   Generates the server key/cert if they don't\n"
-           "                            exist. Use with -f to force the regeneration.\n\n"
-           "  -a, --add_trust_cert      <client_cert_pem_file>\n"
-           "                            Adds the client cert to the trusted\n"
-           "                            certificates directory.\n\n"
-           "  -r, --remove_trust_cert   <client_cert_pem_file>\n"
-           "                            Removes the client cert from the trusted\n"
-           "                            certificates directory.\n\n"
-           "  -d, --display_server_cert [<cert_pem_file>]\n"
-           "                            Prints the server's certificate to the\n"
-           "                            standard output. If the file path is\n"
-           "                            specified, then the server's certificate\n"
-           "                            is stored in the file.\n\n");
-}
-
-
-static void
-InitProxyPaths(const gchar *toolDir)
-{
-   guestProxyDir        = g_build_filename(toolDir, "GuestProxyData", NULL);
-   guestProxyServerDir  = g_build_filename(guestProxyDir, "server", NULL);
-   guestProxyTrustedDir = g_build_filename(guestProxyDir, "trusted", NULL);
-   guestProxySslConf    = g_build_filename(toolDir, "guestproxy-ssl.conf", NULL);
-}
-
-
-#ifndef _WIN32
-/*
- *----------------------------------------------------------------------
- *
- * CheckRootPriv --
- *
- *    Check if the effect user id is root.
- *
- * Results:
- *    TRUE if it is, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-CheckRootPriv(void)
-{
-   if (geteuid() != 0) {
-      Error("Please re-run this program as the super user to execute "
-            "this operation.\n");
-      return FALSE;
-   }
-   return TRUE;
-}
-#endif
-
-
-/*
- *----------------------------------------------------------------------
- *
- * ValidateEnvironment --
- *
- *    Initialize command and directory paths, which are used to hold
- *    key and certificate files, and find commands to operate on them.
- *
- * Results:
- *    TRUE if successfully find all the paths. Otherwise FALSE.
- *
- * Side effects:
- *    Path global variables are set accordingly and guest proxy data
- *    directories are created on-demand.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-ValidateEnvironment(gboolean requireRootPriv)     // IN
-{
-   gboolean ret = FALSE;
-
-   if (requireRootPriv && !CheckRootPriv()) {
-      Error("Current user has insufficient privileges.\n");
-      goto exit;
-   }
-
-   if (!initialized) {
-      CertKey_InitOpenSSLLib();
-      initialized = TRUE;
-   }
-
-   if (!g_file_test(guestProxySslConf, G_FILE_TEST_IS_REGULAR)) {
-      Error("Couldn't find the GuestProxy Config file at '%s'.\n",
-            guestProxySslConf);
-      goto exit;
-   }
-
-   /* Create guest proxy data directories on-demand */
-   if (!g_file_test(guestProxyDir, G_FILE_TEST_IS_DIR)) {
-      if (g_mkdir(guestProxyDir, 0755) < 0) {
-         Error("Couldn't create the directory '%s'.\n", guestProxyDir);
-         goto exit;
-      }
-   }
-
-   if (!g_file_test(guestProxyServerDir, G_FILE_TEST_IS_DIR)) {
-      if (g_mkdir(guestProxyServerDir, 0755) < 0) {
-         Error("Couldn't create the directory '%s'.\n", guestProxyServerDir);
-         goto exit;
-      }
-   }
-
-   if (!g_file_test(guestProxyTrustedDir, G_FILE_TEST_IS_DIR)) {
-      if (g_mkdir(guestProxyTrustedDir, 0700) < 0) {
-         Error("Couldn't create the directory '%s'.\n", guestProxyTrustedDir);
-         goto exit;
-      }
-   }
-
-   ret = TRUE;
-
-exit:
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * AddTrustCert --
- *
- *    Add the supplied certificate file (clientCertPemFile) to the
- *    trusted certificate directory.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-AddTrustCert(const gchar *clientCertPemFile)      // IN
-{
-   gboolean ret = FALSE;
-   int last, num;
-   gchar *hash = NULL;
-   gchar *path = NULL;
-
-   if (!ValidateEnvironment(TRUE)) {
-      goto exit;
-   }
-
-   if (!g_file_test(clientCertPemFile, G_FILE_TEST_IS_REGULAR)) {
-      Error("No certificate file found at %s.\n", clientCertPemFile);
-      goto exit;
-   }
-
-   hash = CertKey_ComputeCertPemFileHash(clientCertPemFile);
-   if (!hash) {
-      goto exit;
-   }
-
-   if (CertUtil_FindCert(clientCertPemFile, guestProxyTrustedDir, hash,
-                        &num, &last) && num >= 0) {
-      Error("The specified certificate file already exists: %s.%d.\n",
-            hash, num);
-      goto exit;
-   }
-
-   path = CertUtil_CreateCertFileName(guestProxyTrustedDir, hash, last + 1);
-   if (!CertUtil_CopyFile(clientCertPemFile, path)) {
-      Error("Unable to add %s to the trusted certificate store.\n",
-            clientCertPemFile);
-      goto exit;
-   }
-
-   printf("Successfully added the %s to the trusted certificate store.\n",
-          clientCertPemFile);
-   ret = TRUE;
-
-exit:
-   g_free(hash);
-   g_free(path);
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * DisplayServerCert --
- *
- *    Display the server certificate file to console. If a file name
- *    (serverCertPemFile) is supplied, write to that file instead.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-DisplayServerCert(const gchar *serverCertPemFile) // IN
-{
-   gboolean ret = FALSE;
-   gchar *cert = NULL;
-   FILE *file = NULL;
-   GMappedFile *fmap = NULL;
-
-   if (!ValidateEnvironment(FALSE)) {
-      goto exit;
-   }
-
-   cert = g_build_filename(guestProxyServerDir, "cert.pem", NULL);
-   if (!g_file_test(cert, G_FILE_TEST_IS_REGULAR)) {
-      Error("Couldn't find the server certificate file: %s.\n", cert);
-      goto exit;
-   }
-
-   if (serverCertPemFile && strlen(serverCertPemFile)) {
-      printf("Copying the server certificate to %s.\n", serverCertPemFile);
-
-      if (!CertUtil_CopyFile(cert, serverCertPemFile)) {
-         Error("Failed to copy the certificate file to the file.\n");
-         goto exit;
-      }
-      printf("Successfully copied the server certificate.\n");
-
-   } else {
-
-      fmap = g_mapped_file_new(cert, FALSE, NULL);
-      if (fmap) {
-
-         const gchar *content = g_mapped_file_get_contents(fmap);
-         gsize length = g_mapped_file_get_length(fmap);
-
-         if (fwrite(content, 1, length, stdout) < length) {
-            Error("Failed to display %s: %s.\n", cert, strerror(errno));
-            goto exit;
-         }
-      } else {
-         Error("Couldn't open the server certificate file.\n");
-         goto exit;
-      }
-   }
-
-   ret = TRUE;
-
-exit:
-   g_free(cert);
-   if (file) {
-      fclose(file);
-   }
-   if (fmap) {
-      g_mapped_file_unref(fmap);
-   }
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CreateKeyCert --
- *
- *    Create the server key and certificate files.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-CreateKeyCert(gboolean force)
-{
-   gboolean ret = FALSE;
-   gchar *cert = NULL;
-   gchar *key = NULL;
-
-   if (!ValidateEnvironment(TRUE)) {
-      goto exit;
-   }
-
-   key  = g_build_filename(guestProxyServerDir, "key.pem", NULL);
-   cert = g_build_filename(guestProxyServerDir, "cert.pem", NULL);
-
-   /*
-    * If both server key and certificate files already exist and the
-    * program is not asked to create them by force, print an warning
-    * message about server key/cert files not regenerating.
-    */
-   if (g_file_test(key, G_FILE_TEST_IS_REGULAR) &&
-       g_file_test(cert, G_FILE_TEST_IS_REGULAR) && !force) {
-      printf("\nNOTE: both %s and \n      %s already exist.\n"
-             "      They are not generated again. To regenerate "
-             "them by force,\n      use the \"%s -g -f\" command.\n\n",
-             key, cert, g_get_prgname());
-      ret = TRUE;
-      goto exit;
-   }
-
-   printf("Generating the key and certificate files.\n");
-
-   if (!CertKey_GenerateKeyCert(RSA_KEY_LENGTH, CERT_EXPIRED_IN_DAYS,
-                                guestProxySslConf, key, cert)) {
-      goto exit;
-   }
-
-   ret = TRUE;
-   printf("Successfully generated the key and certificate files.\n");
-
-exit:
-   g_free(key);
-   g_free(cert);
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * RemoveTrustCert --
- *
- *    Remove the specified certificate from the trusted certificate
- *    store.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-RemoveTrustCert(const gchar *clientCertPemFile)
-{
-   gboolean ret = FALSE;
-   int last, num;
-   gchar *hash = NULL;
-   gchar *src = NULL;
-   gchar *dst = NULL;
-
-   if (!ValidateEnvironment(TRUE)) {
-      goto exit;
-   }
-
-   if (!g_file_test(clientCertPemFile, G_FILE_TEST_IS_REGULAR)) {
-      Error("No certificate file found at %s.\n", clientCertPemFile);
-      goto exit;
-   }
-
-   hash = CertKey_ComputeCertPemFileHash(clientCertPemFile);
-   if (!hash) {
-      goto exit;
-   }
-
-   if (!CertUtil_FindCert(clientCertPemFile, guestProxyTrustedDir, hash,
-                         &num, &last) || num < 0) {
-      Error("Couldn't find any certificate in the trusted directory.\n");
-      goto exit;
-   }
-
-   dst = CertUtil_CreateCertFileName(guestProxyTrustedDir, hash, num);
-   if (last != num) {
-      src = CertUtil_CreateCertFileName(guestProxyTrustedDir, hash, last);
-      if (rename(src, dst) != 0) {
-         Error("Failed to rename %s to %s with error: %s.",
-               src, dst, strerror(errno));
-         goto exit;
-      }
-   } else {
-      if (unlink(dst) != 0) {
-         Error("Failed to remove %s with error: %s.", dst, strerror(errno));
-         goto exit;
-      }
-   }
-
-   ret = TRUE;
-   printf("Successfully removed the certificate.\n");
-
-exit:
-   g_free(hash);
-   g_free(src);
-   g_free(dst);
-
-   return ret;
-}
-
-
-/*
-  "  -e, --erase_proxy_data   Erases the trusted and server directories,\n"
-  "                           and their contents including server key/cert.\n\n"
-*/
-
-/*
- *----------------------------------------------------------------------
- *
- * EraseProxyData --
- *
- *    Delete the guest proxy data diectory and its contents.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-EraseProxyData(void)
-{
-   gboolean ret = FALSE;
-
-   if (!CheckRootPriv()) {
-      goto exit;
-   }
-
-   if (g_file_test(guestProxyDir, G_FILE_TEST_IS_DIR)) {
-      if (!CertUtil_RemoveDir(guestProxyDir)) {
-         Error("Fail to remove the directory '%s'.\n", guestProxyDir);
-         goto exit;
-      }
-   }
-
-   ret = TRUE;
-
-exit:
-   return ret;
-}
-
-
-/*
- * Aggregation of command options.
- */
-static struct _options {
-   gchar        *addCert;
-   gchar     *deleteCert;
-   gchar     *outputCert;
-   gboolean  displayCert;
-   gboolean generateCert;
-   gboolean        usage;
-   gboolean        verbose;
-   gboolean        force;
-   gboolean        erase;
-} options = { NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE};
-
-
-static gboolean
-ParseDisplayCert(const gchar* name,
-                 const gchar* value,
-                 gpointer data,
-                 GError **error)
-{
-   options.displayCert = TRUE;
-   if (value) {
-      options.outputCert = g_strdup(value);
-   }
-
-   return TRUE;
-}
-
-
-static GOptionEntry cmdOptions[] = {
-   { "help",                'h', 0,
-     G_OPTION_ARG_NONE,      &options.usage,        NULL, NULL },
-   { "verbose",             'v', 0,
-     G_OPTION_ARG_NONE,      &options.verbose,      NULL, NULL },
-   { "erase_proxy_data",    'e', 0,
-     G_OPTION_ARG_NONE,      &options.erase,        NULL, NULL },
-   { "force",               'f', 0,
-     G_OPTION_ARG_NONE,      &options.force,        NULL, NULL },
-   { "generate_key_cert",   'g', 0,
-     G_OPTION_ARG_NONE,      &options.generateCert, NULL, NULL },
-   { "add_trust_cert",      'a', 0,
-     G_OPTION_ARG_FILENAME,  &options.addCert,      NULL, NULL },
-   { "remove_trust_cert",   'r', 0,
-     G_OPTION_ARG_FILENAME,  &options.deleteCert,   NULL, NULL },
-   { "display_server_cert", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
-     G_OPTION_ARG_CALLBACK,  ParseDisplayCert,      NULL, NULL },
-   { NULL }
-};
-
-
-/*
- *----------------------------------------------------------------------
- *
- * ParseOptions --
- *
- *    Parse command options.
- *
- * Results:
- *    Recognized options are saved into the options variable.
- *
- * Side effects:
- *    Both argc and argv are updated to remove those already
- *    recognized options.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ParseOptions(int *argc,                           // IN/OUT
-             char ***argv)                        // IN/OUT
-{
-   GError *error = NULL;
-   GOptionContext *context;
-
-   context = g_option_context_new(NULL);
-   g_option_context_add_main_entries(context, cmdOptions, NULL);
-   /*
-    * Turn off glib option parser help message in order to provide the
-    * complete help messages compatible to those from the original perl
-    * implementation script.
-    */
-   g_option_context_set_help_enabled(context, FALSE);
-
-   if (!g_option_context_parse(context, argc, argv, &error)) {
-      printf("Option parsing failed: %s\n", error->message);
-      PrintUsage(g_get_prgname());
-      exit(1);
-   }
-
-   g_option_context_free(context);
-}
-
-int
-main(int argc, char **argv)
-{
-   ParseOptions(&argc, &argv);
-   if (options.usage) {
-      PrintUsage(g_get_prgname());
-      exit(0);
-   }
-
-   if (options.verbose) {
-      gIsLogEnabled = TRUE;
-   }
-
-   InitProxyPaths(CertUtil_GetToolDir());
-
-#ifdef _WIN32
-   /*
-    * The old VB script created the key with bad perms; regenerate if we
-    * find it looks bad.
-    */
-   {
-      gchar *keyFilename = g_build_filename(guestProxyServerDir,
-                                            "key.pem", NULL);
-
-      if (g_file_test(keyFilename, G_FILE_TEST_EXISTS)) {
-         if (!CheckKeyFile(keyFilename)) {
-            printf("Warning!  Insecure keyfile (%s) found,"
-                  " regenerating key and cert.\n", keyFilename);
-            options.force = TRUE;
-         }
-      }
-      g_free(keyFilename);
-   }
-#endif
-
-   if ((options.generateCert && !CreateKeyCert(options.force)) ||
-       (options.displayCert && !DisplayServerCert(options.outputCert)) ||
-       (options.addCert && !AddTrustCert(options.addCert)) ||
-       (options.deleteCert && !RemoveTrustCert(options.deleteCert)) ||
-       (options.erase && !EraseProxyData())) {
-      return 1;
-   } else {
-      return 0;
-   }
-}
diff --git a/open-vm-tools/guestproxycerttool/cert_tool_version.h b/open-vm-tools/guestproxycerttool/cert_tool_version.h
deleted file mode 100644 (file)
index fdb6626..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2016 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * cert_tool_version.h --
- *
- * Version definitions for the vmware-guestproxycerttool program
- */
-
-#ifndef _GUESTPROXYCERTTOOL_VERSION_H_
-#define _GUESTPROXYCERTTOOL_VERSION_H_
-
-/*
- * This component's version is coupled with Tools versioning. The effect
- * is that the version increments with each build, and with each Tools
- * version bump. If and when it becomes necessary to version the component
- * manually, make sure that the version is bumped any time the component or
- * its dependencies are changed.
- */
-#include "vm_tools_version.h"
-#define GUESTPROXYCERTTOOL_VERSION_COMMAS   TOOLS_VERSION_EXT_CURRENT_CSV
-#define GUESTPROXYCERTTOOL_VERSION_STRING   TOOLS_VERSION_EXT_CURRENT_STR
-
-#endif /* _GUESTPROXYCERTTOOL_VERSION_H_*/
diff --git a/open-vm-tools/guestproxycerttool/cert_util.c b/open-vm-tools/guestproxycerttool/cert_util.c
deleted file mode 100644 (file)
index 2829bc9..0000000
+++ /dev/null
@@ -1,496 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2016 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * cert_util.c --
- *
- *    Utilities to manage the certificates.
- */
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "cert_util.h"
-
-/*
- *----------------------------------------------------------------------
- *
- * CompareFile --
- *
- *    Check if two files are the same.
- *
- * Results:
- *    TRUE if file comparison is performed successfully, otherwise
- *    FALSE. When the returned value is TRUE, 'same' is TRUE if two
- *    input files are the same, otherwise FALSE. When the returned
- *    value is FALSE, 'same' is not defined.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-CompareFile(const gchar *fname1,                 // IN
-            const gchar *fname2,                 // IN
-            gboolean *same)                      // OUT
-{
-   gsize num;
-   gboolean ret = FALSE;
-   GMappedFile *m1;
-   GMappedFile *m2 = NULL;
-   GError *error = NULL;
-
-   m1 = g_mapped_file_new(fname1, FALSE, &error);
-   if (m1 == NULL) {
-      Error("Unable to map %s: %s.\n", fname1, error->message);
-      goto exit;
-   }
-
-   m2 = g_mapped_file_new(fname2, FALSE, &error);
-   if (m2 == NULL) {
-      Error("Unable to map %s: %s.\n", fname2, error->message);
-      goto exit;
-   }
-
-   ret = TRUE;
-   *same = FALSE;
-
-   num = g_mapped_file_get_length(m1);
-   if (g_mapped_file_get_length(m2) == num) {
-      if (num) {
-         if (memcmp(g_mapped_file_get_contents(m1),
-                    g_mapped_file_get_contents(m2), num) == 0) {
-            *same = TRUE;
-         }
-      } else {
-         /* Two empty files */
-         *same = TRUE;
-      }
-   }
-
-exit:
-   g_clear_error(&error);
-   if (m1) {
-      g_mapped_file_unref(m1);
-   }
-   if (m2) {
-      g_mapped_file_unref(m2);
-   }
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertUtil_CreateCertFileName --
- *
- *    A convenient function to make up the certificate file name based
- *    on the supplied guest proxy certificate store (certDir), subject
- *    name hash (hash), and certificate version (version).
- *
- * Results:
- *    Return the full path name of the certificate. Callers should free
- *    the returned string.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gchar *
-CertUtil_CreateCertFileName(const gchar *certDir, // IN
-                            const gchar *hash,    // IN
-                            int version)          // IN
-{
-   gchar *ret;
-   gchar *tmp;
-
-   tmp = g_strdup_printf("%s.%d", hash, version);
-   ret = g_build_filename(certDir, tmp, NULL);
-
-   g_free(tmp);
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * IntCmp --
- *
- *    This is an integer comparator, which is used to sort a list
- *    with ascending order.
- *
- * Results:
- *    The difference of ga and gb.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gint
-IntCmp(gconstpointer ga,                         // IN
-       gconstpointer gb)                         // IN
-{
-   gint a = GPOINTER_TO_INT(ga);
-   gint b = GPOINTER_TO_INT(gb);
-
-   return (a - b);
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * MatchFile --
- *
- *    Scan each file at the directory and collect file extensions of
- *    matched files. Sort the file extension list in ascending order.
- *
- * Results:
- *    Return a list of file extensions, their file names matching the
- *    regular expression. These extensions are file version numbers.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static GList *
-MatchFile(GDir *dir,                             // IN
-          GRegex *regExpr)                       // IN
-{
-   const gchar *fn, *cp;
-   GList *list = NULL;
-
-   while ((fn = g_dir_read_name(dir)) != NULL) {
-      if (g_regex_match(regExpr, fn, 0, NULL)) {
-
-         cp = strrchr(fn, '.');
-         list = g_list_prepend(list, GINT_TO_POINTER(atoi(cp + 1)));
-      }
-   }
-
-   list = g_list_sort(list, IntCmp);
-
-   return list;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * SearchFile --
- *
- *    Search files with pattern (<fname>.[0-9]+) at a directory <path>.
- *
- * Results:
- *    Return TRUE if file search is performed successfully, otherwise
- *    FALSE. When the returned value is TRUE, 'list' is set to include
- *    a list of file extensions matching the pattern.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-SearchFile(const gchar *path,                    // IN
-           const gchar *fname,                   // IN
-           GList **list)                         // OUT
-{
-   gboolean ret = FALSE;
-   gchar *pattern;
-   GRegex *regExpr;
-   GDir *dir = NULL;
-   GError *error = NULL;
-
-   pattern = g_strdup_printf("%s.[0-9]+", fname);
-   regExpr = g_regex_new(pattern, 0, 0, &error);
-   if (!regExpr) {
-      Error("Failed to compile %s: %s.\n", pattern, error->message);
-      goto exit;
-   }
-
-   dir = g_dir_open(path, 0, &error);
-   if (!dir) {
-      Error("Failed to open %s: %s.\n", path, error->message);
-      goto exit;
-   }
-
-   *list = MatchFile(dir, regExpr);
-   ret = TRUE;
-
-exit:
-   g_free(pattern);
-   g_clear_error(&error);
-   if (dir) {
-      g_dir_close(dir);
-   }
-   if (regExpr) {
-      g_regex_unref(regExpr);
-   }
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertUtil_FindCert --
- *
- *    From the trusted certificate directory (certDir), check if
- *    there is any certificate file matching the contents of the
- *    supplied one. In general, certificate files are saved in the
- *    directory by the format of <hash>.[0-9]+.
- *
- * Results:
- *    Return TRUE if the function is successfully executed. Otherwise
- *    FALSE. When return TRUE, 'num' is set to the version of matching
- *    certificate file or -1 if no matching. For 'last', it is set to
- *    the highest version, or -1 if the store has no certificate file.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-CertUtil_FindCert(const gchar *certFile,          // IN
-                  const gchar *certDir,           // IN
-                  const gchar *hash,              // IN
-                  int *num,                       // OUT
-                  int *last)                      // OUT
-{
-   gboolean ret = FALSE;
-   const GList *node;
-   GList *list = NULL;
-   gchar *path = NULL;
-
-   *last = *num = -1;
-   if (!SearchFile(certDir, hash, &list)) {
-      goto exit;
-   }
-
-   ret = TRUE;
-   if (!list) {
-      goto exit;
-   }
-
-   /* *last = the highest file version */
-   node = g_list_last(list);
-   *last = GPOINTER_TO_INT(node->data);
-
-   for (node = g_list_first(list); node; node = g_list_next(node)) {
-      gboolean same = FALSE;
-      int ext = GPOINTER_TO_INT(node->data);
-
-      g_free(path);
-      path = CertUtil_CreateCertFileName(certDir, hash, ext);
-
-      if (!CompareFile(certFile, path, &same)) {
-         ret = FALSE;
-         goto exit;
-      }
-
-      if (same) {
-         *num = ext;
-         break;
-      }
-   }
-
-exit:
-   g_free(path);
-   if (list) {
-      g_list_free(list);
-   }
-
-   return ret;
-}
-
-
-#ifndef _WIN32
-/*
- *----------------------------------------------------------------------
- *
- * CertUtil_GetToolDir --
- *
- *    Get the VMware tool installation directory.
- *
- * Results:
- *    The VMware tool installation directory. Callers should not free
- *    the returned string.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-const gchar *
-CertUtil_GetToolDir(void)
-{
-   static gchar *path = NULL;
-
-   if (!path) {
-      path = g_build_filename(G_DIR_SEPARATOR_S, "etc", "vmware-tools", NULL);
-   }
-
-   return path;
-}
-#endif
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertUtil_CopyFile --
- *
- *    Copy a file from source to destination.
- *
- * Results:
- *    TRUE if success, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-CertUtil_CopyFile(const gchar *src,              // IN
-                  const gchar *dst)              // IN
-{
-   gsize length;
-   gboolean ret = FALSE;
-   GMappedFile *smap;
-   GError *error = NULL;
-   FILE *file = NULL;
-   const gchar *content;
-
-   smap = g_mapped_file_new(src, FALSE, &error);
-   if (!smap) {
-      Error("Unable to map %s: %s.\n", src, error->message);
-      goto exit;
-   }
-
-   file = g_fopen(dst, "w");
-   if (!file) {
-      Error("Failed to open %s: %s.\n", dst, strerror(errno));
-      goto exit;
-   }
-
-   length = g_mapped_file_get_length(smap);
-   content = g_mapped_file_get_contents(smap);
-   if (fwrite(content, 1, length, file) < length) {
-      Error("Failed to copy %s to %s: %s.\n", src, dst, strerror(errno));
-      goto exit;
-   }
-
-   ret = TRUE;
-
-exit:
-   g_clear_error(&error);
-   if (smap) {
-      g_mapped_file_unref(smap);
-   }
-   if (file) {
-      fclose(file);
-   }
-
-   return ret;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * CertUtil_RemoveDir --
- *
- *    Remove a directory. This directory can be non-empty. When it is
- *    non-empty, all of its files and subdirectories are removed too.
- *
- * Results:
- *    TRUE if the directory is successfully removed, otherwise FALSE.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-gboolean
-CertUtil_RemoveDir(const gchar *dirToRemove)
-{
-   gboolean ret = FALSE;
-   GDir *dir = NULL;
-   const gchar *file;
-   GError *error = NULL;
-   gchar *fname = NULL;
-
-   if ((dir = g_dir_open(dirToRemove, 0, &error)) == NULL) {
-      Error("Failed to open %s: %s.\n", dirToRemove, error->message);
-      goto exit;
-   }
-
-   while ((file = g_dir_read_name(dir)) != NULL) {
-      g_free(fname);
-      fname = g_build_filename(dirToRemove, file, NULL);
-
-      if (g_file_test(fname, G_FILE_TEST_IS_DIR)) {
-         if (!CertUtil_RemoveDir(fname)) {
-            Error("Couldn't remove the directory '%s'.\n", fname);
-            goto exit;
-         }
-      } else if (g_remove(fname) < 0) {
-         Error("Couldn't remove the file '%s'.\n", fname);
-         goto exit;
-      }
-   }
-
-   g_dir_close(dir);
-   dir = NULL;
-
-   if (g_rmdir(dirToRemove) < 0) {
-      Error("Couldn't remove the directory '%s'.\n", dirToRemove);
-      goto exit;
-   }
-
-   ret = TRUE;
-
-exit:
-   g_free(fname);
-   g_clear_error(&error);
-   if (dir) {
-      g_dir_close(dir);
-   }
-
-   return ret;
-}
diff --git a/open-vm-tools/guestproxycerttool/cert_util.h b/open-vm-tools/guestproxycerttool/cert_util.h
deleted file mode 100644 (file)
index 8c7df32..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*********************************************************
- * Copyright (C) 2014-2016 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-#ifndef _CERT_UTIL_H_
-#define _CERT_UTIL_H_
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-/*
- *----------------------------------------------------------------------
- *
- * Error --
- *
- *    Prefix the error message with the program name and output the
- *    message to the standard error.
- *
- * Results:
- *    None.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
-
-#ifdef _WIN32
-#define Error(fmt, ...)                                         \
-   fprintf(stderr, "%s: " fmt, g_get_prgname(), __VA_ARGS__);
-#else
-#define Error(fmt, args...)                                     \
-   fprintf(stderr, "%s: " fmt, g_get_prgname(), ##args);
-#endif
-
-gchar *
-CertUtil_CreateCertFileName(const gchar *certDir, // IN
-                            const gchar *hash,    // IN
-                            int version);         // IN
-
-gboolean
-CertUtil_FindCert(const gchar *certFile,          // IN
-                  const gchar *certDir,           // IN
-                  const gchar *hash,              // IN
-                  int *num,                       // OUT
-                  int *last);                     // OUT
-
-gboolean
-CertUtil_CopyFile(const gchar *src,               // IN
-                  const gchar *dst);              // IN
-
-gboolean
-CertUtil_RemoveDir(const gchar *dirToRemove);     // IN
-
-const gchar *CertUtil_GetToolDir(void);
-
-gboolean CheckRootPriv(void);
-
-#endif // #ifndef _CERT_UTIL_H_
index e058dba0d5a615def80bae4193a21ccb823f255a..e2613c1803981f2825b07eb5c78684da16ceeee9 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2013-2016 VMware, Inc.  All rights reserved.
+### Copyright (C) 2013-2018 VMware, Inc.  All rights reserved.
 ###
 ### This program is free software; you can redistribute it and/or modify
 ### it under the terms of version 2 of the GNU General Public License as
 noinst_LTLIBRARIES = libSslDirect.la
 
 libSslDirect_la_CPPFLAGS =
-if ENABLE_GRABBITMQPROXY
-   libSslDirect_la_CPPFLAGS += @SSL_CPPFLAGS@
-endif
 
 libSslDirect_la_SOURCES =
-if ENABLE_GRABBITMQPROXY
-   libSslDirect_la_SOURCES += sslDirect.c
-else
-   libSslDirect_la_SOURCES += sslStubs.c
-endif
+libSslDirect_la_SOURCES += sslStubs.c
index 19719422f8c85542323185e47bab16e32fd2dec3..7b8492277e7c9647e61019a82e5903e70d723270 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2008-2016 VMware, Inc.  All rights reserved.
+### Copyright (C) 2008-2018 VMware, Inc.  All rights reserved.
 ###
 ### This program is free software; you can redistribute it and/or modify
 ### it under the terms of version 2 of the GNU General Public License as
@@ -58,11 +58,6 @@ libvmtools_la_LIBADD += @LIBVMTOOLS_LIBADD@
 libvmtools_la_LIBADD += @GLIB2_LIBS@
 libvmtools_la_LIBADD += @ICU_LIBS@
 
-if ENABLE_GRABBITMQPROXY
-   libvmtools_la_LIBADD += @SSL_LIBS@
-   libvmtools_la_LIBADD += -lcrypto
-endif
-
 if USE_SLASH_PROC
 libvmtools_la_LIBADD += ../lib/slashProc/libSlashProc.la
 endif
index cd18b9529c017188d3756238eb9c60240ff545a8..50c168b830533dc64050e177c0cfdc77f954af0c 100644 (file)
@@ -7,9 +7,6 @@ confdir = /etc/vmware-tools
 
 conf_SCRIPTS = ./common/vm-support
 conf_SCRIPTS += ./common/statechange.subr
-if ENABLE_GRABBITMQPROXY
-   conf_SCRIPTS += ./common/guestproxy-ssl.conf
-endif
 conf_SCRIPTS += $(defaultscripts)
 
 vmwsrcdir = $(confdir)/scripts/vmware
index b252d2e820faff47c43b0a4d5e43f993131bf782..2261e25a4953b87a1e6892670957f3e248140e8f 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2009-2017 VMware, Inc.  All rights reserved.
+### Copyright (C) 2009-2018 VMware, Inc.  All rights reserved.
 ###
 ### This program is free software; you can redistribute it and/or modify
 ### it under the terms of version 2 of the GNU General Public License as
@@ -22,9 +22,6 @@ endif
 if HAVE_GTKMM
    SUBDIRS += dndcp
 endif
-if ENABLE_GRABBITMQPROXY
-   SUBDIRS += grabbitmqProxy
-endif
 SUBDIRS += guestInfo
 SUBDIRS += hgfsServer
 SUBDIRS += powerOps
diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/COPYING b/open-vm-tools/services/plugins/grabbitmqProxy/COPYING
deleted file mode 100644 (file)
index 09f465a..0000000
+++ /dev/null
@@ -1,502 +0,0 @@
-                 GNU LESSER GENERAL PUBLIC LICENSE
-                      Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-                 GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                           NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/Makefile.am b/open-vm-tools/services/plugins/grabbitmqProxy/Makefile.am
deleted file mode 100644 (file)
index bc33b39..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-################################################################################
-### Copyright (C) 2014-2016 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-plugindir = @VMSVC_PLUGIN_INSTALLDIR@
-plugin_LTLIBRARIES = libgrabbitmqProxy.la
-
-libgrabbitmqProxy_la_CPPFLAGS =
-libgrabbitmqProxy_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
-libgrabbitmqProxy_la_CPPFLAGS += @SSL_CPPFLAGS@
-
-libgrabbitmqProxy_la_LDFLAGS =
-libgrabbitmqProxy_la_LDFLAGS += @PLUGIN_LDFLAGS@
-
-libgrabbitmqProxy_la_LIBADD =
-libgrabbitmqProxy_la_LIBADD += @VMTOOLS_LIBS@
-libgrabbitmqProxy_la_LIBADD += @SSL_LIBS@
-
-libgrabbitmqProxy_la_SOURCES =
-libgrabbitmqProxy_la_SOURCES += grabbitmqProxyPlugin.c
diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c b/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
deleted file mode 100644 (file)
index 69a653c..0000000
+++ /dev/null
@@ -1,1970 +0,0 @@
-/*********************************************************
- * Copyright (C) 2012-2018 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/**
- * @file grabbitmqProxyPlugin.c
- *
- * Guest RabbitMQ proxy, routing traffic to VMX RabbitMQ proxy.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#else
-#include <winsock2.h>
-#endif
-
-#define G_LOG_DOMAIN "grabbitmqProxy"
-
-#include "vm_assert.h"
-#include "vmware/tools/log.h"
-#include "vmware/tools/plugin.h"
-#include "vmware/tools/utils.h"
-#include "vmware/guestrpc/tclodefs.h"
-#include "vm_version.h"
-#include "embed_version.h"
-#include "vmtoolsd_version.h"
-#include "rpcout.h"
-#include "rabbitmqProxyConst.h"
-#include "vm_basic_types.h"
-#include "poll.h"
-#ifdef OPEN_VM_TOOLS
-#include "vmci_sockets.h"
-#include "sslDirect.h"
-#else
-#include "vsockCommon.h"
-#include "ssl.h"
-#endif
-#include "asyncsocket.h"
-#include "str.h"
-#include "util.h"
-#include "guestApp.h"
-
-#include <openssl/ssl.h>
-
-VM_EMBED_VERSION(VMTOOLSD_VERSION_STRING);
-
-#ifndef SOCKET_ERROR
-#define SOCKET_ERROR        (-1)
-#endif
-
-#ifndef sockerr
-#define sockerr()           errno
-#endif
-
-#define GUEST_RABBITMQ_PROXY_VERSION             "1.0"
-#define CONFGROUP_GRABBITMQ_PROXY                "grabbitmqproxy"
-
-#define DEFAULT_MAX_SEND_QUEUE_LEN               (256 * 1024)
-
-/*user level recv buffer */
-#define RMQ_CLIENT_CONN_RECV_BUFF_SIZE           (64 * 1024)
-
-/* these are socket level send/recv buffers */
-#define DEFAULT_RMQCLIENT_CONN_RECV_BUFF_SIZE    (64 * 1024)
-#define DEFAULT_RMQCLIENT_CONN_SEND_BUFF_SIZE    (64 * 1024)
-#define DEFAULT_VMX_CONN_RECV_BUFF_SIZE          (64 * 1024)
-#define DEFAULT_VMX_CONN_SEND_BUFF_SIZE          (64 * 1024)
-
-#define VC_UUID_SIZE 36
-
-/*  container for each connection details */
-typedef struct _ConnInfo {
-   Bool isRmqClient;
-   AsyncSocket *asock;
-   AsyncSocketRecvFn recvCb;
-   AsyncSocketSendFn sendCb;
-   AsyncSocketErrorFn errorCb;
-
-   gboolean shutDown;
-
-   int32 packetLen;
-   char *recvBuf;
-   int recvBufLen;
-
-   int sendQueueLen;
-
-   gboolean recvStopped;
-
-   struct _ConnInfo *toConn;  /* the corresponding vmx connection for RabbitMq
-                                 client connection, or vice versa. */
-} ConnInfo;
-
-typedef struct {
-   AsyncSocket *vmxListenSock;   /* for vsocket connection from VMX */
-   AsyncSocket *rmqListenSock;   /* for connections from RabbitMQ clients */
-
-   GList *rmqConnList;         /* list of connections from RabbitMQ client.
-                                * we do not need a list for vmx connection as
-                                * each vmx connection is attached to a RabbitMQ
-                                * client connection. */
-
-   ToolsAppCtx *ctx;           /* tools context */
-   gboolean messageTunnellingEnabled;    /* Status of Message bus Tunnelling */
-
-   int maxSendQueueLen;
-} GuestProxyData;
-
-static GuestProxyData proxyData;
-
-static void
-StopRecvFromConn(ConnInfo *conn);   // IN
-static void
-CloseConn(ConnInfo *conn);  // IN
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetConfigInt --
- *
- *      Get an integer number from tools config.
- *
- * Result:
- *      Return the configured integer value.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static int
-GetConfigInt(const char *name,      // IN
-             int defaultVal)        // IN
-{
-   GError *gerr = NULL;
-   int num = g_key_file_get_integer(proxyData.ctx->config,
-                                    CONFGROUP_GRABBITMQ_PROXY,
-                                    name,
-                                    &gerr);
-   if (gerr) {
-      g_clear_error(&gerr);
-      return defaultVal;
-   }
-
-   return num;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetConfigBool --
- *
- *      Get a boolean from tools config.
- *
- * Result:
- *      Return the configured boolean value.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-GetConfigBool(const char *name,           // IN
-              gboolean defaultVal)        // IN
-{
-   GError *gerr = NULL;
-   gboolean val = g_key_file_get_boolean(proxyData.ctx->config,
-                                         CONFGROUP_GRABBITMQ_PROXY,
-                                         name,
-                                         &gerr);
-   if (gerr) {
-      g_clear_error(&gerr);
-      return defaultVal;
-   }
-
-   return val;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetConnName --
- *
- *      return a name for a connection
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-static char *
-GetConnName(ConnInfo *conn)            // IN
-{
-   return conn->isRmqClient ? "client" : "vmx";
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ShutDownConn --
- *
- *      Close connection immediately if its send buffer is empty, otherwise
- *      mark it is being shut down and stop receivng and wait for the send
- *      buffer to be cleared.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-ShutDownConn(ConnInfo *conn)            // IN
-{
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   conn->toConn = NULL;
-   if (conn->sendQueueLen > 0) {
-      g_info("Shutting down %s connection %d.\n",
-             GetConnName(conn), AsyncSocket_GetFd(conn->asock));
-      conn->shutDown = TRUE;
-      StopRecvFromConn(conn);
-   } else {
-      CloseConn(conn);
-   }
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * CloseConn --
- *
- *      Close a socket connection and its corresponding vmx or client
- *      connection. Remove the connection from client connection list if
- *      it is a client connection. The corresponding peer connection is not
- *      closead immediately if its send buffer is not empty, we will wait for
- *      the send buffer to be empty by marking a shutdown flag only.
- *
- *      Note: AsyncSocket does not differentiate read/write errors yet and
- *      does not try to send any data to the other end on close, so pending
- *      send data is dropped when a connection is closed even the socket may
- *      be still good for write. We might need to handle partial socket
- *      shutdown later.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-CloseConn(ConnInfo *conn)   // IN
-{
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   ASSERT(conn->asock != NULL);
-
-   if (conn->toConn != NULL) {
-      ShutDownConn(conn->toConn);
-      conn->toConn = NULL;
-   }
-   g_info("Closing %s connection %d\n", GetConnName(conn),
-          AsyncSocket_GetFd(conn->asock));
-
-   AsyncSocket_Close(conn->asock);
-   conn->asock = NULL;
-   free(conn->recvBuf);
-   conn->recvBuf = NULL;
-
-   /* remove the connection from corresponding conn list */
-   if (conn->isRmqClient) {
-      proxyData.rmqConnList = g_list_remove(proxyData.rmqConnList, conn);
-   }
-   free(conn);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * AssignVmxConn --
- *
- *      Assign vmx connection to a RabbitMq client connection.
- *
- * Result:
- *      TURE on success, FALSE otherwise.
- *
- * Side-effects:
- *      None
- *-----------------------------------------------------------------------------
- */
-
-static Bool
-AssignVmxConn(ConnInfo *conn)    // IN
-{
-   GList *lp;
-
-   for(lp = proxyData.rmqConnList; lp; lp = g_list_next(lp)) {
-      ConnInfo *cli = (ConnInfo *)(lp->data);
-      if (cli->toConn == NULL) {
-         cli->toConn = conn;
-         conn->toConn = cli;
-         return TRUE;
-      }
-   }
-
-   return FALSE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * StartRecvFromRmqClient --
- *
- *      Register recv callback for RabbitMQ client connection.
- *
- * Result:
- *      TURE on success, FALSE otherwise.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-StartRecvFromRmqClient(ConnInfo *conn)   // IN
-{
-   int res;
-
-   ASSERT(AsyncSocket_GetState(conn->asock) == AsyncSocketConnected);
-
-   if (conn->recvBuf == NULL) {
-      conn->recvBufLen = RMQ_CLIENT_CONN_RECV_BUFF_SIZE;
-      conn->recvBuf = malloc(conn->recvBufLen);
-      if (conn->recvBuf == NULL) {
-         g_info("Error in allocating recv buffer for socket %d, "
-                "closing connection.\n",
-                AsyncSocket_GetFd(conn->asock));
-         CloseConn(conn);
-         return FALSE;
-      }
-   }
-
-   res = AsyncSocket_RecvPartial(conn->asock, conn->recvBuf,
-                                 conn->recvBufLen,
-                                 conn->recvCb, conn);
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in AsyncSocket_RecvPartial for socket %d: %s\n",
-             AsyncSocket_GetFd(conn->asock), AsyncSocket_Err2String(res));
-      CloseConn(conn);
-      return FALSE;
-   }
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * StartRecvFromVmx --
- *
- *      Register recv callback for VMX connection.
- *
- * Result:
- *      TURE on success, FALSE otherwise.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-StartRecvFromVmx(ConnInfo *conn)   // IN
-{
-   int res;
-   res = AsyncSocket_Recv(conn->asock, &conn->packetLen,
-                          sizeof conn->packetLen,
-                          conn->recvCb, conn);
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in AsyncSocket_Recv for socket %d: %s\n",
-             AsyncSocket_GetFd(conn->asock), AsyncSocket_Err2String(res));
-      CloseConn(conn);
-      return FALSE;
-   }
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * RecvPacketFromVmxConn --
- *
- *      Wrapper function for recving a dataMap packet from VMX connection.
- *
- * Result:
- *      TURE on success, FALSE otherwise.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-RecvPacketFromVmxConn(ConnInfo *conn, int len)
-{
-   int res;
-
-   res = AsyncSocket_Recv(conn->asock, conn->recvBuf + sizeof conn->packetLen,
-         len, conn->recvCb, conn);
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in AsyncSocket_Recv for socket %d: %s\n",
-             AsyncSocket_GetFd(conn->asock), AsyncSocket_Err2String(res));
-      CloseConn(conn);
-      return FALSE;
-   }
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ConnSendDoneCb --
- *
- *      Callback function when some data is sent over a connection.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-ConnSendDoneCb(void *buf,            // IN
-               int len,              // IN
-               AsyncSocket *asock,   // IN
-               void *clientData)     // IN
-{
-   ConnInfo *dst = (ConnInfo *)clientData;
-   ConnInfo *src = dst->toConn;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   free(buf);
-
-   if (AsyncSocket_GetState(asock) != AsyncSocketConnected) {
-      /* this callback may be called after the connection is closed to
-       * empty the send buffer */
-      return;
-   }
-
-   dst->sendQueueLen -= len;
-   ASSERT(dst->sendQueueLen >= 0);
-
-   if (dst->sendQueueLen == 0 && dst->shutDown) {
-      g_info("Closing %s connection %d as sendbuffer is now empty.\n",
-             GetConnName(dst), AsyncSocket_GetFd(dst->asock));
-      CloseConn(dst);
-      return;
-   }
-
-   g_debug("%d bytes sent to %s connection %d, sendQueueLen = %d\n",
-           len, GetConnName(dst), AsyncSocket_GetFd(dst->asock),
-           dst->sendQueueLen);
-
-   if ((!(dst->shutDown)) && src->recvStopped &&
-       (dst->sendQueueLen < proxyData.maxSendQueueLen)) {
-      g_debug("Restart reading from connection %d.\n",
-              AsyncSocket_GetFd(src->asock));
-
-      src->recvStopped = FALSE;
-      if (src->isRmqClient) {
-         StartRecvFromRmqClient(src);
-      } else {
-         StartRecvFromVmx(src);
-      }
-   }
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * StopRecvFromConn --
- *
- *      Temporarily stop recving from a given connection.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-StopRecvFromConn(ConnInfo *conn)   // IN
-{
-   int res;
-   g_debug("Temporarily stop reading from socket %d.\n",
-            AsyncSocket_GetFd(conn->asock));
-   res = AsyncSocket_CancelRecvEx(conn->asock, NULL, NULL, NULL, TRUE);
-   ASSERT(res == ASOCKERR_SUCCESS);
-   conn->recvStopped = TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * SendToConn --
- *
- *      Call AsyncSocket_Send to queue the buffer for send.
- *      - If there is too much data queued, then recv from
- *        source connection is temporarily stopped.
- *
- * Result:
- *      TRUE on success, FALSE otherwise.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-SendToConn(ConnInfo *dst,          // IN/OUT
-           char *buf,              // IN
-           int len)                // IN
-{
-   ConnInfo *src = dst->toConn;
-   int res;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   res = AsyncSocket_Send(dst->asock, buf, len, dst->sendCb, dst);
-
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in AsyncSocket_Send for socket %d, "
-             "closing connection: %s\n",
-             AsyncSocket_GetFd(dst->asock), AsyncSocket_Err2String(res));
-      free(buf);     /* need to free here */
-      CloseConn(dst);
-      return FALSE;
-   }
-
-   g_debug("Sending %d bytes to socket %d\n", len,
-           AsyncSocket_GetFd(dst->asock));
-
-   dst->sendQueueLen += len;
-   g_debug("Socket %d sendQueueLen = %d\n",
-           AsyncSocket_GetFd(dst->asock), dst->sendQueueLen);
-
-   if ((!src->recvStopped) && (dst->sendQueueLen > proxyData.maxSendQueueLen)) {
-      StopRecvFromConn(src);
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * SendVmxConnectRequest --
- *
- *      Notify VMX the listening port via RPC command so VMX can connect to
- *      the guest proxy.
- *      - 'sock': listening socket struct
- *
- * Result:
- *      TRUE on success, FALSE otherwise
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-SendVmxConnectRequest(void)
-{
-   AsyncSocket *asock = proxyData.vmxListenSock;
-   gboolean ok;
-   struct sockaddr_vm addr;
-   socklen_t len = sizeof addr;
-   int port;
-   int fd;
-   gchar *msg;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   ASSERT(asock != NULL);
-
-   fd = AsyncSocket_GetFd(asock);
-   ASSERT(fd >= 0);
-
-   /* get the listening port */
-   if (getsockname(fd, (struct sockaddr *)&addr, &len) == SOCKET_ERROR) {
-      g_warning("Error in socket getsockname: error=%d.\n", sockerr());
-      return FALSE;
-   }
-
-   port = addr.svm_port;
-
-   msg = g_strdup_printf("xrabbitmqProxy.connect %d", port);
-   ok = RpcChannel_Send(proxyData.ctx->rpc, msg, strlen(msg), NULL, NULL);
-   if (!ok) {
-      g_warning("Failed to send connect request to VMX RabbitMQ Proxy.\n");
-   }
-   g_free(msg);
-
-   return ok;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * SendToVmxRmqProxy --
- *
- *      Package RabbitMQ Client data and send it to VMX RabbitMQ Proxy.
- *
- * Result:
- *      TRUE on sucess, FALSE on error
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-SendToVmxRmqProxy(ConnInfo *cli,     // IN
-                  char *buf,         // IN
-                  int len)           // IN
-{
-   DataMap map;
-   ErrorCode res;
-   char *newBuf;
-   char *serBuf;
-   int bufLen;
-   gboolean mapCreated = FALSE;
-   char *ver;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   res = DataMap_Create(&map);
-   if (res != DMERR_SUCCESS) {
-      goto quit;
-   }
-
-   mapCreated = TRUE;
-
-   res = DataMap_SetInt64(&map, RMQPROXYDM_FLD_COMMAND,
-                          COMMAND_DATA, TRUE);
-   if (res != DMERR_SUCCESS) {
-      goto quit;
-   }
-
-   ver = strdup(GUEST_RABBITMQ_PROXY_VERSION);
-   if (ver == NULL) {
-      res = DMERR_INSUFFICIENT_MEM;
-      goto quit;
-   }
-   res = DataMap_SetString(&map, RMQPROXYDM_FLD_GUEST_VER_ID, ver, -1, TRUE);
-   if (res != DMERR_SUCCESS) {
-      goto quit;
-   }
-
-   newBuf = malloc(len);
-   if (newBuf == NULL) {
-      g_warning("Error in allocating memory.\n");
-      goto quit;
-   }
-   memcpy(newBuf, buf, len);
-   res = DataMap_SetString(&map, RMQPROXYDM_FLD_PAYLOAD, newBuf,
-                           len, TRUE);
-   if (res != DMERR_SUCCESS) {
-      goto quit;
-   }
-
-   res = DataMap_Serialize(&map, &serBuf, &bufLen);
-   if (res != DMERR_SUCCESS) {
-      goto quit;
-   }
-
-   DataMap_Destroy(&map);
-   return SendToConn(cli->toConn, serBuf, bufLen);
-
-quit:
-   if (mapCreated) {
-      DataMap_Destroy(&map);
-   }
-   g_info("Error in dataMap encoding for socket %d, error=%d, "
-          "closing connection.\n",
-          AsyncSocket_GetFd(cli->asock), res);
-   CloseConn(cli);
-   return FALSE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * RmqClientConnRecvedCb --
- *
- *      Callback function when some data is recved from RabbitMQ client.
- *
- * Result:
- *      TRUE to continue polling, FALSE to discontinue polling.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-RmqClientConnRecvedCb(void *buf,            // IN
-                      int len,              // IN
-                      AsyncSocket *asock,   // IN
-                      void *clientData)     // IN
-{
-   ConnInfo *conn = (ConnInfo *)clientData;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   g_debug("Recved %d bytes from client connection %d\n", len,
-           AsyncSocket_GetFd(conn->asock));
-   ASSERT(buf == conn->recvBuf);
-   if (SendToVmxRmqProxy(conn, conn->recvBuf, len)) {
-      StartRecvFromRmqClient(conn);
-   }
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ProcessVmxDataPacket --
- *
- *      Process the dataMap packet received from VMX.
- *
- * Result:
- *      TRUE on success, FALSE on error.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-ProcessVmxDataPacket(ConnInfo *cli,     // IN
-                     DataMap *map)      // IN
-{
-   ErrorCode res;
-   int64 cmdType;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   res = DataMap_GetInt64(map, RMQPROXYDM_FLD_COMMAND, &cmdType);
-   ASSERT(res == DMERR_SUCCESS);
-
-   switch (cmdType) {
-      case COMMAND_DATA:
-         {
-            char *buf;
-            int payloadLen;
-            char *payload;
-
-            res = DataMap_GetString(map, RMQPROXYDM_FLD_PAYLOAD,
-                                    &payload, &payloadLen);
-            ASSERT(res == DMERR_SUCCESS && payloadLen > 0);
-            buf = malloc(payloadLen); /* get rid of this ? */
-
-            if (buf) {
-               memcpy(buf, payload, payloadLen);
-               return SendToConn(cli, buf, payloadLen);
-            } else {
-               g_warning("Could not allocate buffer for socket %d, "
-                         "closing connection.\n",
-                         AsyncSocket_GetFd(cli->asock));
-               CloseConn(cli);
-               return FALSE;
-            }
-            break;
-         }
-      case COMMAND_CLOSE:
-         {
-            g_debug("Closing connection %d as instructed.\n",
-                    AsyncSocket_GetFd(cli->asock));
-            CloseConn(cli);
-            return FALSE;
-         }
-      case COMMAND_CONNECT:
-         break;
-      default:
-         g_debug("Unknown dataMap packet type from connection %d!\n",
-                 AsyncSocket_GetFd(cli->asock));
-         CloseConn(cli);
-         return FALSE;
-   }
-
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ProcessPacketHeaderLen --
- *
- *      Helper function to handle once a dataMap packet length is known.
- *
- * Results:
- *      None
- *
- * Side effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-ProcessPacketHeaderLen(ConnInfo *conn,   // IN
-                       int len)          // IN
-{
-   int pktLen = ntohl(conn->packetLen);
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (conn->recvBuf == NULL || conn->recvBufLen < pktLen + len) {
-      conn->recvBufLen = pktLen + len;
-      free(conn->recvBuf);
-      conn->recvBuf = malloc(pktLen + len);
-      if (conn->recvBuf == NULL) {
-         g_info("Could not allocate recv buffer for socket %d, "
-                "closing connection.\n", AsyncSocket_GetFd(conn->asock));
-         CloseConn(conn);
-         return;
-      }
-   }
-
-   *((int32 *)(conn->recvBuf)) = conn->packetLen;
-   RecvPacketFromVmxConn(conn, pktLen);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * VmxConnRecvedCb --
- *
- *      Callback function when data from VMX vsocket connection is recved.
- *
- * Result:
- *      TRUE to continue polling, FALSE to discontinue polling.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-VmxConnRecvedCb(void *buf,            // IN
-                int len,              // IN
-                AsyncSocket *asock,   // IN
-                void *clientData)     // IN
-{
-   ConnInfo *conn = (ConnInfo *)clientData;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (buf == &conn->packetLen) {
-      ASSERT(len == sizeof conn->packetLen);
-      ProcessPacketHeaderLen(conn, len);
-   } else {
-      DataMap map;
-      ErrorCode res;
-      int packetLen = len + sizeof conn->packetLen;
-
-      /* decoding the packet */
-      res = DataMap_Deserialize(conn->recvBuf, packetLen, &map);
-      ASSERT(res == DMERR_SUCCESS);
-
-      if (ProcessVmxDataPacket(conn->toConn, &map)) {
-         StartRecvFromVmx(conn); /* continue to recv next packet */
-      }
-
-      DataMap_Destroy(&map);
-   }
-
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ConnErrorHandlerCb --
- *
- *      Connection error handler for asyncsocket.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-ConnErrorHandlerCb(int err,             // IN
-                   AsyncSocket *asock,  // IN
-                   void *clientData)    // IN
-{
-   ConnInfo *conn = (ConnInfo *)clientData;
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   ASSERT(conn->asock != NULL);
-   g_info("Error code %d, on %s connection %d\n", err, GetConnName(conn),
-          AsyncSocket_GetFd(conn->asock));
-
-   CloseConn(conn);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * VmxListenSockConnectedCb --
- *
- *      Poll callback function for a new VMX connection.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *-----------------------------------------------------------------------------
- */
-
-void
-VmxListenSockConnectedCb(AsyncSocket *asock,    // IN
-                         void *clientData)      // IN
-{
-   int res;
-   int fd = AsyncSocket_GetFd(asock);
-   ConnInfo *conn = NULL;
-   int sendBufSize = GetConfigInt("vmxSendBufferSize",
-                                  DEFAULT_VMX_CONN_SEND_BUFF_SIZE);
-   int recvBufSize = GetConfigInt("vmxRecvBufferSize",
-                                  DEFAULT_VMX_CONN_RECV_BUFF_SIZE);
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   g_info("Got vmx connection, socket=%d\n", fd);
-
-   if (AsyncSocket_GetState(asock) != AsyncSocketConnected) {
-      g_info("Socket %d is not connected, closing\n", fd);
-      goto exit;
-   }
-
-   if (!AsyncSocket_EstablishMinBufferSizes(asock, sendBufSize, recvBufSize)) {
-      g_info("Cannot set VSOCK buffer size minima, closing socket %d\n", fd);
-      goto exit;
-   }
-
-   conn = calloc(1, sizeof *conn);
-   if (conn == NULL) {
-      g_warning("Could not allocate memory, closing socket %d\n", fd);
-      goto exit;
-   }
-
-   conn->asock = asock;
-   conn->recvCb = VmxConnRecvedCb;
-   conn->sendCb = ConnSendDoneCb;
-   conn->errorCb = ConnErrorHandlerCb;
-
-   res = AsyncSocket_SetErrorFn(asock, conn->errorCb, conn);
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in set error handler for socket %d\n", fd);
-      goto exit;
-   }
-
-   if (!AssignVmxConn(conn)) {
-      g_warning("Could not find RabbitMQ client connection for vmx connection, "
-                "closing connection ...\n");
-      goto exit;
-   }
-
-   if (StartRecvFromVmx(conn)) {
-      StartRecvFromRmqClient(conn->toConn);
-   }
-   return;
-
-exit:
-   AsyncSocket_Close(asock);
-   free(conn);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * RmqClientSockHandShakeCb --
- *
- *      Callback function when a RabbitMQ client connection completes the
- *      SSL hand shake.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-RmqClientSockHandShakeCb(Bool status,           // IN
-                         AsyncSocket *asock,    // IN
-                         void *clientData)      // IN
-{
-   ConnInfo *conn;
-   int fd, res;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (!status) {
-      g_warning("Failed SSL hand shake in socket %d, closing connection.\n",
-                AsyncSocket_GetFd(asock));
-      goto exit;
-   }
-
-   fd = AsyncSocket_GetFd(asock);
-
-   g_info("Established new RabbitMQ client connection %d.\n", fd);
-
-   if (!SendVmxConnectRequest()) {
-      g_warning("Closing RabbitMQ client connection %d due to error in "
-                "sending connection request!\n", fd);
-      goto exit;
-   }
-
-   /* add to the client connection list */
-   conn = calloc(1, sizeof *conn);
-   if (conn == NULL) {
-      g_warning("Could not allocate memory, closing socket %d\n", fd);
-      goto exit;
-   }
-
-   conn->isRmqClient = TRUE;
-   conn->asock = asock;
-   conn->recvCb = RmqClientConnRecvedCb;
-   conn->sendCb = ConnSendDoneCb;
-   conn->errorCb = ConnErrorHandlerCb;
-
-   res = AsyncSocket_SetErrorFn(asock, conn->errorCb, conn);
-   if (res != ASOCKERR_SUCCESS) {
-      g_info("Error in set error handler for socket %d\n", fd);
-      free(conn);
-      goto exit;
-   }
-
-   proxyData.rmqConnList = g_list_append(proxyData.rmqConnList, conn);
-
-   /* we start recv only after the vmx connection is established,
-      so we do not need to buffer no-destination content */
-   return;
-
-exit:
-   AsyncSocket_Close(asock);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetProxyDataDir --
- *
- *      Find out the guest proxy data directory.
- *
- * Result:
- *      Return the path of the guest proxy data directory.
- *      NULL if there is an error.
- *      Caller should treat the returned string as static, and not free it.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-static const char *
-GetProxyDataDir(void)
-{
-   static char *proxyDataDir = NULL;
-   char *confPath = NULL;
-
-   if (proxyDataDir) {
-      goto done;
-   }
-
-   confPath = GuestApp_GetConfPath();
-   if (confPath) {
-      proxyDataDir = g_strdup_printf("%s%sGuestProxyData", confPath, DIRSEPS);
-   }
-
-done:
-   free(confPath);
-
-   return proxyDataDir;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetSslCertFile --
- *
- *      Find out the SSL certicate file path
- *
- * Result:
- *      The SSL certificate file path
- *      NULL if there is an error.
- *      Caller should treat the returned string as static, and not free it.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static const char *
-GetSslCertFile(void)
-{
-   static char *certFile = NULL;
-   const char *dataDir;
-
-   if (certFile) {
-      goto done;
-   }
-
-   dataDir = GetProxyDataDir();
-   if (dataDir) {
-      certFile = g_strdup_printf("%s%sserver%scert.pem", dataDir, DIRSEPS,
-                                 DIRSEPS);
-   }
-
-done:
-   return certFile;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetSslKeyFile --
- *
- *      Find out the SSL key file path
- *
- * Result:
- *      The SSL key file path
- *      NULL if there is an error.
- *      Caller should treat the returned string as static, and not free it.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static const char *
-GetSslKeyFile(void)
-{
-   static char *keyFile = NULL;
-   const char *dataDir;
-
-   if (keyFile) {
-      goto done;
-   }
-
-   dataDir = GetProxyDataDir();
-   if (dataDir) {
-      keyFile = g_strdup_printf("%s%sserver%skey.pem", dataDir, DIRSEPS,
-                                DIRSEPS);
-   }
-
-done:
-   return keyFile;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetSslTrustDir --
- *
- *      Find out the SSL trusted client certificate directory path.
- *
- * Result:
- *      The SSL trusted client certificate directory path.
- *      NULL if there is an error.
- *      Caller should treat the returned string as static, and not free it.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static const char *
-GetSslTrustDir(void)
-{
-   static char *trustDir = NULL;
-   const char *dataDir;
-
-   if (trustDir) {
-      goto done;
-   }
-
-   dataDir = GetProxyDataDir();
-   if (dataDir) {
-      trustDir = g_strdup_printf("%s%strusted", dataDir, DIRSEPS);
-   }
-
-done:
-   return trustDir;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * TheSslContext --
- *
- *      Create and cache a global SSL_CTX object
- *
- * Result:
- *      The SSL_CTX object created.
- *      NULL if there is an error.
- *      Caller should not free the SSL context returned.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static SSL_CTX *
-TheSslContext(void)
-{
-   static SSL_CTX *sslCtx = NULL;
-   SSL_CTX *workingCtx = NULL;
-   const char *certFile;
-   const char *keyFile;
-   const char *trustDir;
-   long sslCtxOptions;
-
-   if (sslCtx) {
-      goto done;
-   }
-
-   workingCtx = SSL_NewContext();
-   if (!workingCtx) {
-      g_warning("Cannot create the SSL context.\n");
-      goto done;
-   }
-
-   /*
-    * The bora/lib/ssl code not yet ready to disable TLS1, and TLS1_1,
-    * we shall remove the code below once it is able to.
-    */
-   sslCtxOptions = SSL_CTX_get_options(workingCtx);
-   /* Allow only TLSv1_2 */
-
-#ifdef SSL_OP_NO_TLSv1
-   sslCtxOptions |= SSL_OP_NO_TLSv1;
-#endif
-
-#ifdef SSL_OP_NO_TLSv1_1
-   sslCtxOptions |= SSL_OP_NO_TLSv1_1;
-#endif
-
-   SSL_CTX_set_options(workingCtx, sslCtxOptions);
-
-   certFile = GetSslCertFile();
-   if (!certFile) {
-      g_warning("Cannot find the certificate file\n");
-      goto done;
-   }
-   if (!SSL_CTX_use_certificate_file(workingCtx, certFile,
-                                     SSL_FILETYPE_PEM)) {
-      g_warning("Cannot load the certificate file: %s\n", certFile);
-      goto done;
-   }
-
-   keyFile = GetSslKeyFile();
-   if (!keyFile) {
-      g_warning("Cannot find the key file\n");
-      goto done;
-   }
-   if (!SSL_CTX_use_PrivateKey_file(workingCtx, keyFile,
-                                    SSL_FILETYPE_PEM)) {
-      g_warning("Cannot load the key file: %s\n", keyFile);
-      goto done;
-   }
-
-   trustDir = GetSslTrustDir();
-   if (!trustDir) {
-      g_warning("Cannot find the trusted client certificate directory\n");
-      goto done;
-   }
-   if (!SSL_CTX_load_verify_locations(workingCtx, NULL, trustDir)) {
-      g_warning("Cannot load the trusted cert directory: %s\n", trustDir);
-      goto done;
-   }
-
-   SSL_CTX_set_verify(workingCtx, SSL_VERIFY_PEER |
-                      SSL_VERIFY_FAIL_IF_NO_PEER_CERT | SSL_VERIFY_CLIENT_ONCE,
-                      NULL);
-
-   sslCtx = workingCtx;
-   workingCtx = NULL;
-
-done:
-   if (workingCtx) {
-      SSL_CTX_free(workingCtx);
-   }
-
-   return sslCtx;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * RmqListenSockConnectedCb --
- *
- *      Poll callback function when a new RabbitMQ client connection.
- *      listen socket.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-void
-RmqListenSockConnectedCb(AsyncSocket *asock,    // IN
-                         void *clientData)      // IN
-{
-   int fd = AsyncSocket_GetFd(asock);
-   int sendBufSize = GetConfigInt("rmqClientSendBuffer",
-                                  DEFAULT_RMQCLIENT_CONN_SEND_BUFF_SIZE);
-   int recvBufSize = GetConfigInt("rmqClientRecvBuffer",
-                                  DEFAULT_RMQCLIENT_CONN_RECV_BUFF_SIZE);
-
-
-   g_debug("Entering %s\n", __FUNCTION__);
-   g_info("Got new RabbitMQ client connection %d.\n", fd);
-
-   if (AsyncSocket_GetState(asock) != AsyncSocketConnected) {
-      g_info("Socket %d is not connected, closing.\n", fd);
-      goto exit;
-   }
-
-   if (!AsyncSocket_EstablishMinBufferSizes(asock, sendBufSize, recvBufSize)) {
-      g_info("Closing socket %d due to error.\n", fd);
-      goto exit;
-   }
-
-   if (GetConfigBool("ssl", TRUE)) {
-      SSL_CTX *sslCtx = TheSslContext();
-      if (!sslCtx) {
-         g_warning("Closing socket %d due to the invalid ssl context.\n", fd);
-         goto exit;
-      }
-
-      AsyncSocket_StartSslAccept(asock, sslCtx, RmqClientSockHandShakeCb, NULL);
-   } else {
-      RmqClientSockHandShakeCb(TRUE, asock, NULL);
-   }
-
-   return;
-
-exit:
-   AsyncSocket_Close(asock);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * CreateVmxListenSocket --
- *
- *      Create listening socket for VMX vsocket connection. The auto assigned
- *      port will be sent to VMX via RPC.
- *
- * Result:
- *      TRUE on success, FALSE otherwise
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-CreateVmxListenSocket(void)
-{
-   int res = ASOCKERR_SUCCESS;
-   AsyncSocket *asock;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   asock = AsyncSocket_ListenVMCI(VMCISock_GetLocalCID(), VMADDR_PORT_ANY,
-                                  VmxListenSockConnectedCb,
-                                  NULL, NULL, &res);
-
-   if (asock == NULL || res != ASOCKERR_SUCCESS) {
-      g_info("Could not create listening socket for VMX proxy connection: %s\n",
-             AsyncSocket_Err2String(res));
-      if (asock != NULL) {
-         AsyncSocket_Close(asock);
-      }
-      return FALSE;
-   }
-
-   proxyData.vmxListenSock = asock;
-
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * CreateRmqListenSocket --
- *
- *      Create listening socket for RabbitMQ clients.
- *
- * Result:
- *      TRUE on success, FALSE otherwise
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-CreateRmqListenSocket(void)
-{
-   int defaultPort = 6672;  /* default RabbitMQ Proxy listening port */
-   int port;
-   int res = ASOCKERR_SUCCESS;
-   AsyncSocket *asock;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   port = GetConfigInt("port", defaultPort);
-
-   if (GetConfigBool("enableNetworkConnections", FALSE)) {
-      asock = AsyncSocket_Listen(NULL, port, RmqListenSockConnectedCb,
-                                 NULL, NULL, &res);
-   } else {
-      asock = AsyncSocket_ListenLoopback(port, RmqListenSockConnectedCb,
-                                         NULL, NULL, &res);
-   }
-
-   if (asock == NULL || res != ASOCKERR_SUCCESS) {
-      g_info("Error in creating listening socket for RabbitMQ client: %s\n",
-             AsyncSocket_Err2String(res));
-      if (asock != NULL) {
-         AsyncSocket_Close(asock);
-      }
-      return FALSE;
-   }
-
-   proxyData.rmqListenSock = asock;
-
-   return TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * InitProxyData --
- *
- *      Init proxyData structure.
- *      - 'ctx': ToolsAppCtx
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-InitProxyData(ToolsAppCtx *ctx)   // IN
-{
-   /* init proxyData */
-   memset(&proxyData, 0, sizeof proxyData);
-
-   proxyData.ctx = ctx;
-   proxyData.messageTunnellingEnabled = FALSE;
-   proxyData.maxSendQueueLen = GetConfigInt("maxSendQueueLen",
-                                            DEFAULT_MAX_SEND_QUEUE_LEN);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetVmVcUuidFromVmx --
- *
- *      Send a GuestRpc command to VMX to retrieve the VM's VC uuid.
- *
- * Result:
- *      The VM's vc uuid if successful.
- *      NULL otherwise.
- *      Caller needs to free the returned result string.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static char *
-GetVmVcUuidFromVmx(void)
-{
-   char *vcUuid;
-   char *reply = NULL;
-   size_t replyLen;
-   gboolean ok;
-   gchar *msg = "xrabbitmqProxy.getVmVcUuid";
-
-   /* check VMX to see if proxy is enabled or not */
-   ok = RpcChannel_Send(proxyData.ctx->rpc, msg, strlen(msg),
-                        &reply, &replyLen);
-   if (!ok) {
-      g_warning("Guest rpc call to VMX failed, "
-                "cannot retrieve vc uuid from vmx.\n");
-      RpcChannel_Free(reply);
-      return NULL;
-   }
-
-   if (replyLen > VC_UUID_SIZE) {
-      g_warning("Guest rpc call to VMX failed, "
-                "the returned vc uuid too large.\n");
-      RpcChannel_Free(reply);
-      return NULL;
-   }
-
-   vcUuid = Util_SafeMalloc(replyLen + 1);
-   Str_Strcpy(vcUuid, reply, replyLen + 1);
-
-   g_info("Guest rpc call to VMX, retrieved vc uuid %s\n",
-          vcUuid);
-
-   RpcChannel_Free(reply);
-   return vcUuid;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GetVmVcUuidDir --
- *
- *      Return the directory to publish the VM's vc uuid
- *
- * Result:
- *      A string represents where to publish the VM's vc uuid
- *      NULL otherwise.
- *      Caller should not free the returned string
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static const char *
-GetVmVcUuidDir(void) // IN
-{
-   static char *vmVcUuidDir = NULL;
-   const char *proxyDataDir;
-
-   if (vmVcUuidDir) {
-      goto done;
-   }
-
-   proxyDataDir = GetProxyDataDir();
-   if (proxyDataDir) {
-      vmVcUuidDir = g_strdup_printf("%s%sVmVcUuid", proxyDataDir, DIRSEPS);
-   }
-
-done:
-   return vmVcUuidDir;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * PublishVmVcUuid --
- *
- *      Publish the vc uuid in the guest
- *
- * Result:
- *      TRUE if successful
- *      FALSE otherwise
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static gboolean
-PublishVmVcUuid(const char *vcUuid) // IN
-{
-   gboolean status = FALSE;
-   GError *err = NULL;
-   char *filename = NULL;
-   const char *dir = GetVmVcUuidDir();
-
-   if (!dir) {
-      g_warning("Cannot find out the VM VC UUID path\n");
-      goto done;
-   }
-
-   if (g_mkdir_with_parents(dir, 0755) < 0) {
-      g_warning("Cannot create directory %s\n", dir);
-      goto done;
-   }
-
-   filename = g_strdup_printf("%s%svm.vc.uuid", dir, DIRSEPS);
-   g_assert(filename);
-
-   g_file_set_contents(filename, vcUuid, -1, &err);
-   if (err != NULL)  {
-      g_warning("Cannot write the vc uuid to file %s, %s\n", filename,
-                err->message);
-      goto done;
-   }
-
-   status = TRUE;
-
-done:
-
-   if (err) {
-      g_error_free(err);
-   }
-   g_free(filename);
-
-   return status;
-}
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * GRabbitmqProxyDisableMessageTunnelling --
- *
- *     Clean up sockets and connections.
- *
- * Results:
- *      None
- *
- * Side-effects:
- *      None
- *
- *----------------------------------------------------------------------------
- */
-
-static void
-GRabbitmqProxyDisableMessageTunnelling()
-{
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (proxyData.vmxListenSock) {
-      AsyncSocket_Close(proxyData.vmxListenSock);
-      proxyData.vmxListenSock = NULL;
-   }
-
-   if (proxyData.rmqListenSock) {
-      AsyncSocket_Close(proxyData.rmqListenSock);
-      proxyData.rmqListenSock = NULL;
-   }
-
-   while (proxyData.rmqConnList != NULL) {
-      ConnInfo *cli = (ConnInfo *)(proxyData.rmqConnList->data);
-      CloseConn(cli);
-   }
-
-   proxyData.messageTunnellingEnabled = FALSE;
-}
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * GRabbitmqProxyEnableMessageTunnelling --
- *
- *     Creates the sockets and starts listening.
- *
- * Results:
- *      None
- *
- * Side-effects:
- *      None
- *
- *----------------------------------------------------------------------------
- */
-
-static void
-GRabbitmqProxyEnableMessageTunnelling()
-{
-   char * vcUuid;
-
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (proxyData.messageTunnellingEnabled) {
-      return;
-   }
-
-   vcUuid = GetVmVcUuidFromVmx();
-
-   if (!vcUuid) {
-      g_warning("Failed to get vc uuid, disable the rabbitmq proxy");
-      return;
-   }
-
-   if (!PublishVmVcUuid(vcUuid))
-   {
-      g_warning("Failed to publish vc uuid, disable the rabbitmq proxy");
-      free(vcUuid);
-      return;
-   }
-
-   free(vcUuid);
-
-   if (!CreateVmxListenSocket() || !CreateRmqListenSocket()) {
-      g_warning("The proxy is disabled due to initialization error.\n");
-      GRabbitmqProxyDisableMessageTunnelling();
-      return;
-   }
-
-   proxyData.messageTunnellingEnabled = TRUE;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GRabbitmqProxyShutdown --
- *
- *      Clean up internal state on shutdown.
- *
- * Result:
- *      None
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-static void
-GRabbitmqProxyShutdown(gpointer src,                 // IN
-                       ToolsAppCtx *ctx,             // IN
-                       ToolsPluginData *plugin)      // IN
-{
-   g_debug("Entering %s\n", __FUNCTION__);
-
-   if (proxyData.messageTunnellingEnabled) {
-      GRabbitmqProxyDisableMessageTunnelling();
-   }
-}
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * GRabbitmqProxySetOption --
- *
- *      Handles a "Set_Option" callback. Handles
- *      TOOLSOPTION_ENABLE_MESSAGE_BUS_TUNNEL by enabling or disabling
- *      the message bus tunnel.
- *
- * Result:
- *      TRUE on success.
- *
- * Side-effects:
- *      None
- *
- *----------------------------------------------------------------------------
- */
-
-static gboolean
-GRabbitmqProxySetOption(gpointer src,               // IN
-                        ToolsAppCtx *ctx,           // IN
-                        const gchar *option,        // IN
-                        const gchar *value,         // IN
-                        ToolsPluginData *plugin)    // IN
-{
-   gboolean retVal = FALSE;
-
-   if (strcmp(option, TOOLSOPTION_ENABLE_MESSAGE_BUS_TUNNEL) == 0) {
-      if (strcmp(value, "1") == 0) {
-         GRabbitmqProxyEnableMessageTunnelling();
-      } else if (strcmp(value, "0") == 0 &&
-                 proxyData.messageTunnellingEnabled) {
-         GRabbitmqProxyDisableMessageTunnelling();
-      }
-   }
-
-   return retVal;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * GRabbitmqProxyGetSSLLibPath --
- *
- *      This function returns the properly formatted string that points to
- *      a directory containing the library files.
- *
- * Results:
- *      Absolute path of the directory containing the library files.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-char *
-GRabbitmqProxyGetSSLLibPath(const char *arg1,     // IN/UNUSED
-                            const char *arg2)     // IN/UNUSED
-{
-   gchar *sslLibPath = NULL;
-
-#ifdef _WIN32
-   sslLibPath = GuestApp_GetInstallPath();
-#elif !defined(OPEN_VM_TOOLS)
-   sslLibPath = VMTools_GetLibdir();
-#endif
-
-   if (NULL != sslLibPath) {
-      gchar *endPath;
-      g_debug("%s: SSL Library Directory is %s\n", __FUNCTION__, sslLibPath);
-      endPath = sslLibPath + strlen(sslLibPath) - 1;
-      if ((endPath > sslLibPath) && (DIRSEPC == *endPath)) {
-         *endPath = 0;
-      }
-   }
-
-   return sslLibPath;
-} // GRabbitmqProxyGetSSLLibPath
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * ToolsOnLoad --
- *
- *      Returns the registration data for the Guest RabbitMQ Proxy.
- *
- * Result:
- *      Returns the registration data.
- *
- * Side-effects:
- *      None
- *
- *-----------------------------------------------------------------------------
- */
-
-TOOLS_MODULE_EXPORT ToolsPluginData *
-ToolsOnLoad(ToolsAppCtx *ctx)           // IN
-{
-   static ToolsPluginData regData = { "grabbitmqProxy", NULL, NULL, NULL };
-
-   ToolsPluginSignalCb sigs[] = {
-      { TOOLS_CORE_SIG_SHUTDOWN, GRabbitmqProxyShutdown, &regData },
-      { TOOLS_CORE_SIG_SET_OPTION, GRabbitmqProxySetOption, &regData }
-   };
-   ToolsAppReg regs[] = {
-      { TOOLS_APP_SIGNALS,
-        VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
-   };
-
-   InitProxyData(ctx);
-   Poll_InitGtk();
-   SSL_Init(GRabbitmqProxyGetSSLLibPath, NULL, NULL);
-
-   if (!TOOLS_IS_MAIN_SERVICE(ctx) && !TOOLS_IS_USER_SERVICE(ctx)) {
-      g_info("Unknown container '%s', not loading grabbitmqProxyPlugin.",
-             ctx->name);
-      return NULL;
-   }
-
-   regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
-
-   g_info("The Guest RabbitMQ Proxy is up and running ...\n");
-   return &regData;
-}
diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/rabbitmqProxyConst.h b/open-vm-tools/services/plugins/grabbitmqProxy/rabbitmqProxyConst.h
deleted file mode 100644 (file)
index 56d6688..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*********************************************************
- * Copyright (C) 2012-2017 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * rabbitmqProxyConst.h --
- *
- *    constants used in RabbitMQ Proxy DataMap etc.
- */
-
-#ifndef _RABBITMQ_PROXY_CONST_H_
-#define _RABBITMQ_PROXY_CONST_H_
-
-#include "dataMap.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#define HOST_RABBITMQ_PROXY_LISTEN_PATH    "/var/run/rabbitmqproxy.uds"
-
-/*
- * NOTE: changing the following IDs may break datamap encoding compatibility.
- */
-
-/* field IDs */
-enum {
-   RMQPROXYDM_FLD_COMMAND              = 1,
-   RMQPROXYDM_FLD_GUEST_CONN_ID        = 2,
-   RMQPROXYDM_FLD_PAYLOAD              = 3,
-   RMQPROXYDM_FLD_GUEST_VER_ID         = 4,
-   RMQPROXYDM_FLD_QUEUE_PREFIX_ID      = 5,
-   RMQPROXYDM_FLD_VC_UUID              = 6,
-};
-
-
-/* command types */
-enum {
-   COMMAND_DATA        = 1,
-   COMMAND_CONNECT     = 2,
-   COMMAND_CLOSE       = 3,
-};
-
-#if defined(__cplusplus)
-}  // extern "C"
-#endif
-
-#endif  /* _RABBITMQ_PROXY_CONST_H_ */