Github user laurentgo commented on a diff in the pull request:
https://github.com/apache/drill/pull/578#discussion_r85802137
--- Diff: contrib/native/client/src/clientlib/drillClientImpl.cpp ---
@@ -1849,4 +2048,150 @@ void ZookeeperImpl:: debugPrint(){
}
}
+typedef int (*sasl_callback_proc_t)(void); // see sasl_callback_ft
+
+static int SaslAuthenticatorImpl::userNameCallback(void *context, int id,
const char **result, unsigned *len) {
+ const std::string* const username = (const std::string* const) context;
+
+ if ((SASL_CB_USER == id || SASL_CB_AUTHNAME == id)
+ && username != NULL) {
+ *result = username->c_str();
+// *len = (unsigned int) username->length();
+ }
+ return SASL_OK;
+}
+
+static int SaslAuthenticatorImpl::passwordCallback(sasl_conn_t *conn, void
*context, int id, sasl_secret_t **psecret) {
+ const SaslAuthenticatorImpl* const authenticator = (const
SaslAuthenticatorImpl* const) context;
+
+ if (SASL_CB_PASS == id) {
+ const std::string password = authenticator->m_password;
+ const size_t length = password.length();
+ authenticator->m_secret->len = length;
+ std::memcpy(authenticator->m_secret->data, password.c_str(),
length);
+ *psecret = authenticator->m_secret;
+ }
+ return SASL_OK;
+}
+
+SaslAuthenticatorImpl::SaslAuthenticatorImpl(const DrillUserProperties*
const properties) :
+ m_properties(properties), m_pConnection(NULL), m_secret(NULL),
m_servicename(NULL), m_servicehost(NULL) {
+}
+
+SaslAuthenticatorImpl::~SaslAuthenticatorImpl() {
+ if (m_secret) {
+ free(m_secret);
--- End diff --
since this object was created by the SASL library, should sasl_dispose be
called instead?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---