This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository remote-login-service-x2go. commit 2b9dfd6071e9c9ce69f91cae7e5bcff8d0936839 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Nov 11 16:23:13 2015 +0100 Code project moved permanently into Arctica Project's realm. --- AUTHORS | 7 - AUTHORS.Canonical | 5 - COPYING | 674 -------------- ChangeLog.until-1.0.0 | 1122 ------------------------ Makefile.am | 36 - Makefile.am.coverage | 48 - NEWS | 1 - README | 7 - README.discontinued | 5 + configure.ac | 105 --- data/Makefile.am | 21 - data/org.ArcticaProject.RemoteLogon.service.in | 3 - data/remote-logon-service.conf.in | 6 - debian/changelog | 152 ---- debian/compat | 1 - debian/control | 35 - debian/copyright | 31 - debian/rules | 12 - debian/source/format | 1 - m4/gcov.m4 | 86 -- po/Makefile.in.in | 222 ----- po/POTFILES.in | 8 - src/Makefile.am | 69 -- src/citrix-server.c | 227 ----- src/citrix-server.h | 59 -- src/crypt.c | 154 ---- src/crypt.h | 25 - src/defines.h | 52 -- src/main.c | 458 ---------- src/org.ArcticaProject.RemoteLogon.xml | 83 -- src/rdp-server.c | 227 ----- src/rdp-server.h | 59 -- src/server.c | 300 ------- src/server.h | 79 -- src/uccs-server.c | 958 -------------------- src/uccs-server.h | 82 -- src/x2go-server.c | 228 ----- src/x2go-server.h | 60 -- tests/Makefile.am | 73 -- tests/dbus-interface.c | 583 ------------ tests/null-config.conf | 2 - tests/server-test.c | 282 ------ tests/slmock | 252 ------ tests/slmock-config.conf.in | 9 - tests/uccs-config.conf | 9 - 45 files changed, 5 insertions(+), 6913 deletions(-) diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 0eda140..0000000 --- a/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -# Generated by Makefile. Do not edit. - - Albert Astals - Albert Astals Cid - Michael Terry - Tarmac - Ted Gould diff --git a/AUTHORS.Canonical b/AUTHORS.Canonical deleted file mode 100644 index 6163413..0000000 --- a/AUTHORS.Canonical +++ /dev/null @@ -1,5 +0,0 @@ - Albert Astals - Albert Astals Cid - Michael Terry - Tarmac - Ted Gould diff --git a/COPYING b/COPYING deleted file mode 100644 index 94a9ed0..0000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state 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 program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/ChangeLog.until-1.0.0 b/ChangeLog.until-1.0.0 deleted file mode 100644 index b79e9b1..0000000 --- a/ChangeLog.until-1.0.0 +++ /dev/null @@ -1,1122 +0,0 @@ -# Generated by Makefile. Do not edit. - -2012-09-20 Ted Gould <ted@gould.cx> - - 1.0.0 - -2012-09-20 Albert Astals Cid <albert.astals@canonical.com> - - Handle the SetLastUsedServer calls - - The data is saved in a file that is encrypted with the password and whose name is the hash of the username to provide as much privacy/security possible - -2012-09-20 Albert Astals <albert.astals@canonical.com> - - Use the correct function pointer check - -2012-09-17 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Do not assume AES data won't have 0 and we can use strlen, etc on it - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Remove printf - -2012-09-13 Albert Astals <albert.astals@canonical.com> - - Keep the last server_used around - -2012-09-14 Ted Gould <ted@gould.cx> - - 0.7.0 - -2012-09-14 Ted Gould <ted@gould.cx> - - Enable the allow cache variable - -2012-09-14 Ted Gould <ted@gould.cx> - - Handle caching and multiple logins much better.. Approved by Albert Astals Cid. - -2012-09-14 Ted Gould <ted@gould.cx> - - Clear the cache if we don't want to use it. - -2012-09-14 Ted Gould <ted@gould.cx> - - Merge in the allow cache branch - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Move the if up - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Do not use the cache if we are told not to use it - -2012-09-14 Ted Gould <ted@gould.cx> - - Make sure that if we're changing the username and password we unblock any queued lookup - -2012-09-14 Ted Gould <ted@gould.cx> - - Pulling the clear JSON task stuff into its own function - -2012-09-14 Ted Gould <ted@gould.cx> - - Only reset the user name and password if they've changed - -2012-09-14 Ted Gould <ted@gould.cx> - - Remove the confusing 'if' statement and clear the username/pass - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Match proper signature - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Change the if line so the previously added test passes - - Not sure i fully understand what this line is trying to do - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Add test that proves that if you try to login twice, the second one is failed - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Actually use -Wall -Werror when compiling. Approved by Ted Gould. - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Merge lp:remote-login-service - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Also make the checks compile - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Compile with -Wall -Werror - -2012-09-14 Albert Astals <albert.astals@canonical.com> - - Set AM_CPPFLAGS to be AM_CFLAGS too - - Since it seems we are compiling in CPP mode - -2012-09-14 Ted Gould <ted@gould.cx> - - Protect NM code from systems without NM running. Approved by Albert Astals Cid. - -2012-09-14 Ted Gould <ted@gould.cx> - - Get teh locale.h change - -2012-09-13 Ted Gould <ted@gould.cx> - - Don't let warnings kill object creation either - -2012-09-13 Ted Gould <ted@gould.cx> - - Make sure that warnings are not fatal - -2012-09-13 Ted Gould <ted@gould.cx> - - Protect against NM Client being NULL and also check to see if it's connected - -2012-09-14 Ted Gould <ted@gould.cx> - - Add locale.h for unoptimized builds. Approved by Albert Astals Cid, jenkins. - -2012-09-14 Ted Gould <ted@gould.cx> - - Add locale.h - -2012-09-13 Ted Gould <ted@gould.cx> - - 0.6.0 - -2012-09-13 Ted Gould <ted@gould.cx> - - Add translatable strings - -2012-09-13 Ted Gould <ted@gould.cx> - - Hard code the help message because gettext doesn't like the string concat and fixing it is too difficult for too little gain - -2012-09-12 Ted Gould <ted@gould.cx> - - Initialize Libtool - -2012-09-12 Ted Gould <ted@gould.cx> - - Move the internationalization stuff so that it gets the define path stuff - -2012-09-12 Ted Gould <ted@gould.cx> - - Setting up locale stuff - -2012-09-12 Ted Gould <ted@gould.cx> - - Looking up the names in the translation database - -2012-09-12 Ted Gould <ted@gould.cx> - - Switching over the conf file over to being translated - -2012-09-12 Ted Gould <ted@gould.cx> - - Adding source files to POTFILES.in - -2012-09-12 Ted Gould <ted@gould.cx> - - Making user visible strings translatable - -2012-09-13 Albert Astals <albert.astals@canonical.com> - - Parse the default server property of the json and map it to the last_used server property. Fixes: https://bugs.launchpad.net/bugs/1045838. Approved by Ted Gould, jenkins. - -2012-09-13 Albert Astals <albert.astals@canonical.com> - - Parse the DefaultServer property - -2012-09-13 Albert Astals <albert.astals@canonical.com> - - Add a test that fails regarding default/last_used server - - Make the default property of the servers map to the last_used on in rls speak - -2012-09-12 Ted Gould <ted@gould.cx> - - Verify the server is available before displaying - -2012-09-11 Ted Gould <ted@gould.cx> - - Attaching the bug - -2012-09-11 Ted Gould <ted@gould.cx> - - Make sure after verifying we revaluate the state - -2012-09-11 Ted Gould <ted@gould.cx> - - Don't start a message if we don't have a URL - -2012-09-11 Ted Gould <ted@gould.cx> - - Checking the return code and verifying the server based on it - -2012-09-11 Ted Gould <ted@gould.cx> - - Queuing up a message to get the HEADer using soup - -2012-09-11 Ted Gould <ted@gould.cx> - - Setting us up to verify the server's existance - -2012-09-11 Ted Gould <ted@gould.cx> - - Have a variable to track whether we've verified the server - -2012-09-11 Ted Gould <ted@gould.cx> - - Property to verify the server's existance or not - -2012-09-11 Ted Gould <ted@gould.cx> - - Gettin' some soup! - -2012-09-11 Ted Gould <ted@gould.cx> - - Make sure we have networking first - -2012-09-12 Ted Gould <ted@gould.cx> - - Check to ensure the network is available - -2012-09-12 Ted Gould <ted@gould.cx> - - Forgot an 'else' - -2012-09-12 Ted Gould <ted@gould.cx> - - Make sure there is only one nm-client allocated for all the UCCS servers - -2012-09-11 Ted Gould <ted@gould.cx> - - Getting fix for network builders - -2012-09-11 Ted Gould <ted@gould.cx> - - When the state changes update our cache and re-evaluate our status - -2012-09-11 Ted Gould <ted@gould.cx> - - Start providing the mechanism to track NM state - -2012-09-11 Ted Gould <ted@gould.cx> - - Making sure to evaluate state at the end as well - -2012-09-11 Ted Gould <ted@gould.cx> - - Disabling the network check on these - -2012-09-11 Ted Gould <ted@gould.cx> - - Making sure to disable the network checks - -2012-09-11 Ted Gould <ted@gould.cx> - - Wrong key to use - -2012-09-11 Ted Gould <ted@gould.cx> - - Adding a parameter to the keyfile to remove network checking - -2012-09-11 Ted Gould <ted@gould.cx> - - Splitting out the state evaluation into a helper function - -2012-09-11 Ted Gould <ted@gould.cx> - - Setting up variables to track networking and to see where we are - -2012-09-10 Ted Gould <ted@gould.cx> - - Grabbing libnm-glib - -2012-09-10 Ted Gould <ted@gould.cx> - - Grab some signalling - -2012-09-12 Ted Gould <ted@gould.cx> - - Add a state to the servers to know if they're configured. Fixes: https://bugs.launchpad.net/bugs/1047939. Approved by Albert Astals Cid, jenkins. - -2012-09-11 Ted Gould <ted@gould.cx> - - Attaching bug - -2012-09-11 Ted Gould <ted@gould.cx> - - Add an executable for the build system that don't have thin-client-config-agent - -2012-09-10 Ted Gould <ted@gould.cx> - - Don't need a tuple there apparently - -2012-09-10 Ted Gould <ted@gould.cx> - - Add a test to ensure we signaled updates - -2012-09-10 Ted Gould <ted@gould.cx> - - Pulling out the set_exec code so that we can test the signal stuff - -2012-09-10 Ted Gould <ted@gould.cx> - - When the server list changes emit the dbus signal - -2012-09-10 Ted Gould <ted@gould.cx> - - Handle a race with an extra DBus message - -2012-09-10 Ted Gould <ted@gould.cx> - - Moving where the config file is parsed to the servers aren't created until we've connected to DBus - -2012-09-10 Ted Gould <ted@gould.cx> - - Watching for servers updating themselves - -2012-09-10 Ted Gould <ted@gould.cx> - - Better handle the case of zero all good servers - -2012-09-10 Ted Gould <ted@gould.cx> - - Updating to trunk - -2012-09-10 Ted Gould <ted@gould.cx> - - Make sure to clear the builder if we don't use it - -2012-09-10 Ted Gould <ted@gould.cx> - - Make the signal get emitted when we change the state - -2012-08-29 Ted Gould <ted@gould.cx> - - Adding a state changed signal - -2012-08-29 Ted Gould <ted@gould.cx> - - Make it so that we can be ready or not based on whether the exec is found - -2012-08-29 Ted Gould <ted@gould.cx> - - Only UCCS servers that are all good as well - -2012-08-29 Ted Gould <ted@gould.cx> - - Making sure we only return all good servers - -2012-08-29 Ted Gould <ted@gould.cx> - - Adding a server state variable - -2012-09-10 Ted Gould <ted@gould.cx> - - Parse username and password info from JSON info. Fixes: https://bugs.launchpad.net/bugs/1045836. Approved by Albert Astals Cid, jenkins. - -2012-09-08 Ted Gould <ted@gould.cx> - - Attach bug number - -2012-09-07 Ted Gould <ted@gould.cx> - - Check for usernames, passwords and domains - -2012-09-07 Ted Gould <ted@gould.cx> - - Oops, wrong builder - -2012-09-07 Ted Gould <ted@gould.cx> - - Doing the same thing on the citrix side of the house - -2012-09-07 Ted Gould <ted@gould.cx> - - Parse additional values from the JSON for the RDP server - -2012-09-07 Ted Gould <ted@gould.cx> - - Use the username/password/domain values in the DBus response - -2012-09-07 Ted Gould <ted@gould.cx> - - Adding some variables to the server - -2012-09-07 Ted Gould <ted@gould.cx> - - Adding more JSON defines - -2012-09-10 Ted Gould <ted@gould.cx> - - Exit gracefully on name lost. Fixes: https://bugs.launchpad.net/bugs/1041338. Approved by Albert Astals Cid, jenkins. - -2012-09-08 Ted Gould <ted@gould.cx> - - Exit gracefully on name lost - -2012-08-30 Ted Gould <ted@gould.cx> - - Cleanup keyfile/json object stuff. Approved by Albert Astals Cid, jenkins. - -2012-08-29 Ted Gould <ted@gould.cx> - - Switching the tests over to using the new config file format - -2012-08-29 Ted Gould <ted@gould.cx> - - Fixing up the config file to match the changes - -2012-08-29 Ted Gould <ted@gould.cx> - - Dropping the per-server type defines - -2012-08-29 Ted Gould <ted@gould.cx> - - Switching to having a single list of servers - -2012-08-29 Ted Gould <ted@gould.cx> - - Use the new function in the server object - -2012-08-29 Ted Gould <ted@gould.cx> - - Fleshing out new from json - -2012-08-29 Ted Gould <ted@gould.cx> - - Fleshing out the new from keyfile function - -2012-08-29 Ted Gould <ted@gould.cx> - - Adding two new new functions - -2012-08-29 Ted Gould <ted@gould.cx> - - 0.5.0 - -2012-08-29 Ted Gould <ted@gould.cx> - - Recurse through domain cache checks - -2012-08-27 Ted Gould <ted@gould.cx> - - Have UCCS servers look at their subservers for servers as well - -2012-08-27 Ted Gould <ted@gould.cx> - - Look through all the lists - -2012-08-27 Ted Gould <ted@gould.cx> - - Oops - -2012-08-27 Ted Gould <ted@gould.cx> - - Switch to using the find_uri function in the server - -2012-08-27 Ted Gould <ted@gould.cx> - - Adding a function to match a URI that is subclassable - -2012-08-27 Ted Gould <ted@gould.cx> - - Pushing up to Server instead of UCCS - -2012-08-27 Ted Gould <ted@gould.cx> - - Moving the cached domains function up into the server object - -2012-08-27 Ted Gould <ted@gould.cx> - - Pulling the list handling out into a helper function - -2012-08-27 Ted Gould <ted@gould.cx> - - Looking in path for execs and being more tollerant of protocol names. Approved by jenkins, Albert Astals Cid. - -2012-08-24 Ted Gould <ted@gould.cx> - - Changing to be proper 'ls' path - -2012-08-24 Ted Gould <ted@gould.cx> - - Look in the paths for the executables - -2012-08-24 Ted Gould <ted@gould.cx> - - Being more tollerant of protocol names - -2012-08-27 Ted Gould <ted@gould.cx> - - Making sure the string is the same one LightDM uses. Approved by Albert Astals Cid. - -2012-08-27 Ted Gould <ted@gould.cx> - - Fixing tests to new string - -2012-08-27 Ted Gould <ted@gould.cx> - - Making sure the string is the same one LightDM uses - -2012-08-27 Ted Gould <ted@gould.cx> - - If we can't find the server just return a NULL list for now. Approved by Albert Astals Cid. - -2012-08-24 Ted Gould <ted@gould.cx> - - Returning a NULL list of domains - -2012-08-21 Ted Gould <ted@gould.cx> - - 0.4.0 - -2012-08-21 Ted Gould <ted@gould.cx> - - Changing the bin name of the TCCA to be correct. Approved by Ted Gould. - -2012-08-21 Ted Gould <ted@gould.cx> - - Fixing the name of the tcca - -2012-08-21 Ted Gould <ted@gould.cx> - - Making login error a boolean on the return. Approved by jenkins, Albert Astals Cid. - -2012-08-21 Ted Gould <ted@gould.cx> - - Making slmock return error on error - -2012-08-21 Ted Gould <ted@gould.cx> - - Adding a test for the login failure case - -2012-08-21 Ted Gould <ted@gould.cx> - - Changing the test to the new prototype - -2012-08-21 Ted Gould <ted@gould.cx> - - Return the boolean to say whether we got logged in - -2012-08-21 Ted Gould <ted@gould.cx> - - Adding a boolean to say where it is successful - -2012-08-21 Ted Gould <ted@gould.cx> - - Implementation of getting cached domains.. Approved by Albert Astals Cid, jenkins. - -2012-08-20 Ted Gould <ted@gould.cx> - - Add a test for CachedDomains interface - -2012-08-20 Ted Gould <ted@gould.cx> - - Add a test to make sure the proper structure comes back - -2012-08-20 Ted Gould <ted@gould.cx> - - Return the value of the function - -2012-08-20 Ted Gould <ted@gould.cx> - - Adding a function in UCCS to get the cached domains - -2012-08-20 Ted Gould <ted@gould.cx> - - Add a handler for getting the cached domains - -2012-08-21 Ted Gould <ted@gould.cx> - - Fix strlen warning. Approved by Albert Astals Cid, jenkins. - -2012-08-20 Ted Gould <ted@gould.cx> - - Include header for strlen - -2012-08-20 Michael Terry <michael.terry@canonical.com> - - Convert slmock to Python 3. Approved by Ted Gould. - -2012-08-20 Michael Terry <michael.terry@canonical.com> - - convert slmock to python3 - -2012-08-20 Ted Gould <ted@gould.cx> - - 0.3.0 - -2012-08-20 Ted Gould <ted@gould.cx> - - Small fixes left over from async-command-line branch landing.. Approved by Ted Gould. - -2012-08-20 Ted Gould <ted@gould.cx> - - Explicitly setting the inital value for the streams - -2012-08-20 Ted Gould <ted@gould.cx> - - make json_waiters_notify static - -2012-08-20 Ted Gould <ted@gould.cx> - - Changing the command line calls to be async. Approved by Antti Kaijanmäki, jenkins. - -2012-08-17 Ted Gould <ted@gould.cx> - - Make sure to clear up the spawned PID if we destroy before it completes - -2012-08-17 Ted Gould <ted@gould.cx> - - Make sure to respond to all the DBus messages if the object is destroyed - -2012-08-17 Ted Gould <ted@gould.cx> - - Only use strdup for the password - -2012-08-16 Ted Gould <ted@gould.cx> - - Merging trunk to resolve conflicts - -2012-08-16 Ted Gould <ted@gould.cx> - - Dropping the unused get_json function - -2012-08-16 Ted Gould <ted@gould.cx> - - Dropping the helper-script - -2012-08-16 Ted Gould <ted@gould.cx> - - Switching to Async I/O for the call to the external process - -2012-08-16 Ted Gould <ted@gould.cx> - - Restructuring the code so that we're kinda queuing things - -2012-08-16 Ted Gould <ted@gould.cx> - - Switch around 'unlock' so that it has a callback - -2012-08-17 Ted Gould <ted@gould.cx> - - Handle the case of no servers available with the correct variant type. Also add a test for it.. Approved by Albert Astals Cid, jenkins. - -2012-08-16 Ted Gould <ted@gould.cx> - - Add a test to make sure lack of servers doesn't kill us - -2012-08-16 Ted Gould <ted@gould.cx> - - Fix the return in the no servers case - -2012-08-17 Ted Gould <ted@gould.cx> - - Create dictionaries with _parse instead of with _new to avoid vararg errors. Approved by Albert Astals Cid, jenkins. - -2012-08-16 Ted Gould <ted@gould.cx> - - Switching to using parse so we don't have to create a bunch of false objects - -2012-08-17 Ted Gould <ted@gould.cx> - - Add copyright headers to source files. Approved by Albert Astals Cid, jenkins. - -2012-08-16 Ted Gould <ted@gould.cx> - - Adding copyright headers on the top of the source files - -2012-08-16 Michael Terry <michael.terry@canonical.com> - - Switch from libexecdir to pkglibexecdir. Approved by Ted Gould, jenkins. - -2012-08-15 Michael Terry <michael.terry@canonical.com> - - install into pkglibexecdir not libexecdir - -2012-08-15 Ted Gould <ted@gould.cx> - - 0.2.0 - -2012-08-14 Ted Gould <ted@gould.cx> - - Adds SLMock tests to the test suite - -2012-08-14 Ted Gould <ted@gould.cx> - - Adding more servers for tests - -2012-08-14 Ted Gould <ted@gould.cx> - - Adding the other Citrix servers - -2012-08-14 Ted Gould <ted@gould.cx> - - Copy, paste, and adjust. The last step is super important. - -2012-08-14 Ted Gould <ted@gould.cx> - - Adding to lovers - -2012-08-14 Ted Gould <ted@gould.cx> - - Passing the right username/password to slmock - -2012-08-14 Ted Gould <ted@gould.cx> - - Passing the username/password to the object - -2012-08-14 Ted Gould <ted@gould.cx> - - Adding in code to do the JSON parsing, let's see if it can pass our test - -2012-08-10 Ted Gould <ted@gould.cx> - - Check for the server in the list - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a login test - -2012-08-10 Ted Gould <ted@gould.cx> - - Dbus test fixes - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding the basic wrapper for all the slmock tests - -2012-08-10 Ted Gould <ted@gould.cx> - - Making slmock executable - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a configuration file for slmock - -2012-08-10 Ted Gould <ted@gould.cx> - - Grabbing slmock from the Maza team - -2012-08-14 Ted Gould <ted@gould.cx> - - First pass at JSON parsing and exec. Uses a helper script, and needs async. But works. - -2012-08-14 Ted Gould <ted@gould.cx> - - Signalling when we loose connections or are being destroyed - -2012-08-14 Ted Gould <ted@gould.cx> - - Making sure to mark the address as authorized if it is - -2012-08-14 Ted Gould <ted@gould.cx> - - Setting the username and password in the object - -2012-08-14 Ted Gould <ted@gould.cx> - - Distribute the script - -2012-08-14 Ted Gould <ted@gould.cx> - - Adding in the helper - -2012-08-14 Ted Gould <ted@gould.cx> - - Using a helper script just for now - -2012-08-13 Ted Gould <ted@gould.cx> - - Building the variant objects from the GList of servers - -2012-08-13 Ted Gould <ted@gould.cx> - - Keep an array of all the sub servers we have - -2012-08-13 Ted Gould <ted@gould.cx> - - Fleshing out some object JSON stuff - -2012-08-13 Ted Gould <ted@gould.cx> - - Calling into the objects so they can build themselves - -2012-08-13 Ted Gould <ted@gould.cx> - - Parsing the array entries and starting to build the server objects. - -2012-08-13 Ted Gould <ted@gould.cx> - - Handling the top level of the JSON file and getting out the array of servers. - -2012-08-13 Ted Gould <ted@gould.cx> - - Adding some JSON lovin' - -2012-08-13 Ted Gould <ted@gould.cx> - - Flesh out the flow that is needed for the unlocking of the UCCS server - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding the new member variables - -2012-08-10 Ted Gould <ted@gould.cx> - - Handle the cases brought out by GetServersFromLogin - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a couple fun little calls to get this party started! - -2012-08-10 Ted Gould <ted@gould.cx> - - Fixing exec parsing - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a test for exec - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding an 'Exec' to the config file - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding an exec property - -2012-08-10 Ted Gould <ted@gould.cx> - - Fixes to have multiple connections - -2012-08-10 Ted Gould <ted@gould.cx> - - Making sure to close the session - -2012-08-10 Ted Gould <ted@gould.cx> - - White space - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a test for the dbus interface - -2012-08-10 Ted Gould <ted@gould.cx> - - Cleaning up the Make file to ensure we don't check coverage of the generated files - -2012-08-10 Ted Gould <ted@gould.cx> - - Fixing coverage linking so it happens in the lib - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding a real test to look at the dbus interface - -2012-08-10 Ted Gould <ted@gould.cx> - - Adding in a dummy test - -2012-08-10 Ted Gould <ted@gould.cx> - - Grab ourselves some dbus test libs - -2012-08-10 Ted Gould <ted@gould.cx> - - Cut and paste error - -2012-08-10 Ted Gould <ted@gould.cx> - - Add a property for read only domains. - -2012-08-09 Ted Gould <ted@gould.cx> - - Abstracting out server objects - -2012-08-09 Ted Gould <ted@gould.cx> - - Adding a variant test - -2012-08-09 Ted Gould <ted@gould.cx> - - Adding a test for keyfile handling - -2012-08-08 Ted Gould <ted@gould.cx> - - Cleaning these up to make these functions work a bit easier. - -2012-08-08 Ted Gould <ted@gould.cx> - - Making the test more real and actually checking something - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a first test with all of the fun that brings - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding in a tests directory - -2012-08-08 Ted Gould <ted@gould.cx> - - Moving all the new server code into it's own library so that we can test it easier. - -2012-08-08 Ted Gould <ted@gould.cx> - - Create the objects from the config file and use them to build the variants - -2012-08-08 Ted Gould <ted@gould.cx> - - Put in a function to build each of the servers from a Keyfile - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding some properties for that UCCS server - -2012-08-08 Ted Gould <ted@gould.cx> - - We need a UCCS server type as well - -2012-08-08 Ted Gould <ted@gould.cx> - - Hmm, put those in quite the wrong place - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding some generic get_properties functions - -2012-08-08 Ted Gould <ted@gould.cx> - - Clean up the strings - -2012-08-08 Ted Gould <ted@gould.cx> - - Restructuring things slightly so that the object type determines the type and the server class takes care of the base tuple building - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding some generic properties to the super class - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding an RDP server class - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a Citrix subclass - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a server base class - -2012-08-09 Ted Gould <ted@gould.cx> - - Noting that there may be some optional fields - -2012-08-09 Ted Gould <ted@gould.cx> - - Adding in a usage overview diagram - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding the application list, even if blank today - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a function to set the last used server - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding an application list to the server information and a function to set it - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a function for a cached domain - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding a boolean to know which server was last - -2012-08-08 Ted Gould <ted@gould.cx> - - Adding the URI to the server login API - -2012-07-30 Ted Gould <ted@gould.cx> - - Remove the network UCCS server - -2012-07-30 Ted Gould <ted@gould.cx> - - 0.0.1 - -2012-07-30 Ted Gould <ted@gould.cx> - - Adding in the service file - -2012-07-30 Ted Gould <ted@gould.cx> - - Adding in a config file - -2012-07-30 Ted Gould <ted@gould.cx> - - Adding in a data directory - -2012-07-30 Ted Gould <ted@gould.cx> - - Adding e-mail to UCCS and removing domain - -2012-07-30 Ted Gould <ted@gould.cx> - - Adding support for UCCS servers - -2012-07-30 Ted Gould <ted@gould.cx> - - Add the 'uccs' server type - -2012-07-30 Ted Gould <ted@gould.cx> - - Handling the get servers request so that we can dump dem servers - -2012-07-30 Ted Gould <ted@gould.cx> - - Parsing the config file to get a list of servers - -2012-07-29 Ted Gould <ted@gould.cx> - - Checking and bringing up config file - -2012-07-29 Ted Gould <ted@gould.cx> - - Make sure that we get into our function - -2012-07-29 Ted Gould <ted@gould.cx> - - Build up some command line parsing - -2012-07-29 Ted Gould <ted@gould.cx> - - Grabbing a default configuration file from the automake dirs - -2012-07-29 Ted Gould <ted@gould.cx> - - Going in, getting the name, and handling the errors - -2012-07-27 Ted Gould <ted@gould.cx> - - Putting the object on the bus - -2012-07-27 Ted Gould <ted@gould.cx> - - Now we can effectively wait forever - -2012-07-27 Ted Gould <ted@gould.cx> - - Ignoring the tarball - -2012-07-27 Ted Gould <ted@gould.cx> - - Now with a binary - -2012-07-27 Ted Gould <ted@gould.cx> - - Fleshing out the Makefiles - -2012-07-27 Ted Gould <ted@gould.cx> - - Basic build system - -2012-07-27 Ted Gould <ted@gould.cx> - - Server URL added - -2012-07-27 Ted Gould <ted@gould.cx> - - First pass at a DBus interface - -2012-07-23 Ted Gould <ted@gould.cx> - - A small diagram describing our place in the world - -2012-07-23 Ted Gould <ted@gould.cx> - - What are we trying to do? - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e3edc22..0000000 --- a/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ - -SUBDIRS = \ - src \ - data \ - po \ - tests - -DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall - -dist-hook: - @if test -d "$(top_srcdir)/.git"; \ - then \ - echo Creating ChangeLog && \ - ( cd "$(top_srcdir)" && \ - echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/missing --run git --no-pager log --since "1970" --format="%ai %aN (%h) %n%n%x09*%w(68,0,10) %s%d%n") > ChangeLog.tmp \ - && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ - || (rm -f ChangeLog.tmp; \ - echo Failed to generate ChangeLog >&2 ); \ - else \ - echo Failed to generate ChangeLog: not a branch >&2; \ - fi - @if test -d "$(top_srcdir)/.git"; \ - then \ - echo Creating AUTHORS && \ - ( cd "$(top_srcdir)" && \ - echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/missing --run git log | grep -e "^Author:" -e "Committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ - && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ - || (rm -f AUTHORS.tmp; \ - echo Failed to generate AUTHORS >&2 ); \ - else \ - echo Failed to generate AUTHORS: not a branch >&2; \ - fi - -include $(top_srcdir)/Makefile.am.coverage diff --git a/Makefile.am.coverage b/Makefile.am.coverage deleted file mode 100644 index fb97747..0000000 --- a/Makefile.am.coverage +++ /dev/null @@ -1,48 +0,0 @@ - -# Coverage targets - -.PHONY: clean-gcno clean-gcda \ - coverage-html generate-coverage-html clean-coverage-html \ - coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr - -clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr - -if HAVE_GCOV - -clean-gcno: - @echo Removing old coverage instrumentation - -find -name '*.gcno' -print | xargs -r rm - -clean-gcda: - @echo Removing old coverage results - -find -name '*.gcda' -print | xargs -r rm - -coverage-html: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html - -generate-coverage-html: - @echo Collecting coverage data - $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool - LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info - -clean-coverage-html: clean-gcda - -$(LCOV) --directory $(top_builddir) -z - -rm -rf coverage.info coveragereport - -if HAVE_GCOVR - -coverage-gcovr: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr - -generate-coverage-gcovr: - @echo Generating coverage GCOVR report - $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml - -clean-coverage-gcovr: clean-gcda - -rm -rf $(top_builddir)/coverage.xml - -endif # HAVE_GCOVR - -endif # HAVE_GCOV diff --git a/NEWS b/NEWS deleted file mode 100644 index 25f1cf7..0000000 --- a/NEWS +++ /dev/null @@ -1 +0,0 @@ -All the news that's fit to print. diff --git a/README b/README deleted file mode 100644 index 3519c77..0000000 --- a/README +++ /dev/null @@ -1,7 +0,0 @@ -A small service to grab various remote login possibilities from the local -network configuration, network servers -that provide them, and present them to the user to log into for both -applications and full desktop posibilities. - -This project has been forked by the X2Go/Arctica Project -to support Remote Login against Linux machines via X2Go. diff --git a/README.discontinued b/README.discontinued new file mode 100644 index 0000000..2bc84a8 --- /dev/null +++ b/README.discontinued @@ -0,0 +1,5 @@ +This project has been moved to the Arctica Project's Git repository: + +https://github.com/ArcticaProject/lightdm-remote-session-x2go + +20151111, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> diff --git a/configure.ac b/configure.ac deleted file mode 100644 index decd462..0000000 --- a/configure.ac +++ /dev/null @@ -1,105 +0,0 @@ -AC_INIT(remote-logon-service, 1.0.0.1) - -AC_PREREQ(2.53) -AM_INIT_AUTOMAKE([]) - -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LIBTOOL -AM_PROG_CC_C_O -AM_SILENT_RULES([yes]) -AC_CONFIG_MACRO_DIR([m4]) - -# Initialize libtool -LT_PREREQ([2.2]) -LT_INIT([disable-static]) - -AC_CONFIG_HEADER(config.h) -AC_CONFIG_FILES([ - Makefile - src/Makefile - data/Makefile - po/Makefile.in - tests/Makefile -]) - -PKG_CHECK_MODULES(SERVICE, glib-2.0 gio-2.0 gio-unix-2.0 json-glib-1.0 libnm-glib libsoup-2.4) -PKG_CHECK_MODULES(TEST, dbustest-1) - -AC_CHECK_LIB(gcrypt, gcry_cipher_get_algo_keylen, GCRYPT_LIBS="-lgcrypt") - -if test x"$GCRYPT_LIBS" = x ; then - echo "You need libgcrypt to compile remote-logon-service"; - exit -fi - -########################### -# Local Install -########################### - -with_localinstall="no" -AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], - [install all files locally (for distcheck)]), - with_localinstall=$enableval, - with_localinstall=no) - -############################## -# Custom Junk -############################## - -AC_DEFUN([AC_DEFINE_PATH], [ - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_path=`eval echo [$]$2` - ac_define_path=`eval echo [$]ac_define_path` - $1="$ac_define_path" - AC_SUBST($1) - ifelse($3, , - AC_DEFINE_UNQUOTED($1, "$ac_define_path"), - AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) -]) - -########################### -# DBus Service Info -########################### - -if test "x$with_localinstall" = "xyes"; then - DBUSSERVICEDIR="${datadir}/dbus-1/services/" -else - DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` -fi -AC_SUBST(DBUSSERVICEDIR) - -########################### -# gcov coverage reporting -########################### - -m4_include([m4/gcov.m4]) -AC_TDD_GCOV -AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) -AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) -AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) -AC_SUBST(COVERAGE_CFLAGS) -AC_SUBST(COVERAGE_LDFLAGS) -AC_SUBST(GCRYPT_LIBS) - -########################### -# Internationalization -########################### - -IT_PROG_INTLTOOL([0.35.0]) -GETTEXT_PACKAGE=remote-logon-service -AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext package]) -AC_DEFINE_PATH(LOCALEDIR, "${datadir}/locale", [locale directory]) -AM_GLIB_GNU_GETTEXT - -########################### -# Flags -########################### - -AC_SUBST(AM_CFLAGS, "-Wall -Werror") -AC_SUBST(AM_CPPFLAGS, $AM_CFLAGS) - -AC_OUTPUT - diff --git a/data/Makefile.am b/data/Makefile.am deleted file mode 100644 index 3ba4d21..0000000 --- a/data/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -config_file_DATA = \ - remote-logon-service.conf -config_filedir = $(sysconfdir) - -dbus_servicesdir = $(DBUSSERVICEDIR) -dbus_services_DATA = org.ArcticaProject.RemoteLogon.service - -%.service: %.service.in - sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ - -%.conf: %.conf.in - $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ - -EXTRA_DIST = \ - org.ArcticaProject.RemoteLogon.service.in \ - remote-logon-service.conf.in - -CLEANFILES = \ - org.ArcticaProject.RemoteLogon.service \ - remote-logon-service.conf - diff --git a/data/org.ArcticaProject.RemoteLogon.service.in b/data/org.ArcticaProject.RemoteLogon.service.in deleted file mode 100644 index 0961dbb..0000000 --- a/data/org.ArcticaProject.RemoteLogon.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.ArcticaProject.RemoteLogon -Exec=@pkglibexecdir@/remote-logon-service diff --git a/data/remote-logon-service.conf.in b/data/remote-logon-service.conf.in deleted file mode 100644 index 5cadcc9..0000000 --- a/data/remote-logon-service.conf.in +++ /dev/null @@ -1,6 +0,0 @@ -[Remote Logon Service] -Servers=Session Broker - -[Server Session Broker] -_Name=Remote Logon -URI=http://localhost:8080/uccs/inifile/ diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index f032652..0000000 --- a/debian/changelog +++ /dev/null @@ -1,152 +0,0 @@ -remote-logon-service (1.0.0.1-0) UNRELEASED; urgency=medium - - * Rename src:package and bin:package: -> remote-logon-service. - - * First forked/upstream release (1.0.0.1): - - Apply patch 01_clear_servers.patch. - - Apply patch glib-deprecated.diff. Provide support for old - GLib versions. - - Apply 02_server-name.patch. Provide support for non-Canonical - UCCS servers. - - Apply 03_x2go+rls.patch. Provide support for X2Go remote logins. - - Extend README file, inform about the RLS fork by X2Go. - - remote-login-service.conf.in: Add URLs for default X2Go Session Broker - installation. - - remote-login-service.conf.in: No https for localhost connections. - * debian/rules: - + Build using dh_autoreconf. - + Make sure we have an empty upstream ChangeLog file when building from Git. - + Remove dummy ChangeLog file after build if empty. - + Fix missing call of dh_auto_clean in override_dh_auto_clean. - * debian/copyright: - + Add Upstream-Contract: field. Add myself as copyright holder. - + Fix upstream source URL. - + Update copyright holders and years. - * debian/control: - + Add B-Ds: dh-autoreconf, libgtest-dev, python. Enable the testsuite at - build time. - + Bump Standards: to 3.9.6. No changes needed. - * debian/source/format: - + Switch back to source format 1.0. - - -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sun, 02 Nov 2014 21:36:41 +0100 - -remote-login-service (1.0.0-0ubuntu3) raring; urgency=low - - * Don't use deprecated g_type_init() with recent glib2.0. - - -- Matthias Klose <doko@ubuntu.com> Tue, 26 Feb 2013 10:40:57 +0100 - -remote-login-service (1.0.0-0ubuntu2) raring; urgency=low - - * SECURITY UPDATE: credentials disclosure via second login (LP: #1070896) - - debian/patches/01_clear_servers.patch: Clear servers on second login - in src/uccs-server.c, add test to tests/dbus-interface.c. - - CVE-2012-0959 - - -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Mon, 05 Nov 2012 14:05:14 -0500 - -remote-login-service (1.0.0-0ubuntu1) quantal; urgency=low - - * New upstream release. - * Support caching the recently used server - * debian/control: Add build dep on libgcrypt11-dev - - -- Ted Gould <ted@ubuntu.com> Thu, 20 Sep 2012 23:55:05 -0500 - -remote-login-service (0.7.0-0ubuntu1) quantal; urgency=low - - * New upstream release. - - Fix NM service detection and fallback - - Fix build on unoptimized build servers - - Fix issues with multiple logins (LP: #1050810) - - Support stored data in UCCS (LP: #1045836) - - Check to insure TCCA is installed before using (LP: #1047939) - - Ensure that the server is available before showing (LP: #1047940) - - Make the UCCS server names translatable (LP: #1049694) - - Fix error message that wasn't that bad (LP: #1041338) - - Place the server marked as default first (LP: #1045838) - * debian/control: - - Adding a build dep on libnm-glib - - Adding a build dep on libsoup2.4-dev - * Dropping debian/patches as all upstream - - -- Ted Gould <ted@ubuntu.com> Thu, 13 Sep 2012 11:16:17 -0500 - -remote-login-service (0.5.0-0ubuntu2) quantal; urgency=low - - * debian/patches/exit-gracefully-on-name-lost.patch: - - Fix possible crash on exit. Patch from trunk. LP: #1041338 - - -- Michael Terry <mterry@ubuntu.com> Tue, 11 Sep 2012 14:03:07 -0400 - -remote-login-service (0.5.0-0ubuntu1) quantal; urgency=low - - * New upstream release. - * Fix protocol names - * Align naming with LightDM services - * Handle recursive searches for domain name caches - - -- Ted Gould <ted@ubuntu.com> Wed, 29 Aug 2012 11:38:02 -0500 - -remote-login-service (0.4.0-0ubuntu1) quantal; urgency=low - - * New upstream release. - * slmock to Python3 - * Return a boolean from GetServersForLogin - * Fix thin-client-config-agent path - * debian/control: - - Build-Dep on python3, not python - - Recommend thin-client-config-agent - - -- Michael Terry <mterry@ubuntu.com> Tue, 21 Aug 2012 17:43:12 -0400 - -remote-login-service (0.3.0-0ubuntu1) quantal; urgency=low - - [ Ted Gould ] - * New upstream release. - * Async command line calling - * Test suite fix - * Remove security issues with helper-script (dropped) - * Crash fix (LP: #1037832) - * debian/rules: Remove block on tests - - [ Michael Terry ] - * debian/control: - - Add Vcs-Bzr link - - Add some new build dependencies for tests (dbus-test-runner, python) - * Drop patch for pkglibexecdir, not needed anymore - * Drop dh-autoreconf, since we don't patch autotools files now - - -- Michael Terry <mterry@ubuntu.com> Mon, 20 Aug 2012 12:42:09 -0400 - -remote-login-service (0.2.0-0ubuntu1) quantal; urgency=low - - * Package for Ubuntu (LP: #1037231) - * Switch to dh9 and drop cdbs - * Add watch file - * Cleanup control and copyright files - * Add patch to use pkglibexecdir instead of libexecdir - - -- Michael Terry <mterry@ubuntu.com> Wed, 15 Aug 2012 15:00:35 -0400 - -remote-login-service (0.2.0-0ubuntu1~ppa2) quantal; urgency=low - - * debian/control: Adding dh-autoreconf as a build depend - - -- Ted Gould <ted@ubuntu.com> Wed, 15 Aug 2012 13:06:38 -0500 - -remote-login-service (0.2.0-0ubuntu1~ppa1) quantal; urgency=low - - * New upstream release. - * Support calling the UCCS service tool - * Tests to deal with JSON output - * debian/control: Adding build dependencies on dbustest and json-glib - - -- Ted Gould <ted@ubuntu.com> Wed, 15 Aug 2012 11:38:31 -0500 - -remote-login-service (0.0.1-0ubuntu1~ppa1) quantal; urgency=low - - * New upstream release. - - -- Ted Gould <ted@ubuntu.com> Mon, 30 Jul 2012 16:57:37 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control deleted file mode 100644 index 8c06e8b..0000000 --- a/debian/control +++ /dev/null @@ -1,35 +0,0 @@ -Source: remote-logon-service -Section: misc -Priority: extra -Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -Build-Depends: dbus-test-runner, - debhelper (>= 9), - intltool (>= 0.35.0), - libdbus-1-dev, - libdbustest1-dev, - libgcrypt11-dev, - libglib2.0-dev (>= 2.29.19), - libjson-glib-dev, - libnm-glib-dev, - libsoup2.4-dev, - dh-autoreconf, - libgtest-dev, - python, - python3, -Standards-Version: 3.9.6 -Homepage: http://www.x2go.org -Vcs-Git: git://code.x2go.org/remote-logon-service.git -Vcs-Browser: http://code.x2go.org/gitweb?p=remote-logon-service.git;a=summary - -Package: remote-logon-service -Architecture: any -Depends: ${shlibs:Depends}, - ${misc:Depends}, -#Breaks: remote-login-service, -# remote-logon-services-x2go (<< 1.0.0.2), -#Replaces: remote-login-service, -# remote-login-services-x2go (<< 1.0.0.2), -Recommends: thin-client-config-agent -Description: Service to track the remote servers to use - A small service to take the various sources for the remote - services and bring them into a simple DBus list. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 297f79a..0000000 --- a/debian/copyright +++ /dev/null @@ -1,31 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: remote-logon-service -Upstream-Contact: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -Source: http://code.x2go.org/gitweb?p=remote-logon-service-x2go.git;a=summary - -Files: * -Copyright: 2012, Canonical Ltd. - 2013, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - 2015, The Arctica Project -License: GPL-3 - -Files: debian/* -Copyright: 2012, Canonical Ltd. - 2012-2015, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -License: GPL-3 - -License: GPL-3 - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 3 of the License. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/> - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/rules b/debian/rules deleted file mode 100755 index afcf78b..0000000 --- a/debian/rules +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/make -f - -%: - dh $@ --with autoreconf - -override_dh_autoreconf: - touch ChangeLog - dh_autoreconf - -override_dh_auto_clean: - if [ -s ChangeLog ]; then rm -f ChangeLog; fi - dh_auto_clean diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index d3827e7..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/m4/gcov.m4 b/m4/gcov.m4 deleted file mode 100644 index 3163584..0000000 --- a/m4/gcov.m4 +++ /dev/null @@ -1,86 +0,0 @@ -# Checks for existence of coverage tools: -# * gcov -# * lcov -# * genhtml -# * gcovr -# -# Sets ac_cv_check_gcov to yes if tooling is present -# and reports the executables to the variables LCOV, GCOVR and GENHTML. -AC_DEFUN([AC_TDD_GCOV], -[ - AC_ARG_ENABLE(gcov, - AS_HELP_STRING([--enable-gcov], - [enable coverage testing with gcov]), - [use_gcov=$enableval], [use_gcov=no]) - - if test "x$use_gcov" = "xyes"; then - # we need gcc: - if test "$GCC" != "yes"; then - AC_MSG_ERROR([GCC is required for --enable-gcov]) - fi - - # Check if ccache is being used - AC_CHECK_PROG(SHTOOL, shtool, shtool) - case `$SHTOOL path $CC` in - *ccache*[)] gcc_ccache=yes;; - *[)] gcc_ccache=no;; - esac - - if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then - AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) - fi - - lcov_version_list="1.6 1.7 1.8 1.9" - AC_CHECK_PROG(LCOV, lcov, lcov) - AC_CHECK_PROG(GENHTML, genhtml, genhtml) - - if test "$LCOV"; then - AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ - glib_cv_lcov_version=invalid - lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` - for lcov_check_version in $lcov_version_list; do - if test "$lcov_version" = "$lcov_check_version"; then - glib_cv_lcov_version="$lcov_check_version (ok)" - fi - done - ]) - else - lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" - AC_MSG_ERROR([$lcov_msg]) - fi - - case $glib_cv_lcov_version in - ""|invalid[)] - lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." - AC_MSG_ERROR([$lcov_msg]) - LCOV="exit 0;" - ;; - esac - - if test -z "$GENHTML"; then - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - fi - - ac_cv_check_gcov=yes - ac_cv_check_lcov=yes - - # Remove all optimization flags from CFLAGS - changequote({,}) - CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` - changequote([,]) - - # Add the special gcc flags - COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" - COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" - COVERAGE_LDFLAGS="-lgcov" - - # Check availability of gcovr - AC_CHECK_PROG(GCOVR, gcovr, gcovr) - if test -z "$GCOVR"; then - ac_cv_check_gcovr=no - else - ac_cv_check_gcovr=yes - fi - -fi -]) # AC_TDD_GCOV diff --git a/po/Makefile.in.in b/po/Makefile.in.in deleted file mode 100644 index 06a8cfe..0000000 --- a/po/Makefile.in.in +++ /dev/null @@ -1,222 +0,0 @@ -# Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> -# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com> -# -# This file may be copied and used freely without restrictions. It may -# be used in projects which are not available under a GNU Public License, -# but which still want to provide support for the GNU gettext functionality. -# -# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE -# instead of PACKAGE and to look for po2tbl in ./ not in intl/ -# -# - Modified by jacob berkman <jacob@ximian.com> to install -# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize -# -# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool -# -# We have the following line for use by intltoolize: -# INTLTOOL_MAKEFILE - -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -top_builddir = @top_builddir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -datadir = @datadir@ -datarootdir = @datarootdir@ -libdir = @libdir@ -DATADIRNAME = @DATADIRNAME@ -itlocaledir = $(prefix)/$(DATADIRNAME)/locale -subdir = po -install_sh = @install_sh@ -# Automake >= 1.8 provides @mkdir_p@. -# Until it can be supposed, use the safe fallback: -mkdir_p = $(install_sh) -d - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ - -GMSGFMT = @GMSGFMT@ -MSGFMT = @MSGFMT@ -XGETTEXT = @XGETTEXT@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot - -ALL_LINGUAS = @ALL_LINGUAS@ - -PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi) - -USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi) - -USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) - -POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) - -DISTFILES = Makefile.in.in POTFILES.in $(POFILES) -EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS - -POTFILES = \ -# This comment gets stripped out - -CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) - -.SUFFIXES: -.SUFFIXES: .po .pox .gmo .mo .msg .cat - -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V)) -INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY)) -INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@; - -.po.pox: - $(MAKE) $(GETTEXT_PACKAGE).pot - $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox - -.po.mo: - $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $< - -.po.gmo: - $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) -o $$file $< - -.po.cat: - sed -f ../intl/po2msg.sed < $< > $*.msg \ - && rm -f $@ && gencat $@ $*.msg - - -all: all-@USE_NLS@ - -all-yes: $(CATALOGS) -all-no: - -$(GETTEXT_PACKAGE).pot: $(POTFILES) - $(GENPOT) - -install: install-data -install-data: install-data-@USE_NLS@ -install-data-no: all -install-data-yes: all - linguas="$(USE_LINGUAS)"; \ - for lang in $$linguas; do \ - dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ - $(mkdir_p) $$dir; \ - if test -r $$lang.gmo; then \ - $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ - echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ - else \ - $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ - echo "installing $(srcdir)/$$lang.gmo as" \ - "$$dir/$(GETTEXT_PACKAGE).mo"; \ - fi; \ - if test -r $$lang.gmo.m; then \ - $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ - echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ - else \ - if test -r $(srcdir)/$$lang.gmo.m ; then \ - $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ - $$dir/$(GETTEXT_PACKAGE).mo.m; \ - echo "installing $(srcdir)/$$lang.gmo.m as" \ - "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ - else \ - true; \ - fi; \ - fi; \ - done - -# Empty stubs to satisfy archaic automake needs -dvi info ctags tags CTAGS TAGS ID: - -# Define this as empty until I found a useful application. -install-exec installcheck: - -uninstall: - linguas="$(USE_LINGUAS)"; \ - for lang in $$linguas; do \ - rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ - rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ - done - -check: all $(GETTEXT_PACKAGE).pot - rm -f missing notexist - srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m - if [ -r missing -o -r notexist ]; then \ - exit 1; \ - fi - -mostlyclean: - rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp - rm -f .intltool-merge-cache - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES stamp-it - rm -f *.mo *.msg *.cat *.cat.m *.gmo - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f Makefile.in.in - -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: $(DISTFILES) - dists="$(DISTFILES)"; \ - extra_dists="$(EXTRA_DISTFILES)"; \ - for file in $$extra_dists; do \ - test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ - done; \ - for file in $$dists; do \ - test -f $$file || file="$(srcdir)/$$file"; \ - ln $$file $(distdir) 2> /dev/null \ - || cp -p $$file $(distdir); \ - done - -update-po: Makefile - $(MAKE) $(GETTEXT_PACKAGE).pot - tmpdir=`pwd`; \ - linguas="$(USE_LINGUAS)"; \ - for lang in $$linguas; do \ - echo "$$lang:"; \ - result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ - if $$result; then \ - if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "msgmerge for $$lang.gmo failed!"; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi; \ - done - -Makefile POTFILES: stamp-it - @if test ! -f $@; then \ - rm -f stamp-it; \ - $(MAKE) stamp-it; \ - fi - -stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ - $(SHELL) ./config.status - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index d886310..0000000 --- a/po/POTFILES.in +++ /dev/null @@ -1,8 +0,0 @@ -[type: gettext/ini] data/remote-logon-service.conf.in -src/server.c -src/remote-logon.c -src/rdp-server.c -src/citrix-server.c -src/x2go-server.c -src/main.c -src/uccs-server.c diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index fa9b8c7..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,69 +0,0 @@ -pkglibexec_PROGRAMS = \ - remote-logon-service - -EXTRA_DIST = \ - org.ArcticaProject.RemoteLogon.xml - -noinst_LTLIBRARIES = \ - libservers.la \ - libgenerated.la - -################################ -# libgenerated -################################ - -libgenerated_la_SOURCES = \ - remote-logon.c \ - remote-logon.h -libgenerated_la_CFLAGS = \ - $(SERVICE_CFLAGS) -$(libgenerated_la_SOURCES): org.ArcticaProject.RemoteLogon.xml - gdbus-codegen \ - --interface-prefix org.ArcticaProject \ - --generate-c remote-logon \ - $^ - -BUILT_SOURCES = $(libgenerated_la_SOURCES) -CLEANFILES = $(BUILT_SOURCES) - -################################ -# libservers -################################ - -libservers_la_SOURCES = \ - citrix-server.c \ - citrix-server.h \ - rdp-server.c \ - rdp-server.h \ - x2go-server.c \ - x2go-server.h \ - uccs-server.c \ - uccs-server.h \ - defines.h \ - server.c \ - server.h \ - crypt.c \ - crypt.h -libservers_la_CFLAGS = \ - -DUCCS_QUERY_TOOL="\"thin-client-config-agent\"" \ - $(SERVICE_CFLAGS) \ - $(COVERAGE_CFLAGS) -libservers_la_LDFLAGS = \ - $(COVERAGE_LDFLAGS) $(GCRYPT_LIBS) -lm - -################################ -# remote-logon-service -################################ - -remote_logon_service_CFLAGS = \ - -DDEFAULT_CONFIG_FILE="\"$(sysconfdir)/remote-logon-service.conf\"" \ - $(SERVICE_CFLAGS) \ - $(COVERAGE_CFLAGS) -remote_logon_service_LDADD = \ - $(builddir)/libservers.la \ - $(builddir)/libgenerated.la \ - $(SERVICE_LIBS) -remote_logon_service_LDFLAGS = \ - $(COVERAGE_LDFLAGS) -remote_logon_service_SOURCES = \ - main.c diff --git a/src/citrix-server.c b/src/citrix-server.c deleted file mode 100644 index e7d4e1d..0000000 --- a/src/citrix-server.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/mman.h> - -#include <glib/gi18n.h> - -#include <string.h> - -#include "citrix-server.h" -#include "defines.h" - -static void citrix_server_class_init (CitrixServerClass *klass); -static void citrix_server_init (CitrixServer *self); -static void citrix_server_dispose (GObject *object); -static void citrix_server_finalize (GObject *object); -static GVariant * get_properties (Server * server); - -G_DEFINE_TYPE (CitrixServer, citrix_server, SERVER_TYPE); - -static void -citrix_server_class_init (CitrixServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = citrix_server_dispose; - object_class->finalize = citrix_server_finalize; - - ServerClass * server_class = SERVER_CLASS(klass); - - server_class->get_properties = get_properties; - - return; -} - -static void -citrix_server_init (CitrixServer *self) -{ - self->username = NULL; - self->password = NULL; - self->domain = NULL; - self->domain_required = FALSE; - - return; -} - -static void -citrix_server_dispose (GObject *object) -{ - - G_OBJECT_CLASS (citrix_server_parent_class)->dispose (object); - return; -} - -/* Unlocks the memory before freeing */ -static void -password_clear (gpointer data) -{ - char * pass = (char *)data; - munlock(pass, strlen(pass)); - g_free(pass); - return; -} - -static void -citrix_server_finalize (GObject *object) -{ - CitrixServer * server = CITRIX_SERVER(object); - - g_clear_pointer(&server->username, g_free); - g_clear_pointer(&server->password, password_clear); - g_clear_pointer(&server->domain, g_free); - - G_OBJECT_CLASS (citrix_server_parent_class)->finalize (object); - return; -} - -static GVariant * -get_properties (Server * server) -{ - CitrixServer * cserver = CITRIX_SERVER(server); - - GVariantBuilder propbuilder; - g_variant_builder_init(&propbuilder, G_VARIANT_TYPE_ARRAY); - - GVariantBuilder namebuilder; - g_variant_builder_init(&namebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&namebuilder, g_variant_new_string("username")); - g_variant_builder_add_value(&namebuilder, g_variant_new_boolean(TRUE)); - if (cserver->username == NULL) { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(cserver->username))); - } - g_variant_builder_add_value(&namebuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&namebuilder)); - - GVariantBuilder passbuilder; - g_variant_builder_init(&passbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&passbuilder, g_variant_new_string("password")); - g_variant_builder_add_value(&passbuilder, g_variant_new_boolean(TRUE)); - if (cserver->password == NULL) { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(cserver->password))); - } - g_variant_builder_add_value(&passbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&passbuilder)); - - GVariantBuilder domainbuilder; - g_variant_builder_init(&domainbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&domainbuilder, g_variant_new_string("domain")); - g_variant_builder_add_value(&domainbuilder, g_variant_new_boolean(cserver->domain_required)); - if (cserver->domain == NULL) { - g_variant_builder_add_value(&domainbuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&domainbuilder, g_variant_new_variant(g_variant_new_string(cserver->domain))); - } - g_variant_builder_add_value(&domainbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&domainbuilder)); - - return g_variant_builder_end(&propbuilder); -} - -Server * -citrix_server_new_from_keyfile (GKeyFile * keyfile, const gchar * groupname) -{ - g_return_val_if_fail(keyfile != NULL, NULL); /* NOTE: No way to check if that's really a keyfile :-( */ - g_return_val_if_fail(groupname != NULL, NULL); - - if (!g_key_file_has_group(keyfile, groupname)) { - g_warning("Server specified but group '%s' was not found", groupname); - return NULL; - } - - CitrixServer * server = g_object_new(CITRIX_SERVER_TYPE, NULL); - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_NAME, NULL)) { - gchar * keyname = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_NAME, NULL); - server->parent.name = g_strdup(_(keyname)); - g_free(keyname); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_URI, NULL)) { - server->parent.uri = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_URI, NULL); - } - - return SERVER(server); -} - -/* Build the Citrix server from information in the JSON object */ -Server * -citrix_server_new_from_json (JsonObject * object) -{ - CitrixServer * server = g_object_new(CITRIX_SERVER_TYPE, NULL); - - if (json_object_has_member(object, JSON_SERVER_NAME)) { - JsonNode * node = json_object_get_member(object, JSON_SERVER_NAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * name = json_node_get_string(node); - server->parent.name = g_strdup(name); - } - } - - if (json_object_has_member(object, JSON_URI)) { - JsonNode * node = json_object_get_member(object, JSON_URI); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * uri = json_node_get_string(node); - server->parent.uri = g_strdup(uri); - } - } - - if (json_object_has_member(object, JSON_USERNAME)) { - JsonNode * node = json_object_get_member(object, JSON_USERNAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * username = json_node_get_string(node); - server->username = g_strdup(username); - } - } - - if (json_object_has_member(object, JSON_PASSWORD)) { - JsonNode * node = json_object_get_member(object, JSON_PASSWORD); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * password = json_node_get_string(node); - server->password = g_strdup(password); - mlock(server->password, strlen(server->password)); - } - } - - if (json_object_has_member(object, JSON_DOMAIN)) { - JsonNode * node = json_object_get_member(object, JSON_DOMAIN); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * domain = json_node_get_string(node); - server->domain = g_strdup(domain); - } - } - - if (json_object_has_member(object, JSON_DOMAIN_REQ)) { - JsonNode * node = json_object_get_member(object, JSON_DOMAIN_REQ); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_BOOLEAN) { - server->domain_required = json_node_get_boolean(node); - } - } - - return SERVER(server); -} diff --git a/src/citrix-server.h b/src/citrix-server.h deleted file mode 100644 index 376fbd6..0000000 --- a/src/citrix-server.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __CITRIX_SERVER_H__ -#define __CITRIX_SERVER_H__ - -#include <glib-object.h> -#include <json-glib/json-glib.h> -#include "server.h" - -G_BEGIN_DECLS - -#define CITRIX_SERVER_TYPE (citrix_server_get_type ()) -#define CITRIX_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CITRIX_SERVER_TYPE, CitrixServer)) -#define CITRIX_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CITRIX_SERVER_TYPE, CitrixServerClass)) -#define IS_CITRIX_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CITRIX_SERVER_TYPE)) -#define IS_CITRIX_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CITRIX_SERVER_TYPE)) -#define CITRIX_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CITRIX_SERVER_TYPE, CitrixServerClass)) - -typedef struct _CitrixServer CitrixServer; -typedef struct _CitrixServerClass CitrixServerClass; - -struct _CitrixServerClass { - ServerClass parent_class; -}; - -struct _CitrixServer { - Server parent; - - gchar * username; - gchar * password; - gchar * domain; - gboolean domain_required; -}; - -GType citrix_server_get_type (void); -Server * citrix_server_new_from_keyfile (GKeyFile * keyfile, const gchar * name); -Server * citrix_server_new_from_json (JsonObject * object); - -G_END_DECLS - -#endif diff --git a/src/crypt.c b/src/crypt.c deleted file mode 100644 index 4e8775f..0000000 --- a/src/crypt.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#include <glib.h> - -#include <gcrypt.h> -#include <math.h> - -#include "crypt.h" - -static gcry_cipher_hd_t -setup_cipher (const gchar * password) -{ - gcry_error_t gcryError; - gcry_cipher_hd_t gcryHandle; - - const size_t keyLength = gcry_cipher_get_algo_keylen(GCRY_CIPHER_AES); - const size_t blkLength = gcry_cipher_get_algo_blklen(GCRY_CIPHER_AES); - - // We are assuming keyLength and blkLength are the same, check it - if (keyLength != blkLength) - return NULL; - - char * aesSymKey = malloc(blkLength); - const size_t passwordLength = strlen(password); - strncpy(aesSymKey, password, blkLength); - size_t i; - for (i = passwordLength; i < blkLength; ++i) - aesSymKey[i] = 0; - - gcryError = gcry_cipher_open(&gcryHandle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC, 0); - if (gcryError) { - g_warning("gcry_cipher_open failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); - return NULL; - } - - gcryError = gcry_cipher_setkey(gcryHandle, aesSymKey, keyLength); - if (gcryError) { - g_warning("gcry_cipher_setkey failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); - gcry_cipher_close(gcryHandle); - return NULL; - } - - // Use the key as IV too - gcryError = gcry_cipher_setiv(gcryHandle, aesSymKey, blkLength); - if (gcryError) { - g_warning("gcry_cipher_setiv failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); - gcry_cipher_close(gcryHandle); - return NULL; - } - - return gcryHandle; -} - -/** - * do_aes_encrypt: - * @origBuffer: text to encrypt. Needs to be null terminated - * @password: password to use. Will be cut/padded with 0 if it exceeds/does not reach the needed length - * @outBufferLength: (out) On success contains the length of the returned buffer - * - * Returns the AES encrypted version of the text. It is responsability of the caller to free it - */ -gchar * -do_aes_encrypt(const gchar *origBuffer, const gchar * password, size_t *outBufferLength) -{ - gcry_error_t gcryError; - gcry_cipher_hd_t gcryHandle; - - gcryHandle = setup_cipher (password); - if (gcryHandle == NULL) { - return NULL; - } - - const size_t blkLength = gcry_cipher_get_algo_blklen(GCRY_CIPHER_AES); - const size_t origBufferLength = strlen(origBuffer); - const size_t bufferLength = ceil((double)origBufferLength / blkLength) * blkLength; - gchar *buffer = malloc(bufferLength); - memcpy(buffer, origBuffer, origBufferLength); - int i; - for (i = origBufferLength; i < bufferLength; ++i) - buffer[i] = 0; - - char * encBuffer = malloc(bufferLength); - size_t lengthDone = 0; - while (lengthDone < bufferLength) { - gcryError = gcry_cipher_encrypt(gcryHandle, &encBuffer[lengthDone], blkLength, &buffer[lengthDone], blkLength); - if (gcryError) { - g_warning("gcry_cipher_encrypt failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); - gcry_cipher_close(gcryHandle); - free(encBuffer); - return NULL; - } - lengthDone += blkLength; - } - - gcry_cipher_close(gcryHandle); - - *outBufferLength = bufferLength; - return encBuffer; -} - -/** - * do_aes_encrypt: - * @encBuffer: encrypted data - * @password: password to use. Will be cut/padded with 0 if it exceeds/does not reach the needed length - * @encBufferLength: Length of encBuffer - * - * Returns the AES decrypted version of the data. It is null terminated. It is responsability of the caller to free it - */ -gchar * -do_aes_decrypt(const gchar *encBuffer, const gchar * password, const size_t encBufferLength) -{ - gcry_error_t gcryError; - gcry_cipher_hd_t gcryHandle; - - gcryHandle = setup_cipher (password); - if (gcryHandle == NULL) { - return NULL; - } - - const size_t blkLength = gcry_cipher_get_algo_blklen(GCRY_CIPHER_AES128); - const size_t bufferLength = encBufferLength; - char * outBuffer = malloc(bufferLength); - size_t lengthDone = 0; - while (lengthDone < bufferLength) { - gcryError = gcry_cipher_decrypt(gcryHandle, &outBuffer[lengthDone], 16, &encBuffer[lengthDone], 16); - if (gcryError) - { - g_warning("gcry_cipher_decrypt failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); - return NULL; - } - lengthDone += blkLength; - } - - gcry_cipher_close(gcryHandle); - char *result = g_strndup(outBuffer, bufferLength); - free(outBuffer); - return result; -} diff --git a/src/crypt.h b/src/crypt.h deleted file mode 100644 index 89fd780..0000000 --- a/src/crypt.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef __CRYPT_H__ -#define __CRYPT_H__ - -gchar * do_aes_encrypt(const gchar * buffer, const gchar * password, size_t *outBufferLength); -gchar * do_aes_decrypt(const gchar * encBuffer, const gchar * password, const size_t encBufferLength); - -#endif diff --git a/src/defines.h b/src/defines.h deleted file mode 100644 index a29d90f..0000000 --- a/src/defines.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __DEFINES_H__ -#define __DEFINES_H__ - -#define CONFIG_MAIN_GROUP "Remote Logon Service" -#define CONFIG_MAIN_SERVERS "Servers" -#define CONFIG_SERVER_PREFIX "Server" -#define CONFIG_SERVER_NAME "Name" -#define CONFIG_SERVER_URI "URI" - -#define CONFIG_UCCS_EXEC "Exec" -#define CONFIG_UCCS_NETWORK "NetworkRequired" -#define CONFIG_UCCS_NETWORK_NONE "None" -#define CONFIG_UCCS_NETWORK_GLOBAL "Global" -#define CONFIG_UCCS_VERIFY "VerifyServer" - -#define CONFIG_SERVER_TYPE "Type" -#define CONFIG_SERVER_TYPE_RDP "RDP" -#define CONFIG_SERVER_TYPE_ICA "ICA" -#define CONFIG_SERVER_TYPE_X2GO "X2GO" -#define CONFIG_SERVER_TYPE_UCCS "UCCS" - -#define JSON_PROTOCOL "Protocol" -#define JSON_SERVER_NAME "Name" -#define JSON_URI "URL" -#define JSON_USERNAME "Username" -#define JSON_PASSWORD "Password" -#define JSON_DOMAIN_REQ "DomainRequired" -#define JSON_DOMAIN "WindowsDomain" -#define JSON_SESSIONTYPE "SessionType" -#define JSON_SESSIONTYPE_REQ "SessionTypeRequired" - -#endif /* __DEFINES_H__ */ diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 7c0a806..0000000 --- a/src/main.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib.h> -#include <glib/gi18n.h> - -/* NOTE: Required to build without optimizations */ -#include <locale.h> - -#include "remote-logon.h" -#include "defines.h" - -#include "server.h" -#include "rdp-server.h" -#include "citrix-server.h" -#include "uccs-server.h" -#include "x2go-server.h" -#include "crypt.h" - -gint server_list_to_array (GVariantBuilder * builder, GList * items); - -enum { - ERROR_SERVER_URI, - ERROR_LOGIN -}; - -GList * config_file_servers = NULL; - -/* Get the error domain for this module */ -static GQuark -error_domain (void) -{ - static GQuark value = 0; - if (value == 0) { - value = g_quark_from_static_string("remote-logon-service"); - } - return value; -} - -/* When one of the state changes on the server emit that so that everone knows there - might be a new server available. */ -static void -server_status_updated (Server * server, ServerState newstate, RemoteLogon * rl) -{ - GVariant * array = NULL; - - GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); - - if (server_list_to_array(&builder, config_file_servers) > 0) { - array = g_variant_builder_end(&builder); - } else { - g_variant_builder_clear(&builder); - array = g_variant_new_array(G_VARIANT_TYPE("(sssba(sbva{sv})a(si))"), NULL, 0); - } - - remote_logon_emit_servers_updated(rl, array); - return; -} - -/* Looks for the config file and does some basic parsing to pull out the UCCS servers - that are configured in it */ -static void -find_config_file (GKeyFile * parsed, const gchar * cmnd_line, RemoteLogon * rl) -{ - GError * error = NULL; - const gchar * file = DEFAULT_CONFIG_FILE; - - if (cmnd_line != NULL) { - file = cmnd_line; - } - - if (!g_key_file_load_from_file(parsed, file, G_KEY_FILE_NONE, &error)) { - g_warning("Unable to parse config file '%s': %s", file, error->message); - g_error_free(error); - return; - } - - if (!g_key_file_has_group(parsed, CONFIG_MAIN_GROUP)) { - g_warning("Config file '%s' doesn't have group '" CONFIG_MAIN_GROUP "'", file); - /* Probably should clear the keyfile, but there doesn't seem to be a way to do that */ - return; - } - - if (g_key_file_has_key(parsed, CONFIG_MAIN_GROUP, CONFIG_MAIN_SERVERS, NULL)) { - gchar ** grouplist = g_key_file_get_string_list(parsed, CONFIG_MAIN_GROUP, CONFIG_MAIN_SERVERS, NULL, NULL); - int i = 0; - gchar * groupsuffix; - - for (groupsuffix = grouplist[0], i = 0; groupsuffix != NULL; groupsuffix = grouplist[++i]) { - gchar * groupname = g_strdup_printf("%s %s", CONFIG_SERVER_PREFIX, groupsuffix); - Server * server = server_new_from_keyfile(parsed, groupname); - g_free(groupname); - - if (server == NULL) { - /* Assume a relevant error is printed above */ - continue; - } - - config_file_servers = g_list_append(config_file_servers, server); - g_signal_connect(server, SERVER_SIGNAL_STATE_CHANGED, G_CALLBACK(server_status_updated), rl); - } - - g_strfreev(grouplist); - } - - /* Signal the list of servers so that we're sure everyone's got them. This is to - solve a possible race where someone could ask while we're configuring these. */ - server_status_updated(NULL, SERVER_STATE_ALLGOOD, rl); - return; -} - -gint -server_list_to_array (GVariantBuilder * builder, GList * items) -{ - gint servercnt = 0; - GList * head = NULL; - for (head = items; head != NULL; head = g_list_next(head)) { - Server * server = SERVER(head->data); - - /* We only want servers that are all good */ - if (server->state != SERVER_STATE_ALLGOOD) { - continue; - } - - servercnt++; - GVariant * variant = server_get_variant(server); - g_variant_builder_add_value(builder, variant); - } - - return servercnt; -} - -static gboolean -handle_get_servers (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) -{ - GVariant * array = NULL; - - GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); - - if (server_list_to_array(&builder, config_file_servers) > 0) { - array = g_variant_builder_end(&builder); - } else { - g_variant_builder_clear(&builder); - array = g_variant_new_array(G_VARIANT_TYPE("(sssba(sbva{sv})a(si))"), NULL, 0); - } - - g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&array, 1)); - - return TRUE; -} - -/* Handle the situation of whether we unlock or not and respond over - DBus with either an error or the list of servers. */ -static void -handle_get_servers_login_cb (UccsServer * server, gboolean unlocked, gpointer user_data) -{ - GDBusMethodInvocation * invocation = (GDBusMethodInvocation *)user_data; - const gchar * sender = g_dbus_method_invocation_get_sender(invocation); - - GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); - - /* Signal whether we're unlocked */ - g_variant_builder_add_value(&builder, g_variant_new_boolean(unlocked)); - - /* Only network, no caching yet */ - g_variant_builder_add_value(&builder, g_variant_new_string("network")); - - /* Get the array of servers */ - GVariant * array = uccs_server_get_servers(server, sender); - g_variant_builder_add_value(&builder, array); - - g_dbus_method_invocation_return_value(invocation, g_variant_builder_end(&builder)); - return; -} - -/* Handle the GetServerForLogin DBus call */ -static gboolean -handle_get_servers_login (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) -{ - GVariant * params = g_dbus_method_invocation_get_parameters(invocation); - const gchar * sender = g_dbus_method_invocation_get_sender(invocation); - - GVariant * child = NULL; - const gchar * uri = NULL; - - child = g_variant_get_child_value(params, 0); - uri = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - GList * lserver = NULL; - Server * server = NULL; - for (lserver = config_file_servers; lserver != NULL; lserver = g_list_next(lserver)) { - server = SERVER(lserver->data); - - if (server == NULL) { - continue; - } - - if (!IS_UCCS_SERVER(server)) { - continue; - } - - if (g_strcmp0(server->uri, uri) == 0) { - break; - } - } - - if (lserver == NULL) { - /* Couldn't find something with that URI, we're done, thanks. */ - g_dbus_method_invocation_return_error(invocation, - error_domain(), - ERROR_SERVER_URI, - "Unable to find a server with the URI: '%s'", - uri); - - return TRUE; - } - - /* Unlock the Server */ - const gchar * username = NULL; - const gchar * password = NULL; - gboolean allowcache = FALSE; - - child = g_variant_get_child_value(params, 1); - username = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - child = g_variant_get_child_value(params, 2); - password = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - child = g_variant_get_child_value(params, 3); - allowcache = g_variant_get_boolean(child); - g_variant_unref(child); - - /* Try to login and mark us as servicing the message */ - uccs_server_unlock(UCCS_SERVER(server), sender, username, password, allowcache, handle_get_servers_login_cb, invocation); - return TRUE; -} - -/* Look through a list of servers to see if one matches a URL */ -static Server * -handle_get_domains_list_helper (GList * list, const gchar * uri) -{ - if (list == NULL) return NULL; - - Server * inserver = SERVER(list->data); - - if (inserver == NULL) { - return handle_get_domains_list_helper(g_list_next(list), uri); - } - - Server * outserver = server_find_uri(inserver, uri); - - if (outserver != NULL) { - return outserver; - } - - return handle_get_domains_list_helper(g_list_next(list), uri); -} - -/* Get the cached domains for a server */ -static gboolean -handle_get_domains (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) -{ - GVariant * params = g_dbus_method_invocation_get_parameters(invocation); - - GVariant * child = NULL; - const gchar * uri = NULL; - - child = g_variant_get_child_value(params, 0); - uri = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - Server * server = handle_get_domains_list_helper(config_file_servers, uri); - - GVariant * domains = NULL; - if (server != NULL) { - domains = server_cached_domains(server); - } else { - domains = g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0); - } - - if (domains == NULL) { - /* Couldn't find something with that URI, we're done, thanks. */ - g_dbus_method_invocation_return_error(invocation, - error_domain(), - ERROR_SERVER_URI, - "Unable to find a server with the URI: '%s'", - uri); - - return TRUE; - } - - g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&domains, 1)); - - return TRUE; -} - -/* Set a given server as last used */ -static gboolean -handle_set_last_used_server (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) -{ - GVariant * params = g_dbus_method_invocation_get_parameters(invocation); - - GVariant * child = NULL; - const gchar * uccsUri = NULL; - const gchar * serverUri = NULL; - - child = g_variant_get_child_value(params, 0); - uccsUri = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - child = g_variant_get_child_value(params, 1); - serverUri = g_variant_get_string(child, NULL); - g_variant_unref(child); /* fine as we know params is still ref'd */ - - GList * lserver = NULL; - Server * server = NULL; - for (lserver = config_file_servers; lserver != NULL; lserver = g_list_next(lserver)) { - server = SERVER(lserver->data); - - if (server == NULL) { - continue; - } - - if (!IS_UCCS_SERVER(server)) { - continue; - } - - if (g_strcmp0(server->uri, uccsUri) == 0) { - break; - } - } - - if (server != NULL) { - server_set_last_used_server (server, serverUri); - } - - g_dbus_method_invocation_return_value(invocation, NULL); - - return TRUE; -} - -/* If we loose the name, tell the world and there's not much we can do */ -static void -name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) -{ - GMainLoop * mainloop = (GMainLoop *)user_data; - - g_warning("Unable to get name '%s'. Exiting.", name); - g_main_loop_quit(mainloop); - - return; -} - -static gchar * cmnd_line_config = NULL; - -static GOptionEntry general_options[] = { - {"config-file", 'c', 0, G_OPTION_ARG_FILENAME, &cmnd_line_config, N_("Configuration file for the remote logon service. Defaults to '/etc/remote-logon-service.conf'."), N_("key_file")}, - {NULL} -}; - -int -main (int argc, char * argv[]) -{ - GError * error = NULL; - -#if !GLIB_CHECK_VERSION (2, 35, 1) - /* Init the GTypes */ - g_type_init(); -#endif - - /* Setup i18n */ - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); - textdomain (GETTEXT_PACKAGE); - - /* Create our global variables */ - GKeyFile * config = g_key_file_new(); - GMainLoop * mainloop = g_main_loop_new(NULL, FALSE); - - /* Handle command line parameters */ - GOptionContext * context; - context = g_option_context_new(_("- Determine the remote servers that can be logged into")); - g_option_context_add_main_entries(context, general_options, "remote-logon-service"); - - if (!g_option_context_parse(context, &argc, &argv, &error)) { - g_print("option parsing failed: %s\n", error->message); - g_error_free(error); - return 1; - } - - /* Start up D' Bus */ - GDBusConnection * session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL /* cancel */, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - g_error_free(error); - return -1; - } - - /* Build Dbus Interface */ - RemoteLogon * skel = remote_logon_skeleton_new(); - /* Export it */ - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(skel), - session_bus, - "/org/ArcticaProject/RemoteLogon", - NULL); - g_signal_connect(skel, "handle-get-servers", G_CALLBACK(handle_get_servers), NULL); - g_signal_connect(skel, "handle-get-servers-for-login", G_CALLBACK(handle_get_servers_login), NULL); - g_signal_connect(skel, "handle-get-cached-domains-for-server", G_CALLBACK(handle_get_domains), NULL); - g_signal_connect(skel, "handle-set-last-used-server", G_CALLBACK(handle_set_last_used_server), NULL); - - g_bus_own_name_on_connection(session_bus, - "org.ArcticaProject.RemoteLogon", - G_BUS_NAME_OWNER_FLAGS_NONE, - NULL, /* aquired handler */ - name_lost, - mainloop, - NULL); /* mainloop free */ - - /* Parse config file */ - find_config_file(config, cmnd_line_config, skel); - - /* Loop forever */ - g_main_loop_run(mainloop); - - g_main_loop_unref(mainloop); - g_object_unref(config); - - g_free(cmnd_line_config); - - return 0; -} diff --git a/src/org.ArcticaProject.RemoteLogon.xml b/src/org.ArcticaProject.RemoteLogon.xml deleted file mode 100644 index 9e1bd26..0000000 --- a/src/org.ArcticaProject.RemoteLogon.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0"?> -<node name="/"> - <interface name="org.ArcticaProject.RemoteLogon"> - <!-- SERVER LIST DOCS - it's in a few places :-) - s: server type: "ica", "freerdp", "x2go", "uccs" - s: server name - s: server uri - b: last used server - a(sbva{sv}): properties for the server - s: type: "username", "password", "domain", "email", "sessiontype" - b: required - v: default value - a{sv}: properties for the value - for value 'domain': a list of possible domains (ica, freerdp) - "domains": a(s) - for value 'domain': a list of domains that are read only - "read-only": b - for value 'sessiontype': TODO -> a subset of session profile parameters... - "nothing-yet": s - a(si): applications pinned for the server - s: ID of the application (desktop file) - i: position the application is pinned in - --> - -<!-- Methods --> - <method name="GetServers"> - <!-- Get the servers that are available on the local network - that don't need a login to get --> - <arg type="a(sssba(sbva{sv})a(si))" name="serverList" direction="out" /> - </method> - <method name="GetServersForLogin"> - <arg type="s" name="uri" direction="in" /> - <arg type="s" name="emailAddress" direction="in" /> - <arg type="s" name="password" direction="in" /> - <arg type="b" name="allowCache" direction="in" /> - - <arg type="b" name="loginSuccess" direction="out" /> - <arg type="s" name="dataType" direction="out"> - <!-- Should be either "cached" or "network" depending on where the data - was gotten from --> - </arg> - <arg type="a(sssba(sbva{sv})a(si))" name="serverList" direction="out" /> - </method> - <method name="GetCachedDomainsForServer"> - <arg type="s" name="uri" direction="in" /> - <arg type="as" name="domains" direction="out" /> - </method> - <method name="SetApplicationsForServer"> - <arg type="s" name="uccsUri" direction="in" /> - <!-- UCCS URI is optional and only needed for servers that - are under a UCCS account. NULL string if not used. --> - <arg type="s" name="serverUri" direction="in" /> - <arg type="a(si)" name="applications" direction="in" /> - </method> - <method name="SetLastUsedServer"> - <arg type="s" name="uccsUri" direction="in" /> - <arg type="s" name="serverUri" direction="in" /> - </method> - -<!-- Signals --> - <signal name="ServersUpdated"> - <arg type="a(sssba(sbva{sv})a(si))" name="serverList" direction="out" /> - </signal> - <signal name="LoginServersUpdated"> - <!-- Note: This IS NOT a broadcast signal, it will only be - signaled to folks who have previously called 'GetServersForLogin' - with a valid password --> - <arg type="s" name="uri" direction="out" /> - <arg type="s" name="emailAddress" direction="out" /> - <arg type="s" name="dataType" direction="out" /> - - <arg type="a(sssba(sbva{sv})a(si))" name="serverList" direction="out" /> - </signal> - <signal name="LoginChanged"> - <!-- This is sent if, for some reason, we think that the folks who - had previously called GetServersForLogin need to recall it. Those - who do not will not be sent 'LoginServersUpdated' signals. --> - <arg type="s" name="uri" direction="out" /> - <arg type="s" name="emailAddress" direction="out" /> - </signal> - - </interface> -</node> diff --git a/src/rdp-server.c b/src/rdp-server.c deleted file mode 100644 index d489314..0000000 --- a/src/rdp-server.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/mman.h> - -#include <glib/gi18n.h> - -#include <string.h> - -#include "rdp-server.h" -#include "defines.h" - -static void rdp_server_class_init (RdpServerClass *klass); -static void rdp_server_init (RdpServer *self); -static void rdp_server_dispose (GObject *object); -static void rdp_server_finalize (GObject *object); -static GVariant * get_properties (Server * server); - -G_DEFINE_TYPE (RdpServer, rdp_server, SERVER_TYPE); - -static void -rdp_server_class_init (RdpServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = rdp_server_dispose; - object_class->finalize = rdp_server_finalize; - - ServerClass * server_class = SERVER_CLASS(klass); - - server_class->get_properties = get_properties; - - return; -} - -static void -rdp_server_init (RdpServer *self) -{ - self->username = NULL; - self->password = NULL; - self->domain = NULL; - self->domain_required = FALSE; - - return; -} - -static void -rdp_server_dispose (GObject *object) -{ - - G_OBJECT_CLASS (rdp_server_parent_class)->dispose (object); - return; -} - -/* Unlocks the memory before freeing */ -static void -password_clear (gpointer data) -{ - char * pass = (char *)data; - munlock(pass, strlen(pass)); - g_free(pass); - return; -} - -static void -rdp_server_finalize (GObject *object) -{ - RdpServer * server = RDP_SERVER(object); - - g_clear_pointer(&server->username, g_free); - g_clear_pointer(&server->password, password_clear); - g_clear_pointer(&server->domain, g_free); - - G_OBJECT_CLASS (rdp_server_parent_class)->finalize (object); - return; -} - -static GVariant * -get_properties (Server * server) -{ - RdpServer * rserver = RDP_SERVER(server); - - GVariantBuilder propbuilder; - g_variant_builder_init(&propbuilder, G_VARIANT_TYPE_ARRAY); - - GVariantBuilder namebuilder; - g_variant_builder_init(&namebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&namebuilder, g_variant_new_string("username")); - g_variant_builder_add_value(&namebuilder, g_variant_new_boolean(TRUE)); - if (rserver->username == NULL) { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(rserver->username))); - } - g_variant_builder_add_value(&namebuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&namebuilder)); - - GVariantBuilder passbuilder; - g_variant_builder_init(&passbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&passbuilder, g_variant_new_string("password")); - g_variant_builder_add_value(&passbuilder, g_variant_new_boolean(TRUE)); - if (rserver->password == NULL) { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(rserver->password))); - } - g_variant_builder_add_value(&passbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&passbuilder)); - - GVariantBuilder domainbuilder; - g_variant_builder_init(&domainbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&domainbuilder, g_variant_new_string("domain")); - g_variant_builder_add_value(&domainbuilder, g_variant_new_boolean(rserver->domain_required)); - if (rserver->domain == NULL) { - g_variant_builder_add_value(&domainbuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&domainbuilder, g_variant_new_variant(g_variant_new_string(rserver->domain))); - } - g_variant_builder_add_value(&domainbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&domainbuilder)); - - return g_variant_builder_end(&propbuilder); -} - -Server * -rdp_server_new_from_keyfile (GKeyFile * keyfile, const gchar * groupname) -{ - g_return_val_if_fail(keyfile != NULL, NULL); /* NOTE: No way to check if that's really a keyfile :-( */ - g_return_val_if_fail(groupname != NULL, NULL); - - if (!g_key_file_has_group(keyfile, groupname)) { - g_warning("Server specified but group '%s' was not found", groupname); - return NULL; - } - - RdpServer * server = g_object_new(RDP_SERVER_TYPE, NULL); - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_NAME, NULL)) { - gchar * keyname = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_NAME, NULL); - server->parent.name = g_strdup(_(keyname)); - g_free(keyname); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_URI, NULL)) { - server->parent.uri = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_URI, NULL); - } - - return SERVER(server); -} - -/* Build the RDP server from information in the JSON object */ -Server * -rdp_server_new_from_json (JsonObject * object) -{ - RdpServer * server = g_object_new(RDP_SERVER_TYPE, NULL); - - if (json_object_has_member(object, JSON_SERVER_NAME)) { - JsonNode * node = json_object_get_member(object, JSON_SERVER_NAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * name = json_node_get_string(node); - server->parent.name = g_strdup(name); - } - } - - if (json_object_has_member(object, JSON_URI)) { - JsonNode * node = json_object_get_member(object, JSON_URI); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * uri = json_node_get_string(node); - server->parent.uri = g_strdup(uri); - } - } - - if (json_object_has_member(object, JSON_USERNAME)) { - JsonNode * node = json_object_get_member(object, JSON_USERNAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * username = json_node_get_string(node); - server->username = g_strdup(username); - } - } - - if (json_object_has_member(object, JSON_PASSWORD)) { - JsonNode * node = json_object_get_member(object, JSON_PASSWORD); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * password = json_node_get_string(node); - server->password = g_strdup(password); - mlock(server->password, strlen(server->password)); - } - } - - if (json_object_has_member(object, JSON_DOMAIN)) { - JsonNode * node = json_object_get_member(object, JSON_DOMAIN); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * domain = json_node_get_string(node); - server->domain = g_strdup(domain); - } - } - - if (json_object_has_member(object, JSON_DOMAIN_REQ)) { - JsonNode * node = json_object_get_member(object, JSON_DOMAIN_REQ); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_BOOLEAN) { - server->domain_required = json_node_get_boolean(node); - } - } - - return SERVER(server); -} diff --git a/src/rdp-server.h b/src/rdp-server.h deleted file mode 100644 index 1339d86..0000000 --- a/src/rdp-server.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __RDP_SERVER_H__ -#define __RDP_SERVER_H__ - -#include <glib-object.h> -#include <json-glib/json-glib.h> -#include "server.h" - -G_BEGIN_DECLS - -#define RDP_SERVER_TYPE (rdp_server_get_type ()) -#define RDP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RDP_SERVER_TYPE, RdpServer)) -#define RDP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RDP_SERVER_TYPE, RdpServerClass)) -#define IS_RDP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RDP_SERVER_TYPE)) -#define IS_RDP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RDP_SERVER_TYPE)) -#define RDP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RDP_SERVER_TYPE, RdpServerClass)) - -typedef struct _RdpServer RdpServer; -typedef struct _RdpServerClass RdpServerClass; - -struct _RdpServerClass { - ServerClass parent_class; -}; - -struct _RdpServer { - Server parent; - - gchar * username; - gchar * password; - gchar * domain; - gboolean domain_required; -}; - -GType rdp_server_get_type (void); -Server * rdp_server_new_from_keyfile (GKeyFile * keyfile, const gchar * name); -Server * rdp_server_new_from_json (JsonObject * object); - -G_END_DECLS - -#endif diff --git a/src/server.c b/src/server.c deleted file mode 100644 index 3272b76..0000000 --- a/src/server.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "server.h" -#include "defines.h" -#include "citrix-server.h" -#include "rdp-server.h" -#include "uccs-server.h" -#include "x2go-server.h" - -static void server_class_init (ServerClass *klass); -static void server_init (Server *self); -static void server_dispose (GObject *object); -static void server_finalize (GObject *object); - -/* Signals */ -enum { - STATE_CHANGED, - LAST_SIGNAL -}; - -G_DEFINE_TYPE (Server, server, G_TYPE_OBJECT); - -static guint signals[LAST_SIGNAL] = { 0 }; - -static void -server_class_init (ServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = server_dispose; - object_class->finalize = server_finalize; - - signals[STATE_CHANGED] = g_signal_new(SERVER_SIGNAL_STATE_CHANGED, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(ServerClass, state_changed), - NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_NONE); - - return; -} - -static void -server_init (Server *self) -{ - self->name = NULL; - self->uri = NULL; - self->last_used = FALSE; - self->state = SERVER_STATE_ALLGOOD; - - return; -} - -static void -server_dispose (GObject *object) -{ - - G_OBJECT_CLASS (server_parent_class)->dispose (object); - return; -} - -static void -server_finalize (GObject *object) -{ - Server * server = SERVER(object); - - g_free(server->name); - g_free(server->uri); - - G_OBJECT_CLASS (server_parent_class)->finalize (object); - return; -} - -/** - * server_new_from_keyfile: - * @keyfile: The keyfile with the @group in it to define the server - * @group: Group name for this server - * - * Looks at a group within the keyfile and builds a server based on - * it's type. Mostly works with a subclass based on the type. - * - * Return value: A new Server object or NULL if error - */ -Server * -server_new_from_keyfile (GKeyFile * keyfile, const gchar * group) -{ - g_return_val_if_fail(keyfile != NULL, NULL); - g_return_val_if_fail(group != NULL, NULL); - - if (!g_key_file_has_group(keyfile, group)) { - return NULL; - } - - gchar * type = NULL; - if (g_key_file_has_key(keyfile, group, CONFIG_SERVER_TYPE, NULL)) { - type = g_key_file_get_string(keyfile, group, CONFIG_SERVER_TYPE, NULL); - } - - if (g_strcmp0(type, CONFIG_SERVER_TYPE_RDP) == 0) { - return SERVER(rdp_server_new_from_keyfile(keyfile, group)); - } else if (g_strcmp0(type, CONFIG_SERVER_TYPE_ICA) == 0) { - return SERVER(citrix_server_new_from_keyfile(keyfile, group)); - } else { - return SERVER(uccs_server_new_from_keyfile(keyfile, group)); - } - - return NULL; -} - -/** - * server_new_from_json: - * @object: JSON object with server definition - * - * Looks at the type and then uses a subclassed function to build the - * server. - * - * Return value: A new Server object or NULL if error - */ -Server * -server_new_from_json (JsonObject * object) -{ - g_return_val_if_fail(object != NULL, NULL); - - if (!json_object_has_member(object, "Protocol")) { - return NULL; - } - - JsonNode * proto_node = json_object_get_member(object, "Protocol"); - if (JSON_NODE_TYPE(proto_node) != JSON_NODE_VALUE) { - return NULL; - } - if (json_node_get_value_type(proto_node) != G_TYPE_STRING) { - return NULL; - } - - const gchar * proto = json_node_get_string(proto_node); - Server * newserver = NULL; - - if (g_strcmp0(proto, "ICA") == 0 || g_strcmp0(proto, "ica") == 0) { - newserver = citrix_server_new_from_json(object); - } - else if (g_strcmp0(proto, "freerdp") == 0 || g_strcmp0(proto, "rdp") == 0 || g_strcmp0(proto, "RDP") == 0 || g_strcmp0(proto, "FreeRDP") == 0) { - newserver = rdp_server_new_from_json(object); - } - else if (g_strcmp0(proto, "x2go") == 0 || g_strcmp0(proto, "X2go") == 0 || g_strcmp0(proto, "X2Go") == 0 || g_strcmp0(proto, "X2GO") == 0 || g_strcmp0(proto, "x2GO") == 0 || g_strcmp0(proto, "x2gO") == 0) { - newserver = x2go_server_new_from_json(object); - } - - return newserver; -} - -GVariant * -server_get_variant (Server * server) -{ - /* Okay, this doesn't do anything useful, but it will generate an error - which could be a good thing */ - g_return_val_if_fail(IS_SERVER(server), NULL); - - ServerClass * klass = SERVER_GET_CLASS(server); - if (klass->get_properties != NULL) { - GVariantBuilder tuple; - g_variant_builder_init(&tuple, G_VARIANT_TYPE_TUPLE); - - if (IS_CITRIX_SERVER(server)) { - g_variant_builder_add_value(&tuple, g_variant_new_string("ica")); - } else if (IS_RDP_SERVER(server)) { - g_variant_builder_add_value(&tuple, g_variant_new_string("freerdp")); - } else if (IS_UCCS_SERVER(server)) { - g_variant_builder_add_value(&tuple, g_variant_new_string("uccs")); - } else if (IS_X2GO_SERVER(server)) { - g_variant_builder_add_value(&tuple, g_variant_new_string("x2go")); - } else { - g_assert_not_reached(); - } - - if (server->name != NULL) { - g_variant_builder_add_value(&tuple, g_variant_new_string(server->name)); - } else { - g_warning("Server has no name"); - g_variant_builder_add_value(&tuple, g_variant_new_string("")); - } - - if (server->uri != NULL) { - g_variant_builder_add_value(&tuple, g_variant_new_string(server->uri)); - } else { - g_warning("Server has no URI"); - g_variant_builder_add_value(&tuple, g_variant_new_string("")); - } - - g_variant_builder_add_value(&tuple, g_variant_new_boolean(server->last_used)); - - GVariant * props = klass->get_properties(server); - g_variant_builder_add_value(&tuple, props); - - if (klass->get_applications != NULL) { - GVariant * array = klass->get_applications(server); - g_variant_builder_add_value(&tuple, array); - } else { - /* NULL array of applications */ - g_variant_builder_add_value(&tuple, g_variant_new_array(G_VARIANT_TYPE("(si)"), NULL, 0)); - } - - return g_variant_builder_end(&tuple); - } - - return NULL; -} - -/** - * server_cached_domains: - * @server: Where should we find those domains? - * - * Gets a list of cached domains for a particular server, if this function - * isn't overriden, then a null array is returned. - */ -GVariant * -server_cached_domains (Server * server) -{ - g_return_val_if_fail(IS_SERVER(server), NULL); - - ServerClass * klass = SERVER_GET_CLASS(server); - if (klass->get_domains != NULL) { - return klass->get_domains(server); - } - - return g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0); -} - -/** - * server_find_uri: - * @server: Server to look in - * @uri: URI to search for - * - * Checks the URI of this server to see if it matches, and then look - * to see if subclasses have a way to match it another way. - */ -Server * -server_find_uri (Server * server, const gchar * uri) -{ - g_return_val_if_fail(IS_SERVER(server), NULL); - - if (g_strcmp0(server->uri, uri) == 0) { - return server; - } - - ServerClass * klass = SERVER_GET_CLASS(server); - - if (klass->find_uri != NULL) { - return klass->find_uri(server, uri); - } - - return NULL; -} - -/** - * server_set_last_used: - * @server: Server to look in - * @uri: URI to set as last used - * - * Checks the URI of this server to see if it matches, and then look - * to see if subclasses have a way to match it another way. - */ -void -server_set_last_used_server (Server * server, const gchar * uri) -{ - g_return_if_fail(IS_SERVER(server)); - - if (g_strcmp0(server->uri, uri) == 0) { - server->last_used = TRUE; - } else { - ServerClass * klass = SERVER_GET_CLASS(server); - - if (klass->set_last_used_server != NULL) { - klass->set_last_used_server(server, uri); - } - } -} diff --git a/src/server.h b/src/server.h deleted file mode 100644 index b3fe77b..0000000 --- a/src/server.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __SERVER_H__ -#define __SERVER_H__ - -#include <glib-object.h> -#include <json-glib/json-glib.h> - -G_BEGIN_DECLS - -#define SERVER_TYPE (server_get_type ()) -#define SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVER_TYPE, Server)) -#define SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVER_TYPE, ServerClass)) -#define IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVER_TYPE)) -#define IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVER_TYPE)) -#define SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVER_TYPE, ServerClass)) - -#define SERVER_SIGNAL_STATE_CHANGED "state-changed" - -typedef struct _Server Server; -typedef struct _ServerClass ServerClass; -typedef enum _ServerState ServerState; - -enum _ServerState { - SERVER_STATE_ALLGOOD, - SERVER_STATE_UNAVAILABLE -}; - -struct _ServerClass { - GObjectClass parent_class; - GVariant * (*get_properties) (Server * server); - GVariant * (*get_applications) (Server * server); - GVariant * (*get_domains) (Server * server); - Server * (*find_uri) (Server * server, const gchar * uri); - void (*set_last_used_server) (Server * server, const gchar * uri); - - /* signals */ - void (*state_changed) (Server * server, ServerState newstate, gpointer user_data); -}; - -struct _Server { - GObject parent; - - gchar * name; - gchar * uri; - gboolean last_used; - - ServerState state; -}; - -GType server_get_type (void); -Server * server_new_from_keyfile (GKeyFile * keyfile, const gchar * group); -Server * server_new_from_json (JsonObject * object); -GVariant * server_get_variant (Server * server); -GVariant * server_cached_domains (Server * server); -Server * server_find_uri (Server * server, const gchar * uri); -void server_set_last_used_server (Server * server, const gchar * uri); - -G_END_DECLS - -#endif diff --git a/src/uccs-server.c b/src/uccs-server.c deleted file mode 100644 index a87e4d1..0000000 --- a/src/uccs-server.c +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib.h> -#include <glib/gi18n.h> - -#include <json-glib/json-glib.h> - -#include <gio/gunixinputstream.h> -#include <gio/gunixoutputstream.h> - -#include <stdlib.h> -#include <string.h> - -#include "uccs-server.h" -#include "defines.h" - -#include "rdp-server.h" -#include "citrix-server.h" - -#include "crypt.h" - -static void uccs_server_class_init (UccsServerClass *klass); -static void uccs_server_init (UccsServer *self); -static void uccs_server_dispose (GObject *object); -static void uccs_server_finalize (GObject *object); -static GVariant * get_properties (Server * server); -static void json_waiters_notify (UccsServer * server, gboolean unlocked); -static GVariant * get_cached_domains (Server * server); -static Server * find_uri (Server * server, const gchar * uri); -static void set_last_used_server (Server * server, const gchar * uri); -static void evaluate_state (UccsServer * server); -static void nm_state_changed (NMClient *client, const GParamSpec *pspec, gpointer user_data); - -typedef struct _json_callback_t json_callback_t; -struct _json_callback_t { - gchar * sender; - void (*callback) (UccsServer * server, gboolean unlocked, gpointer user_data); - gpointer userdata; -}; - -G_DEFINE_TYPE (UccsServer, uccs_server, SERVER_TYPE); - -/* Static global client so we don't keep reallocating them. We only need - one really */ -static NMClient * global_client = NULL; - -static void -uccs_server_class_init (UccsServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = uccs_server_dispose; - object_class->finalize = uccs_server_finalize; - - ServerClass * server_class = SERVER_CLASS(klass); - - server_class->get_properties = get_properties; - /* UCCS can't have applications */ - server_class->get_applications = NULL; - server_class->get_domains = get_cached_domains; - server_class->find_uri = find_uri; - server_class->set_last_used_server = set_last_used_server; - - return; -} - -static void -uccs_server_init (UccsServer *self) -{ - self->exec = g_find_program_in_path(UCCS_QUERY_TOOL); - - self->username = NULL; - self->password = NULL; - - self->lovers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - self->subservers = NULL; - - self->json_waiters = NULL; - self->json_watch = 0; - self->json_pid = 0; - - self->json_stream = NULL; - self->pass_stream = NULL; - - self->min_network = NM_STATE_CONNECTED_GLOBAL; - self->last_network = NM_STATE_DISCONNECTED; - self->nm_client = NULL; - self->nm_signal = 0; - - /* Start as unavailable */ - self->parent.state = SERVER_STATE_UNAVAILABLE; - - if (global_client == NULL) { - global_client = nm_client_new(); - - if (global_client != NULL) { - g_object_add_weak_pointer(G_OBJECT(global_client), (gpointer *)&global_client); - self->nm_client = global_client; - } - } else { - self->nm_client = g_object_ref(global_client); - } - - if (self->nm_client != NULL) { - self->nm_signal = g_signal_connect(self->nm_client, "notify::" NM_CLIENT_STATE, G_CALLBACK(nm_state_changed), self); - } - - self->verify_server = TRUE; - self->verified_server = FALSE; - self->session = NULL; - - /* Need the soup session before the state changed */ - self->session = soup_session_sync_new(); - - nm_state_changed(self->nm_client, NULL, self); - evaluate_state(self); - - return; -} - -/* Small function to try and figure out the state of the server and set the - status appropriately */ -static void -evaluate_state (UccsServer * server) -{ - ServerState tempstate = SERVER_STATE_ALLGOOD; - - if (server->exec == NULL) { - tempstate = SERVER_STATE_UNAVAILABLE; - } - - if (server->last_network < server->min_network) { - tempstate = SERVER_STATE_UNAVAILABLE; - } - - if (server->verify_server && !server->verified_server && server->min_network > NM_STATE_DISCONNECTED) { - tempstate = SERVER_STATE_UNAVAILABLE; - } - - if (tempstate != server->parent.state) { - server->parent.state = tempstate; - g_signal_emit_by_name(server, SERVER_SIGNAL_STATE_CHANGED, server->parent.state); - } - - return; -} - -struct _hash_helper { - GVariant * params; - GDBusConnection * session; -}; - -/* GHashTable foreach item */ -static gboolean -clear_hash_helper (gpointer key, gpointer value, gpointer user_data) -{ - struct _hash_helper * helper = (struct _hash_helper *)user_data; - GError * error = NULL; - - g_dbus_connection_emit_signal(helper->session, - (const gchar *)key, /* dest */ - "/org/ArcticaProject/RemoteLogon", /* object path */ - "org.ArcticaProject.RemoteLogon", /* interface name */ - "org.ArcticaProject.RemoteLogon.LoginChanged", /* signal name */ - helper->params, /* params */ - &error); - - if (error != NULL) { - g_warning("Unable to signal UCCS server shutdown: %s", error->message); - g_error_free(error); - } - - return TRUE; -} - -/* Clear the hash table by going through it and signaling */ -static void -clear_hash (UccsServer * server) -{ - if (g_hash_table_size(server->lovers) == 0) { - return; - } - - g_return_if_fail(server->parent.uri != NULL); - g_return_if_fail(server->username != NULL); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); /* Shouldn't block, we should have it */ - GVariant * param = g_variant_new("(ss)", server->parent.uri, server->username); /* params */ - g_variant_ref_sink(param); - - struct _hash_helper helper; - helper.params = param; - helper.session = session; - - g_hash_table_foreach_remove(server->lovers, clear_hash_helper, &helper); - - g_object_unref(session); - g_variant_unref(param); - - return; -} - -/* Clear the JSON task and waiters */ -static void -clear_json (UccsServer * self) -{ - if (self->json_watch != 0) { - g_source_remove(self->json_watch); - self->json_watch = 0; - } - - if (self->json_pid != 0) { - g_spawn_close_pid(self->json_pid); - self->json_pid = 0; - } - - if (self->json_stream != NULL) { - g_input_stream_close(self->json_stream, NULL, NULL); - g_object_unref(self->json_stream); - self->json_stream = NULL; - } - - if (self->pass_stream != NULL) { - g_output_stream_close(self->pass_stream, NULL, NULL); - g_object_unref(self->pass_stream); - self->pass_stream = NULL; - } - - json_waiters_notify(self, FALSE); - - return; -} - -/* Clean up references */ -static void -uccs_server_dispose (GObject *object) -{ - UccsServer * self = UCCS_SERVER(object); - - g_clear_object(&self->session); - - if (self->nm_signal != 0) { - g_signal_handler_disconnect(self->nm_client, self->nm_signal); - self->nm_signal = 0; - } - - g_clear_object(&self->nm_client); - - clear_json(self); - - if (self->lovers != NULL) { - clear_hash(self); - } - - g_list_free_full(self->subservers, g_object_unref); - self->subservers = NULL; /* Ironically the free function is the only GList - function that doesn't return a new pointer by itself */ - - G_OBJECT_CLASS (uccs_server_parent_class)->dispose (object); - return; -} - -/* Clean up memory */ -static void -uccs_server_finalize (GObject *object) -{ - UccsServer * self = UCCS_SERVER(object); - - g_free(self->exec); self->exec = NULL; - g_free(self->username); self->username = NULL; - g_free(self->password); self->password = NULL; - - if (self->lovers != NULL) { - g_hash_table_unref(self->lovers); - self->lovers = NULL; - } - - G_OBJECT_CLASS (uccs_server_parent_class)->finalize (object); - return; -} - -/* Callback from the message getting complete */ -static void -verify_server_cb (SoupSession * session, SoupMessage * message, gpointer user_data) -{ - UccsServer * server = UCCS_SERVER(user_data); - guint statuscode = 404; - - g_object_get(G_OBJECT(message), SOUP_MESSAGE_STATUS_CODE, &statuscode, NULL); - g_debug("Verification came back with status: %d", statuscode); - - if (statuscode == 200) { - server->verified_server = TRUE; - } else { - server->verified_server = FALSE; - } - - evaluate_state(server); - - return; -} - -/* Set up the process to verify the server */ -static void -verify_server (UccsServer * server) -{ - g_return_if_fail(server->session != NULL); - - if (server->parent.uri == NULL) { - return; - } - - SoupMessage * message = soup_message_new("HEAD", server->parent.uri); - soup_session_queue_message(server->session, message, verify_server_cb, server); - g_debug("Getting HEAD from: %s", server->parent.uri); - - return; -} - -/* Callback for when the Network Manger state changes */ -static void -nm_state_changed (NMClient *client, const GParamSpec *pspec, gpointer user_data) -{ - g_return_if_fail(IS_UCCS_SERVER(user_data)); - UccsServer * server = UCCS_SERVER(user_data); - - if (server->nm_client == NULL || !nm_client_get_manager_running(server->nm_client)) { - server->last_network = NM_STATE_DISCONNECTED; - } else { - server->last_network = nm_client_get_state(server->nm_client); - } - - if (server->last_network == NM_STATE_DISCONNECTED) { - server->verified_server = FALSE; - soup_session_abort(server->session); - } - - if (server->last_network == NM_STATE_CONNECTED_GLOBAL && server->verify_server && !server->verified_server) { - verify_server(server); - } - - evaluate_state(server); - - return; -} - -/* Get the properties that can be sent by the greeter for this server */ -static GVariant * -get_properties (Server * server) -{ - GVariantBuilder propbuilder; - g_variant_builder_init(&propbuilder, G_VARIANT_TYPE_ARRAY); - - GVariantBuilder namebuilder; - g_variant_builder_init(&namebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&namebuilder, g_variant_new_string("email")); - g_variant_builder_add_value(&namebuilder, g_variant_new_boolean(TRUE)); - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(""))); - g_variant_builder_add_value(&namebuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&namebuilder)); - - GVariantBuilder passbuilder; - g_variant_builder_init(&passbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&passbuilder, g_variant_new_string("password")); - g_variant_builder_add_value(&passbuilder, g_variant_new_boolean(TRUE)); - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(""))); - g_variant_builder_add_value(&passbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&passbuilder)); - - return g_variant_builder_end(&propbuilder); -} - -/* Set the exec value for the server */ -const gchar * -uccs_server_set_exec (UccsServer * server, const gchar * exec) -{ - g_return_val_if_fail(IS_UCCS_SERVER(server), NULL); - - g_clear_pointer(&server->exec, g_free); - - if (exec != NULL) { - server->exec = g_find_program_in_path(exec); - } - - evaluate_state(server); - - return server->exec; -} - -/* Build a new uccs server from a keyfile and a group in it */ -Server * -uccs_server_new_from_keyfile (GKeyFile * keyfile, const gchar * groupname) -{ - g_return_val_if_fail(keyfile != NULL, NULL); /* NOTE: No way to check if that's really a keyfile :-( */ - g_return_val_if_fail(groupname != NULL, NULL); - - if (!g_key_file_has_group(keyfile, groupname)) { - g_warning("Server specified but group '%s' was not found", groupname); - return NULL; - } - - UccsServer * server = g_object_new(UCCS_SERVER_TYPE, NULL); - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_NAME, NULL)) { - gchar * keyname = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_NAME, NULL); - server->parent.name = g_strdup(_(keyname)); - g_free(keyname); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_URI, NULL)) { - server->parent.uri = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_URI, NULL); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_UCCS_EXEC, NULL)) { - gchar * key = g_key_file_get_string(keyfile, groupname, CONFIG_UCCS_EXEC, NULL); - uccs_server_set_exec(server, key); - g_free(key); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_UCCS_NETWORK, NULL)) { - gchar * key = g_key_file_get_string(keyfile, groupname, CONFIG_UCCS_NETWORK, NULL); - - if (g_strcmp0(key, CONFIG_UCCS_NETWORK_NONE) == 0) { - server->min_network = NM_STATE_DISCONNECTED; - } else if (g_strcmp0(key, CONFIG_UCCS_NETWORK_GLOBAL) == 0) { - server->min_network = NM_STATE_CONNECTED_GLOBAL; - } - /* NOTE: There is a possibility for other network types to be added here, - but they can be tricky to test. Feel free to patch it, but please include - those tests :-) */ - - g_free(key); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_UCCS_VERIFY, NULL)) { - server->verify_server = g_key_file_get_boolean(keyfile, groupname, CONFIG_UCCS_VERIFY, NULL); - } - - evaluate_state(server); - - return SERVER(server); -} - -/* Look at the array of RLS data and build a server for each entry - in the array */ -static gboolean -parse_rds_array (UccsServer * server, JsonArray * array) -{ - // Got a new set of servers, delete the old one - g_list_free_full(server->subservers, g_object_unref); - server->subservers = NULL; - - int i; - for (i = 0; i < json_array_get_length(array); i++) { - JsonNode * node = json_array_get_element(array, i); - - if (JSON_NODE_TYPE(node) != JSON_NODE_OBJECT) { - continue; - } - - JsonObject * object = json_node_get_object(node); - Server * newserver = server_new_from_json(object); - if (newserver != NULL) { - server->subservers = g_list_append(server->subservers, newserver); - } - } - - return TRUE; -} - -/* Parse the JSON content and allocate servers based on that */ -static gboolean -parse_json (UccsServer * server, GInputStream * json) -{ - if (json == NULL) return FALSE; /* Shouldn't happen, but let's just handle it */ - - gboolean passed = TRUE; - JsonParser * parser = json_parser_new(); - GError * error = NULL; - - if (!json_parser_load_from_stream(parser, json, NULL, &error)) { - g_warning("Unable to parse JSON data: %s", error->message); - g_error_free(error); - error = NULL; - passed = FALSE; - } - - /* Make sure we have a sane root node */ - JsonNode * root_node = NULL; - if (passed) { - root_node = json_parser_get_root(parser); - -#if 0 - JsonGenerator * gen = json_generator_new(); - json_generator_set_root(gen, root_node); - gchar * data = json_generator_to_data(gen, NULL); - g_debug("%s", data); - g_free(data); - g_object_unref(G_OBJECT(gen)); -#endif - } - if (root_node != NULL && JSON_NODE_TYPE(root_node) != JSON_NODE_OBJECT) { - g_warning("Root node of JSON data is not an object. It is: %s", json_node_type_name(root_node)); - passed = FALSE; - } - - /* Take our object and see if it has the property that we need */ - JsonObject * root_object = NULL; - if (passed) { - root_object = json_node_get_object(root_node); - } - if (root_object != NULL && json_object_has_member(root_object, "RemoteDesktopServers")) { - /* This shows that we have some. It's okay if there aren't any. Seems - a bit silly, but we're not bitching too much. */ - JsonNode * rds_node = json_object_get_member(root_object, "RemoteDesktopServers"); - if (JSON_NODE_TYPE(rds_node) == JSON_NODE_ARRAY) { - JsonArray * rds_array = json_node_get_array(rds_node); - passed = parse_rds_array(server, rds_array); - } else { - /* Okay we're a little bit angrier about this one */ - g_warning("Malformed 'RemoteDesktopServer' entry. Not an array but a: %s", json_node_type_name(rds_node)); - passed = FALSE; - } - - if (json_object_has_member(root_object, "DefaultServer")) { - JsonNode * ds_node = json_object_get_member(root_object, "DefaultServer"); - if (JSON_NODE_TYPE(ds_node) == JSON_NODE_VALUE && json_node_get_value_type(ds_node) == G_TYPE_STRING) { - const gchar * default_server_name = json_node_get_string(ds_node); - if (default_server_name != NULL) { - GList * lserver; - for (lserver = server->subservers; lserver != NULL; lserver = g_list_next(lserver)) { - Server * serv = SERVER(lserver->data); - - if (g_strcmp0(serv->name, default_server_name) == 0) { - serv->last_used = TRUE; - break; - } - } - if (lserver == NULL && strlen(default_server_name) > 0) { - g_warning("Could not find the 'DefaultServer' server."); - passed = FALSE; - } - } - } else { - g_warning("Malformed 'DefaultServer' entry. Not a string value"); - passed = FALSE; - } - } - } else { - g_debug("No 'RemoteDesktopServers' found"); - } - - g_object_unref(parser); - return passed; -} - -/* Go through the waiters and notify them of the status */ -static void -json_waiters_notify (UccsServer * server, gboolean unlocked) -{ - /* NOTE: Taking the list as the call back might add themselves to - the list so we don't want to have it corrupted in the middle of - the execution of this function */ - GList * waiters = server->json_waiters; - server->json_waiters = NULL; - - while (waiters != NULL) { - json_callback_t * json_callback = (json_callback_t *)waiters->data; - - if (unlocked) { - g_hash_table_insert(server->lovers, g_strdup(json_callback->sender), GINT_TO_POINTER(TRUE)); - } - - if (json_callback->callback != NULL) { - json_callback->callback(server, unlocked, json_callback->userdata); - } - - g_free(json_callback->sender); - g_free(json_callback); - waiters = g_list_delete_link(waiters, waiters); - } - - return; -} - -/* Callback from when we know that we've got all the JSON we're - gonna get */ -static void -json_grab_cb (GPid pid, gint status, gpointer user_data) -{ - UccsServer * server = UCCS_SERVER(user_data); - - server->json_pid = 0; - server->json_watch = 0; - - if (status == 0) { - gboolean parser = parse_json(server, server->json_stream); - - json_waiters_notify(server, parser); - } else { - g_free(server->username); - server->username = NULL; - g_free(server->password); - server->password = NULL; - - json_waiters_notify(server, FALSE); - } - - /* Drop the Streams -- NOTE: DO NOT CROSS THE STREAMS */ - g_output_stream_close(server->pass_stream, NULL, NULL); - g_object_unref(server->pass_stream); - server->pass_stream = NULL; - - g_input_stream_close(server->json_stream, NULL, NULL); - g_object_unref(server->json_stream); - server->json_stream = NULL; - - g_spawn_close_pid(pid); - - return; -} - -/* This is the callback for writing the password, it mostly exists - to free the buffer, but we'll print some info as well just because - we can */ -static void -password_write_cb (GObject * src_obj, GAsyncResult * res, gpointer user_data) -{ - /* Kill the buffer */ - g_free(user_data); - - GError * error = NULL; - g_output_stream_write_finish(G_OUTPUT_STREAM(src_obj), res, &error); - - if (error != NULL) { - g_warning("Unable to write password to UCCS process: %s", error->message); - g_error_free(error); - } else { - g_debug("Wrote password to UCCS process"); - g_output_stream_close(G_OUTPUT_STREAM(src_obj), NULL, NULL); - } - - return; -} - -/** - * uccs_server_unlock: - * @server: The server to unlock - * @address: DBus address of the person unlocking us - * @username: Username for the UCCS - * @password: (allow-none) Password to use - * @allowcache: If using cache is allowed - * @callback: Function to call when we have an answer - * @user_data: Data for the callback - * - * Unlocks the UCCS server making servers available either from the - * cache or from the network. - */ -void -uccs_server_unlock (UccsServer * server, const gchar * address, const gchar * username, const gchar * password, gboolean allowcache, void (*callback) (UccsServer * server, gboolean unlocked, gpointer user_data), gpointer user_data) -{ - g_return_if_fail(IS_UCCS_SERVER(server)); - g_return_if_fail(username != NULL); - g_return_if_fail(address != NULL); - - /* Check the current values we have, they might be NULL, which in - that case they won't match */ - if (allowcache && g_strcmp0(username, server->username) == 0 && - g_strcmp0(password, server->password) == 0) { - g_hash_table_insert(server->lovers, g_strdup(address), GINT_TO_POINTER(TRUE)); - - if (callback != NULL) { - callback(server, TRUE, user_data); - } - - return; - } - - g_return_if_fail(server->exec != NULL); /* Shouldn't happen, but I'd feel safer if we checked */ - - /* If we're not going to allow the cache, just clear it right away */ - if (!allowcache) { - clear_hash(server); - } - - /* We're changing the username and password, if there were other - people who had it, they need to know we're different now */ - if (g_strcmp0(username, server->username) != 0 || - g_strcmp0(password, server->password) != 0) { - clear_hash(server); - clear_json(server); - - g_clear_pointer(&server->username, g_free); - g_clear_pointer(&server->password, g_free); - - server->username = g_strdup(username); - server->password = g_strdup(password); - } - - /* Add ourselves to the queue */ - json_callback_t * json_callback = g_new0(json_callback_t, 1); - json_callback->sender = g_strdup(address); - json_callback->callback = callback; - json_callback->userdata = user_data; - - server->json_waiters = g_list_append(server->json_waiters, json_callback); - - if (server->json_pid == 0) { - gint std_in, std_out; - GError * error = NULL; - - const gchar * argv[3]; - argv[0] = server->exec; - argv[1] = server->username; - argv[2] = NULL; - - g_setenv("SERVER_ROOT", server->parent.uri, TRUE); - - g_spawn_async_with_pipes(NULL, /* pwd */ - (gchar **)argv, - NULL, /* env */ - G_SPAWN_DO_NOT_REAP_CHILD, - NULL, NULL, /* child setup */ - &server->json_pid, - &std_in, - &std_out, - NULL, /* stderr */ - &error); /* error */ - - if (error != NULL) { - g_warning("Unable to start UCCS process: %s", error->message); - g_error_free(error); - server->json_pid = 0; /* really shouldn't get changed, but since we're using it to detect if it's running, let's double check, eh? */ - json_waiters_notify(server, FALSE); - } else { - /* Watch for when it's done */ - server->json_watch = g_child_watch_add(server->json_pid, json_grab_cb, server); - - /* Set up I/O streams */ - server->json_stream = g_unix_input_stream_new(std_out, TRUE); - server->pass_stream = g_unix_output_stream_new(std_in, TRUE); - - gchar * pass = g_strdup(server->password); - g_output_stream_write_async(server->pass_stream, - pass, - strlen(pass), /* number of bytes */ - G_PRIORITY_DEFAULT, /* priority */ - NULL, /* cancellable */ - password_write_cb, - pass); - } - } - - return; -} - -/* A little quickie function to handle the null server array */ -inline static GVariant * -null_server_array (void) -{ - return g_variant_new_array(G_VARIANT_TYPE("(sssba(sbva{sv})a(si))"), - NULL, 0); -} - -/** - * uccs_server_get_servers: - * @server: Server to get our list from - * @address: Who's asking - * - * Will get a valid variant with servers. If the asker hasn't unlocked us - * then the list will always be empty. - * - * Return value: A variant array - */ -GVariant * -uccs_server_get_servers (UccsServer * server, const gchar * address) -{ - g_return_val_if_fail(IS_UCCS_SERVER(server), null_server_array()); - g_return_val_if_fail(address != NULL, null_server_array()); - - if (!GPOINTER_TO_INT(g_hash_table_lookup(server->lovers, address))) { - g_warning("Address '%s' is not authorized", address); - return null_server_array(); - } - - gchar *last_used_server_name = NULL; - if (server->username != NULL && server->password != NULL) { - gchar *username_sha = g_compute_checksum_for_string (G_CHECKSUM_SHA256, server->username, -1); - gchar *file_path = g_build_path ("/", g_get_user_cache_dir(), "remote-logon-service", "cache", username_sha, NULL); - gchar *encryptedContents; - gsize encryptedContentsLength; - if (g_file_get_contents (file_path, &encryptedContents, &encryptedContentsLength, NULL)) { - gchar *file_contents = do_aes_decrypt(encryptedContents, server->password, encryptedContentsLength); - g_free (encryptedContents); - if (file_contents != NULL) { - GKeyFile * key_file = g_key_file_new(); - if (g_key_file_load_from_data (key_file, file_contents, strlen (file_contents), G_KEY_FILE_NONE, NULL)) { - last_used_server_name = g_key_file_get_string (key_file, server->parent.name, "last_used", NULL); - } - g_key_file_free (key_file); - g_free (file_contents); - } - } - g_free (username_sha); - g_free (file_path); - } - - GVariantBuilder array; - g_variant_builder_init(&array, G_VARIANT_TYPE_ARRAY); - GList * lserver; - gint servercnt = 0; - - Server * last_used_server = NULL; - if (last_used_server_name != NULL) { - for (lserver = server->subservers; last_used_server == NULL && lserver != NULL; lserver = g_list_next(lserver)) { - Server * serv = SERVER(lserver->data); - - /* We only want servers that are all good */ - if (serv->state != SERVER_STATE_ALLGOOD) { - continue; - } - if (g_strcmp0(serv->name, last_used_server_name) == 0) - last_used_server = serv; - } - } - g_free (last_used_server_name); - - for (lserver = server->subservers; lserver != NULL; lserver = g_list_next(lserver)) { - Server * serv = SERVER(lserver->data); - - /* We only want servers that are all good */ - if (serv->state != SERVER_STATE_ALLGOOD) { - continue; - } - - if (last_used_server != NULL) - serv->last_used = last_used_server == serv; - - servercnt++; - g_variant_builder_add_value(&array, server_get_variant(serv)); - } - - if (servercnt == 0) { - g_variant_builder_clear(&array); - return null_server_array(); - } - - return g_variant_builder_end(&array); -} - -/* Returns the cached domains as an array. Not currently with any of - this cached currently, so it's a NULL array. */ -static GVariant * -get_cached_domains (Server * server) -{ - g_return_val_if_fail(IS_UCCS_SERVER(server), NULL); - return g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0); -} - -/* Tail recursive function to look at a list entry and see - if that server matches a URI, or go down the list */ -static Server * -find_uri_helper (GList * list, const gchar * uri) -{ - if (list == NULL) return NULL; - - Server * inserver = SERVER(list->data); - - if (inserver == NULL) { - return find_uri_helper(g_list_next(list), uri); - } - - Server * outserver = server_find_uri(inserver, uri); - - if (outserver != NULL) { - return outserver; - } - - return find_uri_helper(g_list_next(list), uri); -} - -/* Look through our subservers to see if any of them match this - URI either */ -static Server * -find_uri (Server * server, const gchar * uri) -{ - g_return_val_if_fail(IS_UCCS_SERVER(server), NULL); - /* If it is this server that's handled by the super class */ - return find_uri_helper(UCCS_SERVER(server)->subservers, uri); -} - -/* Look through our subservers to see if any of them match this - URI and set as used */ -static void -set_last_used_server (Server * server, const gchar * uri) -{ - Server * subserver = server_find_uri(server, uri); - - if (subserver != NULL) { - subserver->last_used = TRUE; - - /* Write to disk */ - if (UCCS_SERVER(server)->username != NULL && UCCS_SERVER(server)->password) { - GKeyFile * key_file = g_key_file_new(); - g_key_file_set_string (key_file, server->name, "last_used", subserver->name); - gsize data_length; - gchar *data = g_key_file_to_data (key_file, &data_length, NULL); - g_key_file_free (key_file); - - size_t enc_data_length; - gchar *enc_data = do_aes_encrypt(data, UCCS_SERVER(server)->password, &enc_data_length); - g_free (data); - - gchar *dir_path = g_build_path ("/", g_get_user_cache_dir(), "remote-logon-service", "cache", NULL); - gint status = g_mkdir_with_parents (dir_path, 0700); - if (status == 0) - { - gchar *username_sha = g_compute_checksum_for_string (G_CHECKSUM_SHA256, UCCS_SERVER(server)->username, -1); - gchar *path = g_build_path ("/", dir_path, username_sha, NULL); - gboolean success = g_file_set_contents (path, enc_data, enc_data_length, NULL); - if (!success) { - g_warning("Failing writting cache data to '%s'.", path); - } - g_free (username_sha); - g_free (path); - } - else - { - g_warning("Failed to create '%s'.", dir_path); - } - g_free (enc_data); - g_free (dir_path); - } - } -} diff --git a/src/uccs-server.h b/src/uccs-server.h deleted file mode 100644 index 4603a6c..0000000 --- a/src/uccs-server.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __UCCS_SERVER_H__ -#define __UCCS_SERVER_H__ - -#include <glib-object.h> -#include <libnm-glib/nm-client.h> -#include <libsoup/soup.h> -#include "server.h" - -G_BEGIN_DECLS - -#define UCCS_SERVER_TYPE (uccs_server_get_type ()) -#define UCCS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UCCS_SERVER_TYPE, UccsServer)) -#define UCCS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UCCS_SERVER_TYPE, UccsServerClass)) -#define IS_UCCS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UCCS_SERVER_TYPE)) -#define IS_UCCS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UCCS_SERVER_TYPE)) -#define UCCS_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UCCS_SERVER_TYPE, UccsServerClass)) - -typedef struct _UccsServer UccsServer; -typedef struct _UccsServerClass UccsServerClass; - -struct _UccsServerClass { - ServerClass parent_class; -}; - -struct _UccsServer { - Server parent; - - gchar * exec; - - gchar * username; - gchar * password; - - GHashTable * lovers; - - GList * subservers; - - GList * json_waiters; - guint json_watch; - GPid json_pid; - - GInputStream * json_stream; - GOutputStream * pass_stream; - - NMState min_network; - NMState last_network; - NMClient * nm_client; - gulong nm_signal; - - gboolean verify_server; - gboolean verified_server; - SoupSession * session; -}; - -GType uccs_server_get_type (void); -Server * uccs_server_new_from_keyfile (GKeyFile * keyfile, const gchar * name); -void uccs_server_unlock (UccsServer * server, const gchar * address, const gchar * username, const gchar * password, gboolean allowcache, void (*callback) (UccsServer * server, gboolean unlocked, gpointer user_data), gpointer user_data); -GVariant * uccs_server_get_servers (UccsServer * server, const gchar * address); -const gchar *uccs_server_set_exec (UccsServer * server, const gchar * exec); - -G_END_DECLS - -#endif diff --git a/src/x2go-server.c b/src/x2go-server.c deleted file mode 100644 index 3b740de..0000000 --- a/src/x2go-server.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2013 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/mman.h> - -#include <glib/gi18n.h> - -#include <string.h> - -#include "x2go-server.h" -#include "defines.h" - -static void x2go_server_class_init (X2GoServerClass *klass); -static void x2go_server_init (X2GoServer *self); -static void x2go_server_dispose (GObject *object); -static void x2go_server_finalize (GObject *object); -static GVariant * get_properties (Server * server); - -G_DEFINE_TYPE (X2GoServer, x2go_server, SERVER_TYPE); - -static void -x2go_server_class_init (X2GoServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = x2go_server_dispose; - object_class->finalize = x2go_server_finalize; - - ServerClass * server_class = SERVER_CLASS(klass); - - server_class->get_properties = get_properties; - - return; -} - -static void -x2go_server_init (X2GoServer *self) -{ - self->username = NULL; - self->password = NULL; - self->sessiontype = NULL; - self->sessiontype_required = FALSE; - - return; -} - -static void -x2go_server_dispose (GObject *object) -{ - - G_OBJECT_CLASS (x2go_server_parent_class)->dispose (object); - return; -} - -/* Unlocks the memory before freeing */ -static void -password_clear (gpointer data) -{ - char * pass = (char *)data; - munlock(pass, strlen(pass)); - g_free(pass); - return; -} - -static void -x2go_server_finalize (GObject *object) -{ - X2GoServer * server = X2GO_SERVER(object); - - g_clear_pointer(&server->username, g_free); - g_clear_pointer(&server->password, password_clear); - g_clear_pointer(&server->sessiontype, g_free); - - G_OBJECT_CLASS (x2go_server_parent_class)->finalize (object); - return; -} - -static GVariant * -get_properties (Server * server) -{ - X2GoServer * rserver = X2GO_SERVER(server); - - GVariantBuilder propbuilder; - g_variant_builder_init(&propbuilder, G_VARIANT_TYPE_ARRAY); - - GVariantBuilder namebuilder; - g_variant_builder_init(&namebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&namebuilder, g_variant_new_string("username")); - g_variant_builder_add_value(&namebuilder, g_variant_new_boolean(TRUE)); - if (rserver->username == NULL) { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&namebuilder, g_variant_new_variant(g_variant_new_string(rserver->username))); - } - g_variant_builder_add_value(&namebuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&namebuilder)); - - GVariantBuilder passbuilder; - g_variant_builder_init(&passbuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&passbuilder, g_variant_new_string("password")); - g_variant_builder_add_value(&passbuilder, g_variant_new_boolean(TRUE)); - if (rserver->password == NULL) { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&passbuilder, g_variant_new_variant(g_variant_new_string(rserver->password))); - } - g_variant_builder_add_value(&passbuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&passbuilder)); - - GVariantBuilder sessiontypebuilder; - g_variant_builder_init(&sessiontypebuilder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&sessiontypebuilder, g_variant_new_string("x2gosession")); - g_variant_builder_add_value(&sessiontypebuilder, g_variant_new_boolean(rserver->sessiontype_required)); - if (rserver->sessiontype == NULL) { - g_variant_builder_add_value(&sessiontypebuilder, g_variant_new_variant(g_variant_new_string(""))); - } else { - g_variant_builder_add_value(&sessiontypebuilder, g_variant_new_variant(g_variant_new_string(rserver->sessiontype))); - } - g_variant_builder_add_value(&sessiontypebuilder, g_variant_parse(G_VARIANT_TYPE_VARDICT, "{}", NULL, NULL, NULL)); - g_variant_builder_add_value(&propbuilder, g_variant_builder_end(&sessiontypebuilder)); - - return g_variant_builder_end(&propbuilder); -} - -Server * -x2go_server_new_from_keyfile (GKeyFile * keyfile, const gchar * groupname) -{ - g_return_val_if_fail(keyfile != NULL, NULL); /* NOTE: No way to check if that's really a keyfile :-( */ - g_return_val_if_fail(groupname != NULL, NULL); - - if (!g_key_file_has_group(keyfile, groupname)) { - g_warning("Server specified but group '%s' was not found", groupname); - return NULL; - } - - X2GoServer * server = g_object_new(X2GO_SERVER_TYPE, NULL); - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_NAME, NULL)) { - gchar * keyname = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_NAME, NULL); - server->parent.name = g_strdup(_(keyname)); - g_free(keyname); - } - - if (g_key_file_has_key(keyfile, groupname, CONFIG_SERVER_URI, NULL)) { - server->parent.uri = g_key_file_get_string(keyfile, groupname, CONFIG_SERVER_URI, NULL); - } - - return SERVER(server); -} - -/* Build the X2Go server from information in the JSON object */ -Server * -x2go_server_new_from_json (JsonObject * object) -{ - X2GoServer * server = g_object_new(X2GO_SERVER_TYPE, NULL); - - if (json_object_has_member(object, JSON_SERVER_NAME)) { - JsonNode * node = json_object_get_member(object, JSON_SERVER_NAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * name = json_node_get_string(node); - server->parent.name = g_strdup(name); - } - } - - if (json_object_has_member(object, JSON_URI)) { - JsonNode * node = json_object_get_member(object, JSON_URI); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * uri = json_node_get_string(node); - server->parent.uri = g_strdup(uri); - } - } - - if (json_object_has_member(object, JSON_USERNAME)) { - JsonNode * node = json_object_get_member(object, JSON_USERNAME); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * username = json_node_get_string(node); - server->username = g_strdup(username); - } - } - - if (json_object_has_member(object, JSON_PASSWORD)) { - JsonNode * node = json_object_get_member(object, JSON_PASSWORD); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * password = json_node_get_string(node); - server->password = g_strdup(password); - mlock(server->password, strlen(server->password)); - } - } - - if (json_object_has_member(object, JSON_SESSIONTYPE)) { - JsonNode * node = json_object_get_member(object, JSON_SESSIONTYPE); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_STRING) { - const gchar * sessiontype = json_node_get_string(node); - server->sessiontype = g_strdup(sessiontype); - } - } - - if (json_object_has_member(object, JSON_SESSIONTYPE_REQ)) { - JsonNode * node = json_object_get_member(object, JSON_SESSIONTYPE_REQ); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE && json_node_get_value_type(node) == G_TYPE_BOOLEAN) { - server->sessiontype_required = json_node_get_boolean(node); - } - } - - return SERVER(server); -} diff --git a/src/x2go-server.h b/src/x2go-server.h deleted file mode 100644 index 6135321..0000000 --- a/src/x2go-server.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright © 2012 Canonical Ltd. - * Copyright © 2013 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - * Copyright © 2015 The Arctica Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, 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 warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: Ted Gould <ted@canonical.com> - * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - */ - -#ifndef __X2GO_SERVER_H__ -#define __X2GO_SERVER_H__ - -#include <glib-object.h> -#include <json-glib/json-glib.h> -#include "server.h" - -G_BEGIN_DECLS - -#define X2GO_SERVER_TYPE (x2go_server_get_type ()) -#define X2GO_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), X2GO_SERVER_TYPE, X2GoServer)) -#define X2GO_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), X2GO_SERVER_TYPE, X2GoServerClass)) -#define IS_X2GO_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), X2GO_SERVER_TYPE)) -#define IS_X2GO_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), X2GO_SERVER_TYPE)) -#define X2GO_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), X2GO_SERVER_TYPE, X2GoServerClass)) - -typedef struct _X2GoServer X2GoServer; -typedef struct _X2GoServerClass X2GoServerClass; - -struct _X2GoServerClass { - ServerClass parent_class; -}; - -struct _X2GoServer { - Server parent; - - gchar * username; - gchar * password; - gchar * sessiontype; - gboolean sessiontype_required; -}; - -GType x2go_server_get_type (void); -Server * x2go_server_new_from_keyfile (GKeyFile * keyfile, const gchar * name); -Server * x2go_server_new_from_json (JsonObject * object); - -G_END_DECLS - -#endif diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 9a34654..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ - -CLEANFILES = -DISTCLEANFILES = -EXTRA_DIST = -check_PROGRAMS = - -TESTS = \ - server-tester \ - dbus-interface-tester - -##################################### -# Server Test -##################################### - -SERVER_XML_REPORT = server-test.xml -server-tester: server-test Makefile.am - @echo "#!/bin/bash" > $@ - @echo gtester --verbose -k -o $(SERVER_XML_REPORT) $(abs_builddir)/server-test >> $@ - @chmod +x $@ - -CLEANFILES += \ - $(SERVER_XML_REPORT) \ - server-tester - -server_test_SOURCES = \ - server-test.c -server_test_CFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ - $(SERVICE_CFLAGS) -server_test_LDADD = \ - $(top_builddir)/src/libservers.la \ - $(SERVICE_LIBS) - -check_PROGRAMS += server-test - -##################################### -# DBus Interface -##################################### - -DBUS_XML_REPORT = dbus-interface.xml -dbus-interface-tester: dbus-interface uccs-config.conf slmock-config.conf Makefile.am - @echo "#!/bin/bash" > $@ - @echo gtester --verbose -k -o $(DBUS_XML_REPORT) $(abs_builddir)/dbus-interface >> $@ - @chmod +x $@ - -CLEANFILES += \ - $(DBUS_XML_REPORT) \ - dbus-interface-tester \ - slmock-config.conf - -EXTRA_DIST += \ - null-config.conf \ - uccs-config.conf \ - slmock \ - slmock-config.conf.in - -slmock-config.conf: slmock-config.conf.in - sed -e "s|\@slmock\@|$(abs_srcdir)/slmock|" $< > $@ -dbus_interface_SOURCES = \ - dbus-interface.c -dbus_interface_CFLAGS = \ - -DREMOTE_LOGON_SERVICE="\"$(abs_top_builddir)/src/remote-logon-service\"" \ - -DUCCS_CONFIG_FILE="\"$(abs_srcdir)/uccs-config.conf\"" \ - -DSLMOCK_CONFIG_FILE="\"$(abs_builddir)/slmock-config.conf\"" \ - -DNULL_CONFIG_FILE="\"$(abs_srcdir)/null-config.conf\"" \ - $(SERVICE_CFLAGS) \ - $(TEST_CFLAGS) -dbus_interface_LDADD = \ - $(SERVICE_LIBS) \ - $(TEST_LIBS) - -check_PROGRAMS += dbus-interface diff --git a/tests/dbus-interface.c b/tests/dbus-interface.c deleted file mode 100644 index e67b60c..0000000 --- a/tests/dbus-interface.c +++ /dev/null @@ -1,583 +0,0 @@ - -#include <glib.h> -#include <gio/gio.h> -#include <libdbustest/dbus-test.h> - -typedef struct _slmock_table_t slmock_table_t; -typedef struct _slmock_server_t slmock_server_t; - -struct _slmock_table_t { - const gchar * username; - const gchar * password; - slmock_server_t * servers; -}; - -struct _slmock_server_t { - const gchar * name; - const gchar * uri; - const gchar * type; - gboolean last_used; - const gchar * username; - const gchar * password; - const gchar * domain; -}; - -slmock_server_t citrix_server_table[] = { - {"Citrix USA", "107.21.17.35", "ica", FALSE, "useradmin1", "", "IP-0A00001E"}, - {"Citrix 2", "107.21.17.35", "ica", FALSE, "useradmin2", "", "IP-0A00001E"}, - {"Citrix 3", "107.21.17.35", "ica", FALSE, "useradmin3", "", "IP-0A00001E"}, - {"Citrix 4", "107.21.17.35", "ica", FALSE, "useradmin4", "userpass", "IP-0A00001E"}, - {NULL, NULL, NULL} -}; - -slmock_server_t freerdp_server_table[] = { - {"FreeRDP US", "23.21.151.133", "freerdp", TRUE, "Administrator", "", ""}, - {"FreeRDP Asia", "46.137.222.181", "freerdp", FALSE, "Administrator", "", ""}, - {"FreeRDP UK", "46.137.189.194", "freerdp", FALSE, "Administrator", "", ""}, - {NULL, NULL, NULL} -}; - -slmock_server_t freerdp_server_table_after_set_last_used[] = { - {"FreeRDP US", "23.21.151.133", "freerdp", FALSE, "Administrator", "", ""}, - {"FreeRDP Asia", "46.137.222.181", "freerdp", TRUE, "Administrator", "", ""}, - {"FreeRDP UK", "46.137.189.194", "freerdp", FALSE, "Administrator", "", ""}, - {NULL, NULL, NULL} -}; - -slmock_server_t big_server_table[] = { - {"XenServer", "107.21.17.35", "ica", FALSE, "", "", "ASIA"}, - {"Citrix2", "http://1.2.3.4", "ica", FALSE, "fakeuser", "fakepassword", "DOMAIN1"}, - {"Accenture", "10.21.17.35", "freerdp", FALSE, "fakeuser", "", "EUROPE"}, - {"Accenture 2", "https://4.5.6.7", "freerdp", TRUE, "", "", "domain2"}, - {NULL, NULL, NULL} -}; - -slmock_table_t slmock_table[] = { - {"c", "c", citrix_server_table}, - {"f", "f", freerdp_server_table}, - {"b", "b", big_server_table}, - {"f", "f", freerdp_server_table_after_set_last_used} -}; - -static gboolean -find_server (GVariant * varray, slmock_server_t * server) -{ - int ichild; - for (ichild = 0; ichild < g_variant_n_children(varray); ichild++) { - GVariant * child = g_variant_get_child_value(varray, ichild); - gboolean test = FALSE; - - GVariant * type = g_variant_get_child_value(child, 0); - test = g_strcmp0(g_variant_get_string(type, NULL), server->type) == 0; - g_variant_unref(type); - if (!test) { - g_variant_unref(child); - continue; - } - - GVariant * name = g_variant_get_child_value(child, 1); - test = g_strcmp0(g_variant_get_string(name, NULL), server->name) == 0; - g_variant_unref(name); - if (!test) { - g_variant_unref(child); - continue; - } - - GVariant * uri = g_variant_get_child_value(child, 2); - test = g_strcmp0(g_variant_get_string(uri, NULL), server->uri) == 0; - g_variant_unref(uri); - if (!test) { - g_variant_unref(child); - continue; - } - - GVariant * last_used = g_variant_get_child_value(child, 3); - test = g_variant_get_boolean(last_used) == server->last_used; - g_variant_unref(last_used); - if (!test) { - g_variant_unref(child); - continue; - } - - gboolean match_username = FALSE; - gboolean match_password = FALSE; - gboolean match_domain = FALSE; - - GVariant * props = g_variant_get_child_value(child, 4); - int iprop; - for (iprop = 0; iprop < g_variant_n_children(props); iprop++) { - GVariant * prop = g_variant_get_child_value(props, iprop); - - GVariant * prop_type = g_variant_get_child_value(prop, 0); - GVariant * prop_value_wrap = g_variant_get_child_value(prop, 2); - GVariant * prop_value = g_variant_get_variant(prop_value_wrap); - - if (g_strcmp0(g_variant_get_string(prop_type, NULL), "username") == 0) { - if (g_strcmp0(g_variant_get_string(prop_value, NULL), server->username) == 0) { - match_username = TRUE; - } - } else if (g_strcmp0(g_variant_get_string(prop_type, NULL), "password") == 0) { - if (g_strcmp0(g_variant_get_string(prop_value, NULL), server->password) == 0) { - match_password = TRUE; - } - } else if (g_strcmp0(g_variant_get_string(prop_type, NULL), "domain") == 0) { - if (g_strcmp0(g_variant_get_string(prop_value, NULL), server->domain) == 0) { - match_domain = TRUE; - } - } - - g_variant_unref(prop_value); - g_variant_unref(prop_value_wrap); - g_variant_unref(prop_type); - g_variant_unref(prop); - } - g_variant_unref(props); - - g_variant_unref(child); - - if (match_username && match_password && match_domain) { - return TRUE; - } else { - continue; - } - } - - return FALSE; -} - -static gboolean -slmock_check_login(GDBusConnection * session, slmock_table_t * slmockdata, gboolean clear_cache) -{ - if (clear_cache) { - gchar *username_sha = g_compute_checksum_for_string (G_CHECKSUM_SHA256, slmockdata->username, -1); - gchar *file_path = g_build_path ("/", g_get_user_cache_dir(), "remote-logon-service", "cache", username_sha, NULL); - unlink (file_path); - g_free (username_sha); - g_free (file_path); - } - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "GetServersForLogin", - g_variant_new("(sssb)", - "https://slmock.com/", - slmockdata->username, - slmockdata->password, - TRUE), /* params */ - G_VARIANT_TYPE("(bsa(sssba(sbva{sv})a(si)))"), /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - NULL); - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 3); - - GVariant * loggedin = g_variant_get_child_value(retval, 0); - g_assert(g_variant_get_boolean(loggedin)); - g_variant_unref(loggedin); loggedin = NULL; - - GVariant * data = g_variant_get_child_value(retval, 1); - g_assert(g_strcmp0(g_variant_get_string(data, NULL), "network") == 0); - g_variant_unref(data); data = NULL; - - GVariant * array = g_variant_get_child_value(retval, 2); - int i; - // Check all servers should be in the result are in the result - for (i = 0; slmockdata->servers[i].name != NULL; i++) { - g_assert(find_server(array, &slmockdata->servers[i])); - } - // Check there is no more servers in the result than we expected - g_assert(i == g_variant_n_children(array)); - g_variant_unref(array); - - g_variant_unref(retval); - - return TRUE; -} - -static void -test_getservers_slmock (gconstpointer data) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" SLMOCK_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - g_assert(slmock_check_login(session, (slmock_table_t *)data, TRUE)); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - -static void -test_getservers_slmock_none (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" SLMOCK_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "GetServersForLogin", - g_variant_new("(sssb)", - "https://slmock.com/", - "Baduser", - "Badpass", - TRUE), /* params */ - G_VARIANT_TYPE("(bsa(sssba(sbva{sv})a(si)))"), /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - NULL); - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 3); - - GVariant * loggedin = g_variant_get_child_value(retval, 0); - g_assert(!g_variant_get_boolean(loggedin)); - g_variant_unref(loggedin); loggedin = NULL; - - GVariant * array = g_variant_get_child_value(retval, 2); - g_assert(g_variant_n_children(array) == 0); - g_variant_unref(array); - g_variant_unref(retval); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - -static void -test_getservers_slmock_two (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" SLMOCK_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - g_assert(slmock_check_login(session, &slmock_table[0], TRUE)); - g_assert(slmock_check_login(session, &slmock_table[1], TRUE)); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - -static void -test_getservers_none (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" NULL_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "GetServers", - NULL, /* params */ - G_VARIANT_TYPE("(a(sssba(sbva{sv})a(si)))"), /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - NULL); - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 1); - - GVariant * array = g_variant_get_child_value(retval, 0); - g_assert(g_variant_n_children(array) == 0); - g_assert(g_variant_is_of_type(array, G_VARIANT_TYPE_ARRAY)); - - g_variant_unref(array); - g_variant_unref(retval); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - -static void -test_getservers_uccs (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" UCCS_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "GetServers", - NULL, /* params */ - G_VARIANT_TYPE("(a(sssba(sbva{sv})a(si)))"), /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - NULL); - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 1); - - GVariant * array = g_variant_get_child_value(retval, 0); - g_assert(g_variant_n_children(array) == 1); - g_assert(g_variant_is_of_type(array, G_VARIANT_TYPE_ARRAY)); - - GVariant * tuple = g_variant_get_child_value(array, 0); - - if (TRUE) { /* type check */ - GVariant * type = g_variant_get_child_value(tuple, 0); - g_assert(g_variant_is_of_type(type, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(type, NULL), "uccs") == 0); - g_variant_unref(type); - } - - if (TRUE) { /* name check */ - GVariant * name = g_variant_get_child_value(tuple, 1); - g_assert(g_variant_is_of_type(name, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(name, NULL), "Test Server Name") == 0); - g_variant_unref(name); - } - - if (TRUE) { /* uri check */ - GVariant * uri = g_variant_get_child_value(tuple, 2); - g_assert(g_variant_is_of_type(uri, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(uri, NULL), "https://uccs.test.mycompany.com/") == 0); - g_variant_unref(uri); - } - - g_variant_unref(tuple); - g_variant_unref(array); - g_variant_unref(retval); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - -static void -test_getdomains_basic (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" SLMOCK_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - GError * error = NULL; - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "GetCachedDomainsForServer", - g_variant_new("(s)", "https://slmock.com/"), /* params */ - G_VARIANT_TYPE("(as)"), /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - - if (error != NULL) { - g_debug("Error from GetCachedDomainsForServer: %s", error->message); - g_error_free(error); - error = NULL; - } - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 1); - - GVariant * child = g_variant_get_child_value(retval, 0); - g_assert(g_variant_is_of_type(child, G_VARIANT_TYPE_ARRAY)); - g_variant_unref(child); - - g_variant_unref(retval); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - - -static void -test_setlastused_basic (void) -{ - DbusTestService * service = dbus_test_service_new(NULL); - - /* RLS */ - DbusTestProcess * rls = dbus_test_process_new(REMOTE_LOGON_SERVICE); - dbus_test_process_append_param(rls, "--config-file=" SLMOCK_CONFIG_FILE); - dbus_test_service_add_task(service, DBUS_TEST_TASK(rls)); - - /* Dummy */ - DbusTestTask * dummy = dbus_test_task_new(); - dbus_test_task_set_wait_for(dummy, "org.ArcticaProject.RemoteLogon"); - dbus_test_service_add_task(service, dummy); - - /* Get RLS up and running and us on that bus */ - dbus_test_service_start_tasks(service); - - GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - g_dbus_connection_set_exit_on_close(session, FALSE); - - g_assert(slmock_check_login(session, &slmock_table[1], TRUE)); - - GError * error = NULL; - GVariant * retval = g_dbus_connection_call_sync(session, - "org.ArcticaProject.RemoteLogon", - "/org/ArcticaProject/RemoteLogon", - "org.ArcticaProject.RemoteLogon", - "SetLastUsedServer", - g_variant_new("(ss)", "Landscape", freerdp_server_table[1].uri), /* params */ - NULL, /* ret type */ - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - - if (error != NULL) { - g_debug("Error from SetLastUsedServer: %s", error->message); - g_error_free(error); - error = NULL; - } - - g_assert(retval != NULL); - g_assert(g_variant_n_children(retval) == 0); - g_variant_unref(retval); - - g_assert(slmock_check_login(session, &slmock_table[3], FALSE)); - - g_object_unref(session); - g_object_unref(rls); - g_object_unref(service); - - return; -} - - -/* Build the test suite */ -static void -test_dbus_suite (void) -{ - g_test_add_func ("/dbus/interface/GetServers/None", test_getservers_none); - g_test_add_func ("/dbus/interface/GetServers/UCCS", test_getservers_uccs); - g_test_add_data_func ("/dbus/interface/GetServers/SLMock/citrix", &slmock_table[0], test_getservers_slmock); - g_test_add_data_func ("/dbus/interface/GetServers/SLMock/freerdp", &slmock_table[1], test_getservers_slmock); - g_test_add_data_func ("/dbus/interface/GetServers/SLMock/big", &slmock_table[2], test_getservers_slmock); - g_test_add_func ("/dbus/interface/GetServers/SLMock/none", test_getservers_slmock_none); - g_test_add_func ("/dbus/interface/GetServers/SLMock/two", test_getservers_slmock_two); - g_test_add_func ("/dbus/interface/GetDomains/Basic", test_getdomains_basic); - g_test_add_func ("/dbus/interface/SetLastUsed/Basic", test_setlastused_basic); - - return; -} - -gint -main (gint argc, gchar * argv[]) -{ -#if !GLIB_CHECK_VERSION (2, 35, 1) - g_type_init(); -#endif - g_test_init(&argc, &argv, NULL); - - /* Test suites */ - test_dbus_suite(); - - return g_test_run (); -} diff --git a/tests/null-config.conf b/tests/null-config.conf deleted file mode 100644 index f00a4f8..0000000 --- a/tests/null-config.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Remote Logon Service] -DummyValue=This is intentionally left blank diff --git a/tests/server-test.c b/tests/server-test.c deleted file mode 100644 index 06b6233..0000000 --- a/tests/server-test.c +++ /dev/null @@ -1,282 +0,0 @@ -#include <glib.h> - -#include "defines.h" -#include "server.h" -#include "citrix-server.h" -#include "rdp-server.h" -#include "uccs-server.h" - -static gboolean -no_fatal_warnings (const gchar * log_domain, GLogLevelFlags level, const gchar * message, gpointer userdata) -{ - if (level & (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG)) { - return FALSE; - } - - return TRUE; -} - -static void -state_signal (Server * server, ServerState newstate, gboolean * signaled) -{ - *signaled = TRUE; - return; -} - -static void -test_update_signal (void) -{ - g_test_log_set_fatal_handler(no_fatal_warnings, NULL); - - GKeyFile * keyfile = g_key_file_new(); - const gchar * groupname = CONFIG_SERVER_PREFIX " Server Name"; - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_NAME, "My Server"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_URI, "http://my.domain.com"); - g_key_file_set_string(keyfile, groupname, CONFIG_UCCS_NETWORK, CONFIG_UCCS_NETWORK_NONE); - - Server * server = NULL; - server = server_new_from_keyfile(keyfile, groupname); - g_assert(server != NULL); - g_assert(g_strcmp0(server->name, "My Server") == 0); - g_assert(g_strcmp0(server->uri, "http://my.domain.com") == 0); - - UccsServer * userver = UCCS_SERVER(server); - g_assert(userver != NULL); - - gboolean signaled = FALSE; - g_signal_connect(G_OBJECT(server), SERVER_SIGNAL_STATE_CHANGED, G_CALLBACK(state_signal), &signaled); - - if (server->state == SERVER_STATE_ALLGOOD) { - signaled = FALSE; - uccs_server_set_exec(userver, "thisshouldnotexist"); - g_assert(signaled); - g_assert(server->state == SERVER_STATE_UNAVAILABLE); - } - - signaled = FALSE; - uccs_server_set_exec(userver, "ls"); - g_assert(signaled); - g_assert(server->state == SERVER_STATE_ALLGOOD); - - return; -} - -static void -test_uccs_domains (void) -{ - g_test_log_set_fatal_handler(no_fatal_warnings, NULL); - - GKeyFile * keyfile = g_key_file_new(); - const gchar * groupname = CONFIG_SERVER_PREFIX " Server Name"; - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_NAME, "My Server"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_URI, "http://my.domain.com"); - - Server * server = NULL; - server = server_new_from_keyfile(keyfile, groupname); - g_assert(server != NULL); - g_assert(g_strcmp0(server->name, "My Server") == 0); - g_assert(g_strcmp0(server->uri, "http://my.domain.com") == 0); - - GVariant * domains = server_cached_domains(server); - g_assert(domains != NULL); - g_assert(g_variant_is_of_type(domains, G_VARIANT_TYPE_ARRAY)); - g_variant_ref_sink(domains); - g_variant_unref(domains); - - g_object_unref(server); - g_key_file_unref(keyfile); - - return; -} - -static void -test_uccs_exec (void) -{ - g_test_log_set_fatal_handler(no_fatal_warnings, NULL); - - GKeyFile * keyfile = g_key_file_new(); - const gchar * groupname = CONFIG_SERVER_PREFIX " Server Name"; - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_NAME, "My Server"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_URI, "http://my.domain.com"); - g_key_file_set_string(keyfile, groupname, CONFIG_UCCS_EXEC, "ls"); - - Server * server = NULL; - server = server_new_from_keyfile(keyfile, groupname); - g_assert(server != NULL); - g_assert(g_strcmp0(server->name, "My Server") == 0); - g_assert(g_strcmp0(server->uri, "http://my.domain.com") == 0); - g_assert(g_strcmp0(UCCS_SERVER(server)->exec, "/bin/ls") == 0); - - g_object_unref(server); - g_key_file_unref(keyfile); - - return; -} - -typedef struct _type_data_t type_data_t; -struct _type_data_t { - GType type; - const gchar * name; - const gchar * config_type; -}; - -type_data_t type_data[3] = { - {0, "ica", CONFIG_SERVER_TYPE_ICA}, - {0, "freerdp", CONFIG_SERVER_TYPE_RDP}, - {0, "uccs", CONFIG_SERVER_TYPE_UCCS} -}; - -/* -static void -type_data_dump (type_data_t * data) -{ - g_debug("Type data: %X", data); - g_debug(" type: %d", data->type); - g_debug(" name: %s", data->name); - g_debug(" c. type: %s", data->config_type); -} -*/ - -static gboolean -fatal_func (const gchar * log_domain, GLogLevelFlags level, const gchar * message, gpointer userdata) -{ - return FALSE; -} - -static void -test_object_variant (gconstpointer data) -{ - g_test_log_set_fatal_handler(fatal_func, NULL); - - type_data_t * typedata = (type_data_t *)data; - - Server * server = g_object_new(typedata->type, NULL); - - g_assert(server != NULL); - g_assert(IS_SERVER(server)); - - server->name = g_strdup("My Name"); - server->uri = g_strdup("http://mysite.loves.testing.com"); - - GVariant * variant = server_get_variant(server); - - g_assert(g_variant_n_children(variant) == 6); - - GVariant * child = g_variant_get_child_value(variant, 0); - g_assert(g_variant_is_of_type(child, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(child, NULL), typedata->name) == 0); - g_variant_unref(child); - - child = g_variant_get_child_value(variant, 1); - g_assert(g_variant_is_of_type(child, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(child, NULL), "My Name") == 0); - g_variant_unref(child); - - child = g_variant_get_child_value(variant, 2); - g_assert(g_variant_is_of_type(child, G_VARIANT_TYPE_STRING)); - g_assert(g_strcmp0(g_variant_get_string(child, NULL), "http://mysite.loves.testing.com") == 0); - g_variant_unref(child); - - g_variant_ref_sink(variant); - g_variant_unref(variant); - g_object_unref(G_OBJECT(server)); - - return; -} - -static void -test_object_keyfile_basics (gconstpointer data) -{ - g_test_log_set_fatal_handler(fatal_func, NULL); - - type_data_t * typedata = (type_data_t *)data; - - Server * server = NULL; - - server = server_new_from_keyfile(NULL, NULL); - g_assert(server == NULL); - - GKeyFile * keyfile = g_key_file_new(); - server = server_new_from_keyfile(keyfile, NULL); - g_assert(server == NULL); - - server = server_new_from_keyfile(keyfile, CONFIG_SERVER_PREFIX " Server Name"); - g_assert(server == NULL); - - gchar * groupname = g_strdup_printf("%s %s", CONFIG_SERVER_PREFIX, "Server Name"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_NAME, "My Server"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_URI, "http://my.domain.com"); - g_key_file_set_string(keyfile, groupname, CONFIG_SERVER_TYPE, typedata->config_type); - g_key_file_set_string(keyfile, groupname, "dumbledorf", "Bad data, don't screw up!"); - - server = server_new_from_keyfile(keyfile, CONFIG_SERVER_PREFIX " Server Name"); - g_assert(server != NULL); - g_assert(g_strcmp0(server->name, "My Server") == 0); - g_assert(g_strcmp0(server->uri, "http://my.domain.com") == 0); - g_assert(typedata->type == G_OBJECT_TYPE(server)); - - g_object_unref(server); - g_free(groupname); - g_key_file_unref(keyfile); - - return; -} - -static void -test_object_creation (gconstpointer data) -{ - g_test_log_set_fatal_handler(no_fatal_warnings, NULL); - - type_data_t * typedata = (type_data_t *)data; - - Server * server = g_object_new(typedata->type, NULL); - - g_assert(server != NULL); - g_assert(IS_SERVER(server)); - - g_object_unref(G_OBJECT(server)); - return; -} - -/* Build the test suite */ -static void -test_objects_suite (void) -{ - /* Here because they might require code to create the type so can't be - statically defined in the global */ - type_data[0].type = CITRIX_SERVER_TYPE; - type_data[1].type = RDP_SERVER_TYPE; - type_data[2].type = UCCS_SERVER_TYPE; - - g_test_add_data_func ("/server/object/creation/citrix", &type_data[0], test_object_creation); - g_test_add_data_func ("/server/object/creation/rdp", &type_data[1], test_object_creation); - g_test_add_data_func ("/server/object/creation/uccs", &type_data[2], test_object_creation); - - g_test_add_data_func ("/server/object/keyfile/citrix", &(type_data[0]), test_object_keyfile_basics); - g_test_add_data_func ("/server/object/keyfile/rdp", &(type_data[1]), test_object_keyfile_basics); - g_test_add_data_func ("/server/object/keyfile/uccs", &(type_data[2]), test_object_keyfile_basics); - - g_test_add_data_func ("/server/object/variant/citrix", &(type_data[0]), test_object_variant); - g_test_add_data_func ("/server/object/variant/rdp", &(type_data[1]), test_object_variant); - g_test_add_data_func ("/server/object/variant/uccs", &(type_data[2]), test_object_variant); - - g_test_add_func ("/server/uccs/exec", test_uccs_exec); - g_test_add_func ("/server/uccs/domains", test_uccs_domains); - g_test_add_func ("/server/uccs/signal", test_update_signal); - - return; -} - -gint -main (gint argc, gchar * argv[]) -{ -#if !GLIB_CHECK_VERSION (2, 35, 1) - g_type_init(); -#endif - g_test_init(&argc, &argv, NULL); - - /* Test suites */ - test_objects_suite(); - - return g_test_run (); -} diff --git a/tests/slmock b/tests/slmock deleted file mode 100755 index 10ccc95..0000000 --- a/tests/slmock +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/python3 -# -# Copyright (C) 2012 Canonical, Ltd. -# Copyright (C) 2015 The Arctica Project -# Authors: Matthew Fischer <matthew.fischer@canonical.com> -# Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - -import sys -import json -import random -import argparse -import string - -class ManagementServer(): - def __init__(self, url, name): - self.RemoteDesktopServers = [] - self.AdditionalManagementServers = [] - self.URL = url - self.Name = name - - def set_default(self, tsName): - if isinstance(tsName, str): - self.DefaultServer = tsName - else: - raise TypeError("set_default expects a string argument") - - def add_terminal_server(self, server): - self.RemoteDesktopServers.append(server) - - def add_additional_management_server(self, amserver): - if isinstance(amserver, AdditionalManagementServer): - self.AdditionalManagementServers.append(amserver) - else: - raise TypeError("add_additional_management_server expects a "\ - "AdditionalManagementServer argument") - - def toJson(self): - return json.dumps(self, default=convert_to_builtin_type) - -class AdditionalManagementServer(): - def __init__(self, url, name): - self.URL = url - self.Name = name - -class TerminalServer(): - def __init__(self, url, name, protocol, domainRequired = True, - username = None, password = None): - self.URL = url - self.Name = name - self.Protocol = protocol - self.DomainRequired = domainRequired - self.Username = username - self.Password = password - - def add_domain(self, domainName): - if isinstance(domainName, str): - self.WindowsDomain = domainName - else: - raise TypeError("add_domain expects a string argument") - - def toJson(self): - return json.dumps(self, default=convert_to_builtin_type) - -def convert_to_builtin_type(obj): - d = { } - d.update(obj.__dict__) - return d - -def freerdp(email): - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - ts1 = TerminalServer("23.21.151.133", "FreeRDP US", "freerdp", False, - "Administrator") - ts2 = TerminalServer("46.137.222.181", "FreeRDP Asia", "freerdp", False, - "Administrator") - ts3 = TerminalServer("46.137.189.194", "FreeRDP UK", "freerdp", False, - "Administrator") - ms.add_terminal_server(ts1) - ms.add_terminal_server(ts2) - ms.add_terminal_server(ts3) - ms.set_default(ts1.Name) - print(ms.toJson()) - -def x2go(email): - ms = ManagementServer("http://x2go.intern", "X2GoSessionBroker") - ts1 = TerminalServer("10.0.2.11", "X2Go Server 1", "x2go", False, - "foo") - ts2 = TerminalServer("10.0.2.12", "X2Go Server 2", "x2go", False, - "bar") - ts3 = TerminalServer("10.0.2.13", "X2Go Server 3", "x2go", False, - "foobar") - ms.add_terminal_server(ts1) - ms.add_terminal_server(ts2) - ms.add_terminal_server(ts3) - ms.set_default(ts1.Name) - print(ms.toJson()) - -def print_error(text): - print("{ \"Error\": \"%s\" }" % text) - -def error(email): - print_error("Server did not respond") - -def citrix(email): - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - ts1 = TerminalServer("107.21.17.35", "Citrix USA", "ICA", True, - "useradmin1") - ts2 = TerminalServer("107.21.17.35", "Citrix 2", "ICA", True, - "useradmin2") - ts3 = TerminalServer("107.21.17.35", "Citrix 3", "ICA", True, - "useradmin3") - ts4 = TerminalServer("107.21.17.35", "Citrix 4", "ICA", True, - "useradmin4", "userpass") - ts1.add_domain("IP-0A00001E") - ts2.add_domain("IP-0A00001E") - ts3.add_domain("IP-0A00001E") - ts4.add_domain("IP-0A00001E") - ms.add_terminal_server(ts1) - ms.add_terminal_server(ts2) - ms.add_terminal_server(ts3) - ms.add_terminal_server(ts4) - print(ms.toJson()) - -def vmware(email): - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - ts = TerminalServer("https://10.193.37.140", "VMWare-View Lexington", - "vmware", True, "Administrator") - ts.add_domain("VMWARE") - ms.add_terminal_server(ts) - print(ms.toJson()) - -def defaults(email): - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - ts1 = TerminalServer("https://10.10.10.10", "AAA", "vmware") - ts2 = TerminalServer("https://10.10.10.10", "ZZZ", "vmware") - ts3 = TerminalServer("https://10.10.10.10", "MMM-Default", "vmware", True) - ts1.add_domain("VMWARE") - ts2.add_domain("VMWARE") - ts3.add_domain("VMWARE") - ms.set_default(ts3.Name) - ms.add_terminal_server(ts1) - ms.add_terminal_server(ts2) - ms.add_terminal_server(ts3) - print(ms.toJson()) - -# a choice of random problems in the json that the parser should catch -def missing_fields(email): - val = random.randint(1,4) - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - ts3 = TerminalServer("https://10.10.10.10", "TS1-Default", "vmware", True) - ts3.add_domain("VMWARE") - ms.set_default(ts3.Name) - - # no ts's - if val == 1: - print(ms.toJson()) - return - - # no protocol in TS - elif val == 2: - ts3.Protocol = None - - # no url in TS - elif val == 3: - ts3.URL = None - - # no name in TS - elif val == 4: - ts3.Name = None - - ms.add_terminal_server(ts3) - print(ms.toJson()) - -def big(email): - ms = ManagementServer("http://tc.arctica-project.org", "Landscape") - - ts1 = TerminalServer("107.21.17.35", "XenServer", "ICA") - ts2 = TerminalServer("http://1.2.3.4", "Citrix2", "ICA", True, - "fakeuser", "fakepassword") - ts3 = TerminalServer("10.21.17.35", "Accenture", "freerdp", True, - "fakeuser") - ts4 = TerminalServer("https://4.5.6.7", "Accenture 2", "freerdp", False) - ts5 = TerminalServer("5.21.17.35", "VmWare Cloud", "vmware", False, - "fakeuser", "fakepassword") - ts6 = TerminalServer("http://8.9.10.11", "Canonicloud", "vmware", True) - - ts1.add_domain("ASIA") - ts2.add_domain("DOMAIN1") - ts3.add_domain("EUROPE") - ts4.add_domain("domain2") - - ms.add_terminal_server(ts1) - ms.add_terminal_server(ts2) - ms.add_terminal_server(ts3) - ms.add_terminal_server(ts4) - ms.add_terminal_server(ts5) - ms.add_terminal_server(ts6) - ms.set_default(ts4.Name) - - ams1 = AdditionalManagementServer("http://1.2.3.4", "AMS1") - ams2 = AdditionalManagementServer("http://5.6.7.8", "Landscape - Accenture") - ams3 = AdditionalManagementServer("http://10.10.10.10", "AMS3") - ms.add_additional_management_server(ams1) - ms.add_additional_management_server(ams2) - ms.add_additional_management_server(ams3) - - print(ms.toJson()) - -def garbage(email): - print("{, garbage''''''''}}}}}}}}{{{},garbage\n\r\n\n\n\n") - -def random_string(email): - numchars = random.randint(0,4096) - print(''.join(random.choice(string.printable) for x in range(numchars))) - -emailaddrs = {"b" : big, #lots of domains/servers - "c" : citrix, - "d" : defaults, #for easy testing of default ts - "e" : error, - "f" : freerdp, - "x" : x2go, - "g" : garbage, - "m" : missing_fields, #json missing some fields - "r" : random_string, - "v" : vmware, -} - -def help(): - helpstr = "Email address to retrieve server info for. Currently "\ - "the options are: " - emaillist = "" - for key in emailaddrs: - emaillist += key + ", " - helpstr += emaillist[:-2] - return helpstr - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('email', help=help()) - - args = parser.parse_args() - - password = sys.stdin.read() - - if args.email in emailaddrs: - if password != args.email: - print_error("Invalid password") - sys.exit(-1); - else: - emailaddrs[args.email](args.email) - else: - print_error("Invalid username") - sys.exit(-1); diff --git a/tests/slmock-config.conf.in b/tests/slmock-config.conf.in deleted file mode 100644 index 153ab2e..0000000 --- a/tests/slmock-config.conf.in +++ /dev/null @@ -1,9 +0,0 @@ -[Remote Logon Service] -Servers=SLMock Server - -[Server SLMock Server] -Name=SLMock -Type=UCCS -URI=https://slmock.com/ -Exec=@slmock@ -NetworkRequired=None diff --git a/tests/uccs-config.conf b/tests/uccs-config.conf deleted file mode 100644 index 55a6573..0000000 --- a/tests/uccs-config.conf +++ /dev/null @@ -1,9 +0,0 @@ -[Remote Logon Service] -Servers=Test Server - -[Server Test Server] -Name=Test Server Name -Type=UCCS -URI=https://uccs.test.mycompany.com/ -Exec=ls -NetworkRequired=None -- Alioth's /srv/git/code.x2go.org/remote-login-service-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/remote-login-service-x2go.git