Logout problem

5 views
Skip to first unread message

Bram

unread,
Apr 2, 2008, 7:20:16 AM4/2/08
to RubyCAS
I have a mssql database to authenticate the users in the rubycas-
server. I needed to configure some rubyODBC stuff. I used this site
tutorial http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux

The problem is, when i use the login function it works fine. Although
if i use the logout function it goes wrong. I get the
ActiveRecord::StatementInvalid Mysql::Error:. I don't know why but as
you can see it is trying to use the mysql instead of mssql
(sqlserver). Anyone familiar with this problem,

Thanks.

Matt Zukowski

unread,
Apr 2, 2008, 11:00:00 AM4/2/08
to RubyCAS
Bram can you post the backtrace that gets printed along with the
error? This would help narrow down what piece of code is causing the
problem.

Also, what version of the server are you using?

On Apr 2, 7:20 am, Bram <bram.kemp...@gmail.com> wrote:
> I have a mssql database to authenticate the users in the rubycas-
> server. I needed to configure some rubyODBC stuff. I used this site
> tutorialhttp://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLSer...

Bram

unread,
Apr 3, 2008, 9:40:25 AM4/3/08
to RubyCAS
Hmm to give an update on the status, i thought it was the mssql, but
now i'v changed it back to a local mysql database and i got the same
error. And i'm not quite sure why it's there. I got this error:

"
Camping Problem!
CASServer::Controllers::Logout.GET
ActiveRecord::StatementInvalid Mysql::Error: Unknown column 'username'
in 'where clause': SELECT * FROM `casserver_pgt` WHERE (username =
'bram') :

* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/connection_adapters/abstract_adapter.rb:151:in `log'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/connection_adapters/mysql_adapter.rb:299:in `execute'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/connection_adapters/mysql_adapter.rb:499:in `select'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/connection_adapters/abstract/query_cache.rb:55:in
`select_all'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/base.rb:539:in `find_by_sql'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/base.rb:1282:in `find_every'
* /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2.9053/lib/
active_record/base.rb:510:in `find'
* /usr/lib/ruby/gems/1.8/gems/rubycas-server-0.5.1/lib/casserver/
controllers.rb:193:in `get'
* (eval):27:in `send'
* (eval):27:in `service'
* (eval):46:in `run'
"
And it continues... If you want you can see the error @
http://cas2.opensourcecompany.nl
login with bram:cipier
if you go manually to the logout page you see the error. Don't know
where to look,

Thx

Matt Zukowski

unread,
Apr 3, 2008, 11:34:50 AM4/3/08
to RubyCAS
Bram, did you modify the original RubyCAS-Server code at all?

I see in your post that the query being generated is:

SELECT * FROM `casserver_pgt` WHERE (username = 'bram')

But that doesn't make sense -- the query should be a lot more
comlicated... something like this:

SELECT `casserver_pgt`.*, `casserver_st`.* LEFT OUTER JOIN
`casserver_st` ON `casserver_st`.id =
`casserver_pgt`.service_ticket_id AND `casserver_st`.`type` =
'ServiceTicket' WHERE (username = 'bram')

... at least that's the query ActiveRecord generates for me when I do
a logout.

Can you open up this file: /usr/lib/ruby/gems/1.8/gems/rubycas-
server-0.5.1/lib/casserver/controller.rb, and on line 193 tell me if
you have this:

pgts = CASServer::Models::ProxyGrantingTicket.find(:all,
:conditions => ["username = ?", tgt.username],
:include => :service_ticket)

The ':include => :service_ticket' part tells ActiveRecord to generate
a query that includes the service_tickets table, but your query seems
to be missing this table. I want to confirm that your code indeed
shows this.



In any case, maybe try upgrading to the lastest version of rubycas
(0.6.0)? This would ensure that there are no problems with the code
you have in place...
> And it continues... If you want you can see the error @http://cas2.opensourcecompany.nl

Matt Zukowski

unread,
Apr 3, 2008, 11:38:46 AM4/3/08
to RubyCAS
By the way, it looks like you're using a development version of
ActiveRecord (2.0.2.9053, rather than just 2.0.2). Maybe this is the
source of the problem -- there might be something wrong with the
ActiveRecord library you have installed?

On Apr 3, 9:40 am, Bram <bram.kemp...@gmail.com> wrote:
> And it continues... If you want you can see the error @http://cas2.opensourcecompany.nl

Bram

unread,
Apr 3, 2008, 12:06:23 PM4/3/08
to RubyCAS
Ok i see :),
thanks for helping me, but i see i have installed also 2.0.2 any idea
how i can get it back to 2.0.2?

Matt Zukowski

unread,
Apr 3, 2008, 12:13:16 PM4/3/08
to rubycas...@googlegroups.com
Try:

gem uninstall activerecord

Then it should show you a list installed versions. Select the 2.0.2.9053 version to uninstall it. Keep just the normal 2.0.2.

Bram

unread,
Apr 4, 2008, 5:11:48 AM4/4/08
to RubyCAS
I checked the code, seems fine to me.

if tgt
pgts = CASServer::Models::ProxyGrantingTicket.find(:all,
:conditions => ["username = ?", tgt.username],
:include => :service_ticket)
pgts.each do |pgt|
$LOG.debug("Deleting Proxy-Granting Ticket '#{pgt}' for user
'#{pgt.service_ticket.username}'")
pgt.destroy
end

I have updated the rubycas-server to 0.6, uninstalled the activerecord
2.0.2.9053 version. The only problem i have now is that it keeps
searching for the activerecord 2.0.2.9053 version when i try to
startup the rubycas-server.

/usr/local/lib/site_ruby/1.8/rubygems.rb:319:in `activate': can't
activate activesupport (= 2.0.2), already activated
activesupport-2.0.2.9053] (Gem::Exception)

btw thanks for all the support, i'm kinda noob in this. :)

On Apr 3, 6:13 pm, "Matt Zukowski" <matt.zukow...@gmail.com> wrote:
> Try:
>
> gem uninstall activerecord
>
> Then it should show you a list installed versions. Select the 2.0.2.9053
> version to uninstall it. Keep just the normal 2.0.2.
>

Bram

unread,
Apr 7, 2008, 4:32:44 AM4/7/08
to RubyCAS
Solved the problem. I uninstalled activerecord instead of
activesupport the first time. How stupid :). Anyway I uninstalled both
and downloaded the 2 gems. Installed them with -local to be sure i got
the right version gems. It works fine now including the logout
function. I also updated the rubycas-server to 0.6.0, but i noticed
that the 'rubycas-server -v' gives a 'gem_original_require' error. Is
het me again?

Matt Zukowski

unread,
Apr 7, 2008, 11:41:13 AM4/7/08
to RubyCAS
No it's not you this time :) Looks like you found a bug. I'll get this
fixed asap.
Reply all
Reply to author
Forward
0 new messages