Skip to content

Commit

Permalink
Use bucket name in SASL if username omitted
Browse files Browse the repository at this point in the history
Change-Id: Idd4837b33dfb63b7834436e6a9d6f5302ce3d31c
Reviewed-on: http://review.couchbase.org/28532
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
avsej authored and trondn committed Aug 23, 2013
1 parent ab80faa commit 6b2f8e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bconf_provider.c
Expand Up @@ -93,7 +93,8 @@ static lcb_error_t setup_sasl_params(lcb_t instance)
sasl_callbacks[3].proc = NULL;
sasl_callbacks[3].context = NULL;

instance->sasl.name = instance->username;
instance->sasl.name = instance->username ?
instance->username : instance->bucket;
memset(instance->sasl.password.buffer, 0,
sizeof(instance->sasl.password.buffer));
passwd = instance->password;
Expand Down
2 changes: 2 additions & 0 deletions src/instance.c
Expand Up @@ -352,6 +352,7 @@ lcb_error_t lcb_create(lcb_t *instance,
offset = snprintf(buffer, sizeof(buffer),
"GET /pools/default/bucketsStreaming/%s HTTP/1.1\r\n",
bucket);
obj->bucket = strdup(bucket);
break;
case LCB_TYPE_CLUSTER:
offset = snprintf(buffer, sizeof(buffer), "GET /pools/ HTTP/1.1\r\n");
Expand Down Expand Up @@ -458,6 +459,7 @@ void lcb_destroy(lcb_t instance)
free(instance->vbucket_stream.header);
free(instance->vb_server_map);
free(instance->histogram);
free(instance->bucket);
free(instance->username);
free(instance->password);
memset(instance, 0xff, sizeof(*instance));
Expand Down
1 change: 1 addition & 0 deletions src/internal.h
Expand Up @@ -239,6 +239,7 @@ extern "C" {
/* credentials needed to operate cluster via REST API */
char *username;
char *password;
char *bucket;

struct {
const char *name;
Expand Down

0 comments on commit 6b2f8e9

Please sign in to comment.