google-code-export / cpassman

Automatically exported from code.google.com/p/cpassman
0 stars 0 forks source link

Upgrade to 2.1.1 - Undefined index: key in upgrade_ajax.php on line 678 #236

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Nils,

I have a production teampass and another one for testing, I tried upgrade from 
2.0 to 2.1.1 on testing teampass and upgrade was a success. But trying to 
upgrade my production installation I get the following error on "Step 4":

[error] [client 5.5.5.5] PHP Notice:  Undefined index: key in 
/folder/install/upgrade_ajax.php on line 678, referer: 
http://folder/install/upgrade.php

Looking at the code, it fails when trying to encrypt some passwords in 
log_items tables. My testing environment don't have any entry to encrypt and 
because of that works fine:

mysql> SELECT COUNT(*) FROM mytestingdatabase.prefix_log_items WHERE action = 
'at_modification' AND raison LIKE 'at_pw %';
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql> 

But my production installation has some entries to encript here is where update 
fails:

mysql> SELECT COUNT(*) FROM myproductiondatabase.myprefix_log_items WHERE 
action = 'at_modification' AND raison LIKE 'at_pw %';
+----------+
| COUNT(*) |
+----------+
|       22 |
+----------+
1 row in set (0.01 sec)

Thanks in advance,

Original issue reported on code.google.com by alar...@gmail.com on 9 Jan 2012 at 11:33

GoogleCodeExporter commented 9 years ago
Hello,

Ok so the script fails on the encryption.
Can you check that in the 22 records you have if you see something empty after 
'at_pw'?

mysql> SELECT * FROM myproductiondatabase.myprefix_log_items WHERE action = 
'at_modification' AND raison LIKE 'at_pw %';

The encryption may fail if the data to encrypt is empty. 

Original comment by nils.cpa...@gmail.com on 9 Jan 2012 at 7:09

GoogleCodeExporter commented 9 years ago
Hello,

Every result has something after at_pw, example of query result it's like 
follows (I'm not pasting real data of course):

+---------+------------+---------+-----------------+------------------+
| id_item | date       | id_user | action          | raison           |
+---------+------------+---------+-----------------+------------------+
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
|    1111 | 1111111111 |       2 | at_modification | at_pw : passpass |
+---------+------------+---------+-----------------+------------------+
22 rows in set (0.02 sec)

Regards,

Original comment by alar...@gmail.com on 9 Jan 2012 at 7:29

GoogleCodeExporter commented 9 years ago
Oh I think I found the solution.
I didn't focus on the good error message.
It seems that a session variable is not identified.

So please open file upgrade_ajax.php and find line:
$text = AesCtr::encrypt(trim($reason[1]), $_SESSION['key'], 256);
Replace $_SESSION['key'] by $_SESSION['encrypt_key']

Please tell me.

Original comment by nils.cpa...@gmail.com on 10 Jan 2012 at 5:37

GoogleCodeExporter commented 9 years ago
Same problem, diferent index name:

[error] [client 5.5.5.5] PHP Notice:  Undefined index: encrypt_key in 
/folder/install/upgrade_ajax.php on line 678, referer: 
http://folder/install/upgrade.php

Sorry

Original comment by alar...@gmail.com on 10 Jan 2012 at 6:14

GoogleCodeExporter commented 9 years ago
Please use those files and tell me

Original comment by nils.cpa...@gmail.com on 10 Jan 2012 at 7:17

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Nils,

Done, this time line moves:

[error] [client 5.5.5.5] PHP Notice:  Undefined index: encrypt_key in 
/folder/install/upgrade_ajax.php on line 713, referer: 
http://folder/install/upgrade.php

Regards,

Original comment by alar...@gmail.com on 10 Jan 2012 at 7:29

GoogleCodeExporter commented 9 years ago
Rooh how stupid I am ... I've seen my silly mistake.

I've just tested ok on my test server.

Original comment by nils.cpa...@gmail.com on 10 Jan 2012 at 7:53

Attachments:

GoogleCodeExporter commented 9 years ago
I forget the 2d file

Original comment by nils.cpa...@gmail.com on 10 Jan 2012 at 7:55

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Nils,

Awesome, now it's working fine, thank you very much.

Regards,

Original comment by alar...@gmail.com on 10 Jan 2012 at 7:59

GoogleCodeExporter commented 9 years ago
Ah good news ... and very sorry for my mistake.
It was as silly that I couldn't imagine that it was that :-(

Thanks for debugging and helping ;-)

Original comment by nils.cpa...@gmail.com on 10 Jan 2012 at 9:03

GoogleCodeExporter commented 9 years ago
Hi Nils,

There is no reason to apologize I am really grateful for your dedication and 
support, this is the minimum I can do, you are really making a wonderful job, 
and I want you to know, thanks.

Regards,

Original comment by alar...@gmail.com on 10 Jan 2012 at 9:36