Changeset View
Changeset View
Standalone View
Standalone View
head/sys/security/audit/audit_bsm_klib.c
Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | audit_canon_path_vp(struct thread *td, struct vnode *rdir, struct vnode *cdir, | ||||
char *rbuf, *fbuf, *copy; | char *rbuf, *fbuf, *copy; | ||||
struct sbuf sbf; | struct sbuf sbf; | ||||
int error; | int error; | ||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", | WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", | ||||
__func__, __FILE__, __LINE__); | __func__, __FILE__, __LINE__); | ||||
copy = path; | copy = path; | ||||
if (*path == '/') | if (*path == '/') { | ||||
vp = rdir; | vp = rdir; | ||||
else | } else { | ||||
if (cdir == NULL) { | |||||
cpath[0] = '\0'; | |||||
return; | |||||
} | |||||
vp = cdir; | vp = cdir; | ||||
} | |||||
MPASS(vp != NULL); | MPASS(vp != NULL); | ||||
/* | /* | ||||
* NB: We require that the supplied array be at least MAXPATHLEN bytes | * NB: We require that the supplied array be at least MAXPATHLEN bytes | ||||
* long. If this is not the case, then we can run into serious trouble. | * long. If this is not the case, then we can run into serious trouble. | ||||
*/ | */ | ||||
(void) sbuf_new(&sbf, cpath, MAXPATHLEN, SBUF_FIXEDLEN); | (void) sbuf_new(&sbf, cpath, MAXPATHLEN, SBUF_FIXEDLEN); | ||||
/* | /* | ||||
* Strip leading forward slashes. | * Strip leading forward slashes. | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |