mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
clean: avoid maybe-uninitialized
https://github.com/warmcat/libwebsockets/issues/3049
This commit is contained in:
parent
9393dd3934
commit
837db622eb
7 changed files with 26 additions and 41 deletions
|
@ -79,7 +79,8 @@ lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)
|
|||
ret = 0;
|
||||
|
||||
bail:
|
||||
close(fd);
|
||||
if (fd >= 0) /* coverity */
|
||||
close(fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -179,11 +179,11 @@ __lws_lc_untag(struct lws_context *context, lws_lifecycle_t *lc)
|
|||
|
||||
//grp = lws_container_of(lc->list.owner, lws_lifecycle_group_t, owner);
|
||||
|
||||
lws_humanize(buf, sizeof(buf),
|
||||
(uint64_t)lws_now_usecs() - lc->us_creation,
|
||||
humanize_schema_us);
|
||||
|
||||
#if defined(LWS_LOG_TAG_LIFECYCLE)
|
||||
if (lws_humanize(buf, sizeof(buf),
|
||||
(uint64_t)lws_now_usecs() - lc->us_creation,
|
||||
humanize_schema_us) > 0)
|
||||
|
||||
lwsl_cx_notice(context, " -- %s (%d) %s", lc->gutag,
|
||||
(int)lc->list.owner->count - 1, buf);
|
||||
#endif
|
||||
|
|
|
@ -591,7 +591,7 @@ static const char *digest_toks[] = {
|
|||
"response", // 1 << 5
|
||||
"opaque", // 1 << 6
|
||||
"qop", // 1 << 7
|
||||
"algorithm" // 1 << 8
|
||||
"algorithm", // 1 << 8
|
||||
"nc", // 1 << 9
|
||||
"cnonce", // 1 << 10
|
||||
"domain", // 1 << 11
|
||||
|
@ -604,7 +604,7 @@ enum lws_check_basic_auth_results
|
|||
lws_http_digest_auth(struct lws* wsi)
|
||||
{
|
||||
uint8_t nonce[256], response[LWS_GENHASH_LARGEST], qop[32];
|
||||
int seen = 0, n, pend = -1, skipping = 0;
|
||||
int seen = 0, n, pend = -1;
|
||||
char *tmp_digest = NULL;
|
||||
struct lws_tokenize ts;
|
||||
char resp_username[32];
|
||||
|
@ -677,8 +677,6 @@ lws_http_digest_auth(struct lws* wsi)
|
|||
break;
|
||||
|
||||
case LWS_TOKZE_TOKEN_NAME_EQUALS:
|
||||
if (skipping)
|
||||
break;
|
||||
if ((seen & (1 << 15)) == (1 << 15) || pend != -1)
|
||||
/* no auth type token or disordered */
|
||||
return LCBA_END_TRANSACTION;
|
||||
|
@ -704,8 +702,6 @@ lws_http_digest_auth(struct lws* wsi)
|
|||
break;
|
||||
|
||||
case LWS_TOKZE_QUOTED_STRING:
|
||||
if (skipping)
|
||||
break;
|
||||
if (pend < 0)
|
||||
return LCBA_END_TRANSACTION;
|
||||
|
||||
|
@ -757,8 +753,6 @@ lws_http_digest_auth(struct lws* wsi)
|
|||
|
||||
case LWS_TOKZE_DELIMITER:
|
||||
if (*ts.token == ',') {
|
||||
if (skipping)
|
||||
break;
|
||||
if (pend != PEND_DELIM)
|
||||
return LCBA_END_TRANSACTION;
|
||||
|
||||
|
@ -766,11 +760,6 @@ lws_http_digest_auth(struct lws* wsi)
|
|||
break;
|
||||
}
|
||||
if (*ts.token == ';') {
|
||||
if (skipping) {
|
||||
/* try again with this one */
|
||||
skipping = 0;
|
||||
break;
|
||||
}
|
||||
/* it's the end */
|
||||
e = LWS_TOKZE_ENDED;
|
||||
break;
|
||||
|
@ -1062,27 +1051,23 @@ lws_client_interpret_server_handshake(struct lws *wsi)
|
|||
n = atoi(p);
|
||||
|
||||
#if defined(LWS_WITH_HTTP_DIGEST_AUTH)
|
||||
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
|
||||
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
|
||||
wsi->stash->cis[CIS_PASSWORD])) {
|
||||
lwsl_err(
|
||||
"Digest auth requested by server but no credentials provided "
|
||||
"by user\n");
|
||||
return LCBA_FAILED_AUTH;
|
||||
}
|
||||
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
|
||||
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
|
||||
wsi->stash->cis[CIS_PASSWORD])) {
|
||||
lwsl_err("Digest auth requested by server but no credentials provided by user\n");
|
||||
|
||||
return LCBA_FAILED_AUTH;
|
||||
}
|
||||
|
||||
if (0 != lws_http_digest_auth(wsi)) {
|
||||
if (wsi)
|
||||
goto bail3;
|
||||
return 1;
|
||||
}
|
||||
if (lws_http_digest_auth(wsi))
|
||||
goto bail3;
|
||||
|
||||
opaque = wsi->a.opaque_user_data;
|
||||
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "digest_auth_step2");
|
||||
wsi->a.opaque_user_data = opaque;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ah = wsi->http.ah;
|
||||
#endif
|
||||
|
|
|
@ -150,7 +150,7 @@ lws_http_date_parse_unix(const char *b, size_t len, time_t *t)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
return (int)*t == -1 ? -1 : 0;
|
||||
return (int)(*t == -1 ? -1 : 0);
|
||||
}
|
||||
|
||||
#if defined(LWS_WITH_CLIENT)
|
||||
|
|
|
@ -93,7 +93,7 @@ _lws_vhost_init_server_af(struct vh_sock_args *a)
|
|||
int n, opt = 1, limit = 1, san = 2;
|
||||
lws_sockfd_type sockfd;
|
||||
struct lws *wsi;
|
||||
int m = 0, is;
|
||||
int m = 0, is = 0;
|
||||
#if defined(LWS_WITH_IPV6)
|
||||
int value = 1;
|
||||
#endif
|
||||
|
|
|
@ -533,17 +533,16 @@ _lws_smd_msg_deliver_peer(struct lws_context *ctx, lws_smd_peer_t *pr)
|
|||
|
||||
msg = lws_container_of(pr->tail, lws_smd_msg_t, list);
|
||||
|
||||
|
||||
lwsl_cx_info(ctx, "deliver cl 0x%x, len %d, refc %d, to peer %p",
|
||||
lwsl_cx_info(ctx, "deliver cl 0x%x, len %d, to peer %p",
|
||||
(unsigned int)msg->_class, (int)msg->length,
|
||||
(int)msg->refcount, pr);
|
||||
pr);
|
||||
|
||||
pr->cb(pr->opaque, msg->_class, msg->timestamp,
|
||||
((uint8_t *)&msg[1]) + LWS_SMD_SS_RX_HEADER_LEN_EFF,
|
||||
(size_t)msg->length);
|
||||
|
||||
#if !defined(__COVERITY__)
|
||||
assert(msg->refcount);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* If there is one, move forward to the next queued
|
||||
* message that meets the filters of this peer
|
||||
|
|
|
@ -90,8 +90,8 @@ lws_tls_check_cert_lifetime(struct lws_vhost *v)
|
|||
return 1;
|
||||
|
||||
life = (ir.time - now) / (24 * 3600);
|
||||
lwsl_vhost_notice(v, " vhost %s: cert expiry: %dd", v->name,
|
||||
(int)life);
|
||||
lwsl_vhost_notice(v, " vhost %s: cert expiry: %lldd", v->name,
|
||||
(long long)life);
|
||||
} else
|
||||
lwsl_vhost_info(v, " vhost %s: no cert", v->name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue