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

« back to all changes in this revision

Viewing changes to src/lib/krb5/krb/rd_req.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/rd_req.c
3
3
 *
4
 
 * Copyright 1990,1991 by the Massachusetts Institute of Technology.
 
4
 * Copyright 1990,1991, 2008 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
46
46
 */
47
47
 
48
48
krb5_error_code KRB5_CALLCONV
49
 
krb5_rd_req(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, krb5_const_principal server, krb5_keytab keytab, krb5_flags *ap_req_options, krb5_ticket **ticket)
50
 
                                  
51
 
                                     
52
 
                                 
53
 
                                        /* XXX do we really need this */
54
 
                                 
55
 
                                          
56
 
                           
 
49
krb5_rd_req(krb5_context context, krb5_auth_context *auth_context,
 
50
            const krb5_data *inbuf, krb5_const_principal server,
 
51
            krb5_keytab keytab, krb5_flags *ap_req_options,
 
52
            krb5_ticket **ticket)
57
53
{
58
54
    krb5_error_code       retval;
59
55
    krb5_ap_req         * request;
62
58
 
63
59
    if (!krb5_is_ap_req(inbuf))
64
60
        return KRB5KRB_AP_ERR_MSG_TYPE;
 
61
#ifndef LEAN_CLIENT 
65
62
    if ((retval = decode_krb5_ap_req(inbuf, &request))) {
66
63
        switch (retval) {
67
64
        case KRB5_BADMSGTYPE:
68
65
            return KRB5KRB_AP_ERR_BADVERSION; 
69
66
        default:
70
67
            return(retval);
71
 
        }
 
68
        } 
72
69
    }
 
70
#endif /* LEAN_CLIENT */
73
71
 
74
72
    /* Get an auth context if necessary. */
75
73
    new_auth_context = NULL;
79
77
        *auth_context = new_auth_context;
80
78
    }
81
79
 
82
 
    if (!server) {
83
 
        server = request->ticket->server;
84
 
    }
85
 
    /* Get an rcache if necessary. */
86
 
    if (((*auth_context)->rcache == NULL)
87
 
        && ((*auth_context)->auth_context_flags & KRB5_AUTH_CONTEXT_DO_TIME)
88
 
&& server) {
89
 
        if ((retval = krb5_get_server_rcache(context,
90
 
     krb5_princ_component(context,server,0), &(*auth_context)->rcache)))
91
 
            goto cleanup_auth_context;
92
 
    }
93
80
 
 
81
#ifndef LEAN_CLIENT 
94
82
    /* Get a keytab if necessary. */
95
83
    if (keytab == NULL) {
96
84
        if ((retval = krb5_kt_default(context, &new_keytab)))
97
85
            goto cleanup_auth_context;
98
86
        keytab = new_keytab;
99
87
    }
 
88
#endif /* LEAN_CLIENT */
100
89
 
101
90
    retval = krb5_rd_req_decoded(context, auth_context, request, server, 
102
91
                                 keytab, ap_req_options, ticket);
103
92
 
 
93
#ifndef LEAN_CLIENT 
104
94
    if (new_keytab != NULL)
105
95
        (void) krb5_kt_close(context, new_keytab);
 
96
#endif /* LEAN_CLIENT */
106
97
 
107
98
cleanup_auth_context:
108
99
    if (new_auth_context && retval) {