]> git.saurik.com Git - apt.git/blame - ftparchive/sources.cc
DropPrivs: Move the re-set uid/gid thing to the end of the function
[apt.git] / ftparchive / sources.cc
CommitLineData
ce928105
MV
1#include <string>
2#include <iostream>
3
4// for memcpy
5#include <cstring>
6
7#include <apt-pkg/error.h>
8#include <apt-pkg/gpgv.h>
9
10#include "sources.h"
11
12bool DscExtract::TakeDsc(const void *newData, unsigned long newSize)
13{
14 if(newSize > maxSize)
15 return _error->Error("DSC data is too large %lu!", newSize);
16
17 if (newSize == 0)
18 {
19 Length = 0;
20 return true;
21 }
22 memcpy(Data, newData, newSize);
23 Length = newSize;
24
25 return true;
26}
27
28bool DscExtract::Read(std::string FileName)
29{
30 FileFd F;
31 if (OpenMaybeClearSignedFile(FileName, F) == false)
32 return false;
33
34 unsigned long long const FSize = F.FileSize();
35 if(FSize > maxSize)
36 return _error->Error("DSC file '%s' is too large!",FileName.c_str());
37
38 if (F.Read(Data, FSize) == false)
39 return false;
40 Length = FSize;
41
42 IsClearSigned = (FileName != F.Name());
43
44 return true;
45}
46
47