(set_address): fix bad return of pointer to automatic data
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9082 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
27
kdc/524.c
27
kdc/524.c
@@ -118,7 +118,8 @@ verify_flags (const EncTicketPart *et,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* set the `et->caddr' to the most appropriate address to use, where
|
* set the `et->caddr' to the most appropriate address to use, where
|
||||||
* `addr' is the address the request was received from. */
|
* `addr' is the address the request was received from.
|
||||||
|
*/
|
||||||
|
|
||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
set_address (EncTicketPart *et,
|
set_address (EncTicketPart *et,
|
||||||
@@ -126,29 +127,37 @@ set_address (EncTicketPart *et,
|
|||||||
const char *from)
|
const char *from)
|
||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_address v4_addr;
|
krb5_address *v4_addr;
|
||||||
|
|
||||||
ret = krb5_sockaddr2address(addr, &v4_addr);
|
v4_addr = malloc (sizeof(*v4_addr));
|
||||||
|
if (v4_addr == NULL)
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
ret = krb5_sockaddr2address(addr, v4_addr);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
|
free (v4_addr);
|
||||||
kdc_log(0, "Failed to convert address (%s)", from);
|
kdc_log(0, "Failed to convert address (%s)", from);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (et->caddr && !krb5_address_search (context, &v4_addr, et->caddr)) {
|
if (et->caddr && !krb5_address_search (context, v4_addr, et->caddr)) {
|
||||||
kdc_log(0, "Incorrect network address (%s)", from);
|
kdc_log(0, "Incorrect network address (%s)", from);
|
||||||
krb5_free_address(context, &v4_addr);
|
krb5_free_address(context, v4_addr);
|
||||||
|
free (v4_addr);
|
||||||
return KRB5KRB_AP_ERR_BADADDR;
|
return KRB5KRB_AP_ERR_BADADDR;
|
||||||
}
|
}
|
||||||
if(v4_addr.addr_type == KRB5_ADDRESS_INET) {
|
if(v4_addr->addr_type == KRB5_ADDRESS_INET) {
|
||||||
/* we need to collapse the addresses in the ticket to a
|
/* we need to collapse the addresses in the ticket to a
|
||||||
single address; best guess is to use the address the
|
single address; best guess is to use the address the
|
||||||
connection came from */
|
connection came from */
|
||||||
|
|
||||||
free_HostAddresses(et->caddr);
|
free_HostAddresses(et->caddr);
|
||||||
et->caddr->val = &v4_addr;
|
et->caddr->val = v4_addr;
|
||||||
et->caddr->len = 1;
|
et->caddr->len = 1;
|
||||||
} else
|
} else {
|
||||||
krb5_free_address(context, &v4_addr);
|
krb5_free_address(context, v4_addr);
|
||||||
|
free(v4_addr);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user