Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from commit cdf1327 to 922455c fails: PHP Parse error: syntax error, unexpected ')' #1856

Closed
wirerydr opened this issue Aug 8, 2017 · 14 comments

Comments

@wirerydr
Copy link

wirerydr commented Aug 8, 2017

Steps to reproduce

  1. Start from a working installation of commit cdf1327
  2. Upgrade the installed code to the most-recent (at the time) commit 922455c.
  3. Run the upgrade process described at https://teampass.readthedocs.io/en/latest/install/upgrade/

Expected behaviour

Upgrade should complete, followed by successful login to an administrator account.

Actual behaviour

Upgrade reaches Step 5 - Miscellaneous screen. On this screen, the absolute path to an existing SaltKey directory is provided. Once LAUNCH is clicked, "Please Wait" is displayed with a partial swirl, which then freezes. No further output is displayed indefinitely.

Server configuration

Operating system: Fedora 26 (x86_64)

Web server: Apache 2.4.27

Database: MariaDB 10.1.25

PHP version: 7.1.7

Teampass version: cdf1327, upgrading to 922455c

Teampass configuration file:

Updated from an older Teampass or fresh install: cdf1327, upgrading to 922455c

tp.config.php

<?php
global $SETTINGS;
$SETTINGS = array
);

Client configuration

Browser: 54.0.1 (64-bit)

Operating system: Windows 10 (64-bit)

Logs

Web server error log

192.168.240.120 - - [08/Aug/2017:11:25:53 -0400] "GET /tp/install/upgrade.php HTTP/1.1" 200 14832 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:25:54 -0400] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:25:56 -0400] "POST /tp/install/upgrade_ajax.php HTTP/1.1" 200 373 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:25:58 -0400] "POST /tp/install/upgrade.php HTTP/1.1" 200 15498 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:06 -0400] "POST /tp/install/upgrade_ajax.php HTTP/1.1" 200 3208 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:06 -0400] "GET /tp/install/images/tick-circle.png HTTP/1.1" 200 724 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:10 -0400] "POST /tp/install/upgrade.php HTTP/1.1" 200 17114 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:13 -0400] "POST /tp/install/upgrade_ajax.php HTTP/1.1" 200 318 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:20 -0400] "POST /tp/install/upgrade.php HTTP/1.1" 200 13542 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:22 -0400] "GET /tp/install/images/ajax-loader.gif HTTP/1.1" 200 882 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:22 -0400] "POST /tp/install/upgrade_ajax.php HTTP/1.1" 200 274 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:24 -0400] "POST /tp/install/upgrade.php HTTP/1.1" 200 14178 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 76 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_db_original.php HTTP/1.1" 200 85 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 71 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_2.1.26.php HTTP/1.1" 200 40 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 79 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_encryption_pwd.php HTTP/1.1" 200 41 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 87 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_encryption_suggestions.php HTTP/1.1" 200 41 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 71 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_2.1.27.php HTTP/1.1" 200 40 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 80 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_pwds.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 80 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_logs.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 86 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_categories.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 86 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_custfields.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 81 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_files.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 87 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_defuse_for_files_step2.php HTTP/1.1" 200 42 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 70 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_run_final.php HTTP/1.1" 200 40 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:26 -0400] "POST /tp/install/upgrade_scripts_manager.php HTTP/1.1" 200 49 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:31 -0400] "POST /tp/install/upgrade.php HTTP/1.1" 200 13957 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:31 -0400] "GET /tp/install/images/information-white.png HTTP/1.1" 200 707 "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
192.168.240.120 - - [08/Aug/2017:11:26:34 -0400] "POST /tp/install/upgrade_ajax.php HTTP/1.1" 500 - "https://www.example.com/tp/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"
[Tue Aug 08 11:26:34.895767 2017] [php7:emerg] [pid 19892] [client 192.168.240.120:51753] PHP Parse error:  syntax error, unexpected ')', expecting '(' in /opt/teampass/teampass__20170807-922455c/includes/config/tp.config.php on line 4, referer: https://www.example.com/t
p/install/upgrade.php

Firebug log (How to?)

Insert the Firebug log here
@nilsteampassnet
Copy link
Owner

The newest commit fixes this.

@wirerydr
Copy link
Author

wirerydr commented Aug 10, 2017

I really hate to say this (I'm sure you hate hearing it even more), but with 4d23830 I'm seeing exactly the same behaviour: It freezes right after I provide a valid path to my SaltKey directory, with the same "syntax error, unexpected ')'" error. My tp.config.php is again unpopulated.

I reviewed your change in 4d23830 and verified that my upgraded code contained the $ldap_suffix change. So I believe I'm on the correct code.

To be thorough, I also tried another fresh install of 4d23830, with an empty SaltKey directory and empty database. The install completed, however after removing the install/ subdirectory I was still unable to login. If I repeated my login attempt several times it gave me the 10-second warning. The only log info emitted each time I attempted a login was this:

192.168.240.120 - - [10/Aug/2017:05:36:11 -0400] "POST /tp/sources/identify.php HTTP/1.1" 500 - "https://www.example.com/tp/index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"

My tp.config.php (for my fresh-install test) ended up being as follows:

<?php
global $SETTINGS;
$SETTINGS = array (
    'max_latest_items' => '10',
    'enable_favourites' => '1',
    'show_last_items' => '1',
    'enable_pf_feature' => '0',
    'log_connections' => '0',
    'log_accessed' => '1',
    'time_format' => 'H:i:s',
    'date_format' => 'd/m/Y',
    'duplicate_folder' => '0',
    'item_duplicate_in_same_folder' => '0',
    'duplicate_item' => '0',
    'number_of_used_pw' => '3',
    'manager_edit' => '1',
    'cpassman_dir' => '/opt/teampass/teampass-current',
    'cpassman_url' => 'https://www.example.com/tp',
    'favicon' => 'https://www.example.com/tp/favicon.ico',
    'path_to_upload_folder' => '/opt/teampass/teampass-current/upload',
    'url_to_upload_folder' => 'https://www.example.com/tp/upload',
    'path_to_files_folder' => '/opt/teampass/teampass-current/files',
    'url_to_files_folder' => 'https://www.example.com/tp/files',
    'activate_expiration' => '0',
    'pw_life_duration' => '0',
    'maintenance_mode' => '1',
    'enable_sts' => '0',
    'encryptClientServer' => '1',
    'cpassman_version' => '2.1.27',
    'ldap_mode' => '0',
    'ldap_type' => '0',
    'ldap_suffix' => '0',
    'ldap_domain_dn' => '0',
    'ldap_domain_controler' => '0',
    'ldap_user_attribute' => '0',
    'ldap_ssl' => '0',
    'ldap_tls' => '0',
    'ldap_elusers' => '0',
    'ldap_search_base' => '0',
    'richtext' => '0',
    'allow_print' => '0',
    'roles_allowed_to_print' => '0',
    'show_description' => '1',
    'anyone_can_modify' => '0',
    'anyone_can_modify_bydefault' => '0',
    'nb_bad_authentication' => '0',
    'utf8_enabled' => '1',
    'restricted_to' => '0',
    'restricted_to_roles' => '0',
    'enable_send_email_on_user_login' => '0',
    'enable_user_can_create_folders' => '0',
    'insert_manual_entry_item_history' => '0',
    'enable_kb' => '0',
    'enable_email_notification_on_item_shown' => '0',
    'enable_email_notification_on_user_pw_change' => '0',
    'custom_logo' => '',
    'custom_login_text' => '',
    'default_language' => 'english',
    'send_stats' => '0',
    'send_statistics_items' => 'stat_country;stat_users;stat_items;stat_items_shared;stat_folders;stat_folders_shared;stat_admins;stat_managers;stat_ro;stat_mysqlversion;stat_phpversion;stat_teampassversion;stat_languages;stat_kb;stat_suggestion;stat_customfields;stat_api;stat_2fa;stat_agses;stat_duo;stat_ldap;stat_syslog;stat_stricthttps;stat_fav;stat_pf;',
    'send_stats_time' => '1499765191',
    'get_tp_info' => '1',
    'send_mail_on_user_login' => '0',
    'sending_emails' => '0',
    'nb_items_by_query' => 'auto',
    'enable_delete_after_consultation' => '0',
    'enable_personal_saltkey_cookie' => '0',
    'personal_saltkey_cookie_duration' => '31',
    'email_smtp_server' => '',
    'email_smtp_auth' => '',
    'email_auth_username' => '',
    'email_auth_pwd' => '',
    'email_port' => '',
    'email_security' => '',
    'email_server_url' => '',
    'email_from' => '',
    'email_from_name' => '',
    'pwd_maximum_length' => '40',
    'google_authentication' => '0',
    'delay_item_edition' => '0',
    'allow_import' => '0',
    'proxy_ip' => '',
    'proxy_port' => '',
    'upload_maxfilesize' => '10mb',
    'upload_docext' => 'doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx',
    'upload_imagesext' => 'jpg,jpeg,gif,png',
    'upload_pkgext' => '7z,rar,tar,zip',
    'upload_otherext' => 'sql,xml',
    'upload_imageresize_options' => '1',
    'upload_imageresize_width' => '800',
    'upload_imageresize_height' => '600',
    'upload_imageresize_quality' => '90',
    'use_md5_password_as_salt' => '0',
    'ga_website_name' => 'TeamPass for ChangeMe',
    'api' => '0',
    'subfolder_rights_as_parent' => '0',
    'show_only_accessible_folders' => '0',
    'enable_suggestion' => '0',
    'otv_expiration_period' => '7',
    'default_session_expiration_time' => '60',
    'duo' => '0',
    'enable_server_password_change' => '0',
    'ldap_object_class' => '0',
    'bck_script_path' => '/opt/teampass/teampass-current/backups',
    'bck_script_filename' => 'bck_teampass',
    'syslog_enable' => '0',
    'syslog_host' => 'localhost',
    'syslog_port' => '514',
    'manager_move_item' => '0',
    'create_item_without_password' => '0',
    'otv_is_enabled' => '0',
    'agses_authentication_enabled' => '0',
    'item_extra_fields' => '0',
    'saltkey_ante_2127' => 'none',
    'migration_to_2127' => 'done',
    'files_with_defuse' => 'done',
    'timezone' => 'UTC'
);

@nilsteampassnet
Copy link
Owner

My mistake, I've confused your case with something else.

So I think I have fixed your case, so that at least this error is not any more.
But I don't understand the root cause of it.
Indeed this case happens when the script doesn't found any settings inside table "misc" which is not possible in case of an upgrade.
So I'm wondering if you have cleaned up the table misc before upgrading?

If this happens again, Can you please run next query in mysql?

SELECT COUNT(*) FROM teampass_misc WHERE type = 'admin',

nilsteampassnet added a commit that referenced this issue Aug 14, 2017
@wirerydr
Copy link
Author

I see that commit 77e75c9 has appeared. I'll test that after I've completed this response.

Regarding root-cause: I've made before-and-after screenshots of my 'teampass_misc' table, showing: 1) Contents on a working instance pre-upgrade, and 2) Contents after the upgrade freezes.

I notice one difference: after the upgrade, row ID 25 "encryptClientServer 1" exists. That row did not exist before the upgrade. I'm not sure what this value implies, but if it matters, I am running my webserver over https with a valid (LetsEncrypt) cert, not a self-signed one.

Here are the two screenshots:

Before Upgrade

teampass_misc__beforeupgrade

After Upgrade

teampass_misc__afterupgrade

@wirerydr
Copy link
Author

I did some more upgrade tests from my working cdf1327, to both 77e75c9 and the newest (as of Aug 16th) 7e0875a. Both failed with exactly the same error as was originally described in this issue.

I also tested a fresh install of the latest 7e0875a. It also failed the same way as described in my comment on Aug 10th. E.g. The installation appeared to successfully complete (although I had to manually delete the install/ directory. However I'm unable to log in. for this fresh-install test my _misc table is populated with 25 rows, and my tp.config.php file is populated with 117 lines. The only httpd log output each time I try to log in is:

192.168.240.120 - - [17/Aug/2017:00:19:38 -0400] "POST /tp/sources/identify.php HTTP/1.1" 500 - "https://www.example.com/tp/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0"

Something really weird is going on here. I'd suspect that my environment is hosed, were it not for the fact that, despite the fact I'm using https (with a valid cert) and a few symlinks here and there, everything worked fine up to cdf1327.

I'm a coder, but not a php/javascript coder, and actually not a webapp coder at all. Nevertheless I'll see if I can get Xdebug working here, and perhaps derive some better insight into what's going on.

@wirerydr
Copy link
Author

wirerydr commented Aug 17, 2017

After debugging a fresh install of your latest commit 77e75c9, I've found at least two issues:

The code refers to a file called "includes/libraries/protect/AntiXSS/AntiXss.php". However the actual filename is AntiXSS.php (note the capitalized SS). This causes identify.php (line 280) to fail its require_once(), and it appears to fail silently without any httpd logging output. This happens in more than one place:

sources/admin.queries.php:76:require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';
sources/core.php:36:    require_once '../includes/libraries/protect/AntiXSS/AntiXss.php';
sources/identify.php:280:    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';
sources/main.functions.php:1558:    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';
sources/main.functions.php:1874:    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';
sources/main.functions.php:2003:    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';
sources/main.functions.php:2052:    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/AntiXSS/AntiXss.php';

After fixing that, I hit the 2nd problem: When installing a new instance of commit 77e75c9, it looks like the first row of table _user (which presumably should contain the newly-created admin user) is not populated. Thus, identify.php (starting line 659) fails its DB::queryFirstRow( ... ). I have no idea why the row isn't populated. The error printed on the webpage (Login credentials do not correspond!) could probably be changed a bit to more clearly indicate missing (not mismatching) credentials.

Hopefully this gives you a bit more detail to go on....

@nilsteampassnet
Copy link
Owner

Thank you for the investigation and restitution.
I really appreciate this.

nilsteampassnet added a commit that referenced this issue Aug 22, 2017
In regard to #1856, fixed call to antiXSS library
@wirerydr
Copy link
Author

I did a fresh-install test on your latest commit 716c1b8. The AntiXSS.php problem looks fixed. Thank you very much.

The issue with the _user table not being populated with an initial admin user still exists. If I manually populate it with valid encrypted credentials, then I'm finally able to log in and reach the initial Settings screen - so that might be the last issue obstructing a successful fresh install.

I have suspended testing the upgrade path from cdf1327 to current until the fresh-installation scenario becomes stable.

Thanks again!

@nilsteampassnet
Copy link
Owner

This is really strange.
I did a new test of fresh install on latest commit 716c1b8 and followed instruction to install it on a fresh database.
I have the _users table that is populated.
image
Don't you have any error in the log?

@wirerydr
Copy link
Author

wirerydr commented Aug 23, 2017

I have found what I am doing to trigger the problem. Past experience has taught me that once the install is finished, the app will fail to remove the install/ folder with the following apache error:

[Wed Aug 23 15:17:51.893542 2017] [php7:notice] [pid 32122] [client 192.168.240.120:51742] PHP Fatal error:  Uncaught Error: Call to undefined function chmodRecursive() in /opt/teampass/teampass__20170822-716c1b8/sources/core.php:116\nStack trace:\n#0 /opt/teampass/teamp
ass__20170822-716c1b8/index.php(92): require_once()\n#1 {main}\n  thrown in /opt/teampass/teampass__20170822-716c1b8/sources/core.php on line 116

So, I must manually delete the folder, which isn't a big problem. However because of this I have been skipping a step. In the following screen shot, there is "Move to home page" link:

tp_install_07_thankyou

I have not been clicking this. Instead I've been flushing cache in my browser, closing it, deleting install/ manually, restarting Apache, and then opening a new browser instance and surfing to TeamPass. This is what is causing breakage.

If instead, I DO click on that link (and then delete install/, flush cache and restart) it seems my _users table gets populated with 3 rows:

tp_db_3rows

I can then log in successfully (yay!). So, it looks like that link isn't just a redirect to the main TP page. It actually does something to (at least) the _users table.

That Thank You page gives the impression that everything is done (written to file, committed to DB, etc.), and all that remains is to surf to the main TP page. Perhaps the wording of that page should be altered to warn users that they actually need to click that last link or things won't work.

Thanks very-much for your patience.

@nilsteampassnet
Copy link
Owner

Thank you for your explanations.
For your knowledge:

  • users are added during step tables creation
  • during step Finalization, a tag is added in table install.
  • this tag is then checked on home page. If it exists then folder install is removed and table install is dropped.

So in other words, during install:

  • you have to see this Thank you page because it means you have been through all previous steps of installation
  • you don't have to manually clean install folder and table

After step Tables creation, the users have been added to table
image
=>
image

After step Finlaization, the tag clear_install_folder is set to true
image

I hope the sequence is more clear. Please don't hesitate to add your comment, they are really useful.

@wirerydr
Copy link
Author

Thank you, Nils. Apparently I need to drink more coffee before I repeat older tests, because of-course you are right - I am now seeing that the _users table gets populated earlier on in the installation process. I have tried to recreate the failure I was seeing a few days ago, and I cannot. So either I didn't drink enough coffee, or my environment was messed up.

So to summarize - I can now successfully do a fresh install of latest commit 716c1b8, and afterward, I can successfully log in with my new admin user. The PHP Fatal error: Uncaught Error: Call to undefined function chmodRecursive() does still happen though - it is very repeatable. So I do still need to manually delete/move/rename the install/. However I will open a separate issue for that to make things easier for you to track.

I also still cannot upgrade from commit cdf1327 to anything newer - I still end up with an unpopulated includes/config/tp.config.php file. However I don't know if that's really a worthwhile problem anymore, since it's an upgrade from a development commit, not from a release. With your permission I'll close this issue.

Thanks again for your help and patience.

@nilsteampassnet
Copy link
Owner

You are welcome.

Nevertheless I don't understand why the script doesn't remove the install folder the first time you open the login page after upgrading. Don't you have any trace inside the Apache logs?

My tests are running on Windows computer, perhaps are you on Linux. Can you confirm your OS?

@wirerydr
Copy link
Author

Linux - Fedora 26, and Apache 2.4. I've opened #1881 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants