(_krb5_krbhost_info_move): new function
(_krb5_free_krbhst_info): expose to internal use git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16155 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -228,14 +228,37 @@ parse_hostspec(krb5_context context, struct krb5_krbhst_data *kd,
|
|||||||
return hi;
|
return hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
free_krbhst_info(krb5_krbhst_info *hi)
|
_krb5_free_krbhst_info(krb5_krbhst_info *hi)
|
||||||
{
|
{
|
||||||
if (hi->ai != NULL)
|
if (hi->ai != NULL)
|
||||||
freeaddrinfo(hi->ai);
|
freeaddrinfo(hi->ai);
|
||||||
free(hi);
|
free(hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
krb5_error_code
|
||||||
|
_krb5_krbhost_info_move(krb5_context context,
|
||||||
|
krb5_krbhst_info *from,
|
||||||
|
krb5_krbhst_info **to)
|
||||||
|
{
|
||||||
|
/* trailing NUL is included in structure */
|
||||||
|
*to = calloc(1, sizeof(**to) + strlen(from->hostname));
|
||||||
|
if(*to == NULL) {
|
||||||
|
krb5_set_error_string(context, "malloc - out of memory");
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*to)->proto = from->proto;
|
||||||
|
(*to)->port = from->port;
|
||||||
|
(*to)->def_port = from->def_port;
|
||||||
|
(*to)->ai = from->ai;
|
||||||
|
from->ai = NULL;
|
||||||
|
(*to)->next = NULL;
|
||||||
|
strcpy((*to)->hostname, from->hostname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_host_hostinfo(struct krb5_krbhst_data *kd, struct krb5_krbhst_info *host)
|
append_host_hostinfo(struct krb5_krbhst_data *kd, struct krb5_krbhst_info *host)
|
||||||
{
|
{
|
||||||
@@ -245,7 +268,7 @@ append_host_hostinfo(struct krb5_krbhst_data *kd, struct krb5_krbhst_info *host)
|
|||||||
if(h->proto == host->proto &&
|
if(h->proto == host->proto &&
|
||||||
h->port == host->port &&
|
h->port == host->port &&
|
||||||
strcmp(h->hostname, host->hostname) == 0) {
|
strcmp(h->hostname, host->hostname) == 0) {
|
||||||
free_krbhst_info(host);
|
_krb5_free_krbhst_info(host);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*kd->end = host;
|
*kd->end = host;
|
||||||
@@ -747,7 +770,7 @@ krb5_krbhst_free(krb5_context context, krb5_krbhst_handle handle)
|
|||||||
|
|
||||||
for (h = handle->hosts; h != NULL; h = next) {
|
for (h = handle->hosts; h != NULL; h = next) {
|
||||||
next = h->next;
|
next = h->next;
|
||||||
free_krbhst_info(h);
|
_krb5_free_krbhst_info(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(handle->realm);
|
free(handle->realm);
|
||||||
|
Reference in New Issue
Block a user