Lines 31-36
Link Here
|
31 |
|
31 |
|
32 |
#include "cifs_spnego.h" |
32 |
#include "cifs_spnego.h" |
33 |
|
33 |
|
|
|
34 |
// defined in heimdal appl/dceutils/k5dce.h |
35 |
#define KRB5_TC_OPENCLOSE 0x00000001 |
36 |
|
34 |
#define CIFS_DEFAULT_KRB5_DIR "/tmp" |
37 |
#define CIFS_DEFAULT_KRB5_DIR "/tmp" |
35 |
#define CIFS_DEFAULT_KRB5_PREFIX "krb5cc_" |
38 |
#define CIFS_DEFAULT_KRB5_PREFIX "krb5cc_" |
36 |
|
39 |
|
Lines 45-58
Link Here
|
45 |
} sectype_t; |
48 |
} sectype_t; |
46 |
|
49 |
|
47 |
static inline int |
50 |
static inline int |
48 |
k5_data_equal(krb5_data d1, krb5_data d2, unsigned int length) |
51 |
k5_realm_equal(Realm d1, Realm d2) |
|
|
52 |
{ |
53 |
int len1 = length_Realm(&d1); |
54 |
int len2 = length_Realm(&d2); |
55 |
|
56 |
return (len1 == len2 && |
57 |
memcmp(d1, d2, len1) == 0); |
58 |
} |
59 |
|
60 |
static inline int |
61 |
k5_name_equal(PrincipalName d1, krb5_data d2, unsigned int length) |
49 |
{ |
62 |
{ |
50 |
if (!length) |
63 |
if (!length) |
51 |
length = d1.length; |
64 |
length = d1.name_string.len; |
52 |
|
65 |
|
53 |
return (d1.length == length && |
66 |
return (d1.name_string.len == length && |
54 |
d1.length == d2.length && |
67 |
d1.name_string.len == d2.length && |
55 |
memcmp(d1.data, d2.data, length) == 0); |
68 |
memcmp(d1.name_string.val, d2.data, length) == 0); |
56 |
|
69 |
|
57 |
} |
70 |
} |
58 |
|
71 |
|
Lines 94-102
Link Here
|
94 |
} |
107 |
} |
95 |
|
108 |
|
96 |
while (!credtime && !krb5_cc_next_cred(context, ccache, &cur, &creds)) { |
109 |
while (!credtime && !krb5_cc_next_cred(context, ccache, &cur, &creds)) { |
97 |
if (k5_data_equal(creds.server->realm, principal->realm, 0) && |
110 |
|
98 |
k5_data_equal(creds.server->data[0], tgt, tgt.length) && |
111 |
if (k5_realm_equal(creds.server->realm, principal->realm) && |
99 |
k5_data_equal(creds.server->data[1], principal->realm, 0) && |
112 |
k5_name_equal(creds.server->name, tgt, tgt.length) && |
100 |
creds.times.endtime > time(NULL)) |
113 |
creds.times.endtime > time(NULL)) |
101 |
credtime = creds.times.endtime; |
114 |
credtime = creds.times.endtime; |
102 |
krb5_free_cred_contents(context, &creds); |
115 |
krb5_free_cred_contents(context, &creds); |