r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[MySQL]

Pekr
30-Aug-2005
[167x2]
huh, ok. Finally can test ... while I have set old-passwords in my.ini, 
restarted service, it is not enough - so I installed mysql administrator 
app and changed user password, server probably needs to regenerate 
them to behave correctly ..
hopefully the same problem exists even for php folks, so I hope our 
partner site will not send me to hell with rebol ;-)
Volker
30-Aug-2005
[169x2]
Here is something more: http://dev.mysql.com/doc/mysql/en/password-hashing.html
You do not need "old-passwords" globally, only your accounts needs 
an old-style-password.
Pekr
31-Aug-2005
[171x4]
what is your common rebol syntax you use mySQL driver with? I find 
it a bit difficult to use Doc's block mode, as I have to provide 
it with exactly the same amount of question marks, as there is amount 
of columns in the table (talking of insert here)
does anyone use non-rebolish, but string mode (eg. using 'compose), 
with direct mySQL syntax? (which allows constructs as for e.g. insert 
into mytable (col1, col8, col9) values ("A", "B", "C") ... so you 
don't need to care about the rest of arguments for e.g.?
Is there any "block syntax" equivalent to insert, to be used for 
updates?
hmm,  maybe I am already decided, thanks for any input, but it seems 
to me easier to directly compose valid mySQL syntax, than to think 
how to overcome rebol block conversion syntax, as I can't know what 
cases Doc's driver is able to parse ...
Thorsten
4-Sep-2005
[175]
Hi Mike, sorry for the late reply. Changing passwords to the old 
algorhitm and setting the variable ol_password to "on" did the job. 
Thanks
Pekr
5-Sep-2005
[176]
has anyone experience with character sets and collations? I can see 
there are variables like character_set_connection() and collation_connection(), 
etc. - can those be set from within the Rebol?
MikeL
16-Sep-2005
[177]
This is related, I think, to my notes about VID and MySQL in the 
View section. In a test that we ran in 2004 we were able to load 
1,000,000 rows in under 30 minutes.  We did not investigate further 
but we thought we could improve this by running parallel loads and 
putting it on a real server instead of a laptop.  This volume was 
equal to the annual volume of  the transactions we were interested 
in so would represent a journal of everything that happened to this 
app as a keyed transaction in one year.   


From that 1,000,000 row database, we were able to create an HTML 
report based on some selected criteria in 2.5 seconds.  

All tests done with REBOL View using Doc's mySQL protocol.
Tomc
20-Oct-2005
[178]
volker  thanks for figureing out the SET PASSWORD ...OLD_PASSWORD(''xyz'); 
before I needed it ;)
Pekr
8-Jan-2006
[179x7]
I am reopening the issue of mySQL protocol not being able to connect 
to newer >= 4.11 mySQL version database. I decided to consider this 
task as being a proof if the community is, or is not able to effectively 
resort some issues, which clearly show as a show stopper for some 
rebollers (as can be seen on ml). If we are not able to effectively 
resolve this issue, then I have to ask - what actually are we able 
to sort?
Yesterday afternoon I spent investigating Doc's scheme, and here 
are my conclusions:


- The part of code responsible for password communication with the 
server is in the 'scrambler object. The function whish establishes 
connection with server is 'do-handshake


- rebol's mysql protocol seems to distinguish protocol version 9 
and 10, and I was not able to find out, what does it mean on mysql's 
side of things. It also seems to me, there is long-password item 
already in the stack, but dunno if related, it is just osme constant. 
Protocol version 9 and 10 use different hash functions and different 
crypt functions. I really don't know, where does DocKimbel find out 
how to implement those functions, maybe by looking into mySQL source, 
so I downloaded them


- to read more about passwords in mysql, go here - http://dev.mysql.com/doc/refman/5.0/en/password-hashing.html
. Maybe it is not protocol 9 and 10 related, as you may use old password 
scheme even with new databases. The difference is as follows - starting 
from mySQL 4.11, passwords are stored in 41 bytes wide field, whereas 
with older versions, it was 16bytes. New passwords always start with 
* (asterisk) char, to be easily distinguished ...


- how things might work? Mysql sends scrambled password, and Doc's 
scheme stores it in 'crypt-seed variable.  Data is being sent by 
the protocol by 'send-packet function, where for the password part, 
scrambler/scramble function is used, which calls crypt-v10 or crypt-v9, 
according to protocol versions. Those function use hash-v10(9), floor 
and other functions ...


I think that we somehow need to find out, how to compute hash for 
not 16bytes, but for those 41bytes ...
Now - sorry if I am breaking some licenses, but I will post some 
stuff to my website, and remove it once we are finished:

http://www.rebol.cz/mysql/mysql-protocol.r
http://www.rebol.cz/mysql/password.c
I think we somehow need to figure out, how to compute new hash which 
will be 41 bytes in the result. Dunno why they don't use some standard 
hashing algorithm, so we could use simply rebol's 'checksum :-(
maybe this is better description:

The password is saved (in user.password) by using the PASSWORD() 
function in
  mysql.


  This is .c file because it's used in libmysqlclient, which is entirely 
  in C.
  (we need it to be portable to a variety of systems).
  Example:
    update user set password=PASSWORD("hello") where user="test"
  This saves a hashed number as a string in the password field.

  The new authentication is performed in following manner:

  SERVER:  public_seed=create_random_string()
           send(public_seed)

  CLIENT:  recv(public_seed)
           hash_stage1=sha1("password")
           hash_stage2=sha1(hash_stage1)
           reply=xor(hash_stage1, sha1(public_seed,hash_stage2)

           // this three steps are done in scramble() 

           send(reply)

     
  SERVER:  recv(reply)
           hash_stage1=xor(reply, sha1(public_seed,hash_stage2))
           candidate_hash2=sha1(hash_stage1)
           check(candidate_hash2==hash_stage2)

           // this three steps are done in check_scramble()
why Doc implemented his hash-V9 and hash-V10 functions this way? 
Don't we have 'sha1 method with 'checksum? (just basing it upon "help 
checksum")
So - I did some homework here, but I am at my limits (well, maybe 
not, but I will be very slow from now on), whereas we have ppl knowing 
C here, and ppl who did some hashing etc. for Beer (Ladislav), so 
guys, if you find some 10 minutes of spare time, please at least 
try to give me some pointers here. As I said - the world is upgrading 
mySQL to 5.0 now, so 4.11 is older, not to mention 4.0.1 or 3.23. 
It is about having mysql free scheme for rebol, or not. And don't 
think every admin will be willing to set old-password parameter for 
his server, as this can be regarded a security risk ...
Pekr
9-Jan-2006
[186]
.
Graham
9-Jan-2006
[187]
I think someone needs to pay someone to fix it.
Pekr
9-Jan-2006
[188]
:-)
Graham
9-Jan-2006
[189]
You have these open source sites where a developer offers to fix 
something for a sum.  The community then collects the money and pays 
the developer.  Whoever needs this, will donate to have this done.
Pekr
9-Jan-2006
[190]
how much, and to whom?
Graham
9-Jan-2006
[191x2]
someone first off needs to say that they will do it, and for how 
much.
Jeff could probably do it.
Pekr
9-Jan-2006
[193]
I suggested such model for a long time already. I used it with rebol 
in the past too ... so just - how much, and who does it? :-)
Graham
9-Jan-2006
[194x3]
Ask him how much he wants, and then see who is interested in contributing.
There must be quite a few rebol users using mysql.
if no one contributes .. then clearly it's not worth doing.
Pekr
9-Jan-2006
[197]
I will see what comes up on ml ....
Graham
9-Jan-2006
[198]
People have to earn a living ..
Pekr
9-Jan-2006
[199x4]
anton (sorry, can't write capital "a", my keyboard broken :-), the 
trouble is that I can see some ppl frustrated at ml .....
I don't know any other language, which would not have mysql scheme 
....
I did some preparations even for plug-in ... but nothing happened. 
To have NS kind of plug-in, not many C wrapped code would be needed 
imo!
Not investing much money in our PC shop, I would pay some ppl myself 
to do the job for me :-(
Anton
9-Jan-2006
[203]
I'd be crazy to add this to my schedule now. But ask me in about 
a month and I might look into it then.
Pekr
9-Jan-2006
[204x3]
working on some rebol stuff, if I might ask?
I would at least like to know, if checksum/secure uses typical SHa1 
method?
notice : this group is now web-public
Anton
9-Jan-2006
[207x2]
Of course, rebol, but also looking at getting broadband, and fixing 
other people's computers :-( Trojans galore last week.)
Goodness me, Petr, the checksum/secure question can be sooo easily 
answered. So easily, that I think an experienced reboler such as 
yourself in posing this question must be implying something else.
Pekr
9-Jan-2006
[209]
I don't understand what do you mean here. I probably know, from its 
help, that it supports md5 and sha1, but dunno how to use such fact 
in regards to mysql scheme. Why doc coded his own functions then? 
Or is it just that older auth schemes did not use typical sha1 hashing?
sqlab
9-Jan-2006
[210]
Only the /pro,  /command  and sdk  versions have this functions exposed
Pekr
9-Jan-2006
[211]
really?
sqlab
9-Jan-2006
[212]
If I remember, otherwise there is only encloak
Pekr
9-Jan-2006
[213]
I am not talking about encryption, just looking into 'checsum function 
help ... I just need hash ...
Anton
9-Jan-2006
[214]
We need the C code that they use to generate the checksum. That way 
we might see some comments or code which tell us how it is computed 
and if rebol's builtin checksum also does it.
Pekr
9-Jan-2006
[215x2]
I posted two links above to rebol.cz ...
Now - sorry if I am breaking some licenses, but I will post some 
stuff to my website, and remove it once we are finished:

http://www.rebol.cz/mysql/mysql-protocol.r
http://www.rebol.cz/mysql/password.c