>Number:         3405
>Category:       mod_so
>Synopsis:       LoadLibrary with relative paths assumes libraries are relative 
>to ap_server_root.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Nov 16 06:40:01 PST 1998
>Last-Modified:
>Originator:     [EMAIL PROTECTED]
>Organization:
apache
>Release:        Apache 1.3.3
>Environment:
Windows NT 4.0 Service Pack 3
Apache 1.3.3
MSVC 6.0
Apache-JServ-19981109
>Description:
When using LoadModule directive with no path for the module name, mod_so assumes
the module is relative to the server_root (uses ap_server_root_relative).  In
other words, the server root must contain all the files that apache will 
reference including shared modules not just the application specific files,
such as document root and cgi-bin, etc.

This behavior causes a problem when running Apache from a hard disk with the 
Server Root being a CDROM with ISO level 1 (8.3 naming convention).  For 
example,  the following directive: "LoadModule jserv_module 
ApacheModuleJServ.dll"
 will fail if the server root is pointing to a CDROM ISO Level 1 even if 
apache is started from the hard disk with all the share modules co-located.  
The basic problem is that Apache assumes all it's resources, such as, shared 
modules are relative to the server root when relative paths are used.  Apache 
should be able to support loading it's from both an absolute path and the 
standard search path.  
executables, etc from the location from which it is started.   
>How-To-Repeat:
Yes.  Install apache and point it's server root to a location which doesnot
contain the share modules (ie. ApacheModuleJServ.dll).  You will get a 
can not load "Server root"/ApacheModuleJserv.dll" into server error.
>Fix:
Yes.  Update mod_so.c so it will check the full path for the shared module and
it that fails, strip the path and use the default system search algorithm to
find the module.  A context diff for a potential fix follows:

*** mod_so.c    Sat Sep 19 08:27:24 1998
--- /kelly/apache_1.3.3/src/modules/standard/mod_so.c   Wed Nov 11 12:29:59 1998
***************
*** 232,238 ****
       */
      if (!(modhandle = ap_os_dso_load(szModuleFile))) {
        const char *my_error = ap_os_dso_error();
!       return ap_pstrcat (cmd->pool, "Cannot load ", szModuleFile,
                        " into server: ", 
                        my_error ? my_error : "(reason unknown)",
                        NULL);
--- 232,242 ----
       */
      if (!(modhandle = ap_os_dso_load(szModuleFile))) {
        const char *my_error = ap_os_dso_error();
!       char *cPtr;
!       if ((cPtr=strrchr(szModuleFile, (int) '/')) || 
!           (cPtr=strrchr(szModuleFile,(int) '\\')))
!         if (!(modhandle = ap_os_dso_load(cPtr+1)))
!            return ap_pstrcat (cmd->pool, "Cannot load ", szModuleFile,
                        " into server: ", 
                        my_error ? my_error : "(reason unknown)",
                        NULL);
***************
*** 293,299 ****
      
      if (!(handle = ap_os_dso_load(file))) {
        const char *my_error = ap_os_dso_error();
!       return ap_pstrcat (cmd->pool, "Cannot load ", filename, 
                        " into server:", 
                        my_error ? my_error : "(reason unknown)",
                        NULL);
--- 297,307 ----
      
      if (!(handle = ap_os_dso_load(file))) {
        const char *my_error = ap_os_dso_error();
!       char *cPtr;
!       if ((cPtr=strrchr(file, (int) '/')) || 
!           (cPtr=strrchr(file,(int) '\\')))
!         if (!(handle = ap_os_dso_load(cPtr+1)))
!            return ap_pstrcat (cmd->pool, "Cannot load ", filename, 
                        " into server:", 
                        my_error ? my_error : "(reason unknown)",
                        NULL);

>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <[EMAIL PROTECTED]> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]



Reply via email to