1*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 2*7c478bd9Sstevel@tonic-gate /* 3*7c478bd9Sstevel@tonic-gate * src/lib/krb5/asn.1/asn1_misc.c 4*7c478bd9Sstevel@tonic-gate * 5*7c478bd9Sstevel@tonic-gate * Copyright 1994 by the Massachusetts Institute of Technology. 6*7c478bd9Sstevel@tonic-gate * All Rights Reserved. 7*7c478bd9Sstevel@tonic-gate * 8*7c478bd9Sstevel@tonic-gate * Export of this software from the United States of America may 9*7c478bd9Sstevel@tonic-gate * require a specific license from the United States Government. 10*7c478bd9Sstevel@tonic-gate * It is the responsibility of any person or organization contemplating 11*7c478bd9Sstevel@tonic-gate * export to obtain such a license before exporting. 12*7c478bd9Sstevel@tonic-gate * 13*7c478bd9Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 14*7c478bd9Sstevel@tonic-gate * distribute this software and its documentation for any purpose and 15*7c478bd9Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright 16*7c478bd9Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and 17*7c478bd9Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that 18*7c478bd9Sstevel@tonic-gate * the name of M.I.T. not be used in advertising or publicity pertaining 19*7c478bd9Sstevel@tonic-gate * to distribution of the software without specific, written prior 20*7c478bd9Sstevel@tonic-gate * permission. M.I.T. makes no representations about the suitability of 21*7c478bd9Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express 22*7c478bd9Sstevel@tonic-gate * or implied warranty. 23*7c478bd9Sstevel@tonic-gate */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate #include "asn1_misc.h" 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate asn1_error_code asn1_krb5_realm_copy(target, source) 28*7c478bd9Sstevel@tonic-gate krb5_principal target; 29*7c478bd9Sstevel@tonic-gate krb5_principal source; 30*7c478bd9Sstevel@tonic-gate { 31*7c478bd9Sstevel@tonic-gate target->realm.length = source->realm.length; 32*7c478bd9Sstevel@tonic-gate target->realm.data = (char*)malloc(target->realm.length); /* copy realm */ 33*7c478bd9Sstevel@tonic-gate if (target->realm.data == NULL) return ENOMEM; 34*7c478bd9Sstevel@tonic-gate memcpy(target->realm.data,source->realm.data, /* to client */ 35*7c478bd9Sstevel@tonic-gate target->realm.length); 36*7c478bd9Sstevel@tonic-gate return 0; 37*7c478bd9Sstevel@tonic-gate } 38