about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2006-11-07 01:33:57 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2006-11-07 01:33:57 -0500
commitf255f8da2e6a2a8b53639ea2264d5db3c3760b23 (patch)
tree5d5c700e34c7004923e9f83a990d2d0c18b14813 /src
parent39be21ba143146c614e9d24b51f6707c8c44eddb (diff)
downloadlynx-snapshots-f255f8da2e6a2a8b53639ea2264d5db3c3760b23.tar.gz
snapshot of project "lynx", label v2-8-7dev_2
Diffstat (limited to 'src')
-rw-r--r--src/HTInit.c24
-rw-r--r--src/LYUtils.c21
-rw-r--r--src/LYUtils.h6
3 files changed, 29 insertions, 22 deletions
diff --git a/src/HTInit.c b/src/HTInit.c
index 73619aab..2691bb8a 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -153,15 +153,16 @@ void HTFormatInit(void)
     SET_INTERNL("text/html", "www/present", HTMLPresent, 1.0);
     SET_INTERNL("text/xml", "www/present", HTMLPresent, 2.0);
 
-    /*
-     * These should override the default types as necessary.
-     */
-    HTLoadTypesConfigFile(global_type_map, mediaSYS);
+    if (LYisAbsPath(global_type_map)) {
+	/* These should override the default types as necessary.  */
+	HTLoadTypesConfigFile(global_type_map, mediaSYS);
+    }
 
     /*
      * Load the local maps.
      */
-    if (LYCanReadFile(personal_type_map)) {
+    if (IsOurFile(personal_type_map)
+	&& LYCanReadFile(personal_type_map)) {
 	/* These should override everything else. */
 	HTLoadTypesConfigFile(personal_type_map, mediaUSR);
     } else {
@@ -1332,17 +1333,22 @@ void HTFileInit(void)
     SET_SUFFIX1(".html", "text/html", "8bit");
 #endif /* BUILTIN_SUFFIX_MAPS */
 
-    /* These should override the default extensions as necessary. */
-    HTLoadExtensionsConfigFile(global_extension_map);
+    if (LYisAbsPath(global_extension_map)) {
+	/* These should override the default extensions as necessary. */
+	HTLoadExtensionsConfigFile(global_extension_map);
+    }
 
-    if (LYCanReadFile(personal_extension_map)) {
+    /*
+     * Load the local maps.
+     */
+    if (IsOurFile(personal_extension_map)
+	&& LYCanReadFile(personal_extension_map)) {
 	/* These should override everything else. */
 	HTLoadExtensionsConfigFile(personal_extension_map);
     } else {
 	char buffer[LY_MAXPATH];
 
 	LYAddPathToHome(buffer, sizeof(buffer), personal_extension_map);
-	/* These should override everything else. */
 	HTLoadExtensionsConfigFile(buffer);
     }
 }
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 1153f69a..356b61b9 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -5789,28 +5789,20 @@ int remove(char *name)
 }
 #endif
 
-/*
- * Default, for single-user systems such as Cygwin and OS/2 EMX:
- */
-#define IsOurFile(name) TRUE
-#define OpenHiddenFile(name, mode) fopen(name, mode)
-
 #if defined(MULTI_USER_UNIX)
-
-#undef IsOurFile
-#undef OpenHiddenFile
-
 /*
  * Verify if this is really a file, not accessed by a link, except for the
  * special case of its directory being pointed to by a link from a directory
  * owned by root and not writable by other users.
  */
-static BOOL IsOurFile(const char *name)
+BOOL IsOurFile(const char *name)
 {
+    BOOL result = FALSE;
     struct stat data;
 
     if (lstat(name, &data) == 0
 	&& S_ISREG(data.st_mode)
+	&& (data.st_mode & (S_IWOTH | S_IWGRP)) == 0
 	&& data.st_nlink == 1
 	&& data.st_uid == getuid()) {
 	int linked = FALSE;
@@ -5860,9 +5852,10 @@ static BOOL IsOurFile(const char *name)
 	} while (leaf != path);
 	FREE(path);
 #endif
-	return !linked;
+	result = !linked;
     }
-    return FALSE;
+    CTRACE2(TRACE_CFG, (tfp, "IsOurFile(%s) %d\n", name, result));
+    return result;
 }
 
 /*
@@ -5922,6 +5915,8 @@ static FILE *OpenHiddenFile(const char *name, const char *mode)
     }
     return fp;
 }
+#else
+#define OpenHiddenFile(name, mode) fopen(name, mode)
 #endif /* MULTI_USER_UNIX */
 
 FILE *LYNewBinFile(const char *name)
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 9844d728..f2239f5c 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -196,6 +196,12 @@ extern "C" {
     extern void statusline(const char *text);
     extern void toggle_novice_line(void);
 
+#if defined(MULTI_USER_UNIX)
+    extern BOOL IsOurFile(const char *name);
+#else
+#define IsOurFile(name) TRUE
+#endif
+
 #ifdef EXP_ASCII_CTYPES
     extern int ascii_tolower(int i);
     extern int ascii_toupper(int i);