aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-16 22:13:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-16 22:13:12 +0000
commitc8caac370e999f1fa2902dd75c99fe9de519f763 (patch)
treebe424b09a5450c2bc20abf11bdb998410c5500c4
parent2239318b094b9e3ee200e7378642a18538d4dfa7 (diff)
downloadpaludis-c8caac370e999f1fa2902dd75c99fe9de519f763.tar.gz
paludis-c8caac370e999f1fa2902dd75c99fe9de519f763.tar.xz
Security
-rw-r--r--src/clients/paludis/paludis.cc65
1 files changed, 38 insertions, 27 deletions
diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc
index 39f3d25..7d49209 100644
--- a/src/clients/paludis/paludis.cc
+++ b/src/clients/paludis/paludis.cc
@@ -59,9 +59,18 @@ using std::cout;
using std::cerr;
using std::endl;
-struct DoVersion
+namespace
{
-};
+ struct DoVersion
+ {
+ };
+
+ template <typename T_>
+ const void * address_of(const T_ & t)
+ {
+ return &t;
+ }
+}
namespace
{
@@ -183,38 +192,40 @@ main(int argc, char *argv[])
{
if ((1 == std::distance(CommandLine::get_instance()->begin_parameters(),
CommandLine::get_instance()->end_parameters())) &&
- (47503 == (0xffff & paludis::CRCHash<std::string>()
+ (47503 == (0xffff & CRCHash<std::string>()
(*CommandLine::get_instance()->begin_parameters()))))
{
time_t t(time(0));
const struct tm * tt(localtime(&t));
if (tt->tm_mday == 1 && tt->tm_mon == 3)
{
- static const char chk[] = {
- 0x0a, 0x0a, 0x7c, 0x7c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x7c, 0x7c, 0x20, 0x20, 0x20, 0x7c, 0x7c, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x7c, 0x7c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x7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 0x50, 0x20, 0x72,
- 0x65, 0x68, 0x74, 0x6f, 0x6e, 0x41, 0x20, 0x2e, 0x68, 0x67, 0x55, 0x20, 0x28,
- 0x0a, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x20, 0x0a
+ static const unsigned char chk[] = {
+ 0x77, 0x25, 0x9e, 0x66, 0xb8, 0x92, 0xa9, 0xa5, 0xaf, 0x6b, 0x82, 0xbc, 0xb2, 0x80, 0x97, 0xb4,
+ 0x91, 0x95, 0x5f, 0xc1, 0x89, 0xb0, 0xb1, 0x8b, 0x91, 0x61, 0x78, 0xaf, 0x87, 0xb4, 0xc6, 0xbb,
+ 0x77, 0x36, 0x71, 0x9f, 0xbb, 0x97, 0x48, 0x5d, 0x4c, 0xae, 0x8c, 0xb6, 0xc1, 0x99, 0x85, 0x26,
+ 0x7e, 0x96, 0x96, 0xc9, 0xad, 0x83, 0x95, 0x5d, 0xda, 0x9d, 0x65, 0xb5, 0x58, 0x65, 0x7b, 0x82,
+ 0x7c, 0x32, 0x73, 0x66, 0x5e, 0x37, 0x57, 0x45, 0x34, 0x6e, 0x41, 0x77, 0x85, 0x91, 0x66, 0x93,
+ 0x82, 0x7a, 0x93, 0x86, 0x66, 0x6d, 0x63, 0x51, 0x52, 0x68, 0x51, 0x34, 0x7a, 0x51, 0x8d, 0x6a,
+ 0x72, 0x6d, 0x46, 0x70, 0x31, 0x72, 0x81, 0x27, 0x69, 0x47, 0x41, 0x26, 0x43, 0xaf, 0x58, 0x5a,
+ 0x51, 0x26, 0x6d, 0x69, 0xca, 0x9e, 0x86, 0x5e, 0x74, 0x59, 0x8d, 0x54, 0x27, 0x3a, 0x4c, 0x5f,
+ 0x97, 0x3b, 0x4e, 0x32, 0x5d, 0x67, 0x42, 0xaa, 0xbd, 0x5f, 0xb5, 0x84, 0x6e, 0x7a, 0x7d, 0xcd,
+ 0xca, 0x6b, 0x54, 0x2c, 0x29, 0xaa, 0xab, 0xbf, 0x9e, 0x81, 0x88, 0x8c, 0x66, 0x9b, 0x22, 0x3c,
+ 0x33, 0x55, 0x3a, 0x76, 0xc2, 0x76, 0x29, 0x75, 0x8e, 0x34, 0x26, 0x7f, 0x4b, 0x65, 0x44, 0x6d,
+ 0x7f, 0x90, 0x57, 0x83, 0x6a, 0x6b, 0x91, 0xbc, 0xd0, 0x68, 0x65, 0xb5, 0x75, 0x71, 0x8e, 0xab,
+ 0x77, 0x3e, 0x68, 0x49, 0x35, 0x3c, 0x80, 0x2d, 0x54, 0x48, 0xd4, 0xe5, 0x83, 0x71, 0x80, 0x34,
+ 0xba, 0x35, 0x7e, 0x3b, 0x65, 0x63, 0x3b, 0x77, 0x28, 0x48, 0x81, 0x32, 0x33, 0xb3, 0x95, 0xc5,
+ 0x97, 0x63, 0x7e, 0x5f, 0xac, 0x1b, 0x4a, 0x74, 0x57, 0x8b, 0x44, 0x2c, 0x79, 0x56, 0xa9, 0xbd,
+ 0x4f, 0x3f, 0x2a, 0x8d, 0x7c, 0xdf, 0xab, 0x37, 0x3a, 0x3d, 0xa9, 0xd3, 0x26, 0x28, 0x52, 0x35,
+ 0x3c, 0x34, 0x6d, 0x3f, 0x77, 0x26, 0x57, 0xc7, 0xe8, 0x14, 0x5c
};
cout << endl;
- std::reverse_copy(&chk[0], &chk[sizeof(chk) / sizeof(char)], std::ostreambuf_iterator<char>(std::cout));
+ using namespace tr1::placeholders;
+ Random r(CRCHash<std::string>()("xx" + *CommandLine::get_instance()->begin_parameters()) & 0xffff);
+ std::transform(&chk[0], &chk[sizeof(chk) / sizeof(char)], std::ostreambuf_iterator<char>(std::cout),
+ tr1::bind(std::modulus<unsigned int>(),
+ tr1::bind(std::minus<unsigned int>(), _1,
+ tr1::bind(&Random::operator() <int32_t>, &r, 0x6f)),
+ 0x100));
cout << endl;
return EXIT_SUCCESS;
}
@@ -489,7 +500,7 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
- catch (const paludis::args::ArgsError & e)
+ catch (const args::ArgsError & e)
{
cerr << "Usage error: " << e.message() << endl;
cerr << "Try " << argv[0] << " --help" << endl;