示例#1
0
/*
 * Same caveats as audit_write().  In addition, this function explicitly
 * assumes success; use audit_write_failure_self() on error.
 */
int
audit_write_success_self(short event_code, token_t *tok)
{
	token_t *subject;
	char *func = "audit_write_success_self()";

	if ((subject = au_to_me()) == NULL) {
		syslog(LOG_ERR, "%s: au_to_me() failed", func);
		return (kAUMakeSubjectTokErr);
	}

	return (audit_write(event_code, subject, tok, 0, 0));
}
示例#2
0
文件: lib_wrappers.c 项目: aosm/bsm
/*
 * Same caveats as audit_write().  In addition, this function explicitly 
 * assumes success; use audit_write_failure() on error.  
 */
int 
audit_write_success(short event_code, token_t *tok, au_id_t auid, 
		    uid_t euid, gid_t egid, uid_t ruid, gid_t rgid, 
		    pid_t pid, au_asid_t sid, au_tid_t *tid)
{
    char *func = "audit_write_success()";
    token_t *subject = NULL;

    /* tokenize and save subject */
    subject = au_to_subject32(auid, euid, egid, ruid, rgid, pid, sid, tid);
    if (subject == NULL)
    {
	syslog(LOG_ERR, "%s: au_to_subject32() failed", func);
	return kAUMakeSubjectTokErr;
    }
    return audit_write(event_code, subject, tok, 0, 0);
}
示例#3
0
/*
 * Same caveats as audit_write().  In addition, this function explicitly
 * assumes failure; use audit_write_success_self() otherwise.
 *
 * XXX  This should let the caller pass an error return value rather than
 * hard-coding -1.
 */
int
audit_write_failure_self(short event_code, char *errmsg, int errret)
{
	char *func = "audit_write_failure_self()";
	token_t *subject, *errtok;

	if ((subject = au_to_me()) == NULL) {
		syslog(LOG_ERR, "%s: au_to_me() failed", func);
		return (kAUMakeSubjectTokErr);
	}
	/* tokenize and save the error message */
	if ((errtok = au_to_text(errmsg)) == NULL) {
		au_free_token(subject);
		syslog(LOG_ERR, "%s: au_to_text() failed", func);
		return (kAUMakeTextTokErr);
	}
	return (audit_write(event_code, subject, errtok, -1, errret));
}
示例#4
0
文件: lib_wrappers.c 项目: aosm/bsm
/*
 * Same caveats as audit_write().  In addition, this function explicitly 
 * assumes failure; use audit_write_success() otherwise.  
 *
 * XXX  This should let the caller pass an error return value rather than
 * hard-coding -1.  
 */
int
audit_write_failure(short event_code, char *errmsg, int errcode, 
		    au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 
		    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid)
{
    char *func = "audit_write_failure()";
    token_t *subject, *errtok;

    subject = au_to_subject32(auid, euid, egid, ruid, rgid, pid, sid, tid);
    if (subject == NULL)
    {
	syslog(LOG_ERR, "%s: au_to_subject32() failed", func);
	return kAUMakeSubjectTokErr;
    }
    /* tokenize and save the error message */
    if ((errtok = au_to_text(errmsg)) == NULL)
    {
	syslog(LOG_ERR, "%s: au_to_text() failed", func);
	return kAUMakeTextTokErr;
    }
    return audit_write(event_code, subject, errtok, -1, errcode);
}