Thu Apr 20 16:23:23 1995 Theodore Y. Ts'o (tytso@dcl)
+ * copy_addrs.c, copy_athctr.c, copy_auth.c, copy_cksum.c,
+ copy_creds.c, copy_key.c, copy_princ.c, copy_tick.c,
+ gc_2tgt.c, gc_frm_kdc.c, gc_via_tgt.c, get_creds.c,
+ mk_req_ext.c: Unless HAVE_C_STRUCTURE_ASSIGNMENT is defined, use
+ memcpy to copy structures around, instead of using
+ structure assignments. (Which aren't guaranteed to work
+ on some broken compilers.)
+
* mk_req.c (krb5_mk_req): Use krb5_sname_to_principal() in order
to create the service principal from the service and
hostname pair. This allows for the host cannoncialization
if (!(tmpad = (krb5_address *)malloc(sizeof(*tmpad))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tmpad = *inad;
+#else
+ memcpy(tmpad, inad, sizeof(krb5_address));
+#endif
if (!(tmpad->contents = (krb5_octet *)malloc(inad->length))) {
krb5_xfree(tmpad);
return ENOMEM;
if (!(tempto = (krb5_authenticator *)malloc(sizeof(*tempto))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempto = *authfrom;
+#else
+ memcpy(tempto, authfrom, sizeof(krb5_authenticator));
+#endif
retval = krb5_copy_principal(context, authfrom->client, &tempto->client);
if (retval) {
if (!(tmpad = (krb5_authdata *)malloc(sizeof(*tmpad))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tmpad = *inad;
+#else
+ memcpy(tmpad, inad, sizeof(krb5_authdata));
+#endif
if (!(tmpad->contents = (krb5_octet *)malloc(inad->length))) {
krb5_xfree(tmpad);
return ENOMEM;
if (!(tempto = (krb5_checksum *)malloc(sizeof(*tempto))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempto = *ckfrom;
+#else
+ memcpy(tempto, ckfrom, sizeof(krb5_checksum));
+#endif
if (!(tempto->contents =
(krb5_octet *)malloc(tempto->length))) {
if (!(tempcred = (krb5_creds *)malloc(sizeof(*tempcred))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempcred = *incred; /* copy everything quickly */
+#else
+ memcpy(tempcred, incred, sizeof(krb5_creds));
+#endif
retval = krb5_copy_principal(context, incred->client, &tempcred->client);
if (retval)
goto cleanlast;
if (!(new_key = (krb5_keyblock *) malloc(sizeof(krb5_keyblock))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*new_key = *from;
+#else
+ memcpy(new_key, from, sizeof(krb5_keyblock));
+#endif
if (!(new_key->contents = (krb5_octet *)malloc(new_key->length))) {
krb5_xfree(new_key);
return(ENOMEM);
if (tempprinc == 0)
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempprinc = *inprinc; /* Copy all of the non-allocated pieces */
+#else
+ memcpy(tempprinc, inprinc, sizeof(krb5_principal_data));
+#endif
nelems = (int) krb5_princ_size(context, inprinc);
tempprinc->data = malloc(nelems * sizeof(krb5_data));
if (!(tempto = (krb5_enc_tkt_part *)malloc(sizeof(*tempto))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempto = *partfrom;
+#else
+ memcpy(tempto, partfrom, sizeof(krb5_enc_tkt_part));
+#endif
retval = krb5_copy_keyblock(context, partfrom->session,
&tempto->session);
if (retval) {
if (!(tempto = (krb5_ticket *)malloc(sizeof(*tempto))))
return ENOMEM;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*tempto = *from;
+#else
+ memcpy(tempto, from, sizeof(krb5_ticket));
+#endif
retval = krb5_copy_principal(context, from->server, &tempto->server);
if (retval) {
krb5_xfree(tempto);
goto errout;
/* Should verify that the ticket is what we asked for. */
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
(*out_cred)->times = dec_rep->enc_part2->times;
+#else
+ memcpy(&(*out_cred)->times, &dec_rep->enc_part2->times,
+ sizeof(krb5_ticket_times));
+#endif
+
(*out_cred)->ticket_flags = dec_rep->enc_part2->flags;
(*out_cred)->is_skey = TRUE;
if (dec_rep->enc_part2->caddrs)
krb5_free_cred_contents(context, &tgtq);
memset(&tgtq, 0, sizeof(tgtq));
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
tgtq.times = tgt.times;
+#else
+ memcpy(&tgtq.times, &tgt.times, sizeof(krb5_ticket_times));
+#endif
+
if (retval = krb5_copy_principal(context, tgt.client, &tgtq.client))
goto cleanup;
if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
}
(*out_cred)->keyblock.etype = dec_rep->ticket->enc_part.etype;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
(*out_cred)->times = dec_rep->enc_part2->times;
+#else
+ memcpy(&(*out_cred)->times, &dec_rep->enc_part2->times,
+ sizeof(krb5_ticket_times));
+#endif
#if 0
/* XXX probably need access to the request */
memset((char *)&mcreds, 0, sizeof(krb5_creds));
mcreds.times.endtime = in_creds->times.endtime;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
mcreds.keyblock = in_creds->keyblock;
+#else
+ memcpy(&mcreds.keyblock, &in_creds->keyblock, sizeof(krb5_keyblock));
+#endif
mcreds.authdata = in_creds->authdata;
mcreds.server = in_creds->server;
mcreds.client = in_creds->client;
if (retval = encode_krb5_ap_req(&request, &toutbuf))
goto cleanup_cksum;
+#ifdef HAVE_C_STRUCTURE_ASSIGNMENT
*outbuf = *toutbuf;
+#else
+ memcpy(outbuf, toutbuf, sizeof(krb5_data));
+#endif
+
krb5_xfree(toutbuf);
cleanup_cksum: