Giter VIP home page Giter VIP logo

Comments (1)

empiredan avatar empiredan commented on May 27, 2024

Have we tried to set host in zoo_sasl_params_t with NULL ?

typedef struct zoo_sasl_params {
  const char *service;          /*!< The service name, usually "zookeeper" */
  const char *host;             /*!< The server name, e.g. "zk-sasl-md5" */
  const char *mechlist;         /*!< Mechanisms to try, e.g. "DIGEST-MD5" */
  const sasl_callback_t *callbacks;  /*!< List of callbacks */
} zoo_sasl_params_t;

ZOOAPI zhandle_t *zookeeper_init_sasl(const char *host, watcher_fn fn,
  int recv_timeout, const clientid_t *clientid, void *context, int flags,
  log_callback_fn log_callback, zoo_sasl_params_t *sasl_params);

I found that host would be set automatically if it was NULL:

int zoo_sasl_connect(zhandle_t *zh)
{
......
    rc = _zsasl_getipport(zh, (const struct sockaddr *)&local_ip, salen,
        iplocalport, NULL);
    if (rc < 0) {
        return _zsasl_fail(zh, rc);
    }

    salen = sizeof(remote_ip);
    if (getpeername(zh->fd->sock, (struct sockaddr *)&remote_ip, &salen) < 0) {
        LOG_ERROR(LOGCALLBACK(zh), "getpeername");
        return _zsasl_fail(zh, ZSYSTEMERROR);
    }

    rc = _zsasl_getipport(zh, (const struct sockaddr *)&remote_ip, salen,
        ipremoteport, host);
    if (rc < 0) {
        return _zsasl_fail(zh, rc);
    }
......
    /* client new connection */
    sr = sasl_client_new(
        sc->params.service,
        sc->params.host ? sc->params.host : host,
        iplocalport,
        ipremoteport,
        sc->params.callbacks,
        /*secflags*/0,
        &sc->conn);

    if (sr != SASL_OK) {
        LOG_ERROR(LOGCALLBACK(zh),
            "allocating SASL connection state: %s",
            sasl_errstring(sr, NULL, NULL));
        return _zsasl_fail(zh, ZSYSTEMERROR);
    }

    return ZOK;
}

from incubator-pegasus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.