From: <jh...@us...> - 2011-05-04 22:22:54
|
Revision: 284 http://etch.svn.sourceforge.net/etch/?rev=284&view=rev Author: jheiss Date: 2011-05-04 22:22:48 +0000 (Wed, 04 May 2011) Log Message: ----------- Update parsing of authentication key to be compatible with ruby 1.9. In 1.8 "\0"[0] == 0. In 1.9 "\0"[0] == "\0" Modified Paths: -------------- trunk/server/lib/etch/server.rb Modified: trunk/server/lib/etch/server.rb =================================================================== --- trunk/server/lib/etch/server.rb 2011-05-04 22:13:07 UTC (rev 283) +++ trunk/server/lib/etch/server.rb 2011-05-04 22:22:48 UTC (rev 284) @@ -78,9 +78,10 @@ # str = Base64.decode64(key) - # check header + + # check header (this is actually the length of the key type field) hdr = str.slice!(0..3) - unless hdr[0] == 0 && hdr[1] == 0 && hdr[2] == 0 && hdr[3] == 7 + if hdr.bytes.to_a != [0, 0, 0, 7] raise "Bad key format #{hdr}" end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2011-08-15 21:50:03
|
Revision: 299 http://etch.svn.sourceforge.net/etch/?rev=299&view=rev Author: thepob Date: 2011-08-15 21:49:55 +0000 (Mon, 15 Aug 2011) Log Message: ----------- adding etchdebuglog support per user request - there was an email thread about this one Modified Paths: -------------- trunk/server/lib/etch/server.rb Modified: trunk/server/lib/etch/server.rb =================================================================== --- trunk/server/lib/etch/server.rb 2011-07-09 00:36:49 UTC (rev 298) +++ trunk/server/lib/etch/server.rb 2011-08-15 21:49:55 UTC (rev 299) @@ -24,14 +24,16 @@ end @@configbase end - + @@auth_enabled = nil @@auth_deny_new_clients = nil + @@etchdebuglog = nil def self.read_config_file config_file = File.join(configbase, 'etchserver.conf') if File.exist?(config_file) auth_enabled = false auth_deny_new_clients = false + etchdebuglog = nil IO.foreach(config_file) do |line| # Skip blank lines and comments next if line =~ /^\s*$/ @@ -47,7 +49,11 @@ auth_deny_new_clients = true end end + if line =~ /^\s*etchdebuglog\s*=\s*(.*)/ + etchdebuglog = $1 + end end + @@etchdebuglog = etchdebuglog @@auth_enabled = auth_enabled @@auth_deny_new_clients = auth_deny_new_clients end @@ -203,12 +209,19 @@ @facts = facts @tag = tag @debug = debug - @dlogger = Logger.new(File.join(Rails.configuration.root_path, 'log', 'etchdebug.log')) + + if @@etchdebuglog + @dlogger = Logger.new(@@etchdebuglog) + else + @dlogger = Logger.new(File.join(Rails.configuration.root_path, 'log', 'etchdebug.log')) + end + if debug @dlogger.level = Logger::DEBUG else @dlogger.level = Logger::INFO end + @fqdn = @facts['fqdn'] if !@fqdn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-27 01:50:15
|
Revision: 327 http://etch.svn.sourceforge.net/etch/?rev=327&view=rev Author: jheiss Date: 2012-04-27 01:50:09 +0000 (Fri, 27 Apr 2012) Log Message: ----------- When passing a params key to Rails for possible storage in the database (various find_or_create_by_* calls), dup the key. This eliminates intermittent "RuntimeError: can't modify frozen String" errors I was getting from the test suite. The wisdom of the Internets seems to indicate that a hash key (all hash keys? or just params hash keys? it's not clear) can be or always are frozen, and thus dup'ing the key fixes the problem. It's a little strange that it's an intermittent problem, but the dup fix seems fairly cheap and harmless. Modified Paths: -------------- trunk/server/lib/etch/server.rb Modified: trunk/server/lib/etch/server.rb =================================================================== --- trunk/server/lib/etch/server.rb 2012-04-27 01:44:06 UTC (rev 326) +++ trunk/server/lib/etch/server.rb 2012-04-27 01:50:09 UTC (rev 327) @@ -231,7 +231,7 @@ # Update the stored facts for this client @client = Client.find_or_create_by_name(@fqdn) @facts.each do |key, value| - fact = Fact.find_or_create_by_client_id_and_key(:client_id => @client.id, :key => key, :value => value) + fact = Fact.find_or_create_by_client_id_and_key(:client_id => @client.id, :key => key.dup, :value => value) if fact.value != value fact.update_attributes(:value => value) end @@ -326,7 +326,7 @@ end request[:files][name][:orig] = origpath # Update the stored record of the original - original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name, :sum => sha1) + original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name.dup, :sum => sha1) if original.sum != sha1 original.update_attributes(:sum => sha1) end @@ -334,7 +334,7 @@ if filehash['sha1sum'] sha1 = filehash['sha1sum'] # Update the stored record of the original - original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name, :sum => sha1) + original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name.dup, :sum => sha1) if original.sum != sha1 original.update_attributes(:sum => sha1) end @@ -379,7 +379,7 @@ # setup and depend elements that we send to the client to ensure it # supplies a proper orig file. if !response[:need_orig][file] - config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => file, :config => config_xml.to_s) + config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => file.dup, :config => config_xml.to_s) if config.config != config_xml.to_s config.update_attributes(:config => config_xml.to_s) end @@ -429,7 +429,7 @@ commands_xml = Etch.xmlnewelem('allcommands', response_xml) response[:allcommands].each do |commandname, command_xml| # Update the stored record of the command - config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => commandname, :config => command_xml.to_s) + config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => commandname.dup, :config => command_xml.to_s) if config.config != command_xml.to_s config.update_attributes(:config => command_xml.to_s) end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |