source: branches/guitools-1.0/shared/swat.vrs

Last change on this file was 451, checked in by Herwig Bauernfeind, 15 years ago

GUI-Tools: SSCC 1.0.0, SMBUsers 0.9.8 several fixes, rest

File size: 3.4 KB
Line 
1/*:VRX _FindHtpasswd
2*/
3_FindHtpasswd:
4 IF options.!debug == 1 THEN say '_FindHtpasswd() started'
5 /* htpasswd.exe - required for SWAT but not really part of Samba */
6 samba.!htpasswdexe = ""
7 if samba.!htpasswdexe = "" then do /* INI entry */
8 call charout , " Do we have an INI entry for Apache? "
9 apachepath = VRGetIni( "Apache", "Path", samba.!bin'\sscc.ini' )
10 say apachepath
11 samba.!htpasswdexe = apachepath'\htpasswd.exe'
12 if \VRFileExists(samba.!htpasswdexe) then do /* It is invalid! */
13 samba.!htpasswdexe = ""
14 ok = VRDelIni( "Apache", "Path", samba.!bin'\sscc.ini' )
15 end
16 end
17 if samba.!htpasswdexe = "" then do /* wellknown locations */
18 WellKnown = SysBootdrive()"\ecs\system\apache2\bin;"SysBootdrive()"\apache2\bin"
19 Programs = value("PROGRAMS",,'OS2ENVIRONMENT')
20 if Programs <> "" then WellKnown = Wellknown';'Programs'\apache2\bin'
21 Tools = value("TOOLS",,'OS2ENVIRONMENT')
22 if Tools <> "" then WellKnown = Wellknown';'Tools'\apache2\bin'
23 call charout , " Are binaries in wellknown locations? "
24 ok = VRFindFile("htpasswdexe.exe",WellKnown)
25 if ok <> "" then say "Yes."; else say "No."
26 if ok <> "" then samba.!htpasswdexe = ok
27 drop Wellknown Tools Programs
28 end
29
30 if samba.!htpasswdexe = "" then do /* in current directory? */
31 call charout , " Is htpasswd.exe in current directory? "
32 ok = SysFileTree('.\htpasswd.exe', exist.,'FO')
33 if exist.0 = 1 then say "Yes."; else say "No."
34 if exist.0 = 1 then samba.!htpasswdexe = exist.1
35 end
36 if samba.!htpasswdexe = "" then do /* in parent directory? */
37 call charout , " Is htpasswd.exe in parent directory? "
38 ok = SysFileTree('..\htpasswd.exe', exist.,'FO')
39 if exist.0 = 1 then say "Yes."; else say "No."
40 if exist.0 = 1 then samba.!htpasswdexe = exist.1
41 end
42 if samba.!htpasswdexe = "" then do /* in ..\BIN directory? */
43 call charout , " Is htpasswd.exe in ..\BIN directory? "
44 ok = SysFileTree('..\bin\htpasswd.exe', exist.,'FO')
45 if exist.0 = 1 then say "Yes."; else say "No."
46 if exist.0 = 1 then samba.!htpasswdexe = exist.1
47 end
48 if samba.!htpasswdexe = "" then do /* in \apache2\bin */
49 call charout , " Is htpasswd.exe in "SysBootDrive()"\apache2\bin path? "
50 ok = SysFileTree(SysBootDrive()'\apache2\bin\htpasswd.exe', exist.,'FO')
51 if exist.0 = 1 then say "Yes."; else say "No."
52 if exist.0 = 1 then samba.!htpasswdexe = exist.1
53 end
54 if samba.!htpasswdexe = "" then do /* in ..\..\apache2\bin */
55 call charout , " Is htpasswd.exe in ..\..\apache2\bin path? "
56 ok = SysFileTree('..\..\apache2\bin\htpasswd.exe', exist.,'FO')
57 if exist.0 = 1 then say "Yes."; else say "No."
58 if exist.0 = 1 then samba.!htpasswdexe = exist.1
59 end
60
61 if samba.!htpasswdexe = "" then do /* in PATH ? */
62 call charout , " Is htpasswd.exe in PATH? "
63 samba.!htpasswdexe = SysSearchPath("PATH","htpasswd.exe")
64 if samba.!htpasswdexe = "" then say "No."; else say "Yes."
65 end
66
67 if samba.!htpasswdexe = "" then do
68 swatauth = 0
69 swatusers = ""
70 end
71 else do
72 swatauth = 1
73 swatusers = ETC'\samba\private\swatusers'
74 end
75 IF options.!debug == 1 THEN say '_FindHtpasswd() done'
76return
Note: See TracBrowser for help on using the repository browser.