qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1515602 - in /qpid/trunk/qpid/cpp/src: CMakeLists.txt qpid/NullSaslClient.cpp qpid/NullSaslClient.h qpid/SaslFactory.cpp
Date Mon, 19 Aug 2013 21:01:19 GMT
Author: gsim
Date: Mon Aug 19 21:01:18 2013
New Revision: 1515602

URL: http://svn.apache.org/r1515602
Log:
QPID-5083: provide simple default where sasl functionality is not available

Added:
    qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.cpp
    qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.h
Modified:
    qpid/trunk/qpid/cpp/src/CMakeLists.txt
    qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp

Modified: qpid/trunk/qpid/cpp/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/CMakeLists.txt?rev=1515602&r1=1515601&r2=1515602&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/CMakeLists.txt Mon Aug 19 21:01:18 2013
@@ -578,6 +578,9 @@ if (BUILD_SASL)
       qpid/sys/cyrus/CyrusSecurityLayer.cpp
      )
   set(qpidcommon_sasl_lib sasl2)
+else (BUILD_SASL)
+  set(HAVE_SASL OFF)
+  set(BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker")
 endif (BUILD_SASL)
 
 # Optional SSL/TLS support. Requires Netscape Portable Runtime on Linux.
@@ -979,6 +982,7 @@ set (qpidcommon_SOURCES
      qpid/StringUtils.cpp
      qpid/Url.cpp
      qpid/UrlArray.cpp
+     qpid/NullSaslClient.cpp
      qpid/NullSaslServer.cpp
      qpid/amqp_0_10/SessionHandler.cpp
      qpid/framing/AccumulatedAck.cpp

Added: qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.cpp?rev=1515602&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.cpp (added)
+++ qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.cpp Mon Aug 19 21:01:18 2013
@@ -0,0 +1,53 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "NullSaslClient.h"
+#include "Exception.h"
+
+namespace qpid {
+namespace {
+const std::string ANONYMOUS("ANONYMOUS");
+}
+
+bool NullSaslClient::start(const std::string& mechanisms, std::string&,
+           const qpid::sys::SecuritySettings*)
+{
+    if (mechanisms.find(ANONYMOUS) == std::string::npos) {
+        throw qpid::Exception("No suitable mechanism!");
+    }
+    return false;
+}
+std::string NullSaslClient::step(const std::string&)
+{
+    return std::string();
+}
+std::string NullSaslClient::getMechanism()
+{
+    return ANONYMOUS;
+}
+std::string NullSaslClient::getUserId()
+{
+    return ANONYMOUS;
+}
+std::auto_ptr<qpid::sys::SecurityLayer> NullSaslClient::getSecurityLayer(uint16_t)
+{
+    return std::auto_ptr<qpid::sys::SecurityLayer>();
+}
+} // namespace qpid

Added: qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.h?rev=1515602&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.h (added)
+++ qpid/trunk/qpid/cpp/src/qpid/NullSaslClient.h Mon Aug 19 21:01:18 2013
@@ -0,0 +1,41 @@
+#ifndef QPID_NULLSASLCLIENT_H
+#define QPID_NULLSASLCLIENT_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "Sasl.h"
+
+namespace qpid {
+
+class NullSaslClient : public Sasl
+{
+  public:
+    bool start(const std::string& mechanisms, std::string& response,
+                       const qpid::sys::SecuritySettings* externalSecuritySettings = 0);
+    std::string step(const std::string& challenge);
+    std::string getMechanism();
+    std::string getUserId();
+    std::auto_ptr<qpid::sys::SecurityLayer> getSecurityLayer(uint16_t maxFrameSize);
+  private:
+};
+} // namespace qpid
+
+#endif  /*!QPID_NULLSASLCLIENT_H*/

Modified: qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp?rev=1515602&r1=1515601&r2=1515602&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp Mon Aug 19 21:01:18 2013
@@ -20,6 +20,7 @@
  */
 #include "qpid/SaslFactory.h"
 #include "qpid/SaslServer.h"
+#include "qpid/NullSaslClient.h"
 #include "qpid/NullSaslServer.h"
 #include <map>
 #include <string.h>
@@ -48,7 +49,8 @@ SaslFactory& SaslFactory::getInstance()
 
 std::auto_ptr<Sasl> SaslFactory::create( const std::string &, const std::string
&, const std::string &, const std::string &, int, int, bool )
 {
-    return std::auto_ptr<Sasl>();
+    std::auto_ptr<Sasl> client(new NullSaslClient);
+    return client;
 }
 
 std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, bool
/*encryptionRequired*/, const qpid::sys::SecuritySettings&)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message