summaryrefslogtreecommitdiff
path: root/lib/webrick/httpauth/htpasswd.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webrick/httpauth/htpasswd.rb')
-rw-r--r--lib/webrick/httpauth/htpasswd.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/webrick/httpauth/htpasswd.rb b/lib/webrick/httpauth/htpasswd.rb
index a4a80647d8..8a058861d3 100644
--- a/lib/webrick/httpauth/htpasswd.rb
+++ b/lib/webrick/httpauth/htpasswd.rb
@@ -32,7 +32,15 @@ module WEBrick
open(@path){|io|
while line = io.gets
line.chomp!
- user, pass = line.split(":")
+ case line
+ when %r!\A[^:]+:[a-zA-Z0-9./]{13}\z!
+ user, pass = line.split(":")
+ when /:\$/, /:{SHA}/
+ raise NotImplementedError,
+ 'MD5, SHA1 .htpasswd file not supported'
+ else
+ raise StandardError, 'bad .htpasswd file'
+ end
@passwd[user] = pass
end
}