#15 select returned more than one result

closed-fixed
nobody
None
5
2005-06-12
2004-07-26
Brian
No

I was getting "select returned more than one result" in
my logs once and a while. I knew this was not possible
because usernames must be unique in the database. So
I modified the sorce to log the query when there was
more than one result. Line 521:

if (mysql_num_rows(result) != 1) {
syslog(LOG_ERR, "%s", "pam_mysql:
select returned more than one result");
syslog(LOG_ERR, "pam_mysql: %s",
sql);
mysql_free_result(result);
return PAM_AUTH_ERR;
}

With this, I would see this in my logs:

pam_mysql: select returned more than one result
pam_mysql: ^HP^O^HH÷^N^H
pam_mysql: select returned more than one result
pam_mysql: \230Z^N^H^PĂ^M^H
pam_mysql: select returned more than one result
pam_mysql: čß^RBčß^RBassword FROM mailbox WHERE
username='demo'
pam_mysql: select returned more than one result
pam_mysql: u^N^Hx^H^N^H
pam_mysql: select returned more than one result
pam_mysql: ř\221^N^HČ8^N^H
pam_mysql: select returned more than one result
pam_mysql: \200Ž^N^H°T^N^H
pam_mysql: select returned more than one result
pam_mysql: XĘ^N^H(q^N^H
pam_mysql: select returned more than one result
pam_mysql: `ć^N^H\220\214^N^H
pam_mysql: select returned more than one result
pam_mysql: 8^B^O^H^HŠ^N^H
pam_mysql: select returned more than one result
pam_mysql: @^^^O^HpÄ^N^H
pam_mysql: select returned more than one result
pam_mysql: ^X:^O^Hčŕ^N^H
pam_mysql: select returned more than one result
pam_mysql: @W^O^H\200ţ^N^H

This looks like escaping\hack attempts. If this is the
queries actually sent to the database, someone may be
able to escape out the entire query and send their own.
(or I could just be thinking too much) I am only
concerned with security... Should the input be checked
more?

Brian

Discussion

    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=995831

    The problem you reported will most likely be cleared in 0.6.

     
  • Brian
    Brian
    2005-06-12

    Logged In: YES
    user_id=712768

    I am glad to hear that. Do you know a time frame for the
    newer release? So I know when to check back....

     
  • Logged In: YES
    user_id=995831

    0.6 will be released tomorrow (13 Jun) if no showstopper found.