kezhuw commented on code in PR #2223: URL: https://github.com/apache/zookeeper/pull/2223#discussion_r2010704219
########## zookeeper-client/zookeeper-client-c/include/zookeeper.h: ########## @@ -667,6 +667,74 @@ 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. + * \param buf_len the size of buf in bytes, is also the max allowed length of + * the actual password (excluding the null terminator), which is 1023. The + * 1-byte difference from 1024 accounts for the null (\0) terminator. A length + * of 1023 is sufficient for storing the password. Review Comment: Is here too many implementation details ? I think the contract is much clear now: 1. The max allowed password len is `buf_len`. 2. 1023 is indeed the max password length, but I think it does not deserve too much attention in api doc, as we have `buf_len`. Besides, after checked https://linux.die.net/man/3/sasl_getsecret_t, I think the null terminator does not actually matter. I think we can keep it, but again, does not deserve too much strokes. -- 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: notifications-unsubscr...@zookeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org