Jim Jeffers
2005-Sep-20 22:14 UTC
URGENT: SHA1 crashing application when it hosted remotely.
Hey guys, Sorry I need a quick response. I have an app that I need to deploy today. I''m hosting it on DreamHost but for some reason anytime I need to call my user login method which encrypts the users password with SHA1 the application crashes. This exact same app runs fine on my system. Is there a .rb file I need to put in my /lib directory because the sha1 gem isn''t installed on the host machine? Here is the error I have in my production log: --------------------------------------------------------------- Processing SystemController#create (for 149.169.89.196 at Tue Sep 20 15:08:46 PDT 2005) Parameters: {"user"=>{"name"=>"skogan-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org", "level"=>"administrator", "password"=>"test", "email"=>"test-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org"}, "commit"=>"Create", "action"=>"create", "controller"=>"system"} NameError (uninitialized constant SHA1): /usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/ active_support/dependencies.rb:186:in `const_missing'' /app/models/user.rb:37:in `hash_password'' /app/models/user.rb:11:in `before_create'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/callbacks.rb:348:in `send'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/callbacks.rb:348:in `callback'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/callbacks.rb:260:in `create_without_timestamps'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/timestamp.rb:30:in `create'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/base.rb:1139:in `create_or_update_without_callbacks'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/callbacks.rb:249:in `create_or_update'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/base.rb:965:in `save_without_validation'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/validations.rb:650:in `save_without_transactions'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/transactions.rb:128:in `save'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/transactions.rb:128:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/transactions.rb:93:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/transactions.rb:120:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ active_record/transactions.rb:128:in `save'' /app/controllers/system_controller.rb:27:in `create'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/base.rb:756:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/base.rb:756:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/filters.rb:295:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/benchmarking.rb:41:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/rescue.rb:80:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/base.rb:356:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/base.rb:356:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' /lib/fcgi_handler.rb:136:in `process_request'' /lib/fcgi_handler.rb:62:in `process!'' /lib/fcgi_handler.rb:53:in `each_cgi'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' /lib/fcgi_handler.rb:53:in `process!'' /lib/fcgi_handler.rb:20:in `process!'' dispatch.fcgi:24
Jim Jeffers
2005-Sep-20 22:17 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Also, My code in the user model is as follows: require "digest/sha1" class User < ActiveRecord::Base ..... private def self.hash_password(password) Digest::SHA1.hexdigest(password) end ---------- I''m assuming the code is ok as it runs fine on my test machine but SHA1 needs to be installed or included on the host? Thanks guys! - Jim On Sep 20, 2005, at 3:14 PM, Jim Jeffers wrote:> Hey guys, > > Sorry I need a quick response. I have an app that I need to deploy > today. I''m hosting it on DreamHost but for some reason anytime I > need to call my user login method which encrypts the users password > with SHA1 the application crashes. > > This exact same app runs fine on my system. Is there a .rb file I > need to put in my /lib directory because the sha1 gem isn''t > installed on the host machine? Here is the error I have in my > production log: > > --------------------------------------------------------------- > Processing SystemController#create (for 149.169.89.196 at Tue Sep > 20 15:08:46 PDT 2005) > Parameters: {"user"=>{"name"=>"skogan-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org", > "level"=>"administrator", "password"=>"test", > "email"=>"test-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org"}, "commit"=>"Create", > "action"=>"create", "controller"=>"system"} > > > NameError (uninitialized constant SHA1): > /usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/ > active_support/dependencies.rb:186:in `const_missing'' > /app/models/user.rb:37:in `hash_password'' > /app/models/user.rb:11:in `before_create'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/callbacks.rb:348:in `send'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/callbacks.rb:348:in `callback'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/callbacks.rb:260:in `create_without_timestamps'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/timestamp.rb:30:in `create'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/base.rb:1139:in `create_or_update_without_callbacks'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/callbacks.rb:249:in `create_or_update'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/base.rb:965:in `save_without_validation'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/validations.rb:650:in `save_without_transactions'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/transactions.rb:128:in `save'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/transactions.rb:128:in `transaction'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/transactions.rb:93:in `transaction'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/transactions.rb:120:in `transaction'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > active_record/transactions.rb:128:in `save'' > /app/controllers/system_controller.rb:27:in `create'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/base.rb:756:in `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/base.rb:756:in `perform_action_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/filters.rb:295:in `perform_action_without_benchmark'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/benchmarking.rb:41:in `measure'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/rescue.rb:80:in `perform_action'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/base.rb:356:in `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > action_controller/base.rb:356:in `process'' > /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb: > 32:in `dispatch'' > /lib/fcgi_handler.rb:136:in `process_request'' > /lib/fcgi_handler.rb:62:in `process!'' > /lib/fcgi_handler.rb:53:in `each_cgi'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' > /lib/fcgi_handler.rb:53:in `process!'' > /lib/fcgi_handler.rb:20:in `process!'' > dispatch.fcgi:24 > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Ezra Zygmuntowicz
2005-Sep-20 22:40 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Jim- Can you drop into an irb session on dreamhost and require "digest/sha1" return true? I believe that digest/sha1 is in the std library if I''m not mistaken. -Ezra On Sep 20, 2005, at 3:17 PM, Jim Jeffers wrote:> Also, > > My code in the user model is as follows: > > require "digest/sha1" > > class User < ActiveRecord::Base > > ..... > > private > def self.hash_password(password) > Digest::SHA1.hexdigest(password) > end > > > > ---------- > I''m assuming the code is ok as it runs fine on my test machine but > SHA1 needs to be installed or included on the host? > > Thanks guys! > > - Jim > > > > On Sep 20, 2005, at 3:14 PM, Jim Jeffers wrote: > > >> Hey guys, >> >> Sorry I need a quick response. I have an app that I need to >> deploy today. I''m hosting it on DreamHost but for some reason >> anytime I need to call my user login method which encrypts the >> users password with SHA1 the application crashes. >> >> This exact same app runs fine on my system. Is there a .rb file I >> need to put in my /lib directory because the sha1 gem isn''t >> installed on the host machine? Here is the error I have in my >> production log: >> >> --------------------------------------------------------------- >> Processing SystemController#create (for 149.169.89.196 at Tue Sep >> 20 15:08:46 PDT 2005) >> Parameters: {"user"=>{"name"=>"skogan-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org", >> "level"=>"administrator", "password"=>"test", >> "email"=>"test-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org"}, "commit"=>"Create", >> "action"=>"create", "controller"=>"system"} >> >> >> NameError (uninitialized constant SHA1): >> /usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/ >> active_support/dependencies.rb:186:in `const_missing'' >> /app/models/user.rb:37:in `hash_password'' >> /app/models/user.rb:11:in `before_create'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/callbacks.rb:348:in `send'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/callbacks.rb:348:in `callback'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/callbacks.rb:260:in `create_without_timestamps'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/timestamp.rb:30:in `create'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/base.rb:1139:in `create_or_update_without_callbacks'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/callbacks.rb:249:in `create_or_update'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/base.rb:965:in `save_without_validation'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/validations.rb:650:in `save_without_transactions'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/transactions.rb:128:in `save'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/transactions.rb:128:in `transaction'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/transactions.rb:93:in `transaction'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/transactions.rb:120:in `transaction'' >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >> active_record/transactions.rb:128:in `save'' >> /app/controllers/system_controller.rb:27:in `create'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/base.rb:756:in `send'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/base.rb:756:in `perform_action_without_filters'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/filters.rb:295:in >> `perform_action_without_benchmark'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/benchmarking.rb:41:in >> `perform_action_without_rescue'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/benchmarking.rb:41:in `measure'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/benchmarking.rb:41:in >> `perform_action_without_rescue'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/rescue.rb:80:in `perform_action'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/base.rb:356:in `send'' >> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >> action_controller/base.rb:356:in `process'' >> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb: >> 32:in `dispatch'' >> /lib/fcgi_handler.rb:136:in `process_request'' >> /lib/fcgi_handler.rb:62:in `process!'' >> /lib/fcgi_handler.rb:53:in `each_cgi'' >> /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' >> /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' >> /lib/fcgi_handler.rb:53:in `process!'' >> /lib/fcgi_handler.rb:20:in `process!'' >> dispatch.fcgi:24 >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Jim Jeffers
2005-Sep-21 17:09 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Ezra, The line: require "digest/sha1" Does not cause the app to crash as it is declared at the top of my class. The issue only arises when I need to call the self.hash_password method. However, the line actually calling SHA1:>> Digest::SHA1.hexdigest(password)The actual error stating that: NameError (uninitialized constant SHA1) What''s confusing is this code apparently works without a hitch on my demo machine but not the webhost. - Jim On Sep 20, 2005, at 3:40 PM, Ezra Zygmuntowicz wrote:> Jim- > Can you drop into an irb session on dreamhost and require > "digest/sha1" return true? I believe that digest/sha1 is in the std > library if I''m not mistaken. > -Ezra > > > On Sep 20, 2005, at 3:17 PM, Jim Jeffers wrote: > > >> Also, >> >> My code in the user model is as follows: >> >> require "digest/sha1" >> >> class User < ActiveRecord::Base >> >> ..... >> >> private >> def self.hash_password(password) >> Digest::SHA1.hexdigest(password) >> end >> >> >> >> ---------- >> I''m assuming the code is ok as it runs fine on my test machine but >> SHA1 needs to be installed or included on the host? >> >> Thanks guys! >> >> - Jim >> >> >> >> On Sep 20, 2005, at 3:14 PM, Jim Jeffers wrote: >> >> >> >>> Hey guys, >>> >>> Sorry I need a quick response. I have an app that I need to >>> deploy today. I''m hosting it on DreamHost but for some reason >>> anytime I need to call my user login method which encrypts the >>> users password with SHA1 the application crashes. >>> >>> This exact same app runs fine on my system. Is there a .rb file >>> I need to put in my /lib directory because the sha1 gem isn''t >>> installed on the host machine? Here is the error I have in my >>> production log: >>> >>> --------------------------------------------------------------- >>> Processing SystemController#create (for 149.169.89.196 at Tue Sep >>> 20 15:08:46 PDT 2005) >>> Parameters: {"user"=>{"name"=>"skogan-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org", >>> "level"=>"administrator", "password"=>"test", >>> "email"=>"test-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org"}, "commit"=>"Create", >>> "action"=>"create", "controller"=>"system"} >>> >>> >>> NameError (uninitialized constant SHA1): >>> /usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/ >>> active_support/dependencies.rb:186:in `const_missing'' >>> /app/models/user.rb:37:in `hash_password'' >>> /app/models/user.rb:11:in `before_create'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/callbacks.rb:348:in `send'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/callbacks.rb:348:in `callback'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/callbacks.rb:260:in `create_without_timestamps'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/timestamp.rb:30:in `create'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/base.rb:1139:in `create_or_update_without_callbacks'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/callbacks.rb:249:in `create_or_update'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/base.rb:965:in `save_without_validation'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/validations.rb:650:in `save_without_transactions'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/transactions.rb:128:in `save'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/transactions.rb:128:in `transaction'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/transactions.rb:93:in `transaction'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/transactions.rb:120:in `transaction'' >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ >>> active_record/transactions.rb:128:in `save'' >>> /app/controllers/system_controller.rb:27:in `create'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/base.rb:756:in `send'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/base.rb:756:in `perform_action_without_filters'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/filters.rb:295:in >>> `perform_action_without_benchmark'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/benchmarking.rb:41:in >>> `perform_action_without_rescue'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/benchmarking.rb:41:in `measure'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/benchmarking.rb:41:in >>> `perform_action_without_rescue'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/rescue.rb:80:in `perform_action'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/base.rb:356:in `send'' >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ >>> action_controller/base.rb:356:in `process'' >>> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb: >>> 32:in `dispatch'' >>> /lib/fcgi_handler.rb:136:in `process_request'' >>> /lib/fcgi_handler.rb:62:in `process!'' >>> /lib/fcgi_handler.rb:53:in `each_cgi'' >>> /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' >>> /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' >>> /lib/fcgi_handler.rb:53:in `process!'' >>> /lib/fcgi_handler.rb:20:in `process!'' >>> dispatch.fcgi:24 >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> >>> >>> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Joe Van Dyk
2005-Sep-21 17:17 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Can you call that function via irb on the problematic machine? On 9/21/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote:> Ezra, > > The line: > require "digest/sha1" > > Does not cause the app to crash as it is declared at the top of my > class. The issue only arises when I need to call the > self.hash_password method. > > However, the line actually calling SHA1: > >> Digest::SHA1.hexdigest(password) > > The actual error stating that: > NameError (uninitialized constant SHA1) > > What''s confusing is this code apparently works without a hitch on my > demo machine but not the webhost. > > - Jim > > On Sep 20, 2005, at 3:40 PM, Ezra Zygmuntowicz wrote: > > > Jim- > > Can you drop into an irb session on dreamhost and require > > "digest/sha1" return true? I believe that digest/sha1 is in the std > > library if I''m not mistaken. > > -Ezra > > > > > > On Sep 20, 2005, at 3:17 PM, Jim Jeffers wrote: > > > > > >> Also, > >> > >> My code in the user model is as follows: > >> > >> require "digest/sha1" > >> > >> class User < ActiveRecord::Base > >> > >> ..... > >> > >> private > >> def self.hash_password(password) > >> Digest::SHA1.hexdigest(password) > >> end > >> > >> > >> > >> ---------- > >> I''m assuming the code is ok as it runs fine on my test machine but > >> SHA1 needs to be installed or included on the host? > >> > >> Thanks guys! > >> > >> - Jim > >> > >> > >> > >> On Sep 20, 2005, at 3:14 PM, Jim Jeffers wrote: > >> > >> > >> > >>> Hey guys, > >>> > >>> Sorry I need a quick response. I have an app that I need to > >>> deploy today. I''m hosting it on DreamHost but for some reason > >>> anytime I need to call my user login method which encrypts the > >>> users password with SHA1 the application crashes. > >>> > >>> This exact same app runs fine on my system. Is there a .rb file > >>> I need to put in my /lib directory because the sha1 gem isn''t > >>> installed on the host machine? Here is the error I have in my > >>> production log: > >>> > >>> --------------------------------------------------------------- > >>> Processing SystemController#create (for 149.169.89.196 at Tue Sep > >>> 20 15:08:46 PDT 2005) > >>> Parameters: {"user"=>{"name"=>"skogan-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org", > >>> "level"=>"administrator", "password"=>"test", > >>> "email"=>"test-kOlqXI3gPrBKxeuEPmsnZA@public.gmane.org"}, "commit"=>"Create", > >>> "action"=>"create", "controller"=>"system"} > >>> > >>> > >>> NameError (uninitialized constant SHA1): > >>> /usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/ > >>> active_support/dependencies.rb:186:in `const_missing'' > >>> /app/models/user.rb:37:in `hash_password'' > >>> /app/models/user.rb:11:in `before_create'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/callbacks.rb:348:in `send'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/callbacks.rb:348:in `callback'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/callbacks.rb:260:in `create_without_timestamps'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/timestamp.rb:30:in `create'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/base.rb:1139:in `create_or_update_without_callbacks'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/callbacks.rb:249:in `create_or_update'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/base.rb:965:in `save_without_validation'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/validations.rb:650:in `save_without_transactions'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/transactions.rb:128:in `save'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/transactions.rb:128:in `transaction'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/transactions.rb:93:in `transaction'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/transactions.rb:120:in `transaction'' > >>> /usr/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/ > >>> active_record/transactions.rb:128:in `save'' > >>> /app/controllers/system_controller.rb:27:in `create'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/base.rb:756:in `send'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/base.rb:756:in `perform_action_without_filters'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/filters.rb:295:in > >>> `perform_action_without_benchmark'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/benchmarking.rb:41:in > >>> `perform_action_without_rescue'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/benchmarking.rb:41:in `measure'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/benchmarking.rb:41:in > >>> `perform_action_without_rescue'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/rescue.rb:80:in `perform_action'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/base.rb:356:in `send'' > >>> /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ > >>> action_controller/base.rb:356:in `process'' > >>> /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb: > >>> 32:in `dispatch'' > >>> /lib/fcgi_handler.rb:136:in `process_request'' > >>> /lib/fcgi_handler.rb:62:in `process!'' > >>> /lib/fcgi_handler.rb:53:in `each_cgi'' > >>> /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' > >>> /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' > >>> /lib/fcgi_handler.rb:53:in `process!'' > >>> /lib/fcgi_handler.rb:20:in `process!'' > >>> dispatch.fcgi:24 > >>> > >>> _______________________________________________ > >>> Rails mailing list > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>> > >>> > >>> > >>> > >>> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Steven Critchfield
2005-Sep-21 17:26 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
On Wed, 2005-09-21 at 10:09 -0700, Jim Jeffers wrote:> Ezra, > > The line: > require "digest/sha1" > > Does not cause the app to crash as it is declared at the top of my > class. The issue only arises when I need to call the > self.hash_password method.Correct. require returns a true or false as to whether it completed the requested task. http://www.ruby-doc.org/core/classes/Kernel.html#M001745> However, the line actually calling SHA1: > >> Digest::SHA1.hexdigest(password) > > The actual error stating that: > NameError (uninitialized constant SHA1) > > What''s confusing is this code apparently works without a hitch on my > demo machine but not the webhost.Because Class names are Constants in ruby, if you can not load the digest/sha1 library and you didn''t test for success or failure of the load, you are left with the failure coming at the time you try to access the Constant. That is the reason you where asked to check to see if require ''digest/sha1'' returned true via console on your webhost. You may very well just need to provide a better search path to the standard library on your webhost. -- Steven Critchfield <critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org>
Daniel Hobe
2005-Sep-21 17:42 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Use the OpenSSL SHA1 module: require ''openssl'' OpenSSL::Digest::SHA1.hexdigest(''foo'') I''ve had problems with digest/sha1 giving SEGVs before. The openssl version should be faster than digest/sha1 too. Jim Jeffers wrote:> Hey guys, > > Sorry I need a quick response. I have an app that I need to deploy > today. I''m hosting it on DreamHost but for some reason anytime I need > to call my user login method which encrypts the users password with > SHA1 the application crashes. > > This exact same app runs fine on my system. Is there a .rb file I need > to put in my /lib directory because the sha1 gem isn''t installed on the > host machine? Here is the error I have in my production log: >
Jim Jeffers
2005-Sep-22 05:21 UTC
Re: URGENT: SHA1 crashing application when it hosted remotely.
Daniel, That did the trick! Thanks! - Jim On Sep 21, 2005, at 10:42 AM, Daniel Hobe wrote:> Use the OpenSSL SHA1 module: > > require ''openssl'' > OpenSSL::Digest::SHA1.hexdigest(''foo'') > > > I''ve had problems with digest/sha1 giving SEGVs before. The > openssl version should be faster than digest/sha1 too. > > > Jim Jeffers wrote: > >> Hey guys, >> Sorry I need a quick response. I have an app that I need to >> deploy today. I''m hosting it on DreamHost but for some reason >> anytime I need to call my user login method which encrypts the >> users password with SHA1 the application crashes. >> This exact same app runs fine on my system. Is there a .rb file >> I need to put in my /lib directory because the sha1 gem isn''t >> installed on the host machine? Here is the error I have in my >> production log: >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >