diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:26 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:26 -0500 |
commit | 98870ab0a5a3f1822aee681d2997017e1c87d026 (patch) | |
tree | 4f28b9732777b114d5ef2f1647289a48e00a6fda /include/linux | |
parent | d76b0d9b2d87cfc95686e148767cbf7d0e22bdc0 (diff) |
CRED: Documentation
Document credentials and the new credentials API.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/cred.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/cred.h b/include/linux/cred.h index 8edb4d1d5427..794aab5c66e5 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Credentials management | 1 | /* Credentials management - see Documentation/credentials.txt |
2 | * | 2 | * |
3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -169,6 +169,12 @@ static inline struct cred *get_new_cred(struct cred *cred) | |||
169 | * | 169 | * |
170 | * Get a reference on the specified set of credentials. The caller must | 170 | * Get a reference on the specified set of credentials. The caller must |
171 | * release the reference. | 171 | * release the reference. |
172 | * | ||
173 | * This is used to deal with a committed set of credentials. Although the | ||
174 | * pointer is const, this will temporarily discard the const and increment the | ||
175 | * usage count. The purpose of this is to attempt to catch at compile time the | ||
176 | * accidental alteration of a set of credentials that should be considered | ||
177 | * immutable. | ||
172 | */ | 178 | */ |
173 | static inline const struct cred *get_cred(const struct cred *cred) | 179 | static inline const struct cred *get_cred(const struct cred *cred) |
174 | { | 180 | { |
@@ -181,6 +187,10 @@ static inline const struct cred *get_cred(const struct cred *cred) | |||
181 | * | 187 | * |
182 | * Release a reference to a set of credentials, deleting them when the last ref | 188 | * Release a reference to a set of credentials, deleting them when the last ref |
183 | * is released. | 189 | * is released. |
190 | * | ||
191 | * This takes a const pointer to a set of credentials because the credentials | ||
192 | * on task_struct are attached by const pointers to prevent accidental | ||
193 | * alteration of otherwise immutable credential sets. | ||
184 | */ | 194 | */ |
185 | static inline void put_cred(const struct cred *_cred) | 195 | static inline void put_cred(const struct cred *_cred) |
186 | { | 196 | { |