Lines Matching refs:pathname

1340 static int pkgdir_selabel_lookup(const char *pathname,  in pkgdir_selabel_lookup()  argument
1352 if (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1)) { in pkgdir_selabel_lookup()
1353 pathname += sizeof(DATA_DATA_PREFIX) - 1; in pkgdir_selabel_lookup()
1354 } else if (!strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1)) { in pkgdir_selabel_lookup()
1355 pathname += sizeof(DATA_USER_PREFIX) - 1; in pkgdir_selabel_lookup()
1356 while (isdigit(*pathname)) in pkgdir_selabel_lookup()
1357 pathname++; in pkgdir_selabel_lookup()
1358 if (*pathname == '/') in pkgdir_selabel_lookup()
1359 pathname++; in pkgdir_selabel_lookup()
1362 } else if (!strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1)) { in pkgdir_selabel_lookup()
1363 pathname += sizeof(DATA_USER_DE_PREFIX) - 1; in pkgdir_selabel_lookup()
1364 while (isdigit(*pathname)) in pkgdir_selabel_lookup()
1365 pathname++; in pkgdir_selabel_lookup()
1366 if (*pathname == '/') in pkgdir_selabel_lookup()
1367 pathname++; in pkgdir_selabel_lookup()
1370 } else if (!fnmatch(EXPAND_USER_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME)) { in pkgdir_selabel_lookup()
1371 pathname += sizeof(EXPAND_USER_PATH); in pkgdir_selabel_lookup()
1372 while (isdigit(*pathname)) in pkgdir_selabel_lookup()
1373 pathname++; in pkgdir_selabel_lookup()
1374 if (*pathname == '/') in pkgdir_selabel_lookup()
1375 pathname++; in pkgdir_selabel_lookup()
1378 } else if (!fnmatch(EXPAND_USER_DE_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME)) { in pkgdir_selabel_lookup()
1379 pathname += sizeof(EXPAND_USER_DE_PATH); in pkgdir_selabel_lookup()
1380 while (isdigit(*pathname)) in pkgdir_selabel_lookup()
1381 pathname++; in pkgdir_selabel_lookup()
1382 if (*pathname == '/') in pkgdir_selabel_lookup()
1383 pathname++; in pkgdir_selabel_lookup()
1389 if (!(*pathname)) in pkgdir_selabel_lookup()
1392 pkgname = strdup(pathname); in pkgdir_selabel_lookup()
1398 pathname = end; in pkgdir_selabel_lookup()
1400 pathname++; in pkgdir_selabel_lookup()
1407 pkgname, pathname); in pkgdir_selabel_lookup()
1418 … info ? info->seinfo : seinfo, info ? info->name : pkgname, pathname, ctx); in pkgdir_selabel_lookup()
1446 __FUNCTION__, pathname, pkgname, info->seinfo, info->uid, strerror(errno)); in pkgdir_selabel_lookup()
1453 static int restorecon_sb(const char *pathname, const struct stat *sb, in restorecon_sb() argument
1461 if (selabel_lookup(fc_sehandle, &secontext, pathname, sb->st_mode) < 0) in restorecon_sb()
1464 if (lgetfilecon(pathname, &oldsecontext) < 0) in restorecon_sb()
1473 if (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1) || in restorecon_sb()
1474 !strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1) || in restorecon_sb()
1475 !strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1) || in restorecon_sb()
1476 !fnmatch(EXPAND_USER_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME) || in restorecon_sb()
1477 !fnmatch(EXPAND_USER_DE_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME)) { in restorecon_sb()
1478 if (pkgdir_selabel_lookup(pathname, seinfo, uid, &secontext) < 0) in restorecon_sb()
1485 … "SELinux: Relabeling %s from %s to %s.\n", pathname, oldsecontext, secontext); in restorecon_sb()
1487 if (lsetfilecon(pathname, secontext) < 0) in restorecon_sb()
1502 pathname, strerror(errno)); in restorecon_sb()
1519 static bool check_context_match_for_dir(const char *pathname, struct dir_hash_node **new_node, in check_context_match_for_dir() argument
1522 ssize_t read_size = getxattr(pathname, RESTORECON_PARTIAL_MATCH_DIGEST, in check_context_match_for_dir()
1525 bool status = selabel_hash_all_partial_matches(fc_sehandle, pathname, in check_context_match_for_dir()
1546 (*new_node)->path = strdup(pathname); in check_context_match_for_dir()
1579 char *pathname = NULL, *pathdnamer = NULL, *pathdname, *pathbname; in selinux_android_restorecon_common() local
1604 pathname = realpath(pathname_orig, NULL); in selinux_android_restorecon_common()
1605 if (!pathname) in selinux_android_restorecon_common()
1613 error = asprintf(&pathname, "/%s", pathbname); in selinux_android_restorecon_common()
1615 error = asprintf(&pathname, "%s/%s", pathdnamer, pathbname); in selinux_android_restorecon_common()
1620 paths[0] = pathname; in selinux_android_restorecon_common()
1621 issys = (!strcmp(pathname, SYS_PATH) in selinux_android_restorecon_common()
1622 || !strncmp(pathname, SYS_PREFIX, sizeof(SYS_PREFIX)-1)) ? true : false; in selinux_android_restorecon_common()
1625 if (lstat(pathname, &sb) < 0) { in selinux_android_restorecon_common()
1630 error = restorecon_sb(pathname, &sb, nochange, verbose, seinfo, uid); in selinux_android_restorecon_common()
1640 if (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1) || in selinux_android_restorecon_common()
1641 !strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1) || in selinux_android_restorecon_common()
1642 !strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1) || in selinux_android_restorecon_common()
1643 !fnmatch(EXPAND_USER_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME) || in selinux_android_restorecon_common()
1644 !fnmatch(EXPAND_USER_DE_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME)) in selinux_android_restorecon_common()
1652 if (statfs(pathname, &sfsb) == 0) { in selinux_android_restorecon_common()
1763 free(pathname); in selinux_android_restorecon_common()