File: extconf.rb

package info (click to toggle)
ruby-password 0.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 240 kB
  • ctags: 76
  • sloc: ruby: 407; ansic: 48; makefile: 4
file content (62 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# extconf for Ruby/Password
#
# $Id: extconf.rb,v 1.13 2006/03/02 17:35:06 ianmacd Exp $

require 'mkmf'

search_dicts = %w(
  /usr/local/lib/pw_dict.pwd
  /usr/lib/pw_dict.pwd
  /opt/lib/pw_dict.pwd
  /usr/local/lib/cracklib_dict.pwd
  /usr/lib/cracklib_dict.pwd
  /opt/lib/cracklib_dict.pwd
  /var/cache/cracklib/cracklib_dict.pwd
)

if dict = with_config('crack-dict')
  search_dicts.unshift(dict)
end

crack_dict = nil

# find the crack dictionary
print "checking for cracklib dictionary... "

search_dicts.each do |dict|
  # create a header file pointing to the crack dictionary
  if File.exist?(dict)
    puts dict
    crack_dict = dict.sub(/\.pwd/, '')
    break
  end
end

if crack_dict.nil?
  puts "no\nCouldn't find a cracklib dictionary on this system"
  exit 1
end

hfile = File.new("rbcrack.h", 'w')
hfile.printf("#define CRACK_DICT \"%s\"\n", crack_dict)
hfile.close

have_header('crack.h') && have_library('crack', 'FascistCheck') or exit 1

create_makefile('password_crack')

File.open('Makefile', 'a') do |f|
  f.print <<EOF

extra-clean:	distclean
		-rm -rf rbcrack.h doc/

docs:
		-rdoc -x CVS rbcrack.c lib

test:		password_crack.so FORCE
		-cd test; ./tc_password.rb

FORCE:
EOF
end