Skip to content

Commit b25c56f

Browse files
committed
session client BUGFIX ignore wrong msgid parsing error
Fixes #473
1 parent 396f727 commit b25c56f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/session_client.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,7 @@ recv_reply(struct nc_session *session, int timeout, struct lyd_node *op, uint64_
21122112
LY_ERR lyrc;
21132113
struct ly_in *msg = NULL;
21142114
NC_MSG_TYPE ret = NC_MSG_ERROR;
2115+
uint32_t temp_lo = LY_LOSTORE, *prev_lo;
21152116

21162117
assert(op && (op->schema->nodetype & (LYS_RPC | LYS_ACTION)));
21172118

@@ -2124,11 +2125,18 @@ recv_reply(struct nc_session *session, int timeout, struct lyd_node *op, uint64_
21242125
}
21252126

21262127
/* parse */
2128+
prev_lo = ly_temp_log_options(&temp_lo);
21272129
lyrc = lyd_parse_op(NULL, op, msg, LYD_XML, LYD_TYPE_REPLY_NETCONF, envp, NULL);
2128-
if (!lyrc) {
2130+
ly_temp_log_options(prev_lo);
2131+
2132+
if (*envp) {
2133+
/* if the envelopes were parsed, check the message-id, even on error */
21292134
ret = recv_reply_check_msgid(session, *envp, msgid);
21302135
goto cleanup;
2131-
} else {
2136+
}
2137+
2138+
if (lyrc) {
2139+
/* parsing error */
21322140
ERR(session, "Received an invalid message (%s).", ly_err_last(LYD_CTX(op))->msg);
21332141
lyd_free_tree(*envp);
21342142
*envp = NULL;

0 commit comments

Comments
 (0)