kezhuw commented on code in PR #2223:
URL: https://github.com/apache/zookeeper/pull/2223#discussion_r2008788390


##########
zookeeper-client/zookeeper-client-c/include/zookeeper.h:
##########
@@ -667,6 +667,69 @@ ZOOAPI zhandle_t *zookeeper_init_sasl(const char *host, 
watcher_fn fn,
 ZOOAPI sasl_callback_t *zoo_sasl_make_basic_callbacks(const char *user,
   const char *realm, const char* password_file);
 
+/**
+ * \brief signature of the callback function for SASL password.
+ *
+ * This callback is defined by user to decrypt the content of password file 
with
+ * context into the actual password.
+ *
+ * \param content the string read from the password file.
+ * \param content_len the size of the content in bytes.
+ * \param context the handback object that will be associated with the password
+ *   file. The object is not used by zookeeper internally and can be null.
+ * \param buf the buffer where the resulting actual password is saved, NOTE 
that
+ *   this callback must write the null terminator immediately after the last
+ *   character of the actual password, otherwise the behaviour is undefined.

Review Comment:
   Is it better to shape the callback to type `int 
(*zoo_sasl_password_callback_t)(const char *content, size_t content_len, void 
*context, char *password_buf, size_t *password_buf_len)` for the decryption to 
pass back password len ? Fail to do so will result in sasl auth failure instead 
of `undefined`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to