From: Philippe C. <sql...@pa...> - 2008-05-31 11:12:55
|
Lionel Bouton wrote: > Without patching SQLgrey, you might have luck changing the my.cnf file > to change the default client charset (assuming you don't have other > clients needing to connect with a different charset to the same > system). If you want to hack SQLgrey, look for the end of the > connectdb method, it already has a special case for MySQL > (auto-reconnect as MySQL routinely drops conections by default...). > You can then send the SQL query setting the character set you need at > this point : > > $self->{sqlgrey}{dbh}->do("SET CHARACTER SET LATIN1") > > The MySQL doc isn't clear about what happens when the client > auto-reconnects... so your mileage may vary. It would be great if the > DBD driver would allow to set the character set at connection-time, > but I had no luck browsing it's documentation either. So I made this change back on April 3rd: ------------------------------------------------------------------------ # mysql drops the connection, we have some glue code # to reinit the connection, but better use mysql DBD code if ($self->MySQL()) { $self->{sqlgrey}{dbh}->do("SET CHARACTER SET LATIN1") or $self->mylog('dbaccess', 0, "can't set connection character set to LATIN1: $DBI::errstr"); $self->{sqlgrey}{dbh}->{mysql_auto_reconnect} = 1; } ------------------------------------------------------------------------ and yesterday I got this: ------------------------------------------------------------------------ May 30 14:23:24 hobbes postfix/smtpd[28381]: warning: 190.172.137.78: address not listed for hostname 190-172-137-78.speedy.com.ar May 30 14:23:24 hobbes postfix/smtpd[28381]: connect from unknown[190.172.137.78] May 30 14:23:26 hobbes postfix/pickup[28070]: 73E491AFEA9: uid=102 from=<sqlgrey> May 30 14:23:26 hobbes postfix/cleanup[28424]: 73E491AFEA9: message-id=<200...@ho...> May 30 14:23:26 hobbes postfix/qmgr[15197]: 73E491AFEA9: from=<sq...@ho...>, size=490, nrcpt=1 (queue active) May 30 14:23:26 hobbes sqlgrey: warning: Use of uninitialized value in concatenation (.) or string at /usr/sbin/sqlgrey line 1143. May 30 14:23:26 hobbes sqlgrey: dbaccess: error: couldn't access from_awl table: May 30 14:23:26 hobbes sqlgrey: grey: from awl match: updating 190.172.137.78(190.172.137.78), m<FC>ll...@ly...(m<FC>ll...@ly...) ------------------------------------------------------------------------ So I got a new warning about a bad concatenation/string when I got a non [A-Za-z] letter (the "<FC>"). The line referenced above is the mylog() line below from is_in_from_awl(): ------------------------------------------------------------------------ if (!defined $sth or !$sth->execute($sender_name, $sender_domain, $host)) { $self->db_unavailable(); $self->mylog('dbaccess', 0, "error: couldn't access $from_awl table: $DBI::errstr"); return 1; # in doubt, accept } else { ------------------------------------------------------------------------ I went back through my logs trying to see if I could find any other non [A-Za-z] characters in e-mail addresses in sqlgrey lines since April and I couldn't find any. (Note that does not mean that they're weren't any -- I had 26 megs of sqlgrey lines from that time and I don't quite know what to grep for to find 'em.) So the two questions I have at this point are: 1.) Lionel, any suggestions what to do to debug this warning so I can get the real error? 2.) Anybody know a grep regexp for pulling out e-mail addresses with those non [A-Za-z] characters? -- .----------. ,----------== Peep ==----------, / .-. .-. \ `-== (Philippe Chaintreuil) ==-` / | | | | \ On The Other Side Of The Wall! \ `-' `-' _/ FidoNet Netmail Address: /\ .--. / | 1:2613/118 \ | / / / / InterNet Address: / | `--' /\ \ pe...@pa... /`-------' \ \ --PiCTuRe By aN uNKNoWN aSCii aRTiST-- "We're just two lost souls swimming in a fish bowl..." |