Skip to content

Commit

Permalink
Merge pull request #541 from Barenboim/master
Browse files Browse the repository at this point in the history
fix kafka warnings on clang
  • Loading branch information
Barenboim committed Aug 24, 2021
2 parents 5b84728 + b55e318 commit b995150
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/factory/KafkaTaskImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ CommMessageOut *__ComplexKafkaTask::message_out()
if (seqid == 0)
{
KafkaConnectionInfo *conn_info = new KafkaConnectionInfo;
this->get_connection()->set_context(conn_info, std::move([](void *ctx) {
delete (KafkaConnectionInfo *)ctx;
}));

this->get_req()->set_api(&conn_info->api);
this->get_connection()->set_context(conn_info, [](void *ctx) {
delete (KafkaConnectionInfo *)ctx;
});

if (!this->get_req()->get_config()->get_broker_version())
{
Expand Down
3 changes: 2 additions & 1 deletion src/protocol/KafkaMessage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3819,7 +3819,8 @@ int KafkaResponse::append(const void *buf, size_t *size)
if (strncasecmp(this->config.get_sasl_mech(), "SCRAM", 5) == 0)
{
this->clear_buf();
if (this->sasl->scram.state != -1)
if (this->sasl->scram.state !=
KAFKA_SASL_SCRAM_STATE_CLIENT_FINISHED)
ret = this->handle_sasl_continue();
else
this->sasl->status = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/kafka_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ static int kafka_sasl_scram_recv(const char *buf, size_t len, void *p, void *q)

case KAFKA_SASL_SCRAM_STATE_CLIENT_FINAL_MESSAGE:
ret = scram_handle_server_final_message(buf, len, conf, sasl);
sasl->scram.state = -1;
sasl->scram.state = KAFKA_SASL_SCRAM_STATE_CLIENT_FINISHED;
break;

default:
Expand Down
15 changes: 9 additions & 6 deletions src/protocol/kafka_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,21 @@ typedef struct __kafka_parser
size_t hsize;
} kafka_parser_t;

enum __kafka_scram_state
{
KAFKA_SASL_SCRAM_STATE_CLIENT_FIRST_MESSAGE,
KAFKA_SASL_SCRAM_STATE_SERVER_FIRST_MESSAGE,
KAFKA_SASL_SCRAM_STATE_CLIENT_FINAL_MESSAGE,
KAFKA_SASL_SCRAM_STATE_CLIENT_FINISHED,
};

typedef struct __kafka_scram
{
const void *evp;
unsigned char *(*scram_h)(const unsigned char *d, size_t n,
unsigned char *md);
size_t scram_h_size;
enum
{
KAFKA_SASL_SCRAM_STATE_CLIENT_FIRST_MESSAGE,
KAFKA_SASL_SCRAM_STATE_SERVER_FIRST_MESSAGE,
KAFKA_SASL_SCRAM_STATE_CLIENT_FINAL_MESSAGE,
} state;
enum __kafka_scram_state state;
struct iovec cnonce;
struct iovec first_msg;
struct iovec server_signature_b64;
Expand Down

0 comments on commit b995150

Please sign in to comment.