Ejemplo n.º 1
0
void MainWindow::mount( const volumeEntryProperties& entry )
{
	this->disableAll() ;

	if( entry.encryptedVolume() ){

		auto kd = new keyDialog( this,m_ui->tableWidget,entry ) ;

		connect( kd,SIGNAL( cancel() ),this,SLOT( enableAll() ) ) ;
		connect( kd,SIGNAL( openMountPoint( QString ) ),this,SLOT( openMountPointPath( QString ) ) ) ;

		kd->ShowUI() ;
	}else{
		auto mp = new mountPartition( this,m_ui->tableWidget ) ;

		connect( mp,SIGNAL( cancel() ),this,SLOT( enableAll() ) ) ;
		connect( mp,SIGNAL( openMountPoint( QString ) ),this,SLOT( openMountPointPath( QString ) ) ) ;

		mp->ShowUI( entry ) ;
	}
}
static void changeMarkMount(int fanotifyfd, const char* mountpoint, const unsigned int flags)
{
    const uint64_t mask = FAN_OPEN_PERM | FAN_CLOSE_WRITE;

    int dfd = openMountPoint(mountpoint);
    errno = 0;
    int ret = fanotify_mark(fanotifyfd, flags, mask, dfd, NULL);
    int error = errno;
    close(dfd);
    if (ret < 0)
    {
        PRINT(" error: " << ret<<" errno "<<error<<" strerror "<<strerror(error) << " on "<<fanotifyfd);
        exit(11);
    }
}
Ejemplo n.º 3
0
void MainWindow::autoMountVolume( volumeEntryProperties * entry )
{
	Object_raii( entry ) ;

	if( entry && entry->entryisValid() ){

		QStringList l = entry->entryList() ;

		if( entry->encryptedVolume() ){

			this->addEntryToTable( true,l ) ;
		}else{
			if( m_autoMount ){
				auto mp = new mountPartition( this,m_ui->tableWidget ) ;
				connect( mp,SIGNAL( openMountPoint( QString ) ),
					 this,SLOT( openMountPointPath( QString ) ) ) ;
				mp->AutoMount( l ) ;
			}else{
				this->addEntryToTable( false,l ) ;
			}
		}
	}
}
Ejemplo n.º 4
0
void mountPartition::pbMount()
{
	QString test_mount = m_ui->lineEdit->text() ;

	if( test_mount.contains( "/" ) ){
		if( this->isVisible() ){
			DialogMsg msg( this ) ;
			msg.ShowUIOK( tr( "ERROR" ),tr( "\"/\" character is not allowed in the mount name field" ) ) ;
			m_ui->lineEdit->setFocus() ;
		}else{
			this->deleteLater() ;
		}
		return ;
	}

	this->disableAll() ;

	QString exe = zuluMountPath ;

	QString volume = m_path ;
	volume.replace( "\"","\"\"\"" ) ;

	if( m_ui->checkBoxShareMountPoint->isChecked() ){
		exe += " -M -m -d \"" + volume + "\"" ;
	}else{
		exe += " -m -d \"" + volume + "\"" ;
	}

	QString m = m_ui->lineEdit->text().replace( "\"","\"\"\"" ) ;

	exe += " -z \"" + m + "\"";

	if( !m_deviceOffSet.isEmpty() ){

		QString addr = utility::keyPath() ;
		utility::keySend( addr,m_key ) ;

		exe += " -o " + m_deviceOffSet + " -f " + addr ;
	}

	if( m_ui->checkBoxMountReadOnly->isChecked() ){
		exe += " -e -ro" ;
	}else{
		exe += " -e -rw" ;
	}

	if( !m_options.isEmpty() ){
		exe += " -Y " + m_options ;
	}

	auto s = utility::Task::run( utility::appendUserUID( exe ) ).await() ;

	if( s.success() ){

		emit openMountPoint( utility::mountPath( m_ui->lineEdit->text() ) ) ;
		this->HideUI() ;
	}else{
		if( this->isVisible() ){

			QString z = s.output() ;
			z.replace( tr( "ERROR: " ),"" ) ;

			DialogMsg m( this ) ;
			m.ShowUIOK( tr( "ERROR" ),z ) ;
			this->enableAll() ;
		}else{
			this->deleteLater() ;
		}
	}
}