diff options
Diffstat (limited to 'net/dns_resolver/dns_key.c')
-rw-r--r-- | net/dns_resolver/dns_key.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c index 739435a6af39..cfa7a5e1c5c9 100644 --- a/net/dns_resolver/dns_key.c +++ b/net/dns_resolver/dns_key.c | |||
@@ -67,8 +67,9 @@ dns_resolver_instantiate(struct key *key, const void *_data, size_t datalen) | |||
67 | size_t result_len = 0; | 67 | size_t result_len = 0; |
68 | const char *data = _data, *end, *opt; | 68 | const char *data = _data, *end, *opt; |
69 | 69 | ||
70 | kenter("%%%d,%s,'%s',%zu", | 70 | kenter("%%%d,%s,'%*.*s',%zu", |
71 | key->serial, key->description, data, datalen); | 71 | key->serial, key->description, |
72 | (int)datalen, (int)datalen, data, datalen); | ||
72 | 73 | ||
73 | if (datalen <= 1 || !data || data[datalen - 1] != '\0') | 74 | if (datalen <= 1 || !data || data[datalen - 1] != '\0') |
74 | return -EINVAL; | 75 | return -EINVAL; |
@@ -217,6 +218,19 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m) | |||
217 | seq_printf(m, ": %u", key->datalen); | 218 | seq_printf(m, ": %u", key->datalen); |
218 | } | 219 | } |
219 | 220 | ||
221 | /* | ||
222 | * read the DNS data | ||
223 | * - the key's semaphore is read-locked | ||
224 | */ | ||
225 | static long dns_resolver_read(const struct key *key, | ||
226 | char __user *buffer, size_t buflen) | ||
227 | { | ||
228 | if (key->type_data.x[0]) | ||
229 | return key->type_data.x[0]; | ||
230 | |||
231 | return user_read(key, buffer, buflen); | ||
232 | } | ||
233 | |||
220 | struct key_type key_type_dns_resolver = { | 234 | struct key_type key_type_dns_resolver = { |
221 | .name = "dns_resolver", | 235 | .name = "dns_resolver", |
222 | .instantiate = dns_resolver_instantiate, | 236 | .instantiate = dns_resolver_instantiate, |
@@ -224,7 +238,7 @@ struct key_type key_type_dns_resolver = { | |||
224 | .revoke = user_revoke, | 238 | .revoke = user_revoke, |
225 | .destroy = user_destroy, | 239 | .destroy = user_destroy, |
226 | .describe = dns_resolver_describe, | 240 | .describe = dns_resolver_describe, |
227 | .read = user_read, | 241 | .read = dns_resolver_read, |
228 | }; | 242 | }; |
229 | 243 | ||
230 | static int __init init_dns_resolver(void) | 244 | static int __init init_dns_resolver(void) |