Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

fix(security): fix bug in building cyrus-sasl #616

Merged
merged 5 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/runtime/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,14 @@ run = true
[uri-resolver.http://localhost:8080]
factory = partition_resolver_simple
arguments = 127.0.0.1:8080

[security]
krb5_keytab = /etc/pegasus_tst-pegasus.keytab
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files may not exist on test environment, will the test cases fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these configs is used for init kerberos. Or we should delete this unit test.
By the way, I prefer to delete the unit test

krb5_config = /etc/krb5.conf
krb5_principal = pegasus_tst/[email protected]
service_name = pegasus_tst
service_fqdn = pegasus
sasl_plugin_path = /home/mi/workspace/pegasus/rdsn/thirdparty/output/lib/sasl2
enable_auth = true
mandatory_auth = false
super_user = xxx
44 changes: 44 additions & 0 deletions src/runtime/test/sasl_wrapper_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Microsoft Corporation
*
* -=- Robust Distributed System Nucleus (rDSN) -=-
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "runtime/security/sasl_wrapper.h"

#include <gtest/gtest.h>

namespace dsn {
namespace security {
TEST(sasl_wrapper_test, support_gssapi)
{
std::unique_ptr<sasl_wrapper> wrapper = create_sasl_wrapper(true);
error_s err_s = wrapper->init();
ASSERT_TRUE(err_s.is_ok());

std::string output;
err_s = wrapper->start("GSSAPI", "", output);
ASSERT_TRUE(err_s.is_ok() || ERR_SASL_INCOMPLETE == err_s.code());
}
} // namespace security
} // namespace dsn
5 changes: 4 additions & 1 deletion thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,16 @@ ExternalProject_Add(cyrus-sasl
http://www.cyrusimap.org/releases/cyrus-sasl-2.1.27.tar.gz
URL_MD5 a33820c66e0622222c5aefafa1581083
CONFIGURE_COMMAND ./configure --prefix=${TP_OUTPUT}
--enable-gssapi=$TP_OUTPUT
--enable-gssapi=${TP_OUTPUT}
--enable-scram=no
--enable-digest=no
--enable-cram=no
--enable-otp=no
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
add_dependencies(cyrus-sasl krb5)

ExternalProject_Add(http-parser
URL ${OSS_URL_PREFIX}/http-parser-2.9.4.zip
Expand Down