source: trunk/guitools/shared/swat.vrs@ 1027

Last change on this file since 1027 was 1023, checked in by Herwig Bauernfeind, 8 years ago

GUITools: Add GPLv3 header to all .VRS files

File size: 4.2 KB
Line 
1/* Find Apache HtPasswd */
2
3/*
4Copyright (C) 2007-2017 Herwig Bauernfeind for bww bitwise works GmbH.
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20/*:VRX _FindHtpasswd
21*/
22_FindHtpasswd:
23 IF options.!debug == 1 THEN say time()' _FindHtpasswd() started'
24 /* htpasswd.exe - required for SWAT but not really part of Samba */
25 samba.!htpasswdexe = ""
26 if samba.!htpasswdexe = "" then do /* INI entry */
27 call charout , " Do we have an INI entry for Apache? "
28 apachepath = VRGetIni( "Apache", "Path", samba.!bin'\sscc.ini' )
29 say apachepath
30 samba.!htpasswdexe = apachepath'\htpasswd.exe'
31 if \VRFileExists(samba.!htpasswdexe) then do /* It is invalid! */
32 samba.!htpasswdexe = ""
33 ok = VRDelIni( "Apache", "Path", samba.!bin'\sscc.ini' )
34 end
35 end
36 if samba.!htpasswdexe = "" then do /* wellknown locations */
37 WellKnown = SysBootdrive()"\ecs\system\apache2\bin;"SysBootdrive()"\apache2\bin"
38 Programs = value("PROGRAMS",,'OS2ENVIRONMENT')
39 if Programs <> "" then WellKnown = Wellknown';'Programs'\apache2\bin'
40 Tools = value("TOOLS",,'OS2ENVIRONMENT')
41 if Tools <> "" then WellKnown = Wellknown';'Tools'\apache2\bin'
42 call charout , " Are binaries in wellknown locations? "
43 ok = VRFindFile("htpasswdexe.exe",WellKnown)
44 if ok <> "" then say "Yes."; else say "No."
45 if ok <> "" then samba.!htpasswdexe = ok
46 drop Wellknown Tools Programs
47 end
48
49 if samba.!htpasswdexe = "" then do /* in current directory? */
50 call charout , " Is htpasswd.exe in current directory? "
51 ok = SysFileTree('.\htpasswd.exe', exist.,'FO')
52 if exist.0 = 1 then say "Yes."; else say "No."
53 if exist.0 = 1 then samba.!htpasswdexe = exist.1
54 end
55 if samba.!htpasswdexe = "" then do /* in parent directory? */
56 call charout , " Is htpasswd.exe in parent directory? "
57 ok = SysFileTree('..\htpasswd.exe', exist.,'FO')
58 if exist.0 = 1 then say "Yes."; else say "No."
59 if exist.0 = 1 then samba.!htpasswdexe = exist.1
60 end
61 if samba.!htpasswdexe = "" then do /* in ..\BIN directory? */
62 call charout , " Is htpasswd.exe in ..\BIN directory? "
63 ok = SysFileTree('..\bin\htpasswd.exe', exist.,'FO')
64 if exist.0 = 1 then say "Yes."; else say "No."
65 if exist.0 = 1 then samba.!htpasswdexe = exist.1
66 end
67 if samba.!htpasswdexe = "" then do /* in \apache2\bin */
68 call charout , " Is htpasswd.exe in "SysBootDrive()"\apache2\bin path? "
69 ok = SysFileTree(SysBootDrive()'\apache2\bin\htpasswd.exe', exist.,'FO')
70 if exist.0 = 1 then say "Yes."; else say "No."
71 if exist.0 = 1 then samba.!htpasswdexe = exist.1
72 end
73 if samba.!htpasswdexe = "" then do /* in ..\..\apache2\bin */
74 call charout , " Is htpasswd.exe in ..\..\apache2\bin path? "
75 ok = SysFileTree('..\..\apache2\bin\htpasswd.exe', exist.,'FO')
76 if exist.0 = 1 then say "Yes."; else say "No."
77 if exist.0 = 1 then samba.!htpasswdexe = exist.1
78 end
79
80 if samba.!htpasswdexe = "" then do /* in PATH ? */
81 call charout , " Is htpasswd.exe in PATH? "
82 samba.!htpasswdexe = SysSearchPath("PATH","htpasswd.exe")
83 if samba.!htpasswdexe = "" then say "No."; else say "Yes."
84 end
85
86 if samba.!htpasswdexe = "" then do
87 swatauth = 0
88 swatusers = ""
89 end
90 else do
91 swatauth = 1
92 swatusers = ETC'\samba\private\swatusers'
93 end
94 IF options.!debug == 1 THEN say time()' _FindHtpasswd() done'
95return
Note: See TracBrowser for help on using the repository browser.