Beispiel #1
0
krb5_error_code KRB5_LIB_FUNCTION
krb5_copy_address(krb5_context context,
		  const krb5_address *inaddr,
		  krb5_address *outaddr)
{
    struct addr_operations *a = find_af (inaddr->addr_type);
    if(a != NULL && a->copy_addr != NULL)
	return (*a->copy_addr)(context, inaddr, outaddr);
    return copy_HostAddress(inaddr, outaddr);
}
Beispiel #2
0
int
copy_EncKrbCredPart(const EncKrbCredPart *from, EncKrbCredPart *to)
{
if(((&(to)->ticket_info)->val = calloc((&(from)->ticket_info)->len, sizeof(*(&(to)->ticket_info)->val))) == NULL && (&(from)->ticket_info)->len != 0)
return ENOMEM;
for((&(to)->ticket_info)->len = 0; (&(to)->ticket_info)->len < (&(from)->ticket_info)->len; (&(to)->ticket_info)->len++){
if(copy_KrbCredInfo(&(&(from)->ticket_info)->val[(&(to)->ticket_info)->len], &(&(to)->ticket_info)->val[(&(to)->ticket_info)->len])) return ENOMEM;
}
if((from)->nonce) {
(to)->nonce = malloc(sizeof(*(to)->nonce));
if((to)->nonce == NULL) return ENOMEM;
*((to)->nonce) = *((from)->nonce);
}else
(to)->nonce = NULL;
if((from)->timestamp) {
(to)->timestamp = malloc(sizeof(*(to)->timestamp));
if((to)->timestamp == NULL) return ENOMEM;
if(copy_KerberosTime((from)->timestamp, (to)->timestamp)) return ENOMEM;
}else
(to)->timestamp = NULL;
if((from)->usec) {
(to)->usec = malloc(sizeof(*(to)->usec));
if((to)->usec == NULL) return ENOMEM;
*((to)->usec) = *((from)->usec);
}else
(to)->usec = NULL;
if((from)->s_address) {
(to)->s_address = malloc(sizeof(*(to)->s_address));
if((to)->s_address == NULL) return ENOMEM;
if(copy_HostAddress((from)->s_address, (to)->s_address)) return ENOMEM;
}else
(to)->s_address = NULL;
if((from)->r_address) {
(to)->r_address = malloc(sizeof(*(to)->r_address));
if((to)->r_address == NULL) return ENOMEM;
if(copy_HostAddress((from)->r_address, (to)->r_address)) return ENOMEM;
}else
(to)->r_address = NULL;
return 0;
}