Exemple #1
0
void Alcatraz::rmdir_entry()
{
    CString arg0(getArgRep(0)) ;
    pid_t pid = mp->pid() ;
    ArchDep *arch = mp->getArch() ;

    char normpath[PATH_MAX], buf[PATH_MAX] ;

    normalizePath(arg0.get().c_str(), normpath) ;
    int maptype = translatePath(normpath, buf, false, tempname);
    switch(maptype) {
    case PATH_NOTALLOWED:
	arch->abortCall(pid, -1, ENOENT);
	break ;
    case PATH_DELETED:{
	arch->abortCall(pid, -1, ENOENT);
	break ;
    }		   
    case PATH_CREATED: 
    case PATH_MODIFIED:{
	int retval = rmdir(buf) ;
	if (0 == retval) {
	    mt.delMapping(tempname) ;
	    arch->abortCall(pid, 0, 0) ;
#ifdef INSTALL_SHIELD
	    pid_t ppid = mp->ppid() ;
	    mod_log("D", normpath, "N/A", "DE", pid, ppid) ;
#endif
	} else {
	    arch->abortCall(pid, -1, errno) ;
	}
	break ;
    }
    case PATH_NEW:{
	int retval = rmdir_failure(buf) ;
	if (retval != 0) {
	    arch->abortCall(pid, -1, retval) ;
	} else {
	    mt.newDelete(TYPE_DIRECTORY, buf) ;
	    arch->abortCall(pid, 0, 0) ;
#ifdef INSTALL_SHIELD
	    pid_t ppid = mp->ppid() ;
	    mod_log("D", buf, "N/A", "DE", pid, ppid) ;
#endif
	}
	break ;
    }
    default:
	break; 
    }

}
Exemple #2
0
void Alcatraz::unlink_exit()
{
    if (state != -1 && mp->currentRC() == 0) {
	switch (state) {
	case 0:
	    mt.delMapping(tempname) ;
	    break ;
	case 1:
	    mt.delMapping(tempname) ;
	    mt.newDelete(TYPE_FILE, tempname) ;
	    break ;
	default:
	    break ;
	}
    }
}
Exemple #3
0
void Alcatraz::unlink_entry()
{
    CString arg0(getArgRep(0)) ;
    pid_t pid = mp->pid() ;
    ArchDep *arch = mp->getArch() ;

    state = -1 ;

    char normpath[PATH_MAX], buf[PATH_MAX];

    if (strlen(arg0.get().c_str()) == 0)
	arch->abortCall(pid, 0, 0) ;

    normalizePath(arg0.get().c_str(), normpath) ;
    int maptype = translatePath(normpath, buf, false, tempname);
    switch (maptype) {
    case PATH_NOTALLOWED:
	arch->abortCall(pid, -1, ENOENT);
	break;
    case PATH_DELETED:{
	arch->abortCall(pid, -1, ENOENT) ;
	break ;
    }		 
    case PATH_CREATED: {
	state = 0 ;
	arg0.set(buf) ;
#ifdef INSTALL_SHIELD
	pid_t ppid = mp->ppid() ;
	mod_log("F", normpath, "N/A", "DE", pid, ppid) ;
#endif
	break ;
    }
    case PATH_MODIFIED:{
	state = 1 ;
	arg0.set(buf) ;
#ifdef INSTALL_SHIELD
	pid_t ppid = mp->ppid() ;
	mod_log("F", normpath, "N/A", "DE", pid, ppid) ;
#endif
	break ;
    }
    case PATH_NEW:{
	int retval ;
	retval = unlink_failure(buf) ;
	if (retval != 0) {
	    arch->abortCall(pid, -1, retval) ;
	} 
	else {
	    mt.newDelete(TYPE_FILE, buf) ;
	    arch->abortCall(pid, 0, 0) ;
#ifdef INSTALL_SHIELD
	    pid_t ppid = mp->ppid() ;
	    mod_log("F", buf, "N/A", "DE", pid, ppid) ;
#endif
	}
	break ;
    }
    default:
	break; 
    }
}