Commit 7a97b763 authored by Brian Wellington's avatar Brian Wellington

dns_message_gettsig/getsig0 cleanup

parent c4bd4b1a
......@@ -944,11 +944,15 @@ dns_message_gettsig(dns_message_t *msg, dns_name_t **owner);
* Requires:
*
* 'msg' is a valid message.
* 'owner' is not NULL, and *owner is NULL. Contains the owner on return.
* 'owner' is NULL or *owner is NULL.
*
* Returns:
*
* The TSIG rdataset of 'msg', or NULL if there isn't one.
*
* Ensures:
*
* If 'owner' is not NULL, it will point to the owner name.
*/
isc_result_t
......@@ -1034,11 +1038,15 @@ dns_message_getsig0(dns_message_t *msg, dns_name_t **owner);
* Requires:
*
* 'msg' is a valid message.
* 'owner' is not NULL, and *owner is NULL. Contains the owner on return.
* 'owner' is NULL or *owner is NULL.
*
* Returns:
*
* The SIG(0) rdataset of 'msg', or NULL if there isn't one.
*
* Ensures:
*
* If 'owner' is not NULL, it will point to the owner name.
*/
isc_result_t
......
......@@ -2296,9 +2296,10 @@ dns_message_gettsig(dns_message_t *msg, dns_name_t **owner) {
*/
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(owner != NULL && *owner == NULL);
REQUIRE(owner == NULL || *owner == NULL);
*owner = msg->tsigname;
if (owner != NULL)
*owner = msg->tsigname;
return (msg->tsig);
}
......@@ -2431,8 +2432,9 @@ dns_message_getsig0(dns_message_t *msg, dns_name_t **owner) {
*/
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(owner == NULL || *owner == NULL);
if (msg->sig0 != NULL) {
if (msg->sig0 != NULL && owner != NULL) {
/* If dns_message_getsig0 is called on a rendered message
* after the SIG(0) has been applied, we need to return the
* root name, not NULL.
......@@ -2441,12 +2443,8 @@ dns_message_getsig0(dns_message_t *msg, dns_name_t **owner) {
*owner = dns_rootname;
else
*owner = msg->sig0name;
return (msg->sig0);
}
else {
*owner = NULL;
return (NULL);
}
return (msg->sig0);
}
isc_result_t
......
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