|
Home > Archive > SQL Anywhere Mobile > July 2005 > Help needed with authenticate_user_hashed script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Help needed with authenticate_user_hashed script
|
|
|
| I like to implement custom user authentication with mobilink. I get the
following error:
E. 07/13 11:47:40. <1.5> [tb]: Error: [-10048] Expecting at least 2
parameters in script, but only found 0: call
ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed', 'call
mtracker_auth(?, ?, ?, ?)')
here is my connect script:
call ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed',
'call mtracker_auth(?, ?, ?, ?)')
the authentication procedure is as follows:
ALTER PROCEDURE "DBA"."mtracker_auth"(inout @auth_status integer,
in @user_name varchar(128),
in @user_pwd binary(20) DEFAULT
NULL,
in @user_new_pwd binary(20)
DEFAULT NULL)
BEGIN
DECLARE pwd binary(36);
if @user_pwd IS NULL then
if lookup_dbuser(@user_
name) = 1
then
select @auth_status = 1000;
else
select @auth_status = 4000;
end if;
else
if lookup_dbuser(@user_
name) = 1
then
select pwd = password from sysuserperm;
if pwd = @user_pwd then
select @auth_status = 1000;
else
select @auth_status = 4000;
end if;
else
select @auth_status = 4000;
end if;
end if
END
The idea behind this is, that users can enter the same password on the
PocketPC for data synchronisation as they do when logging in to the
database from a pc based client. The consolidated db is on ASA 9 with
latest patches.
The program on the PocketPC is written in C++ using MFC. It fills the
following ul_synch_info structure:
StreamParams.format(L"host=%s", SyncServer.data());
SynchInfo.user_name = UL_TEXT("tb" );
SynchInfo.password = UL_TEXT("mypwd");
SynchInfo.version = UL_TEXT("ul_default");
SynchInfo.stream = ULSocketStream();
SynchInfo.stream_parms = (wchar_t*)StreamPara
ms.data();
The full ML server log:
I. 07/13 11:45:55. Adaptive Server Anywhere MobiLink Version 9.0.2.3124
I. 07/13 11:45:55.
I. 07/13 11:45:55. Copyright © 1989-2004 Sybase, Inc.
Portions Copyright © 2002-2004, iAnywhere Solutions,
Inc.
I. 07/13 11:45:55. All rights reserved. All unpublished rights reserved.
I. 07/13 11:45:55.
I. 07/13 11:45:55. This software contains confidential and trade secret
information of
I. 07/13 11:45:55. iAnywhere Solutions, Inc.
Use, duplication or disclosure of the software and
documentation
I. 07/13 11:45:55. by the U.S. Government is subject to restrictions set
forth in a license
I. 07/13 11:45:55. agreement between the Government and iAnywhere
Solutions, Inc. or
I. 07/13 11:45:55. other written agreement specifying the Government's
rights to use the
I. 07/13 11:45:55. software and any applicable FAR provisions, for
example, FAR 52.227-19.
I. 07/13 11:45:55.
I. 07/13 11:45:55. iAnywhere Solutions, Inc., One Sybase Drive, Dublin,
CA 94568, USA
I. 07/13 11:45:55.
I. 07/13 11:45:55. Networked Seat (per-seat) model. Access to the server
is limited to 1 seat(s).
This server is licensed to:
I. 07/13 11:45:55. Developer Edition
I. 07/13 11:45:55. Restricted Use
I. 07/13 11:45:55. <Main>: MobiLink server started
I. 07/13 11:45:55. <Main>: Option 1: -c
I. 07/13 11:45:55. <Main>: Option 2: dsn=mtracker;uid=dba
;pwd=********
I. 07/13 11:45:55. <Main>: Option 3: -zs
I. 07/13 11:45:55. <Main>: Option 4: mtrackerml
I. 07/13 11:45:55. <Main>: Option 5: -e
I. 07/13 11:45:55. <Main>: Option 6:
D:\Projects\Mobile\W
inCE\mtracker\Databa
se\mtracker_MLClErr.log
I. 07/13 11:45:55. <Main>: Option 7: -vcrs
I. 07/13 11:45:55. <Main>: Option 8: -za
I. 07/13 11:45:55. <Main>: Verbose logging: show row values
I. 07/13 11:45:55. <Main>: Verbose logging: show script names when invoked
I. 07/13 11:45:55. <Main>: Verbose logging: show script contents when
invoked
I. 07/13 11:45:55. <Main>: Individual database connections will be
closed after synchronization errors.
I. 07/13 11:45:55. <Main>: BLOB cache size: 524288
I. 07/13 11:45:55. <Main>: Maximum number of BLOB bytes to compare:
4294967295
I. 07/13 11:45:55. <Main>: Maximum number of database connections: 6
I. 07/13 11:45:55. <Main>: Maximum number of deadlock retries: 10
I. 07/13 11:45:55. <Main>: Timeout for inactive database connections: 60
minutes
I. 07/13 11:45:55. <Main>: Maximum delay between retries after deadlock:
30 seconds
I. 07/13 11:45:55. <Main>: Rowset size: 10
I. 07/13 11:45:55. <Main>: Upload cache size: 524288 bytes
I. 07/13 11:45:55. <Main>: Download cache memory size: 1048576 bytes
I. 07/13 11:45:55. <Main>: Download cache directory size: 10485760 bytes
I. 07/13 11:45:55. <Main>: Number of worker threads: 5
I. 07/13 11:45:55. <Main>: Maximum number of threads uploading
concurrently: 5
I. 07/13 11:45:55. <Main>: Unknown users will be rejected (when there is
no authenticate_user script).
I. 07/13 11:45:55. <Main>: Warning: Example scripts may be automatically
generated and activated for unknown versions.
I. 07/13 11:45:55. <Main>: Local file for remote synchronization logs:
'D:\Projects\Mobile\
WinCE\mtracker\Datab
ase\mtracker_MLClErr
.log'
I. 07/13 11:45:55. <Main>: Stream specifier 1: TCPIP
I. 07/13 11:45:56. <Main>: ODBC DBMS Name: Adaptive Server Anywhere
I. 07/13 11:45:56. <Main>: ODBC DBMS Version: 09.00.0002
I. 07/13 11:45:56. <Main>: ODBC DBMS Driver Version: 09.00.0002
I. 07/13 11:45:56. <Main>: ODBC Version supported by the driver: 3.52
I. 07/13 11:45:56. <Main>: Collation sequence of the consolidated
database is 'cp1252'
I. 07/13 11:45:56. <Main>: ODBC isolation set to: Read Committed
I. 07/13 11:45:56. <Main>: Connected
I. 07/13 11:45:56. <thread 1.1>: Ready to handle requests
I. 07/13 11:45:56. <thread 1.2>: Ready to handle requests
I. 07/13 11:45:56. <thread 1.3>: Ready to handle requests
I. 07/13 11:45:56. <thread 1.4>: Ready to handle requests
I. 07/13 11:45:56. <thread 1.5>: Ready to handle requests
I. 07/13 11:47:39. <thread 1.5>: Working on a request
I. 07/13 11:47:39. <thread 1.5>: ml_scripts_modified last modified at:
2005-07-13 08:24:26.000000
I. 07/13 11:47:39. <thread 1.5>: UltraLite synchronization request from:
tb (version: ul_default)
I. 07/13 11:47:40. <1.5> [tb]: ODBC isolation set to: Read Committed
I. 07/13 11:47:40. <1.5> [tb]: begin_connection <connection> (no script)
I. 07/13 11:47:40. <1.5> [tb]: COMMIT Transaction: begin_connection
E. 07/13 11:47:40. <1.5> [tb]: Error: [-10048] Expecting at least 2
parameters in script, but only found 0: call
ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed', 'call
mtracker_auth(?, ?, ?, ?)')
I. 07/13 11:47:40. <1.5> [tb]: The authenticate_user_ha
shed script
caused an error when invoked.
I. 07/13 11:47:40. <1.5> [tb]: ROLLBACK Transaction: authenticate_user
I. 07/13 11:47:40. <1.5> [tb]: end_connection <connection> (no script)
I. 07/13 11:47:40. <1.5> [tb]: COMMIT Transaction: end_connection
I. 07/13 11:47:40. <1.5> [tb]: Disconnected from consolidated database
I. 07/13 11:47:40. <1.5> [tb]: Synchronization failed
I tried to set a breakpoint in the mtracker_auth procedure but the
debugger never stopped there.
In my understanding the call to
ULConnection::Synchr
onize(ul_info_struct
ue) should pass username and
password to the stored procedure. For whatever reason it finds 0
parameters.
Can anybody tell me what I am doing wrong??
Tom
| |
| Reg Domaratzki \(iAnywhere Solutions\) 2005-07-13, 9:24 am |
| I may be misreading the Mobilink log, but it looks to me like you've defined
your synch script as :
call ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed',
'call mtracker_auth(?, ?, ?, ?)')
I think it should just be :
call mtracker_auth(?, ?, ?, ?)
--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup
iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL
"Tom" <tom@nospam.org> wrote in message news:42d4e627@forums
-1-dub...
> I like to implement custom user authentication with mobilink. I get the
> following error:
>
>
> E. 07/13 11:47:40. <1.5> [tb]: Error: [-10048] Expecting at least 2
> parameters in script, but only found 0: call
> ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed', 'call
> mtracker_auth(?, ?, ?, ?)')
>
>
> here is my connect script:
>
> call ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed',
> 'call mtracker_auth(?, ?, ?, ?)')
>
> the authentication procedure is as follows:
>
>
> ALTER PROCEDURE "DBA"."mtracker_auth"(inout @auth_status integer,
> in @user_name varchar(128),
> in @user_pwd binary(20) DEFAULT
> NULL,
> in @user_new_pwd binary(20)
> DEFAULT NULL)
> BEGIN
> DECLARE pwd binary(36);
> if @user_pwd IS NULL then
> if lookup_dbuser(@user_
name) = 1
> then
> select @auth_status = 1000;
> else
> select @auth_status = 4000;
> end if;
> else
> if lookup_dbuser(@user_
name) = 1
> then
> select pwd = password from sysuserperm;
> if pwd = @user_pwd then
> select @auth_status = 1000;
> else
> select @auth_status = 4000;
> end if;
> else
> select @auth_status = 4000;
> end if;
> end if
> END
>
>
> The idea behind this is, that users can enter the same password on the
> PocketPC for data synchronisation as they do when logging in to the
> database from a pc based client. The consolidated db is on ASA 9 with
> latest patches.
>
> The program on the PocketPC is written in C++ using MFC. It fills the
> following ul_synch_info structure:
>
> StreamParams.format(L"host=%s", SyncServer.data());
> SynchInfo.user_name = UL_TEXT("tb" );
> SynchInfo.password = UL_TEXT("mypwd");
> SynchInfo.version = UL_TEXT("ul_default");
> SynchInfo.stream = ULSocketStream();
> SynchInfo.stream_parms = (wchar_t*)StreamPara
ms.data();
>
> The full ML server log:
>
> I. 07/13 11:45:55. Adaptive Server Anywhere MobiLink Version 9.0.2.3124
> I. 07/13 11:45:55.
> I. 07/13 11:45:55. Copyright © 1989-2004 Sybase, Inc.
> Portions Copyright © 2002-2004, iAnywhere Solutions,
> Inc.
> I. 07/13 11:45:55. All rights reserved. All unpublished rights reserved.
> I. 07/13 11:45:55.
> I. 07/13 11:45:55. This software contains confidential and trade secret
> information of
> I. 07/13 11:45:55. iAnywhere Solutions, Inc.
> Use, duplication or disclosure of the software and
> documentation
> I. 07/13 11:45:55. by the U.S. Government is subject to restrictions set
> forth in a license
> I. 07/13 11:45:55. agreement between the Government and iAnywhere
> Solutions, Inc. or
> I. 07/13 11:45:55. other written agreement specifying the Government's
> rights to use the
> I. 07/13 11:45:55. software and any applicable FAR provisions, for
> example, FAR 52.227-19.
> I. 07/13 11:45:55.
> I. 07/13 11:45:55. iAnywhere Solutions, Inc., One Sybase Drive, Dublin,
> CA 94568, USA
> I. 07/13 11:45:55.
> I. 07/13 11:45:55. Networked Seat (per-seat) model. Access to the server
> is limited to 1 seat(s).
> This server is licensed to:
> I. 07/13 11:45:55. Developer Edition
> I. 07/13 11:45:55. Restricted Use
> I. 07/13 11:45:55. <Main>: MobiLink server started
> I. 07/13 11:45:55. <Main>: Option 1: -c
> I. 07/13 11:45:55. <Main>: Option 2: dsn=mtracker;uid=dba
;pwd=********
> I. 07/13 11:45:55. <Main>: Option 3: -zs
> I. 07/13 11:45:55. <Main>: Option 4: mtrackerml
> I. 07/13 11:45:55. <Main>: Option 5: -e
> I. 07/13 11:45:55. <Main>: Option 6:
> D:\Projects\Mobile\W
inCE\mtracker\Databa
se\mtracker_MLClErr.log
> I. 07/13 11:45:55. <Main>: Option 7: -vcrs
> I. 07/13 11:45:55. <Main>: Option 8: -za
> I. 07/13 11:45:55. <Main>: Verbose logging: show row values
> I. 07/13 11:45:55. <Main>: Verbose logging: show script names when invoked
> I. 07/13 11:45:55. <Main>: Verbose logging: show script contents when
> invoked
> I. 07/13 11:45:55. <Main>: Individual database connections will be
> closed after synchronization errors.
> I. 07/13 11:45:55. <Main>: BLOB cache size: 524288
> I. 07/13 11:45:55. <Main>: Maximum number of BLOB bytes to compare:
> 4294967295
> I. 07/13 11:45:55. <Main>: Maximum number of database connections: 6
> I. 07/13 11:45:55. <Main>: Maximum number of deadlock retries: 10
> I. 07/13 11:45:55. <Main>: Timeout for inactive database connections: 60
> minutes
> I. 07/13 11:45:55. <Main>: Maximum delay between retries after deadlock:
> 30 seconds
> I. 07/13 11:45:55. <Main>: Rowset size: 10
> I. 07/13 11:45:55. <Main>: Upload cache size: 524288 bytes
> I. 07/13 11:45:55. <Main>: Download cache memory size: 1048576 bytes
> I. 07/13 11:45:55. <Main>: Download cache directory size: 10485760 bytes
> I. 07/13 11:45:55. <Main>: Number of worker threads: 5
> I. 07/13 11:45:55. <Main>: Maximum number of threads uploading
> concurrently: 5
> I. 07/13 11:45:55. <Main>: Unknown users will be rejected (when there is
> no authenticate_user script).
> I. 07/13 11:45:55. <Main>: Warning: Example scripts may be automatically
> generated and activated for unknown versions.
> I. 07/13 11:45:55. <Main>: Local file for remote synchronization logs:
> 'D:\Projects\Mobile\
WinCE\mtracker\Datab
ase\mtracker_MLClErr
.log'
> I. 07/13 11:45:55. <Main>: Stream specifier 1: TCPIP
> I. 07/13 11:45:56. <Main>: ODBC DBMS Name: Adaptive Server Anywhere
> I. 07/13 11:45:56. <Main>: ODBC DBMS Version: 09.00.0002
> I. 07/13 11:45:56. <Main>: ODBC DBMS Driver Version: 09.00.0002
> I. 07/13 11:45:56. <Main>: ODBC Version supported by the driver: 3.52
> I. 07/13 11:45:56. <Main>: Collation sequence of the consolidated
> database is 'cp1252'
> I. 07/13 11:45:56. <Main>: ODBC isolation set to: Read Committed
> I. 07/13 11:45:56. <Main>: Connected
> I. 07/13 11:45:56. <thread 1.1>: Ready to handle requests
> I. 07/13 11:45:56. <thread 1.2>: Ready to handle requests
> I. 07/13 11:45:56. <thread 1.3>: Ready to handle requests
> I. 07/13 11:45:56. <thread 1.4>: Ready to handle requests
> I. 07/13 11:45:56. <thread 1.5>: Ready to handle requests
> I. 07/13 11:47:39. <thread 1.5>: Working on a request
> I. 07/13 11:47:39. <thread 1.5>: ml_scripts_modified last modified at:
> 2005-07-13 08:24:26.000000
> I. 07/13 11:47:39. <thread 1.5>: UltraLite synchronization request from:
> tb (version: ul_default)
> I. 07/13 11:47:40. <1.5> [tb]: ODBC isolation set to: Read Committed
> I. 07/13 11:47:40. <1.5> [tb]: begin_connection <connection> (no script)
> I. 07/13 11:47:40. <1.5> [tb]: COMMIT Transaction: begin_connection
> E. 07/13 11:47:40. <1.5> [tb]: Error: [-10048] Expecting at least 2
> parameters in script, but only found 0: call
> ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed', 'call
> mtracker_auth(?, ?, ?, ?)')
> I. 07/13 11:47:40. <1.5> [tb]: The authenticate_user_ha
shed script
> caused an error when invoked.
> I. 07/13 11:47:40. <1.5> [tb]: ROLLBACK Transaction: authenticate_user
> I. 07/13 11:47:40. <1.5> [tb]: end_connection <connection> (no script)
> I. 07/13 11:47:40. <1.5> [tb]: COMMIT Transaction: end_connection
> I. 07/13 11:47:40. <1.5> [tb]: Disconnected from consolidated database
> I. 07/13 11:47:40. <1.5> [tb]: Synchronization failed
>
>
> I tried to set a breakpoint in the mtracker_auth procedure but the
> debugger never stopped there.
>
> In my understanding the call to
> ULConnection::Synchr
onize(ul_info_struct
ue) should pass username and
> password to the stored procedure. For whatever reason it finds 0
> parameters.
>
> Can anybody tell me what I am doing wrong??
>
> Tom
| |
|
| Hi Reg,
Yep, works now (almost). I think the ml_add_connection_sc
ript is for use
in ISQL and does the same thing I have done with Sybase Central.
I have another problem creating an ASA - Mobilink 'single sign on'. I
will post a new message for that.
Thanks a lot for your help.
Tom
Reg Domaratzki (iAnywhere Solutions) wrote:
> I may be misreading the Mobilink log, but it looks to me like you've defined
> your synch script as :
>
> call ml_add_connection_sc
ript('ul_default', 'authenticate_user_h
ashed',
> 'call mtracker_auth(?, ?, ?, ?)')
>
> I think it should just be :
>
> call mtracker_auth(?, ?, ?, ?)
>
>
|
|
|
|
|