#1  
Old 1st April 2013, 20:48
abdi abdi is offline
Senior Member
 
Join Date: Sep 2012
Posts: 118
Thanks: 0
Thanked 10 Times in 6 Posts
Default API Stats Modification

Hello Till,

After a through investigation I have noticed the following situation with the API.

The API function (say)

Code:
$domain_record = sites_web_domain_get($session_id, $domain_id)
Returns the entire record inclusive of the stats_password crypt-ed value.

That might not be a problem, however it's:

When updating any of the above returned record with say:
Code:
$domain_record['active'] = 'n';
sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record)
The finely updated record will hold a crypt-ed, crypt-ed stats_password Thus killing or resetting the stats_password set originally to some Un-Known crypt-ed characters ...

Do you see a problem there?

Joseph
Reply With Quote
Sponsored Links
  #2  
Old 1st April 2013, 20:55
abdi abdi is offline
Senior Member
 
Join Date: Sep 2012
Posts: 118
Thanks: 0
Thanked 10 Times in 6 Posts
Default Solution to the problem

My suggested solution to that problem is as follows:

In the API lib file "/usr/local/ispconfig/interface/lib/classes/remoting.inc.php"

I have introduced a new variable called update_stats_password which a user should set to 1 if they wish to update a stats_password. Otherwise by default its removed from the array to avoid messing up the preset stats_password .

Below is my updated function suggesting to be added to the next update if its OK.

Code:
//* Update a record
	public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
    {
		if(!$this->checkPerm($session_id, 'sites_web_domain_update')) {
			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
			return false;
		}
		
		//* Set a few defaults for nginx servers
		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
		
		//* Added by Abdi Joseph
		if($params['update_stats_password'] != '1') unset($params['stats_password']);
		
		$affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params);
		return $affected_rows;
	}
Any suggestions or comments are welcome ...

Abdi Joseph

Last edited by abdi; 1st April 2013 at 20:57.
Reply With Quote
  #3  
Old 2nd April 2013, 09:56
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,509
Thanks: 815
Thanked 5,268 Times in 4,130 Posts
 
Default

The api function works fine, you just used it the wrong way. Like with all API functions you have to pass a empty password parameter when the password shall not be change don update. So the correct API usage wozld be:

$domain_record['active'] = 'n';
$domain_record['stats_password'] = '';
sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record)
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clamav-daemon status failed ! sawa73 Server Operation 14 16th March 2013 09:13
Hacked server Captain Installation/Configuration 8 23rd December 2010 10:39
rkhunter report Captain Installation/Configuration 6 10th October 2010 13:05
adding mail boxes kwickcut Server Operation 20 11th August 2010 01:02
missing webalizer stats bolero Installation/Configuration 15 12th November 2008 16:28


All times are GMT +2. The time now is 04:33.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.