1 | /*:VRX _FindHtpasswd
|
---|
2 | */
|
---|
3 | _FindHtpasswd:
|
---|
4 | /* htpasswd.exe - required for SWAT but not really part of Samba */
|
---|
5 | samba.!htpasswdexe = ""
|
---|
6 | if samba.!htpasswdexe = "" then do /* INI entry */
|
---|
7 | call charout , " Do we have an INI entry for Apache? "
|
---|
8 | apachepath = VRGetIni( "Apache", "Path", samba.!bin'\sscc.ini' )
|
---|
9 | say apachepath
|
---|
10 | samba.!htpasswdexe = apachepath'\htpasswd.exe'
|
---|
11 | if \VRFileExists(samba.!htpasswdexe) then do /* It is invalid! */
|
---|
12 | samba.!htpasswdexe = ""
|
---|
13 | ok = VRDelIni( "Apache", "Path", samba.!bin'\sscc.ini' )
|
---|
14 | end
|
---|
15 | end
|
---|
16 | if samba.!htpasswdexe = "" then do /* in current directory? */
|
---|
17 | call charout , " Is htpasswd.exe in current directory? "
|
---|
18 | ok = SysFileTree('.\htpasswd.exe', exist.,'FO')
|
---|
19 | say exist.0' (1 = Yes, 0 = No)'
|
---|
20 | if exist.0 = 1 then samba.!htpasswdexe = exist.1
|
---|
21 | end
|
---|
22 | if samba.!htpasswdexe = "" then do /* in parent directory? */
|
---|
23 | call charout , " Is htpasswd.exe in parent directory? "
|
---|
24 | ok = SysFileTree('..\htpasswd.exe', exist.,'FO')
|
---|
25 | say exist.0' (1 = Yes, 0 = No)'
|
---|
26 | if exist.0 = 1 then samba.!htpasswdexe = exist.1
|
---|
27 | end
|
---|
28 | if samba.!htpasswdexe = "" then do /* in ..\BIN directory? */
|
---|
29 | call charout , " Is htpasswd.exe in ..\BIN directory? "
|
---|
30 | ok = SysFileTree('..\bin\htpasswd.exe', exist.,'FO')
|
---|
31 | say exist.0' (1 = Yes, 0 = No)'
|
---|
32 | if exist.0 = 1 then samba.!htpasswdexe = exist.1
|
---|
33 | end
|
---|
34 | if samba.!htpasswdexe = "" then do /* in \apache2\bin */
|
---|
35 | call charout , " Is htpasswd.exe in "SysBootDrive()"\apache2\bin path? "
|
---|
36 | ok = SysFileTree(SysBootDrive()'\apache2\bin\htpasswd.exe', exist.,'FO')
|
---|
37 | say exist.0' (1 = Yes, 0 = No)'
|
---|
38 | if exist.0 = 1 then samba.!htpasswdexe = exist.1
|
---|
39 | end
|
---|
40 | if samba.!htpasswdexe = "" then do /* in ..\..\apache2\bin */
|
---|
41 | call charout , " Is htpasswd.exe in ..\..\apache2\bin path? "
|
---|
42 | ok = SysFileTree('..\..\apache2\bin\htpasswd.exe', exist.,'FO')
|
---|
43 | say exist.0' (1 = Yes, 0 = No)'
|
---|
44 | if exist.0 = 1 then samba.!htpasswdexe = exist.1
|
---|
45 | end
|
---|
46 |
|
---|
47 | if samba.!htpasswdexe = "" then do /* in PATH ? */
|
---|
48 | call charout , " Is htpasswd.exe in PATH? "
|
---|
49 | samba.!htpasswdexe = SysSearchPath("PATH","htpasswd.exe")
|
---|
50 | if samba.!htpasswdexe = "" then say "No."; else say "Yes."
|
---|
51 | end
|
---|
52 |
|
---|
53 | if samba.!htpasswdexe = "" then do
|
---|
54 | swatauth = 0
|
---|
55 | swatusers = ""
|
---|
56 | end
|
---|
57 | else do
|
---|
58 | swatauth = 1
|
---|
59 | swatusers = ETC'\samba\private\swatusers'
|
---|
60 | end
|
---|
61 | return
|
---|