Hey,
Can look more closely later, but a few quick things that might help:
1) stick to memcached/memcached on github - that's an old couchbase fork
you linked to. If you're using couchbase you need to talk to them instead.
2) in the t/ dir there're some unit tests for SASL which might help you
understand the workflow better.
On Mon, 18 Mar 2019, Jiuming Shao wrote:
> Hey all,
> I am writing my own implementation of a memcachedClient within which I want to add authentication. I just started with PLAIN auth but
> failed.
>
> My main reference is this one
https://github.com/couchbase/memcached/blob/master/docs/sasl.md
> My guess is that the binary message I am sending through the wire was wrong, thus it could never match with the secret I store in the db
> file.
> After searching around, I found out the SASL_AUTH(0X21) is also a key-value like operation, where the key is the auth mechanism, and the
> value being auth data. The tricky part is how I put them in the outgoing request.
>
> Please correct me if i am wrong, below is an example of PLAIN auth request
> 1. The auth mechanism comes right after the header. in this case 'PLAIN'
> 2. A NULL byte comes after the "key" -> "PLAIN". In this case byte # 29.
> 3. Then comes the user@hostName
> 4. A NULL bytes comes after user@hostname. In this case byte # 34
> 5. The last part is the password
> * In my memcached-sasl-db, should I store userName:password or username@hostName:password?
> * Does the TotalLength of the message include the NULL bytes being added between authKey/authData and username/password?
> * In my authData should I use \0x00userName\0x00password or \0x00userName@hostNname\0x00password?
> * Any other suggestions?
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
memcached+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
>
>