one-sha1.patch
| one-1.5.0/include/User.h 2010-02-17 16:44:56.000000000 +0100 | ||
|---|---|---|
| 149 | 149 |
**/ |
| 150 | 150 |
static int split_secret(const string secret, string& user, string& pass); |
| 151 | 151 | |
| 152 |
/** |
|
| 153 |
* "Encrypts" the password with SHA1 digest |
|
| 154 |
* @param password |
|
| 155 |
* @return sha1 encrypted password |
|
| 156 |
*/ |
|
| 157 |
static string sha1_digest(const string& pass); |
|
| 158 | 152 | |
| 159 | 153 |
private: |
| 160 | 154 |
// ------------------------------------------------------------------------- |
| one-1.5.0/src/client/ruby/oneuser 2010-02-17 16:26:03.000000000 +0100 | ||
|---|---|---|
| 128 | 128 |
* list (Lists all the users in the pool) |
| 129 | 129 |
oneuser list |
| 130 | 130 | |
| 131 |
* gensha1 (Generates SHA1 string) |
|
| 132 |
oneuser gensha1 password |
|
| 133 | ||
| 131 | 134 |
EOT |
| 132 | 135 | |
| 133 | 136 |
def text_commands |
| ... | ... | |
| 205 | 208 |
userpool.info |
| 206 | 209 |
puts userpool.to_xml |
| 207 | 210 |
end |
| 211 | ||
| 212 |
when "gensha1" |
|
| 213 |
check_parameters("gensha1", 1)
|
|
| 214 |
sha_password = Digest::SHA1.hexdigest(ARGV[0]) |
|
| 215 |
puts sha_password |
|
| 208 | 216 |
|
| 209 | 217 |
else |
| 210 | 218 |
oneup_opts.print_help |
| one-1.5.0/src/cloud/ec2/lib/EC2QueryClient.rb 2010-02-17 16:43:59.000000000 +0100 | ||
|---|---|---|
| 56 | 56 |
end |
| 57 | 57 |
|
| 58 | 58 |
@access_key_id = ec2auth[0] |
| 59 |
@access_key_secret = Digest::SHA1.hexdigest(ec2auth[1])
|
|
| 59 |
@access_key_secret = ec2auth[1]
|
|
| 60 | 60 |
|
| 61 | 61 |
# Server location |
| 62 | 62 |
|
| one-1.5.0/src/cloud/occi/lib/OCCIClient.rb 2010-02-17 16:46:58.000000000 +0100 | ||
|---|---|---|
| 57 | 57 |
raise "No authorization data present" |
| 58 | 58 |
end |
| 59 | 59 |
|
| 60 |
@occiauth[1] = Digest::SHA1.hexdigest(@occiauth[1]) |
|
| 61 | 60 |
end |
| 62 | 61 |
|
| 63 | 62 |
################################# |
| one-1.5.0/src/oca/ruby/OpenNebula.rb 2010-02-17 16:21:59.000000000 +0100 | ||
|---|---|---|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 |
one_secret=~/^(.+?):(.+)$/ |
| 83 |
@one_auth = "#{$1}:#{Digest::SHA1.hexdigest($2)}"
|
|
| 83 |
@one_auth = "#{$1}:#{$2}"
|
|
| 84 | 84 | |
| 85 | 85 |
if endpoint |
| 86 | 86 |
@one_endpoint=endpoint |
| one-1.5.0/src/scheduler/Scheduler.cc 2010-02-17 16:47:52.000000000 +0100 | ||
|---|---|---|
| 143 | 143 |
throw runtime_error("Wrong format must be <username>:<password>");
|
| 144 | 144 |
} |
| 145 | 145 | |
| 146 |
secret = one_name + ":" + User::sha1_digest(one_pass);
|
|
| 146 |
secret = one_name + ":" + one_pass;
|
|
| 147 | 147 | |
| 148 | 148 |
// ----------------------------------------------------------- |
| 149 | 149 |
// Pools |
| one-1.5.0/src/um/User.cc 2010-02-17 16:45:25.000000000 +0100 | ||
|---|---|---|
| 375 | 375 | |
| 376 | 376 |
/* -------------------------------------------------------------------------- */ |
| 377 | 377 |
/* -------------------------------------------------------------------------- */ |
| 378 | ||
| 379 |
string User::sha1_digest(const string& pass) |
|
| 380 |
{
|
|
| 381 |
EVP_MD_CTX mdctx; |
|
| 382 |
unsigned char md_value[EVP_MAX_MD_SIZE]; |
|
| 383 |
unsigned int md_len; |
|
| 384 |
ostringstream oss; |
|
| 385 |
|
|
| 386 |
EVP_MD_CTX_init(&mdctx); |
|
| 387 |
EVP_DigestInit_ex(&mdctx, EVP_sha1(), NULL); |
|
| 388 | ||
| 389 |
EVP_DigestUpdate(&mdctx, pass.c_str(), pass.length()); |
|
| 390 | ||
| 391 |
EVP_DigestFinal_ex(&mdctx,md_value,&md_len); |
|
| 392 |
EVP_MD_CTX_cleanup(&mdctx); |
|
| 393 | ||
| 394 |
for(unsigned int i = 0; i<md_len; i++) |
|
| 395 |
{
|
|
| 396 |
oss << setfill('0') << setw(2) << hex << nouppercase
|
|
| 397 |
<< (unsigned short) md_value[i]; |
|
| 398 |
} |
|
| 399 | ||
| 400 |
return oss.str(); |
|
| 401 |
} |
|
| 402 | ||
| 403 |
/* -------------------------------------------------------------------------- */ |
|
| 404 |
/* -------------------------------------------------------------------------- */ |
|
| one-1.5.0/src/um/UserPool.cc 2010-02-17 16:48:14.000000000 +0100 | ||
|---|---|---|
| 112 | 112 |
{
|
| 113 | 113 |
if (User::split_secret(one_token,one_name,one_pass) == 0) |
| 114 | 114 |
{
|
| 115 |
string sha1_pass = User::sha1_digest(one_pass); |
|
| 116 |
allocate(&one_uid, one_name, sha1_pass, true); |
|
| 115 |
allocate(&one_uid, one_name, one_pass, true); |
|
| 117 | 116 |
} |
| 118 | 117 |
else |
| 119 | 118 |
{
|