[PATCH] selinux: rename selinux_ctxid_to_string

Rename selinux_ctxid_to_string to selinux_sid_to_string to be
consistent with other interfaces.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Stephen Smalley 2006-09-25 23:31:57 -07:00 коммит произвёл Linus Torvalds
Родитель 62bac0185a
Коммит 1a70cd40cb
5 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -70,8 +70,8 @@ int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op,
void selinux_audit_set_callback(int (*callback)(void)); void selinux_audit_set_callback(int (*callback)(void));
/** /**
* selinux_ctxid_to_string - map a security context ID to a string * selinux_sid_to_string - map a security context ID to a string
* @ctxid: security context ID to be converted. * @sid: security context ID to be converted.
* @ctx: address of context string to be returned * @ctx: address of context string to be returned
* @ctxlen: length of returned context string. * @ctxlen: length of returned context string.
* *
@ -79,7 +79,7 @@ void selinux_audit_set_callback(int (*callback)(void));
* string will be allocated internally, and the caller must call * string will be allocated internally, and the caller must call
* kfree() on it after use. * kfree() on it after use.
*/ */
int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen); int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
/** /**
* selinux_get_inode_sid - get the inode's security context ID * selinux_get_inode_sid - get the inode's security context ID
@ -156,7 +156,7 @@ static inline void selinux_audit_set_callback(int (*callback)(void))
return; return;
} }
static inline int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen) static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
{ {
*ctx = NULL; *ctx = NULL;
*ctxlen = 0; *ctxlen = 0;

Просмотреть файл

@ -244,7 +244,7 @@ static int audit_set_rate_limit(int limit, uid_t loginuid, u32 sid)
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
int rc; int rc;
if ((rc = selinux_ctxid_to_string(sid, &ctx, &len))) if ((rc = selinux_sid_to_string(sid, &ctx, &len)))
return rc; return rc;
else else
audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE, audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
@ -267,7 +267,7 @@ static int audit_set_backlog_limit(int limit, uid_t loginuid, u32 sid)
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
int rc; int rc;
if ((rc = selinux_ctxid_to_string(sid, &ctx, &len))) if ((rc = selinux_sid_to_string(sid, &ctx, &len)))
return rc; return rc;
else else
audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE, audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
@ -293,7 +293,7 @@ static int audit_set_enabled(int state, uid_t loginuid, u32 sid)
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
int rc; int rc;
if ((rc = selinux_ctxid_to_string(sid, &ctx, &len))) if ((rc = selinux_sid_to_string(sid, &ctx, &len)))
return rc; return rc;
else else
audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE, audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
@ -321,7 +321,7 @@ static int audit_set_failure(int state, uid_t loginuid, u32 sid)
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
int rc; int rc;
if ((rc = selinux_ctxid_to_string(sid, &ctx, &len))) if ((rc = selinux_sid_to_string(sid, &ctx, &len)))
return rc; return rc;
else else
audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE, audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
@ -538,7 +538,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
if (status_get->mask & AUDIT_STATUS_PID) { if (status_get->mask & AUDIT_STATUS_PID) {
int old = audit_pid; int old = audit_pid;
if (sid) { if (sid) {
if ((err = selinux_ctxid_to_string( if ((err = selinux_sid_to_string(
sid, &ctx, &len))) sid, &ctx, &len)))
return err; return err;
else else
@ -576,7 +576,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
"user pid=%d uid=%u auid=%u", "user pid=%d uid=%u auid=%u",
pid, uid, loginuid); pid, uid, loginuid);
if (sid) { if (sid) {
if (selinux_ctxid_to_string( if (selinux_sid_to_string(
sid, &ctx, &len)) { sid, &ctx, &len)) {
audit_log_format(ab, audit_log_format(ab,
" ssid=%u", sid); " ssid=%u", sid);
@ -614,7 +614,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
loginuid, sid); loginuid, sid);
break; break;
case AUDIT_SIGNAL_INFO: case AUDIT_SIGNAL_INFO:
err = selinux_ctxid_to_string(audit_sig_sid, &ctx, &len); err = selinux_sid_to_string(audit_sig_sid, &ctx, &len);
if (err) if (err)
return err; return err;
sig_data = kmalloc(sizeof(*sig_data) + len, GFP_KERNEL); sig_data = kmalloc(sizeof(*sig_data) + len, GFP_KERNEL);

Просмотреть файл

@ -1398,7 +1398,7 @@ static void audit_log_rule_change(uid_t loginuid, u32 sid, char *action,
if (sid) { if (sid) {
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
if (selinux_ctxid_to_string(sid, &ctx, &len)) if (selinux_sid_to_string(sid, &ctx, &len))
audit_log_format(ab, " ssid=%u", sid); audit_log_format(ab, " ssid=%u", sid);
else else
audit_log_format(ab, " subj=%s", ctx); audit_log_format(ab, " subj=%s", ctx);

Просмотреть файл

@ -898,7 +898,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
if (axi->osid != 0) { if (axi->osid != 0) {
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
if (selinux_ctxid_to_string( if (selinux_sid_to_string(
axi->osid, &ctx, &len)) { axi->osid, &ctx, &len)) {
audit_log_format(ab, " osid=%u", audit_log_format(ab, " osid=%u",
axi->osid); axi->osid);
@ -1005,7 +1005,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
if (n->osid != 0) { if (n->osid != 0) {
char *ctx = NULL; char *ctx = NULL;
u32 len; u32 len;
if (selinux_ctxid_to_string( if (selinux_sid_to_string(
n->osid, &ctx, &len)) { n->osid, &ctx, &len)) {
audit_log_format(ab, " osid=%u", n->osid); audit_log_format(ab, " osid=%u", n->osid);
call_panic = 2; call_panic = 2;

Просмотреть файл

@ -21,10 +21,10 @@
#include "security.h" #include "security.h"
#include "objsec.h" #include "objsec.h"
int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen) int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
{ {
if (selinux_enabled) if (selinux_enabled)
return security_sid_to_context(ctxid, ctx, ctxlen); return security_sid_to_context(sid, ctx, ctxlen);
else { else {
*ctx = NULL; *ctx = NULL;
*ctxlen = 0; *ctxlen = 0;