11<?php
22use function Hestiacp \quoteshellarg \quoteshellarg ;
3+
4+ try {
5+ require_once '../inc/vendor/autoload.php ' ;
6+ } catch (Throwable $ ex ) {
7+ $ errstr = 'Unable able to load required libraries. Please run v-add-sys-phpmailer in command line. Error: ' . $ ex ->getMessage ();
8+ trigger_error ($ errstr );
9+ echo $ errstr ;
10+ exit (1 );
11+ }
12+
313//die("Error: Disabled");
414define ('HESTIA_DIR_BIN ' , '/usr/local/hestia/bin/ ' );
515define ('HESTIA_CMD ' , '/usr/bin/sudo /usr/local/hestia/bin/ ' );
@@ -71,7 +81,7 @@ function api_legacy(array $request_data) {
7181 exit ;
7282 }
7383 $ v_ip = quoteshellarg (get_real_user_ip ());
74- $ output = '' ;
84+ unset( $ output) ;
7585 exec (HESTIA_CMD ."v-get-user-salt admin " .$ v_ip ." json " , $ output , $ return_var );
7686 $ pam = json_decode (implode ('' , $ output ), true );
7787 $ salt = $ pam ['admin ' ]['SALT ' ];
@@ -84,6 +94,16 @@ function api_legacy(array $request_data) {
8494 $ hash = crypt ($ password , '$6$rounds=5000$ ' .$ salt .'$ ' );
8595 $ hash = str_replace ('$rounds=5000 ' , '' , $ hash );
8696 }
97+ if ($ method == 'yescrypt ' ) {
98+ $ v_password = tempnam ("/tmp " , "vst " );
99+ $ fp = fopen ($ v_password , "w " );
100+ fwrite ($ fp , $ password ."\n" );
101+ fclose ($ fp );
102+ unset($ output );
103+ exec (HESTIA_CMD . 'v-check-user-password "admin" ' . $ password . ' ' .$ v_ip .' yes ' , $ output , $ return_var );
104+ $ hash = $ output [0 ];
105+ unset($ output );
106+ }
87107 if ($ method == 'des ' ) {
88108 $ hash = crypt ($ password , $ salt );
89109 }
0 commit comments