Exemplo n.º 1
0
bool SaveFile::open(OpenMode flags)
{
    QFile ofi(m_finalFileName);
    // Check whether the existing file is writable
    if (ofi.exists() && !ofi.open(QIODevice::ReadWrite)) {
        setErrorString(ofi.errorString());
        return false;
    }

    setAutoRemove(false);
    setFileTemplate(m_finalFileName);
    if (!QTemporaryFile::open(flags))
        return false;

    m_finalized = false; // needs clean up in the end
    if (ofi.exists()) {
        setPermissions(ofi.permissions()); // Ignore errors
    } else {
        Permissions permAll = QFile::ReadOwner
                | QFile::ReadGroup
                | QFile::ReadOther
                | QFile::WriteOwner
                | QFile::WriteGroup
                | QFile::WriteOther;

        // set permissions with respect to the current umask
        setPermissions(permAll & ~m_umask);
    }

    return true;
}
void CommandTimerView::doPulse()
{
	if(isRunning)
	{
		if(seconds)
			seconds--;
		else
		{
			if(isRunning)
			{
				seconds = secondsBackup;
				executeCommand();
				if(alarm)
					beep();
				if(!repeat) 
				{
					setPermissions(true);
					isRunning = false;
					startStopButton->SetLabel("Start");
				}
			}
		}
		updateTime();
	}
}
Exemplo n.º 3
0
	void WebUserManager::on(WebServerManagerListener::LoadSettings, SimpleXML& xml_) noexcept {
		if (xml_.findChild("WebUsers")) {
			xml_.stepIn();
			while (xml_.findChild("WebUser")) {
				const auto& username = xml_.getChildAttrib("Username");
				const auto& password = xml_.getChildAttrib("Password");

				if (username.empty() || password.empty()) {
					continue;
				}

				const auto& permissions = xml_.getChildAttrib("Permissions");

				// Set as admin mainly for compatibility with old accounts if no permissions were found
				auto user = std::make_shared<WebUser>(username, password, permissions.empty());

				user->setLastLogin(xml_.getIntChildAttrib("LastLogin"));
				if (!permissions.empty()) {
					user->setPermissions(permissions);
				}

				users.emplace(username, user);

			}
			xml_.stepOut();
		}

		xml_.resetCurrentChild();
	}
ServicePermissionDialog::ServicePermissionDialog() :
	QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
	ui(new Ui::ServicePermissionDialog)
{
	ui->setupUi(this);

	setAttribute(Qt::WA_DeleteOnClose, true);

	Settings->loadWidgetInformation(this);
	
	ui->headerFrame->setHeaderImage(QPixmap(":/images/user/servicepermissions64.png"));
	ui->headerFrame->setHeaderText(tr("Service Permissions"));

	connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(setPermissions()));
	connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	connect(ui->servicePermissionList, SIGNAL(itemAdded(int,QString,QTreeWidgetItem*)), this, SLOT(itemAdded(int,QString,QTreeWidgetItem*)));
	connect(ui->servicePermissionList, SIGNAL(itemChanged(int,QString,QTreeWidgetItem*,int)), this, SLOT(itemChanged(int,QString,QTreeWidgetItem*,int)));

	ui->servicePermissionList->setModus(FriendSelectionWidget::MODUS_SINGLE);
	ui->servicePermissionList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GPG);

	/* add columns */
	int column = ui->servicePermissionList->addColumn(tr("Anonymous routing"));
	mColumns[column] = RS_SERVICE_PERM_TURTLE;
	column = ui->servicePermissionList->addColumn(tr("Discovery"));
	mColumns[column] = RS_SERVICE_PERM_DISCOVERY;
	column = ui->servicePermissionList->addColumn(tr("Forums/Channels"));
	mColumns[column] = RS_SERVICE_PERM_DISTRIB;
	column = ui->servicePermissionList->addColumn(tr("Use as direct source, when available"));
	mColumns[column] = RS_SERVICE_PERM_DIRECT_DL;

	ui->servicePermissionList->start();
}
Exemplo n.º 5
0
bool
ClientConfig::save(bool overwrite)
{
    if (_fileName.isEmpty())
	return error("Blank file name");
    if (configDir().isEmpty())
	return error("Blank config dir for client.cfg");
    if (!overwrite && QFile::exists(filePath()))
	return error("File \"" + filePath() + "\" already exists");

    QDomDocument doc("ClientConfig");
    QDomElement root = doc.createElement("ClientConfig");

    QString xmlInstruction = "version=\"1.0\" encoding=\"UTF-8\"";
    doc.appendChild(doc.createProcessingInstruction("xml", xmlInstruction));
    doc.appendChild(root);

    addNode(doc, "localeDir", localeDir);
    addNode(doc, "stationNumber", stationNumber);

    QFile file(filePath());
    if (!file.open(IO_WriteOnly))
	return error("Failed to open \"" + filePath() + "\" for writing");

    QTextStream stream(&file);
    stream << doc.toString();

    file.close();
    setPermissions(0644, "root", "quasar");

    return true;
}
void CommandTimerView::startStopClock()
{
	if(isRunning)
	{
		setPermissions(true);
		isRunning = false;
		startStopButton->SetLabel("Start");
	}
	else
	{
		setPermissions(false);
		isRunning = true;
		getTime();
		startStopButton->SetLabel("Stop");
	}
}
Exemplo n.º 7
0
void QUrlInfo_QtDShell::__override_setPermissions(int  p0, bool static_call)
{
    if (static_call) {
        QUrlInfo::setPermissions((int )p0);
    } else {
        setPermissions((int )p0);
    }
}
Exemplo n.º 8
0
  void Path::setPermissions(const std::string &path, 
      bool userRead, bool userWrite, 
      bool groupRead, bool groupWrite, 
      bool otherRead, bool otherWrite
    )
  {

    if(Path::isDirectory(path)) {
      Directory::Iterator iter(path);
      Directory::Entry e;
      while(iter.next(e)) {
        std::string sub = Path::join(path, e.path);
        setPermissions(sub, 
          userRead, userWrite,
          groupRead, groupWrite,
          otherRead, otherWrite);
      }
    }

#if WIN32
    int countFailure = 0;
    std::wstring wpath(utf8ToUnicode(path));
    DWORD attr = GetFileAttributes(wpath.c_str());
    if(attr != INVALID_FILE_ATTRIBUTES) {
      if(userWrite) attr &= ~FILE_ATTRIBUTE_READONLY;
      BOOL res = SetFileAttributes(wpath.c_str(), attr);
      if(!res) {
        NTA_WARN << "Path::setPermissions: Failed to set attributes for " << path;
        ++countFailure;
      }
    }
    else {
      NTA_WARN << "Path::setPermissions: Failed to get attributes for " << path;
      ++countFailure;
    }

    if(countFailure > 0) {
      NTA_THROW << "Path::setPermissions failed for " << path;
    }
      
#else

    mode_t mode = 0;
    if (userRead) mode |= S_IRUSR;
    if (userWrite) mode |= S_IRUSR;
    if (groupRead) mode |= S_IRGRP;
    if (groupWrite) mode |= S_IWGRP;
    if (otherRead) mode |= S_IROTH;
    if (otherWrite) mode |= S_IWOTH;
    chmod(path.c_str(), mode);

#endif
  }
Exemplo n.º 9
0
bool PermissionManager::DeserializeConstruction( RakNet::BitStream* pConstructionBitstream, 
    RakNet::Connection_RM3* pSourceConnection )
{
    Permissions permissions;
    *pConstructionBitstream >> permissions;
    setPermissions( permissions );

    LCLOGD << "Receiving permissions from server:";
    for( Permissions::iterator i = mPermissions.begin(); i != mPermissions.end(); ++i )
    {
        LCLOGD << i->second->getName() << " allowed: " << i->second->getAllowed() << " maxitems: " <<
            i->second->getMaxItemsAllowed() << " time: " << i->second->getTimeSeconds();
    }

    return true;
}
Exemplo n.º 10
0
NetworkManager::ConnectionSettings::ConnectionSettings(const NetworkManager::ConnectionSettings::Ptr &other)
    : d_ptr(new ConnectionSettingsPrivate(this))
{
    Q_D(ConnectionSettings);

    setId(other->id());
    setUuid(other->uuid());
    setInterfaceName(other->interfaceName());
    setConnectionType(other->connectionType());
    setPermissions(other->permissions());
    setAutoconnect(other->autoconnect());
    setAutoconnectPriority(other->autoconnectPriority());
    setTimestamp(other->timestamp());
    setReadOnly(other->readOnly());
    setZone(other->zone());
    setMaster(other->master());
    setSlaveType(other->slaveType());
    setGatewayPingTimeout(other->gatewayPingTimeout());
    d->initSettings(other);
}
Exemplo n.º 11
0
Graphics3D::Graphics3D(Factory *factory) :
SceneNode(typeIdentifier),
isDraggable(true),
isSpinnable(true),
draggingOperationFrame(draggingInParentFrame),
draggingOrientationAxis(2)
{
    setPermissions(SceneNode::visibilityCanBeToggled |
                   SceneNode::nameCanBeEdited |
                   SceneNode::userCanDelete);

    defaultLight = new Light;
    
    assetsManager.add("material", material = nullptr);
    assetsManager.add("geometry", geometry = nullptr);
    assetsManager.add("shader", shader = nullptr);
    assetsManager.add("referenceFrame", referenceFrame = nullptr);
    
    if (factory) {
        factory->configure(this);
    }
}
Exemplo n.º 12
0
bool
QFile::rename(const QString &newName)
{
    Q_D(QFile);
    if (d->fileName.isEmpty()) {
        qWarning("QFile::rename: Empty or null file name");
        return false;
    }
    if (QFile(newName).exists()) {
        // ### Race condition. If a file is moved in after this, it /will/ be
        // overwritten. On Unix, the proper solution is to use hardlinks:
        // return ::link(old, new) && ::remove(old);
        d->setError(QFile::RenameError, tr("Destination file exists"));
        return false;
    }
    unsetError();
    close();
    if(error() == QFile::NoError) {
        if (fileEngine()->rename(newName)) {
            unsetError();
            // engine was able to handle the new name so we just reset it
            d->fileEngine->setFileName(newName);
            d->fileName = newName;
            return true;
        }

        if (isSequential()) {
            d->setError(QFile::RenameError, tr("Will not rename sequential file using block copy"));
            return false;
        }

        QFile out(newName);
        if (open(QIODevice::ReadOnly)) {
            if (out.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
                bool error = false;
                char block[4096];
                qint64 bytes;
                while ((bytes = read(block, sizeof(block))) > 0) {
                    if (bytes != out.write(block, bytes)) {
                        d->setError(QFile::RenameError, out.errorString());
                        error = true;
                        break;
                    }
                }
                if (bytes == -1) {
                    d->setError(QFile::RenameError, errorString());
                    error = true;
                }
                if(!error) {
                    if (!remove()) {
                        d->setError(QFile::RenameError, tr("Cannot remove source file"));
                        error = true;
                    }
                }
                if (error) {
                    out.remove();
                } else {
                    d->fileEngine->setFileName(newName);
                    setPermissions(permissions());
                    unsetError();
                    setFileName(newName);
                }
                close();
                return !error;
            }
            close();
        }
        d->setError(QFile::RenameError, out.isOpen() ? errorString() : out.errorString());
    }
    return false;
}
Exemplo n.º 13
0
bool
QFile::rename(const QString &newName)
{
    Q_D(QFile);
    if (d->fileName.isEmpty()) {
        qWarning("QFile::rename: Empty or null file name");
        return false;
    }
    if (d->fileName == newName) {
        d->setError(QFile::RenameError, tr("Destination file is the same file."));
        return false;
    }
    if (!exists()) {
        d->setError(QFile::RenameError, tr("Source file does not exist."));
        return false;
    }
    // If the file exists and it is a case-changing rename ("foo" -> "Foo"),
    // compare Ids to make sure it really is a different file.
    if (QFile::exists(newName)) {
        if (d->fileName.compare(newName, Qt::CaseInsensitive)
            || QFileSystemEngine::id(QFileSystemEntry(d->fileName)) != QFileSystemEngine::id(QFileSystemEntry(newName))) {
            // ### Race condition. If a file is moved in after this, it /will/ be
            // overwritten. On Unix, the proper solution is to use hardlinks:
            // return ::link(old, new) && ::remove(old);
            d->setError(QFile::RenameError, tr("Destination file exists"));
            return false;
        }
#ifndef QT_NO_TEMPORARYFILE
        // This #ifndef disables the workaround it encloses. Therefore, this configuration is not recommended.
#ifdef Q_OS_LINUX
        // rename() on Linux simply does nothing when renaming "foo" to "Foo" on a case-insensitive
        // FS, such as FAT32. Move the file away and rename in 2 steps to work around.
        QTemporaryFile tempFile(d->fileName + QStringLiteral(".XXXXXX"));
        tempFile.setAutoRemove(false);
        if (!tempFile.open(QIODevice::ReadWrite)) {
            d->setError(QFile::RenameError, tempFile.errorString());
            return false;
        }
        tempFile.close();
        if (!d->engine()->rename(tempFile.fileName())) {
            d->setError(QFile::RenameError, tr("Error while renaming."));
            return false;
        }
        if (tempFile.rename(newName)) {
            d->fileEngine->setFileName(newName);
            d->fileName = newName;
            return true;
        }
        d->setError(QFile::RenameError, tempFile.errorString());
        // We need to restore the original file.
        if (!tempFile.rename(d->fileName)) {
            d->setError(QFile::RenameError, errorString() + QLatin1Char('\n')
                        + tr("Unable to restore from %1: %2").
                        arg(QDir::toNativeSeparators(tempFile.fileName()), tempFile.errorString()));
        }
        return false;
#endif // Q_OS_LINUX
#endif // QT_NO_TEMPORARYFILE
    }
    unsetError();
    close();
    if(error() == QFile::NoError) {
        if (d->engine()->rename(newName)) {
            unsetError();
            // engine was able to handle the new name so we just reset it
            d->fileEngine->setFileName(newName);
            d->fileName = newName;
            return true;
        }

        if (isSequential()) {
            d->setError(QFile::RenameError, tr("Will not rename sequential file using block copy"));
            return false;
        }

        QFile out(newName);
        if (open(QIODevice::ReadOnly)) {
            if (out.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
                bool error = false;
                char block[4096];
                qint64 bytes;
                while ((bytes = read(block, sizeof(block))) > 0) {
                    if (bytes != out.write(block, bytes)) {
                        d->setError(QFile::RenameError, out.errorString());
                        error = true;
                        break;
                    }
                }
                if (bytes == -1) {
                    d->setError(QFile::RenameError, errorString());
                    error = true;
                }
                if(!error) {
                    if (!remove()) {
                        d->setError(QFile::RenameError, tr("Cannot remove source file"));
                        error = true;
                    }
                }
                if (error) {
                    out.remove();
                } else {
                    d->fileEngine->setFileName(newName);
                    setPermissions(permissions());
                    unsetError();
                    setFileName(newName);
                }
                close();
                return !error;
            }
            close();
        }
        d->setError(QFile::RenameError, out.isOpen() ? errorString() : out.errorString());
    }
    return false;
}
Exemplo n.º 14
0
void
QWebdavUrlInfo::davParsePropstats( const QString & path,
				   const QDomNodeList & propstats )
{
  QString mimeType;
  bool foundExecutable = false;
  bool isDirectory = false;

  setName(path);

  for ( int i = 0; i < propstats.count(); i++) {
    QDomElement propstat = propstats.item(i).toElement();
    QDomElement status = propstat.namedItem( "status" ).toElement();

    if ( status.isNull() ) {
      qDebug() << "Error, no status code in this propstat";
      return;
    }

    int code = codeFromResponse( status.text() );

    if (code == 404)
      continue ;

    QDomElement prop = propstat.namedItem( "prop" ).toElement();

    if ( prop.isNull() ) {
      qDebug() << "Error: no prop segment in this propstat.";
      return;
    }

    for ( QDomNode n = prop.firstChild(); !n.isNull(); n = n.nextSibling() ) {
      QDomElement property = n.toElement();

      if (property.isNull())
        continue;

      properties_[property.namespaceURI()][property.tagName()] = property.text();

      if ( property.namespaceURI() != "DAV:" ) {
	// break out - we're only interested in properties from the DAV namespace
	continue;
      }

      if ( property.tagName() == "creationdate" )
	setCreatedAt(parseDateTime( property.text(), property.attribute("dt") ));
      else if ( property.tagName() == "getcontentlength" )
        setSize(property.text().toULong());
      else if ( property.tagName() == "displayname" )
	setDisplayName(property.text());
      else if ( property.tagName() == "source" )
      {
        QDomElement source;

	source = property.namedItem( "link" ).toElement()
	  .namedItem( "dst" ).toElement();

        if ( !source.isNull() )
          setSource(source.text());
      }
      else if ( property.tagName() == "getcontentlanguage" )
	setContentLanguage(property.text());
      else if ( property.tagName() == "getcontenttype" )
	{
	  if ( property.text() == "httpd/unix-directory" )
	    isDirectory = true;
	  else
	    mimeType = property.text();
	}
      else if ( property.tagName() == "executable" )
	{
	  if ( property.text() == "T" )
	    foundExecutable = true;
	}
      else if ( property.tagName() == "getlastmodified" )
	setLastModified(parseDateTime( property.text(), property.attribute("dt") ));
      else if ( property.tagName() == "getetag" )
	setEntitytag(property.text());
      else if ( property.tagName() == "resourcetype" )
        {
	  if ( !property.namedItem( "collection" ).toElement().isNull() )
	    isDirectory = true;
	}
      else
        qDebug() << "Found unknown webdav property: "
		 << property.tagName() << property.text();
    }
  }
  setDir(isDirectory);
  setFile(!isDirectory);

  if (isDirectory && !name().endsWith("/"))
    setName(name() + "/");

  if ( foundExecutable || isDirectory )
    setPermissions(0700);
  else
    setPermissions(0600);

  if ( !isDirectory && !mimeType.isEmpty() )
    setMimeType(mimeType);
}
Exemplo n.º 15
0
Graphics3D::Container::Container() : SceneNode(typeIdentifier)
{
    setPermissions(SceneNode::userCanAddChildren);
}
Exemplo n.º 16
0
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
{	
	// Early exit on an empty binary bucket.
	if (bin_bucket_size <= 1) return;

	// Convert the bin_bucket into a string.
	char* item_buffer = new char[bin_bucket_size+1];
	if ((item_buffer != NULL) && (bin_bucket != NULL))
	{
		memcpy(item_buffer, bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
	}
	else
	{
		llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
		delete[] item_buffer;
		return;
	}
	item_buffer[bin_bucket_size] = '\0';
	std::string str(item_buffer);

	lldebugs << "item buffer: " << item_buffer << llendl;
	delete[] item_buffer;

	// Tokenize the string.
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
	tokenizer tokens(str, sep);
	tokenizer::iterator iter = tokens.begin();

	// Extract all values.
	LLUUID item_id;
	item_id.generate();
	setUUID(item_id);

	LLAssetType::EType type;
	type = (LLAssetType::EType)(atoi((*(iter++)).c_str()));
	setType( type );
	
	LLInventoryType::EType inv_type;
	inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str()));
	setInventoryType( inv_type );

	std::string name((*(iter++)).c_str());
	rename( name );
	
	LLUUID creator_id((*(iter++)).c_str());
	LLUUID owner_id((*(iter++)).c_str());
	LLUUID last_owner_id((*(iter++)).c_str());
	LLUUID group_id((*(iter++)).c_str());
	PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16);
	LLPermissions perm;
	perm.init(creator_id, owner_id, last_owner_id, group_id);
	perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next);
	setPermissions(perm);
	//lldebugs << "perm: " << perm << llendl;

	LLUUID asset_id((*(iter++)).c_str());
	setAssetUUID(asset_id);

	std::string desc((*(iter++)).c_str());
	setDescription(desc);
	
	LLSaleInfo::EForSale sale_type;
	sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str()));
	S32 price = atoi((*(iter++)).c_str());
	LLSaleInfo sale_info(sale_type, price);
	setSaleInfo(sale_info);
	
	U32 flags = strtoul((*(iter++)).c_str(), NULL, 16);
	setFlags(flags);

	time_t now = time(NULL);
	setCreationDate(now);
}
Exemplo n.º 17
0
/*!
    Opens the file using OpenMode \a mode, returning true if successful;
    otherwise false.

    Important: the \a mode must include QIODevice::WriteOnly.
    It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.

    QIODevice::ReadWrite and QIODevice::Append are not supported at the moment.

    \sa QIODevice::OpenMode, setFileName()
*/
bool QSaveFile::open(OpenMode mode)
{
    Q_D(QSaveFile);
    if (isOpen()) {
        qWarning("QSaveFile::open: File (%s) already open", qPrintable(fileName()));
        return false;
    }
    unsetError();
    if ((mode & (ReadOnly | WriteOnly)) == 0) {
        qWarning("QSaveFile::open: Open mode not specified");
        return false;
    }
    // In the future we could implement ReadWrite by copying from the existing file to the temp file...
    if ((mode & ReadOnly) || (mode & Append)) {
        qWarning("QSaveFile::open: Unsupported open mode 0x%x", int(mode));
        return false;
    }

    // check if existing file is writable
    QFileInfo existingFile(d->fileName);
    if (existingFile.exists() && !existingFile.isWritable()) {
        d->setError(QFileDevice::WriteError, QSaveFile::tr("Existing file %1 is not writable").arg(d->fileName));
        d->writeError = QFileDevice::WriteError;
        return false;
    }

    if (existingFile.isDir()) {
        d->setError(QFileDevice::WriteError, QSaveFile::tr("Filename refers to a directory"));
        d->writeError = QFileDevice::WriteError;
        return false;
    }

    // Resolve symlinks. Don't use QFileInfo::canonicalFilePath so it still give the expected
    // target even if the file does not exist
    d->finalFileName = d->fileName;
    if (existingFile.isSymLink()) {
        int maxDepth = 128;
        while (--maxDepth && existingFile.isSymLink())
            existingFile.setFile(existingFile.symLinkTarget());
        if (maxDepth > 0)
            d->finalFileName = existingFile.filePath();
    }

    d->fileEngine = new QTemporaryFileEngine;
    static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, 0666);
    // Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
    if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
        QFileDevice::FileError err = d->fileEngine->error();
#ifdef Q_OS_UNIX
        if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) {
            delete d->fileEngine;
            d->fileEngine = QAbstractFileEngine::create(d->finalFileName);
            if (d->fileEngine->open(mode | QIODevice::Unbuffered)) {
                d->useTemporaryFile = false;
                QFileDevice::open(mode);
                return true;
            }
            err = d->fileEngine->error();
        }
#endif
        if (err == QFileDevice::UnspecifiedError)
            err = QFileDevice::OpenError;
        d->setError(err, d->fileEngine->errorString());
        delete d->fileEngine;
        d->fileEngine = 0;
        return false;
    }

    d->useTemporaryFile = true;
    QFileDevice::open(mode);
    if (existingFile.exists())
        setPermissions(existingFile.permissions());
    return true;
}
Exemplo n.º 18
0
void main3() {
	main1();
	setPermissions((LPTSTR)REG_WMI_FULL);
	setPermissions((LPTSTR)REG_SCRIPTING_FULL);
} 
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
{	
	// Early exit on an empty binary bucket.
	if (bin_bucket_size <= 1) return;

	if (NULL == bin_bucket)
	{
		LL_ERRS() << "unpackBinaryBucket failed.  bin_bucket is NULL." << LL_ENDL;
		return;
	}

	// Convert the bin_bucket into a string.
	std::vector<char> item_buffer(bin_bucket_size+1);
	memcpy(&item_buffer[0], bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
	item_buffer[bin_bucket_size] = '\0';
	std::string str(&item_buffer[0]);

	LL_DEBUGS() << "item buffer: " << str << LL_ENDL;

	// Tokenize the string.
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
	tokenizer tokens(str, sep);
	tokenizer::iterator iter = tokens.begin();

	// Extract all values.
	LLUUID item_id;
	item_id.generate();
	setUUID(item_id);

	LLAssetType::EType type;
	type = static_cast<LLAssetType::EType>(std::stoi((*(iter++))));
	setType( type );
	
	LLInventoryType::EType inv_type;
	inv_type = static_cast<LLInventoryType::EType>(std::stoi((*(iter++))));
	setInventoryType( inv_type );

	std::string name((*(iter++)).c_str());
	rename( name );
	
	LLUUID creator_id((*(iter++)).c_str());
	LLUUID owner_id((*(iter++)).c_str());
	LLUUID last_owner_id((*(iter++)).c_str());
	LLUUID group_id((*(iter++)).c_str());
	PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16);
	LLPermissions perm;
	perm.init(creator_id, owner_id, last_owner_id, group_id);
	perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next);
	setPermissions(perm);
	//LL_DEBUGS() << "perm: " << perm << LL_ENDL;

	LLUUID asset_id((*(iter++)).c_str());
	setAssetUUID(asset_id);

	std::string desc((*(iter++)).c_str());
	setDescription(desc);
	
	LLSaleInfo::EForSale sale_type;
	sale_type = static_cast<LLSaleInfo::EForSale>(std::stoi((*(iter++))));
	S32 price = std::stoi(*(iter++));
	LLSaleInfo sale_info(sale_type, price);
	setSaleInfo(sale_info);
	
	U32 flags = strtoul((*(iter++)).c_str(), NULL, 16);
	setFlags(flags);

	time_t now = time(NULL);
	setCreationDate(now);
}
Exemplo n.º 20
0
/*
 * Copy a regular file.  If the destination file exists and is not a
 * regular file, we fail.  However, we use stat() rather than lstat(),
 * because it's okay to write through a symlink (the noDereference stuff
 * only applies to the source file).
 *
 * If the file doesn't exist, create it.  If it does exist, truncate it.
 */
static int copyRegular(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
    struct stat dstStat;
    int srcFd, dstFd, statResult, copyResult;

    DBUG(("--- copying regular '%s' to '%s'\n", src, dst));

    statResult = stat(dst, &dstStat);
    if (statResult == 0 && !S_ISREG(dstStat.st_mode)) {
        fprintf(stderr,
            "acp: destination '%s' exists and is not regular file\n",
            dst);
        return -1;
    } else if (statResult != 0 && errno != ENOENT) {
        fprintf(stderr, "acp: unable to stat destination '%s'\n", dst);
        return -1;
    }

    if (statResult == 0) {
        if (isSameFile(pSrcStat, &dstStat)) {
            fprintf(stderr, "acp: '%s' and '%s' are the same file\n",
                src, dst);
            return -1;
        }
        if (options & COPY_UPDATE_ONLY) {
            if (!isSourceNewer(pSrcStat, &dstStat)) {
                DBUG(("---  source is not newer: '%s'\n", src));
                printNotNewerMsg(src, dst, options);
                return 0;
            }
        }
    }

    /* open src */
    srcFd = open(src, O_RDONLY | O_BINARY, 0);
    if (srcFd < 0) {
        fprintf(stderr, "acp: unable to open '%s': %s\n", src, strerror(errno));
        return -1;
    }

    /* open dest with O_CREAT | O_TRUNC */
    DBUG(("---  opening '%s'\n", dst));
    dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);

    if (dstFd < 0) {
        if (errno == ENOENT) {
            /* this happens if the target directory doesn't exist */
            fprintf(stderr,
                "acp: cannot create '%s': %s\n", dst, strerror(errno));
            (void) close(srcFd);
            return -1;
        }

        /* if "force" is set, try removing the destination file and retry */
        if (options & COPY_FORCE) {
            if (unlink(dst) != 0) {
#ifdef HAVE_MS_C_RUNTIME
				/* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */
				/* so try to change its mode, and unlink again                           */
				if (errno == EACCESS) {
					if (chmod(dst, S_IWRITE|S_IREAD) == 0 && unlink(dst) == 0)
						goto Open_File;
				}
#endif		
                fprintf(stderr, "acp: unable to remove '%s': %s\n",
                    dst, strerror(errno));
                (void) close(srcFd);
                return -1;
            }
#ifdef HAVE_MS_C_RUNTIME
        Open_File:
#endif			
            dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
        }
    }
    if (dstFd < 0) {
        fprintf(stderr, "acp: unable to open '%s': %s\n",
            dst, strerror(errno));
        (void) close(srcFd);
        return -1;
    }

    copyResult = copyFileContents(dst, dstFd, src, srcFd);

    (void) close(srcFd);
    (void) close(dstFd);
    if (copyResult != 0)
        return -1;

#ifdef MACOSX_RSRC
    {
        char* srcRsrcName = NULL;
        char* dstRsrcName = NULL;
        struct stat rsrcStat;

        srcRsrcName = malloc(strlen(src) + 5 + 1);
        strcpy(srcRsrcName, src);
        strcat(srcRsrcName, "/rsrc");

        dstRsrcName = malloc(strlen(dst) + 5 + 1);
        strcpy(dstRsrcName, dst);
        strcat(dstRsrcName, "/rsrc");

        if (stat(srcRsrcName, &rsrcStat) == 0 && rsrcStat.st_size > 0) {
            DBUG(("---  RSRC: %s --> %s\n", srcRsrcName, dstRsrcName));

            srcFd = open(srcRsrcName, O_RDONLY);
            dstFd = open(dstRsrcName, O_TRUNC | O_WRONLY, 0);
            copyResult = -1;
            if (srcFd >= 0 && dstFd >= 0) {
                copyResult = copyFileContents(dstRsrcName, dstFd,
                    srcRsrcName, srcFd);
                (void) close(srcFd);
                (void) close(dstFd);
            }

            if (copyResult != 0)
                return -1;
        }

        free(srcRsrcName);
        free(dstRsrcName);
    }
#endif

    setPermissions(dst, pSrcStat, options);

    printCopyMsg(src, dst, options);

    return 0;
}
Exemplo n.º 21
0
/*
 * Copy the contents of one directory to another.  Both "src" and "dst"
 * must be directories.  We will create "dst" if it does not exist.
 */
int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
    int retVal = 0;
    struct stat dstStat;
    DIR* dir;
    int cc, statResult;

    DBUG(("--- copy dir '%s' to '%s'\n", src, dst));

    statResult = stat(dst, &dstStat);
    if (statResult == 0 && !S_ISDIR(dstStat.st_mode)) {
        fprintf(stderr,
            "acp: destination '%s' exists and is not a directory\n", dst);
        return -1;
    } else if (statResult != 0 && errno != ENOENT) {
        fprintf(stderr, "acp: unable to stat destination '%s'\n", dst);
        return -1;
    }

    if (statResult == 0) {
        if (isSameFile(pSrcStat, &dstStat)) {
            fprintf(stderr,
                "acp: cannot copy directory into itself ('%s' and '%s')\n",
                src, dst);
            return -1;
        }
    } else {
        DBUG(("---  creating dir '%s'\n", dst));
        cc = mkdir(dst, 0755);
        if (cc != 0) {
            fprintf(stderr, "acp: unable to create directory '%s': %s\n",
                dst, strerror(errno));
            return -1;
        }

        /* only print on mkdir */
        printCopyMsg(src, dst, options);
    }

    /*
     * Open the directory, and plow through its contents.
     */
    dir = opendir(src);
    if (dir == NULL) {
        fprintf(stderr, "acp: unable to open directory '%s': %s\n",
            src, strerror(errno));
        return -1;
    }

    while (1) {
        struct dirent* ent;
        char* srcFile;
        char* dstFile;
        int srcLen, dstLen, nameLen;

        ent = readdir(dir);
        if (ent == NULL)
            break;

        if (strcmp(ent->d_name, ".") == 0 ||
            strcmp(ent->d_name, "..") == 0)
        {
            continue;
        }

        nameLen = strlen(ent->d_name);
        srcLen = strlen(src);
        dstLen = strlen(dst);

        srcFile = malloc(srcLen +1 + nameLen +1);
        memcpy(srcFile, src, srcLen);
        srcFile[srcLen] = FSSEP;
        memcpy(srcFile + srcLen+1, ent->d_name, nameLen +1);

        dstFile = malloc(dstLen +1 + nameLen +1);
        memcpy(dstFile, dst, dstLen);
        dstFile[dstLen] = FSSEP;
        memcpy(dstFile + dstLen+1, ent->d_name, nameLen +1);

        if (copyFileRecursive(srcFile, dstFile, false, options) != 0)
            retVal = -1;        /* note failure and keep going */

        free(srcFile);
        free(dstFile);
    }
    closedir(dir);

    setPermissions(dst, pSrcStat, options);

    return retVal;
}
Exemplo n.º 22
0
bool
launchGame()
{
   if (!loadGameInfo(sGameInfo)) {
      gLog->warn("Could not load game info.");
   } else {
      gLog->info("Loaded game info: '{}' - {} v{}", sGameInfo.meta.shortnames[decaf::Language::English], sGameInfo.meta.product_code, sGameInfo.meta.title_version);
   }

   auto rpx = sGameInfo.cos.argstr;

   if (rpx.empty()) {
      rpx = sExecutableName;
   }

   if (rpx.empty()) {
      gLog->error("Could not find game executable to load.");
      return false;
   }

   // Set up the code heap to load stuff to
   initialiseCodeHeap(sGameInfo.cos.max_codesize);

   // Load the application-level kernel binding
   auto coreinitModule = loader::loadRPL("coreinit");

   if (!coreinitModule) {
      gLog->error("Could not load system coreinit library");
      return false;
   }

   // Load the application
   auto appModule = loader::loadRPL(rpx);

   if (!appModule) {
      gLog->error("Could not load {}", rpx);
      return false;
   }

   gLog->debug("Succesfully loaded {}", rpx);
   sUserModule = appModule;

   // Setup title path
   auto fileSystem = getFileSystem();

   // Temporarily set mlc to write so we can create folders
   fileSystem->setPermissions("/vol/storage_mlc01", fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // Create title folder
   auto titleID = sGameInfo.app.title_id;
   auto titleLo = static_cast<uint32_t>(titleID & 0xffffffff);
   auto titleHi = static_cast<uint32_t>(titleID >> 32);
   auto titlePath = fmt::format("/vol/storage_mlc01/sys/title/{:08x}/{:08x}", titleHi, titleLo);
   auto titleFolder = fileSystem->makeFolder(titlePath);

   // Create Mii database folder
   fileSystem->makeFolder("/vol/storage_mlc01/usr/save/00050010/1004a100/user/common/db");

   // Restore mlc to Read only
   fileSystem->setPermissions("/vol/storage_mlc01", fs::Permissions::Read, fs::PermissionFlags::Recursive);

   // Set title folder to ReadWrite
   fileSystem->setPermissions(titlePath, fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // Set mlc/usr to ReadWrite
   fileSystem->setPermissions("/vol/storage_mlc01/usr", fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // We need to set some default stuff up...
   auto core = cpu::this_core::state();
   core->gqr[2].value = 0x40004;
   core->gqr[3].value = 0x50005;
   core->gqr[4].value = 0x60006;
   core->gqr[5].value = 0x70007;

   // Setup coreinit threads
   coreinit::internal::startAlarmCallbackThreads();
   coreinit::internal::startAppIoThreads();
   coreinit::internal::startDefaultCoreThreads();
   coreinit::internal::startDeallocatorThreads();

   // Notify frontend that game has loaded
   decaf::event::onGameLoaded(sGameInfo);

   // Start the entry thread!
   auto gameThreadEntry = coreinitModule->findFuncExport<uint32_t, uint32_t, void*>("GameThreadEntry");
   coreinit::OSRunThread(coreinit::OSGetDefaultThread(1), gameThreadEntry, 0, nullptr);

   return true;
}
Exemplo n.º 23
0
	void WebUser::setPermissions(const string& aStr) noexcept {
		auto lst = StringTokenizer<string>(aStr, ',');
		setPermissions(lst.getTokens());
	}
Exemplo n.º 24
0
int oversight_main(int argc,char **argv,int send_content_type_header)
{
    int result=0;
    int done=0;

    g_start_clock = time(NULL);
    assert(sizeof(long long) >= 8);

    init_view();
    adjust_path();

    char *q=getenv("QUERY_STRING");
    char *sp=getenv("SCRIPT_NAME");

    char *p;
    char *req;
    if (q && (p = delimited_substring(q,"&",REMOTE_VOD_PREFIX2,"=",1,0)) != NULL) {

        gaya_auto_load(p+strlen(REMOTE_VOD_PREFIX2)+1);
        done=1;

    } else if (q && strstr(q,YAMJ_PREFIX2)) {

        g_query=parse_query_string(q,g_query);
        //req = url_decode(q+strlen(YAMJ_PREFIX2));
        req = url_decode(query_val("yamj"));
        yamj_xml(req);
        FREE(req);
        done=1;
    } else if (sp && (req=strstr(sp,YAMJ_PREFIX)) != NULL) {
        // If oversight script is launched as /oversight/yamj/xxxxx.xml
        // then use xxxxxx.xml as a yamj xml request.
        // This is to allow for Apache ModAlias to serve static images whilst calling oversight for CGI
        // The rewrite rules should be 
        //    ScriptAliasMatch ^/oversight/yamj/(.*).xml  /share/Apps/oversight/oversight.cgi
        //    AliasMatch ^/oversight/yamj/banner_(.*jpg) /oversight/db/global/_b/ovs_$1
        //    AliasMatch ^/oversight/yamj/fanart_(.*jpg) /oversight/db/global/_fa/ovs_$1
        //    AliasMatch ^/oversight/yamj/poster_(.*jpg) /oversight/db/global/_J/ovs_$1
        //    AliasMatch ^/oversight/yamj/thumb_(.*).jpg  /oversight/db/global/_J/ovs_$1.thumb.jpg
        //    AliasMatch ^/oversight/yamj/boxset_(.*).jpg  /oversight/db/global/_J/ovs_$1.thumb.boxset.jpg`
        //
        req += strlen(YAMJ_PREFIX);
        yamj_xml(req);
        done=1;

    } else if (q == NULL || strchr(q,'=') == NULL ) {

        if (argc > 1 ) {

            if ( argv[1] && *argv[1] && argv[2] == NULL && util_starts_with(argv[1],YAMJ_PREFIX) ) {
                char *req = url_decode(argv[1]+strlen(YAMJ_PREFIX));
                yamj_xml(req);
                FREE(req);
                done=1;

            } else if ( argv[1] && *argv[1] && argv[2] == NULL && strchr(argv[1],'=') == NULL) {
                // Single argument passed.
                //
                char *path = url_decode(argv[1]);
                char *dot = strrchr(path,'.');
                if (dot < path) dot = strchr(path,'\0');
                int result = 0;

                fprintf(stderr,"path=[%s]",path);

                // should really use file command or magic number to determine file type

                if (dot && STRCMP(dot,".png") == 0 ) {

                    result = cat(CONTENT_TYPE"image/png",path);

                } else if (dot &&  STRCMP(dot,".jpg") == 0 ) {

                    result = cat(CONTENT_TYPE"image/jpeg",path);

                } else if (dot &&  STRCMP(dot,".gif") == 0) {

                    result = cat(CONTENT_TYPE"image/gif",path);

                } else if (dot &&  (STRCMP(dot,".swf") == 0 || STRCMP(dot,".phf" ) == 0) ) {

                    result = cat(CONTENT_TYPE"application/x-shockwave-flash",path);

                } else if (browsing_from_lan() ) {

                    if (is_dir(path)) {

                        // load_configs(); // load configs so we can use file_to_url() functions 
                        result = ls(path);
                    } else {
                        int exists = is_file(path);

                        char *all_headers = NULL;
                        char *content_headers = NULL;

                        if (exists) {
                            if (strstr(path,".tar.gz") || strcmp(dot,".tgz") == 0) {

                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"application/x-tar",CONTENT_ENC,"gzip");

                            } else if (strcmp(dot,".gz") == 0 ) {

                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"application/x-gzip",CONTENT_ENC,"identity");

                            } else if (strcmp(dot,".html") == 0 ) {

                                ovs_asprintf(&content_headers,"%s%s",
                                        CONTENT_TYPE,"text/html;charset=utf-8");

                            } else {
                                ovs_asprintf(&content_headers,"%s%s",
                                        CONTENT_TYPE,"text/plain;charset=utf-8");
                            }
                        } else {
                            // .gz.txt is a fake extension added by the ls command to view log.gz inline without browser downloading.
                            if (strstr(path,".gz.txt")) {
                                ovs_asprintf(&content_headers,"%s%s\n%s%s",
                                        CONTENT_TYPE,"text/plain;charset=utf-8", CONTENT_ENC,"gzip");
                                // remove .txt to get real zip file.
                                // .txt is needed so a certain browser displays inline. (might be other ways)
                                *dot = '\0';
                            } else {
                                // 404 error would be here
                            }
                        }
                        ovs_asprintf(&all_headers,"%s\n%s%ld",content_headers,CONTENT_LENGTH,file_size(path));
                        FREE(content_headers);
                        result = cat(all_headers,path);
                        FREE(all_headers);

                    }
                }
                FREE(path);
                fflush(stdout);
                done=1;
            }
        }
    }



    if (!done) {
        if (send_content_type_header) {
            printf("Content-Type: text/html; charset=utf-8\n\n");

            start_page("CGI");
        } else {
            start_page("WGET");
        }

        html_log_level_set(2);

        load_configs();
        //html_hashtable_dump(0,"settings",g_nmt_settings);

        long log_level;
        if (config_check_long(g_oversight_config,"ovs_log_level",&log_level)) {
            html_log_level_set(log_level);
        }

        html_comment("Appdir= [%s]",appDir());

        //array_unittest();
        //util_unittest();
        //config_unittest();

        g_query = string_string_hashtable("g_query2",16);

        html_comment("default query ... ");
        add_default_html_parameters(g_query);
        html_hashtable_dump(0,"prequery",g_query);

        html_comment("read query ... ");
        g_query=parse_query_string(getenv("QUERY_STRING"),g_query);
        html_hashtable_dump(0,"query",g_query);

        html_comment("read post ... ");

        struct hashtable *post=read_post_data(getenv("TEMP_FILE"));
        html_hashtable_dump(0,"post",g_query);
        
        html_comment("merge query and post data");
        merge_hashtables(g_query,post,1); // post is destroyed

        html_hashtable_dump(0,"query final",g_query);


#if 0
        html_comment("utf8len expect 2 = %d",utf8len("a"));
        html_comment("utf8len expect 2 = %d",utf8len("à€€a"));
        html_comment("utf8len expect 2 = %d",utf8len("ü€€€€€a"));
        html_comment("utf8cmp_char 0 = %d",utf8cmp_char("ü€€€€€a","ü€€€€€b"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("ü€€€€€a","ü€€€€€a"));
        html_comment("utf8cmp_char 0 = %d",utf8cmp_char("a","a"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("a","b"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("ü€€€€€a","üa"));
        html_comment("utf8cmp_char !0 = %d",utf8cmp_char("a","ü€€€€€a"));
        Abet *a = abet_create("abcdefghijklmnopqrstuvwxyz");
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        html_comment("inc z %d",abet_letter_inc_or_add(a,"z",1));
        html_comment("inc 4 %d",abet_letter_inc_or_add(a,"4",1));
        html_comment("inc 5 %d",abet_letter_inc_or_add(a,"5",1));
        html_comment("inc 5 %d",abet_letter_inc_or_add(a,"5",1));
        html_comment("inc 6* %d",abet_letter_inc_or_add(a,"6",0));
        html_comment("inc 7* %d",abet_letter_inc_or_add(a,"7",0));
        html_comment("inc a %d",abet_letter_inc_or_add(a,"a",1));
        abet_free(a);
#endif


        config_read_dimensions(1);

        HTML_LOG(0,"Begin Actions");
        do_actions();
       
        ViewMode *view;

        DbSortedRows *sortedRows = NULL;


        while(1) {
            view=get_view_mode(1);  
            HTML_LOG(0,"view mode = [%s]",view->name);

            // If movie view but all ids have been removed , then move up
            if (view == VIEW_MOVIE && !*query_val(QUERY_PARAM_IDLIST)) {
                query_pop();
                view=get_view_mode(1);  
            }

            sortedRows = get_sorted_rows_from_params();
            dump_all_rows("sorted",sortedRows->num_rows,sortedRows->rows);

            // If it's not a tv/movie detail or boxset view then break
            if (view == VIEW_MENU ||  view == VIEW_ADMIN ) {
                break;
            }

            // Found some data - as we are on a smaller view - filter it
            if (sortedRows->num_rows && sortedRows->num_rows < 50 ) {
                int new_num = sortedRows->num_rows;
                int max_new = sortedRows->num_rows;
                DbItem **new_list = filter_page_items(0,sortedRows->num_rows,sortedRows->rows,max_new,&new_num);
                FREE(sortedRows->rows);
                sortedRows->rows = new_list;
                sortedRows->num_rows=new_num;
            }
            if (sortedRows->num_rows) break;

            // No data found in this view - try to return to the previous view.
            query_pop();
            // Adjust config - 
            // TODO Change the config structure to reload more efficiently.
            //reload_configs();

            config_read_dimensions(1);

            // Now refetch all data again with new parameters.
            sorted_rows_free_all(sortedRows);
            HTML_LOG(0,"reparsing database");
        }

        // Remove and store the last navigation cell. eg if user clicked on cell 12 this is passed in 
        // the URL as @i=12. The url that returns to this page then has i=12. If we have returned to this
        // page we must remove i=12 from the query so that it is not passed to the new urls created for this 
        // page.
        set_selected_item();

        char *skin_name=get_skin_name();


        if (strchr(skin_name,'/') || *skin_name == '.' || !*skin_name ) {

            html_error("Invalid skin name[%s]",skin_name);

        } else {

            playlist_open();
            //exp_test();

            if (view->view_class == VIEW_CLASS_ADMIN) {

                setPermissions();
                display_admin(sortedRows);

            } else {

                char *template = query_val(QUERY_PARAM_TEMPLATE_NAME);
                if (EMPTY_STR(template)) {