/*:VRX _FindHtpasswd */ _FindHtpasswd: IF options.!debug == 1 THEN say time()' _FindHtpasswd() started' /* htpasswd.exe - required for SWAT but not really part of Samba */ samba.!htpasswdexe = "" if samba.!htpasswdexe = "" then do /* INI entry */ call charout , " Do we have an INI entry for Apache? " apachepath = VRGetIni( "Apache", "Path", samba.!bin'\sscc.ini' ) say apachepath samba.!htpasswdexe = apachepath'\htpasswd.exe' if \VRFileExists(samba.!htpasswdexe) then do /* It is invalid! */ samba.!htpasswdexe = "" ok = VRDelIni( "Apache", "Path", samba.!bin'\sscc.ini' ) end end if samba.!htpasswdexe = "" then do /* wellknown locations */ WellKnown = SysBootdrive()"\ecs\system\apache2\bin;"SysBootdrive()"\apache2\bin" Programs = value("PROGRAMS",,'OS2ENVIRONMENT') if Programs <> "" then WellKnown = Wellknown';'Programs'\apache2\bin' Tools = value("TOOLS",,'OS2ENVIRONMENT') if Tools <> "" then WellKnown = Wellknown';'Tools'\apache2\bin' call charout , " Are binaries in wellknown locations? " ok = VRFindFile("htpasswdexe.exe",WellKnown) if ok <> "" then say "Yes."; else say "No." if ok <> "" then samba.!htpasswdexe = ok drop Wellknown Tools Programs end if samba.!htpasswdexe = "" then do /* in current directory? */ call charout , " Is htpasswd.exe in current directory? " ok = SysFileTree('.\htpasswd.exe', exist.,'FO') if exist.0 = 1 then say "Yes."; else say "No." if exist.0 = 1 then samba.!htpasswdexe = exist.1 end if samba.!htpasswdexe = "" then do /* in parent directory? */ call charout , " Is htpasswd.exe in parent directory? " ok = SysFileTree('..\htpasswd.exe', exist.,'FO') if exist.0 = 1 then say "Yes."; else say "No." if exist.0 = 1 then samba.!htpasswdexe = exist.1 end if samba.!htpasswdexe = "" then do /* in ..\BIN directory? */ call charout , " Is htpasswd.exe in ..\BIN directory? " ok = SysFileTree('..\bin\htpasswd.exe', exist.,'FO') if exist.0 = 1 then say "Yes."; else say "No." if exist.0 = 1 then samba.!htpasswdexe = exist.1 end if samba.!htpasswdexe = "" then do /* in \apache2\bin */ call charout , " Is htpasswd.exe in "SysBootDrive()"\apache2\bin path? " ok = SysFileTree(SysBootDrive()'\apache2\bin\htpasswd.exe', exist.,'FO') if exist.0 = 1 then say "Yes."; else say "No." if exist.0 = 1 then samba.!htpasswdexe = exist.1 end if samba.!htpasswdexe = "" then do /* in ..\..\apache2\bin */ call charout , " Is htpasswd.exe in ..\..\apache2\bin path? " ok = SysFileTree('..\..\apache2\bin\htpasswd.exe', exist.,'FO') if exist.0 = 1 then say "Yes."; else say "No." if exist.0 = 1 then samba.!htpasswdexe = exist.1 end if samba.!htpasswdexe = "" then do /* in PATH ? */ call charout , " Is htpasswd.exe in PATH? " samba.!htpasswdexe = SysSearchPath("PATH","htpasswd.exe") if samba.!htpasswdexe = "" then say "No."; else say "Yes." end if samba.!htpasswdexe = "" then do swatauth = 0 swatusers = "" end else do swatauth = 1 swatusers = ETC'\samba\private\swatusers' end IF options.!debug == 1 THEN say time()' _FindHtpasswd() done' return