SOAP API issue

Discussion in 'General' started by Mladen, Dec 9, 2021.

  1. Mladen

    Mladen New Member

    Hi all,
    I was going to submit a bug on the issue tracker, but the bug template redirected me to first create a forum post, so here I am.
    I've been using soap api to automate/customize creation of new clients and as soon as I upgraded ISPC to the latest version (3.2.7p1), I started receiving some errors, like:
    Code:
    Exception: Data truncated for column 'limit_cron_type' at row 1 INSERT INTO `client` (`company_name`, `gender`, `contact_firstname`, `contact_name`, `customer_no`, `username`, `password`, `language`, `usertheme`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `vat_id`, `company_id`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `notes`, `paypal_email`, `locked`, `canceled`, `added_date`, `added_by`, `template_master`, `template_additional`, `default_mailserver`, `mail_servers`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailmailinglist`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mail_wblist`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `limit_mail_backup`, `limit_relayhost`, `default_xmppserver`, `xmpp_servers`, `limit_xmpp_domain`, `limit_xmpp_user`, `limit_xmpp_muc`, `limit_xmpp_anon`, `limit_xmpp_vjud`, `limit_xmpp_proxy`, `limit_xmpp_status`, `limit_xmpp_pastebin`, `limit_xmpp_httparchive`, `default_webserver`, `web_servers`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_ssl_letsencrypt`, `limit_web_aliasdomain`, `limit_web_subdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_backup`, `limit_directive_snippets`, `default_dnsserver`, `dns_servers`, `limit_dns_zone`, `default_slave_dnsserver`, `limit_dns_slave_zone`, `limit_dns_record`, `limit_client`, `default_dbserver`, `db_servers`, `limit_database`, `limit_database_user`, `limit_database_quota`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_openvz_vm`, `limit_openvz_vm_template_id`, `limit_aps`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`) VALUES ('xxxxx.xxx', '', '', 'xxxxx.xxx', '', 'xxxxx.xxx', '$6$rounds=5000$2df000d42b2febaf$x.y/z', 'en', 'default', '', '', '', '', 'RS', '', '', '', '[email protected]', '', '', '', '', '', '', '', '', '', '', '', '', 'n', 'n', '2021-12-09', 'Web form', '1', '', '1', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'n', 'n', '0', '', '0', '0', 'n', 'n', 'n', 'n', 'n', 'n', 'n', '1', '', '0', '0', 'no,suphp', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', '0', '0', '0', '0', 'no', '0', 'n', 'n', '1', '', '0', '0', '0', '0', '0', '1', '', '0', '0', '0', '0', '', '0', '0', '0', '0', '0', '1', '1', 'riud', 'riud', '')
    Essentially, the validation for 'limit_cron_type' column has failed because the value provided in the INSERT statement is '' (an empty string - since it hasn't been set in the soap call client_add()), and the validation specified in the file ispconfig3/interface/web/client/form/client.tform.php looks like this:
    Code:
    'limit_cron_type' => array (
            'datatype'  => 'VARCHAR',
            'formtype'  => 'SELECT',
            'default'   => '',
            'valuelimit' => 'client:limit_cron_type',
            'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
    
    To me, it looks like the default is set to something (an empty string in this case), which is not valid, according to the value (it can only be 'Full Cron', 'Chrooted Cron' or 'URL Cron').
    I'm not sure if this is a bug or not, but if it is, the following variables also have a suspicious combination of value/default and would be wise to re-check those as well:
    • web_php_options
    • ssh_chroot
    Edit:
    After manually adding this limit_cron_type property to the client_add params I got another similar error, this time for the web domain:
    Code:
    Exception: Data truncated for column 'pm' at row 1 INSERT INTO `web_domain` (`server_id`, `ip_address`, `ipv6_address`, `domain`, `type`, `parent_domain_id`, `vhost_type`, `hd_quota`, `traffic_quota`, `cgi`, `ssi`, `suexec`, `errordocs`, `subdomain`, `ssl`, `ssl_letsencrypt`, `php`, `server_php_id`, `perl`, `ruby`, `python`, `enable_pagespeed`, `active`, `web_folder`, `redirect_type`, `redirect_path`, `seo_redirect`, `rewrite_rules`, `rewrite_to_https`, `ssl_state`, `ssl_locality`, `ssl_organisation`, `ssl_organisation_unit`, `ssl_country`, `ssl_domain`, `ssl_key`, `ssl_request`, `ssl_cert`, `ssl_bundle`, `ssl_action`, `stats_password`, `stats_type`, `backup_interval`, `backup_copies`, `backup_excludes`, `backup_format_web`, `backup_format_db`, `backup_encrypt`, `backup_password`, `document_root`, `system_user`, `system_group`, `allow_override`, `proxy_protocol`, `php_fpm_use_socket`, `php_fpm_chroot`, `pm`, `pm_max_children`, `pm_start_servers`, `pm_min_spare_servers`, `pm_max_spare_servers`, `pm_process_idle_timeout`, `pm_max_requests`, `php_open_basedir`, `custom_php_ini`, `apache_directives`, `nginx_directives`, `proxy_directives`, `added_date`, `added_by`, `http_port`, `https_port`, `log_retention`, `jailkit_chroot_app_sections`, `jailkit_chroot_app_programs`, `delete_unused_jailkit`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`) VALUES ('1', '*', '', 'xxx.xxx', 'vhost', '0', 'name', '-1', '-1', 'n', 'n', 'y', '1', '*', 'n', 'n', 'fast-cgi', '0', 'n', 'n', 'n', 'n', 'y', '', '', '', '', NULL, 'n', '', '', '', '', '', '', '', '', '', '', '', '$6$rounds=5000$506d0b1221e55a02$x/y/z.p/q/r', 'webalizer', '', '0', '', '', '', 'n', '', '-', '-', '-', 'All', 'n', 'n', 'n', '', '1', '1', '1', '1', '10', '0', '', NULL, NULL, NULL, NULL, NULL, '', '80', '443', '30', NULL, NULL, 'n', '430', '429', 'riud', 'riud', '')
    
     
    Last edited: Dec 9, 2021
  2. helmo

    helmo Member HowtoForge Supporter

    I think that this default is never used in the webinterface, so the API is the exception here.

    Strictly speaking does remoting_client/API-docs/client_add.html mention the possible values, and not that it's optional.
    But the api could use a log of TLC :(

    Did you try to set
    Code:
    'default' => 'url' 
    ? It might just work... and if so please create an issue/merge request for it.
     

Share This Page