[JDEV] Using v2 queries with xdb_sql

Benoit Decaudin benoit.decaudin at terravirtual.net
Thu Sep 26 13:06:35 CDT 2002


I'm trying to bypass the built-in v1 querydefs for "auth-set", "auth-get",
and the "0k" stuff related to these queries. I have successfully (!?)
removed the code associated with these querydefs, and I wrote to the
configuration file the new querydefs. I can now successfully login to the
server, but I encounter two issues :

- The password is always in plain text, because the server never replies the
0k tags ;
- the users are not stored in the database.

Here are the querydefs :

<querydef name="auth-get" dtd="2" type="get" namespace="jabber:iq:auth">
<text>SELECT password FROM users WHERE username = '$$user$$'</text>
<bindcol tag="password" offset="0"/>

<querydef name="auth-set" dtd="2" type="set" namespace="jabber:iq:auth">
<text>UPDATE users SET password = '$$p$$' WHERE username = '$$user$$'</text>
<bindvar attrib="password">$$p$$</bindvar>

<querydef name="auth-set-new" dtd="2" type="set" namespace="jabber:iq:auth">
<text>INSERT INTO users (username, password) VALUES ('$$jid$$',
<bindvar attrib="password">$$pass$$</bindvar>

<querydef name="auth0k-get" dtd="2" type="get"
<text>SELECT hash, token, sequence FROM users0k WHERE username =
<bindcol tag="hash" offset="0"/>
<bindcol tag="token" offset="1"/>
<bindcol tag="sequence" offset="2"/>

<querydef name="auth0k-set" dtd="2" type="set"
<text>INSERT INTO users0k (username, hash, token, sequence) VALUES
('$$username$$', '$$hash$$', '$$token$$', '$$sequence$$')</text>
<bindvar attrib="hash">$$hash$$</bindvar>
<bindvar attrib="token">$$token$$</bindvar>
<bindvar attrib="sequence">$$sequence$$</bindvar>

Any idea will be more than welcome :)


More information about the JDev mailing list