~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/lib/krb5/krb/copy_princ.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * lib/krb5/krb/copy_princ.c
3
3
 *
4
 
 * Copyright 1990 by the Massachusetts Institute of Technology.
 
4
 * Copyright 1990, 2009 by the Massachusetts Institute of Technology.
5
5
 * All Rights Reserved.
6
6
 *
7
7
 * Export of this software from the United States of America may
54
54
    }
55
55
 
56
56
    for (i = 0; i < nelems; i++) {
57
 
        unsigned int len = krb5_princ_component(context, inprinc, i)->length;
58
 
        krb5_princ_component(context, tempprinc, i)->length = len;
59
 
        if (len) {
60
 
            if (((krb5_princ_component(context, tempprinc, i)->data =
61
 
                   malloc(len)) == 0)) {
62
 
                while (--i >= 0)
63
 
                    free(krb5_princ_component(context, tempprinc, i)->data);
64
 
                free (tempprinc->data);
65
 
                free (tempprinc);
66
 
                return ENOMEM;
67
 
            }
68
 
            memcpy(krb5_princ_component(context, tempprinc, i)->data,
69
 
                   krb5_princ_component(context, inprinc, i)->data, len);
70
 
        } else
71
 
            krb5_princ_component(context, tempprinc, i)->data = 0;
 
57
        if (krb5int_copy_data_contents(context,
 
58
                                       krb5_princ_component(context, inprinc, i),
 
59
                                       krb5_princ_component(context, tempprinc, i)) != 0) {
 
60
            while (--i >= 0)
 
61
                free(krb5_princ_component(context, tempprinc, i)->data);
 
62
            free (tempprinc->data);
 
63
            free (tempprinc);
 
64
            return ENOMEM;
 
65
        }
72
66
    }
73
67
 
74
 
    tempprinc->realm.data =
75
 
        malloc((tempprinc->realm.length = inprinc->realm.length) + 1);
76
 
    if (!tempprinc->realm.data) {
 
68
    if (krb5int_copy_data_contents_add0(context, &inprinc->realm,
 
69
                                        &tempprinc->realm) != 0) {
77
70
        for (i = 0; i < nelems; i++)
78
71
            free(krb5_princ_component(context, tempprinc, i)->data);
79
72
        free(tempprinc->data);
80
73
        free(tempprinc);
81
74
        return ENOMEM;
82
75
    }
83
 
    memcpy(tempprinc->realm.data, inprinc->realm.data,
84
 
           inprinc->realm.length);
85
 
    tempprinc->realm.data[tempprinc->realm.length] = 0;
86
76
 
87
77
    *outprinc = tempprinc;
88
78
    return 0;