Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 22nd November 2013, 17:11
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default Bug in dns_a_update

When I create a resource record using dns_a_add, it create a dns_rr entry with sys_userid and sys_groupid = 0

This doesn't create problem, it's ok.

But when using dns_a_update, even trying this after a dns_a_get

Code:
$dns_record["data"] 		= $_POST['Domain']['ip'];
$dns_record['sys_userid'] 	= "2";
$dns_record['sys_groupid'] 	= "2";
Then when I do the dns_a_update I got this error

Quote:
SOAP Error: looks like we got no XML document
With this SQL tried to execute

Code:
UPDATE `dns_rr` SET `server_id` = \'1\', `zone` = \'2\', `name` = \'sette\', 
`type` = \'A\', `data` = \'192.168.1.80\', `ttl` = \'60\', 
`active` = \'Y\', `stamp` = \'0000-00-00 00:00:00\', `serial` = \'1385072055\', 
`sys_userid` = , `sys_groupid` =  WHERE id = 36
Please note the problem: sys_userid and sys_groupid were not assigned.

So there is a blocking SQL error

Now this problem blocks me ... how can I fix this ?
Reply With Quote
Sponsored Links
  #2  
Old 22nd November 2013, 17:30
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 756
Thanks: 15
Thanked 215 Times in 166 Posts
Default

Are you using latest ISPConfig version?
__________________
Marius Cramer

pixcept KG
Reply With Quote
The Following User Says Thank You to Croydon For This Useful Post:
realtebo (22nd November 2013)
  #3  
Old 22nd November 2013, 17:59
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,579
Thanks: 792
Thanked 4,980 Times in 3,901 Posts
Default

Seems as if you did not set the client ID correctly when calling the function. You can not pass any sys_ columns in the params array.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
realtebo (22nd November 2013)
  #4  
Old 22nd November 2013, 18:06
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default

Code:
>> Update

Please choose the update method. For production systems select 'stable'.
The update from svn is only for development systems and may break your current setup.
Note: Update all slave server, before you update master server.

Select update method (stable,svn) [stable]:

There are no updates available for ISPConfig 3.0.5.3
I found in remote.inc.php the function dns_a_update

It runs updateQuery and from this it runs updateQueryPrepare.

It executes $app->remoting_lib->getSQL

I think the problem was here, or near here, at rows 784 of remoting_lib.inc.php... on

Code:
if($primary_id != 0) {
                                // update client permissions only if client_id > 0
								if($this->formDef['auth'] == 'yes' && $this->client_id > 0) {
									$sql_update .= '`sys_userid` = '.$this->sys_userid.', ';
									$sql_update .= '`sys_groupid` = '.$this->sys_default_group.', ';
								}
								$sql_update = substr($sql_update,0,-2);
                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
Please, help me, this problem is REALLY blocking me... this function, update dns A record is the core of what I'm developing ..
Reply With Quote
  #5  
Old 22nd November 2013, 18:17
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default

This is my quick and dirty patch

Code:
$sql_update .= '`sys_userid` = '. (0 + $this->sys_userid) .', ';
$sql_update .= '`sys_groupid` = '. (0 + $this->sys_default_group) .', ';
This was ugly code, but actually works...

How to open an official bug report ?
Reply With Quote
  #6  
Old 22nd November 2013, 18:26
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by till View Post
Seems as if you did not set the client ID correctly when calling the function. You can not pass any sys_ columns in the params array.
sorry, can you explain me again what can be the problem ?

What's my error? In calling dns_a_update or dns_a_add ?

I tried without passsing any sys_* params, and the problem happens again. I tried to pass these params to workaround the "bug", if it's a bug.
Reply With Quote
  #7  
Old 22nd November 2013, 18:33
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,579
Thanks: 792
Thanked 4,980 Times in 3,901 Posts
Default

The function has these parameters:

$client->dns_a_update($session_id, $client_id, $id, $dns_record)

The owner of the record is defined by the parameter $client_id. The api looks up the userid and groupid of the client and then sets the sys_* params for this record to match the correct values for the client.

So yor problem is not a bug, you just pass a wrong client_id to the function or the client record is incomplete, so that the client has no userid and groupid assigned.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
realtebo (22nd November 2013)
  #8  
Old 22nd November 2013, 19:13
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default



I think the client it's ok
it's the only client I've create directly by ispconfig, not via API.

When using dns_a_add, I cannot send this params, so i'ts not my error.
Or not ? Please help me to understand what's the error
Reply With Quote
  #9  
Old 22nd November 2013, 19:19
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
Default

This is the code I use to add the record

Code:
public function dns_a_add($domain, $ip) 
	{
		$client = $this->getSoapClient();
		$session_id = $client->login($this->username,$this->password);
		$client_id = 1;
		$params = array(
			'server_id' => 1,
			'zone' => 2,
			'name' => $domain,
			'type' => 'a',
			'data' => $ip,
			'aux' => '0',
			'ttl' => '60',
			'active' => 'y',
			'stamp' => 'CURRENT_TIMESTAMP',
			'serial' => time(),
		);
		
		$id = $client->dns_a_add($session_id, $client_id, $params);

		$client->logout($session_id);

		return $id;
	}
Using this, the dns_rr record is created with sys_* = 0

Reply With Quote
  #10  
Old 22nd November 2013, 19:27
realtebo realtebo is offline
Junior Member
 
Join Date: May 2013
Posts: 22
Thanks: 7
Thanked 1 Time in 1 Post
 
Default

And this is the code for updating

Code:
	public function dns_a_update($dns_rr_id, $new_ip)
	{
		$client = $this->getSoapClient();
		$session_id = $client->login($this->username,$this->password);

		$dns_record = $client->dns_a_get($session_id, $dns_rr_id);
		$dns_record["data"] = $new_ip;

		$client_id = 1;	
		$affected_rows = $client->dns_a_update($session_id, $client_id, $dns_rr_id, $dns_record);	
		$client->logout($session_id);
	}
Reply With Quote
The Following User Says Thank You to realtebo For This Useful Post:
feeninuoumn (25th December 2013)
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
Server hangs, BUG: Bad page state in process lucani Installation/Configuration 1 6th September 2012 18:50
Bug when updating ftp accounts from reseller ddelbia General 1 1st July 2010 13:02
error: File /root/rpm/SOURCES/postfix-2.3.3-vda.patch: No such file or directory mxtdn Installation/Configuration 1 25th July 2009 09:20
Help needed error rpmbuild -ba postfix.spec mr_bo Installation/Configuration 2 15th May 2009 09:47
Step 11 Error:rpmbuild -ba postfix.spec tgxg00 Installation/Configuration 7 22nd April 2009 15:16


All times are GMT +2. The time now is 12:29.


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