void LLTransferSourceFile::initTransfer() { std::string filename = mParams.getFilename(); std::string delimiter = gDirUtilp->getDirDelimiter(); if((filename == ".") || (filename == "..") || (filename.find(delimiter[0]) != std::string::npos)) { llwarns << "Attempting to transfer file " << filename << " with path delimiter, aborting!" << llendl; sendTransferStatus(LLTS_ERROR); return; } // Look for the file. mFP = LLFile::fopen(mParams.getFilename(), "rb"); /* Flawfinder: ignore */ if (!mFP) { sendTransferStatus(LLTS_ERROR); return; } // Get the size of the file using the hack from fseek(mFP,0,SEEK_END); mSize = ftell(mFP); fseek(mFP,0,SEEK_SET); sendTransferStatus(LLTS_OK); }
void LLTransferSourceAsset::initTransfer() { if (gAssetStorage) { // *HACK: asset transfers will only be coming from the viewer // to the simulator. This is subset of assets we allow to be // simply pulled straight from the asset system. LLUUID* tidp; if(LLAssetType::lookupIsAssetFetchByIDAllowed(mParams.getAssetType())) { tidp = new LLUUID(getID()); gAssetStorage->getAssetData( mParams.getAssetID(), mParams.getAssetType(), LLTransferSourceAsset::responderCallback, tidp, FALSE); } else { LL_WARNS() << "Attempted to request blocked asset " << mParams.getAssetID() << ":" << LLAssetType::lookupHumanReadable(mParams.getAssetType()) << LL_ENDL; sendTransferStatus(LLTS_ERROR); } } else { LL_WARNS() << "Attempted to request asset " << mParams.getAssetID() << ":" << LLAssetType::lookupHumanReadable(mParams.getAssetType()) << " without an asset system!" << LL_ENDL; sendTransferStatus(LLTS_ERROR); } }