Commit 098a2099 authored by David Howells's avatar David Howells

rxrpc: rxkad: The version number in the response should be net byte order

The version number rxkad places in the response should be network byte
order.

Whilst we're at it, rearrange the code to be more readable.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent ee72b9fd
...@@ -787,10 +787,15 @@ static int rxkad_respond_to_challenge(struct rxrpc_connection *conn, ...@@ -787,10 +787,15 @@ static int rxkad_respond_to_challenge(struct rxrpc_connection *conn,
/* build the response packet */ /* build the response packet */
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.version = RXKAD_VERSION; resp.version = htonl(RXKAD_VERSION);
resp.encrypted.epoch = htonl(conn->epoch); resp.encrypted.epoch = htonl(conn->epoch);
resp.encrypted.cid = htonl(conn->cid); resp.encrypted.cid = htonl(conn->cid);
resp.encrypted.securityIndex = htonl(conn->security_ix); resp.encrypted.securityIndex = htonl(conn->security_ix);
resp.encrypted.inc_nonce = htonl(nonce + 1);
resp.encrypted.level = htonl(conn->security_level);
resp.kvno = htonl(token->kad->kvno);
resp.ticket_len = htonl(token->kad->ticket_len);
resp.encrypted.call_id[0] = resp.encrypted.call_id[0] =
htonl(conn->channels[0] ? conn->channels[0]->call_id : 0); htonl(conn->channels[0] ? conn->channels[0]->call_id : 0);
resp.encrypted.call_id[1] = resp.encrypted.call_id[1] =
...@@ -799,10 +804,6 @@ static int rxkad_respond_to_challenge(struct rxrpc_connection *conn, ...@@ -799,10 +804,6 @@ static int rxkad_respond_to_challenge(struct rxrpc_connection *conn,
htonl(conn->channels[2] ? conn->channels[2]->call_id : 0); htonl(conn->channels[2] ? conn->channels[2]->call_id : 0);
resp.encrypted.call_id[3] = resp.encrypted.call_id[3] =
htonl(conn->channels[3] ? conn->channels[3]->call_id : 0); htonl(conn->channels[3] ? conn->channels[3]->call_id : 0);
resp.encrypted.inc_nonce = htonl(nonce + 1);
resp.encrypted.level = htonl(conn->security_level);
resp.kvno = htonl(token->kad->kvno);
resp.ticket_len = htonl(token->kad->ticket_len);
/* calculate the response checksum and then do the encryption */ /* calculate the response checksum and then do the encryption */
rxkad_calc_response_checksum(&resp); rxkad_calc_response_checksum(&resp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment