*** apache_base:[src.main]http_request.c;1 Mon Aug 23 11:38:21 1999 --- apache_cur:[src.main]http_request.c;4 Mon Aug 23 11:38:05 1999 *************** *** 63,68 **** --- 63,73 ---- * Thoroughly revamped by rst for Apache. NB this file reads * best from the bottom up. * + * PV Jan-Feb 99 + * Porting to OpenVMS. Because VMS does not have the lstat function + * return OK to check_symlinks. Allocate 4 more extra byte to test_dirname + * because it includes the string "/usr" if the directory is "/" for + * make_dirstr_prefix (function of util.c). */ #define CORE_PRIVATE *************** *** 77,82 **** --- 82,91 ---- #include "scoreboard.h" #include "fnmatch.h" + #ifdef VMS + #include /* get RMS$_SYN definition */ + #endif + /***************************************************************** * * Getting and checking directory configuration. Also checks the *************** *** 113,119 **** static int check_symlinks(char *d, int opts) { ! #if defined(OS2) || defined(WIN32) /* OS/2 doesn't have symlinks */ return OK; #else --- 122,128 ---- static int check_symlinks(char *d, int opts) { ! #if defined(OS2) || defined(WIN32) || defined(VMS) /* OS/2 doesn't have symlinks */ return OK; #else *************** *** 243,248 **** --- 252,308 ---- else { errno = 0; rv = stat(path, &r->finfo); + #ifdef VMS + if ( rv >= 0 && !S_ISDIR(r->finfo.st_mode) ) { + /* + * When given stat("/disk/dir1/xxx",&x), the stat function + * finds: + * disk:[dir1.xxx].; + * disk:[dir1]xxx.; + * disk:[dir1]xxx.dir;1 + * + * Check for case where path may be a directory but the + * fucked up C RTL finds a ".;" file in that directory + * so loads finfo with those attributes. + */ + char *vp; + for ( vp = cp-1; vp > path; vp-- ) + if ( (*vp == '.') || (*vp == '/') ) break; + if ( (*vp == '/') && ((cp-path) < 508) ) { + char dtest[512]; + int result; + struct stat dinfo; + /* + * No extension (. in filename), see if .; file exists. + */ + sprintf ( dtest, "%s/.;", path ); + result = stat(dtest, &dinfo ); + if ( result == 0 ) { + /* + * File found, claim it is directory. + */ + if ( (r->finfo.st_ino[0] == dinfo.st_ino[0]) && + (r->finfo.st_ino[1] == dinfo.st_ino[1]) && + (r->finfo.st_ino[2] == dinfo.st_ino[2]) ) { + if ( S_ISREG(dinfo.st_mode) ) + r->finfo.st_mode ^= __S_IFREG; /* clear bit */ + r->finfo.st_mode |= __S_IFDIR; + } + } + /* + * Hide any errors the stat() call set from rest of code. + */ + errno = 0; + } + + } else if ( (errno == EVMSERR) && (vaxc$errno==RMS$_SYN) ) { + /* + * The ap_os_is_filename_valid function didn't do it's job + * right so stat() returned a VMS RMS error code, fixup. + */ + errno = ENOENT; + } + #endif } if (cp != end) *************** *** 429,435 **** --- 489,500 ---- * We need 2 extra bytes, one for trailing \0 and one because * make_dirstr_prefix will add potentially one extra /. */ + + #ifdef VMS + test_dirname = ap_palloc(r->pool, test_filename_len + 6); + #else test_dirname = ap_palloc(r->pool, test_filename_len + 2); + #endif /* ! VMS */ iStart = 1; #ifdef WIN32 *************** *** 490,495 **** --- 555,572 ---- this_conf = entry_config; } } + #ifdef VMS + else if ( (i == 1) && (0==strcmp("/",entry_dir)) ) { + /* + * Munging / -> /usr/ fucked up the comparison test. Force + * ourselves to match the configuration for "/". Note that + * that adding a doesn't solve the problem + * because the (d_components > i) will always cause a mismatch. + * DLJ AUG-99 + */ + this_conf = entry_config; + } + #endif else if (!strcmp(test_dirname, entry_dir)) this_conf = entry_config;