Author Topic: Problems configuring password plugin get SQL syntax error  (Read 9798 times)

Offline nssdcg

  • Newbie
  • *
  • Posts: 1
Problems configuring password plugin get SQL syntax error
« on: July 19, 2012, 03:01:48 PM »
I installed and configured the plugin but I get an error that the password can´t be changed, ith elog I get this error:

Code: [Select]
[16-Jul-2012 20:53:54 -0600]: DB Error: MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd('$1$O86/gN9M$cOXeHqPigXplyQ8Y8j.Qb/', 'eaguilar@mxibs.com')] [Native code: 1305] [Native message: FUNCTION servidp0_rnd3.update_passwd does not exist]  in /home3/servidp0/public_html/mxibs/correo/program/include/rcube_mdb2.php on line 719 (POST /correo/?_task=settings&_action=plugin.password-save?_task=&_action=)
When I try to run mysql according to the read me instructions to create the variable:

Code: [Select]
CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text
        MODIFIES SQL DATA
BEGIN
    DECLARE currentsal varchar(20);
    DECLARE error text;
    SET error = 'incorrect current password';
    SELECT substring_index(substr(user.password,4),_latin1'$',1) INTO currentsalt FROM users WHERE username=user;
    SELECT '' INTO error FROM users WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
    UPDATE users SET password=cryptpass WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
    RETURN error;
END

I get this error:

Error

consulta SQL:

Code: [Select]
CREATE FUNCTION update_password(
oldpass text,
cryptpass text,
user text
) RETURNS textMODIFIES SQL DATA BEGIN DECLARE currentsal varchar( 20 ) ;

MySQL ha dicho: Documentación
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4

I´m clueless, any help please...

Offline Wadsworthsmith

  • Jr. Member
  • **
  • Posts: 10
Problems configuring password plugin get SQL syntax error
« Reply #1 on: June 04, 2013, 07:43:41 AM »
I am also experiencing the same problem... Could anyone help us??
.

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: Problems configuring password plugin get SQL syntax error
« Reply #2 on: June 04, 2013, 09:17:24 AM »
Looks like a problem with delimiter. Try this:
mysql> delimiter //
mysql> CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text
...
    END//
mysql> delimiter ;

Are you sure you know what you're doing? This function is just an example, in most cases you'll need a simple SQL UPDATE query.