zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ride Shoot Speak <ride.shoot.sp...@googlemail.com>
Subject Re: Problems with ACL
Date Tue, 22 Feb 2011 08:34:19 GMT
2011/2/15 Michi Mutsuzaki <michim@yahoo-inc.com>

> On 2/15/11 1:40 AM, "Ride Shoot Speak" <ride.shoot.speak@googlemail.com>
> wrote:
> > Hi,
> >
> > I want to use ZOO_CREATOR_ALL_ACL for the creation of all znodes.
> > Unfortunately zoo_create always returns ZINVALIDACL (-114) each time I
> try
> > to zoo_create a znode. Everything works fine using ZOO_OPEN_ACL_UNSAFE. I
> > use digest authentication. Any ideas?
> >
> > TIA
> > Jan
>
> Hi Jan,
>
> Could you post a code snippet that shows how you are calling zoo_create()?
> Have you called zoo_add_auth()?
>
> Thanks!
> --Michi
>
>
Hi Michi,

sorry for answering a bit late. Yes I've calle zoo_add_auth().

I've wrapped the C API into a simple class. The methods of interest are
these I guess:

void ZooKeeper::connect(const std::string & hosts, unsigned int timeout)
{
  disconnect();
  zhandle_ = zookeeper_init(hosts.c_str(), connectionWatcher, timeout, 0,
this, 0);
  if (zhandle_ == 0) {
    throw ZooKeeperException(errno, zerror(errno));
  }
}

void ZooKeeper::authenticate(const std::string & user, const std::string &
password)
{
  const std::string digest = user + ":" + password;
  const int errorCode = zoo_add_auth(zhandle_, "digest", digest.c_str(),
digest.length(), 0, 0);
  if (errorCode != ZOK) {
    throw ZooKeeperException(errorCode, zerror(errorCode));
  }
}

I call connect and then authenticate. Right now there is only one pair of
credentials so all modules using the wrapper use the same user to access the
ZK.

Best regards
Jan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message