[w3m-dev 04333] Re: w3m's bugs from bugs.debian.org

Hiroyuki Ito <[email protected]> Mon, 26 Jul 2010 20:22:52 +0900 (JST)
Newsgroups gmane.comp.web.w3m.devel
Message-ID <[email protected]>

>> I'd also like to ask if any .m4 file can be created besides
>> aclocal.m4 because it defines AC_W3M_SSL_DIGEST_AUTH . This way can
>> prevent "aclocal -I ."  from overriding the parameters.

aclocal -I .  aclocal.m4 

Index: acinclude.m4
===================================================================
RCS file: /cvsroot/w3m/w3m/acinclude.m4,v
retrieving revision 1.42
diff -u -r1.42 acinclude.m4
--- acinclude.m4	7 Apr 2006 13:21:11 -0000	1.42
+++ acinclude.m4	26 Jul 2010 11:21:11 -0000
@@ -283,18 +283,6 @@
  AC_DEFINE_UNQUOTED(KEYBIND, $enable_keymap)])
 #
 # ----------------------------------------------------------------
-# AC_W3M_DIGEST_AUTH
-# ----------------------------------------------------------------
-AC_DEFUN([AC_W3M_DIGEST_AUTH],
-[AC_SUBST(USE_DIGEST_AUTH)
- AC_MSG_CHECKING(if digest auth is enabled)
- AC_ARG_ENABLE(digest_auth,
- [  --disable-digest-auth		disable digest auth],,
- [enable_digest_auth="yes"])
- test x"$enable_digest_auth" = xyes && AC_DEFINE(USE_DIGEST_AUTH)
- AC_MSG_RESULT($enable_digest_auth)])
-#
-# ----------------------------------------------------------------
 # AC_W3M_MIGEMO
 # ----------------------------------------------------------------
 AC_DEFUN([AC_W3M_MIGEMO],
@@ -426,6 +414,7 @@
 # ----------------------------------------------------------------
 AC_DEFUN([AC_W3M_GC],
 [AC_MSG_CHECKING(GC library exists)
+AC_SUBST(LIBGC)
 AC_ARG_WITH(gc,
  [  --with-gc[=PREFIX]	  	libgc PREFIX],
  [test x"$with_gc" = xno && AC_MSG_ERROR([You can not build w3m without gc])],
@@ -456,7 +445,7 @@
    fi
  fi
  unset ac_cv_lib_gc_GC_init
- AC_CHECK_LIB(gc, GC_init, [LIBS="$LIBS -lgc"])
+ AC_CHECK_LIB(gc, GC_init, [LIBGC="-lgc"])
  if test x"$ac_cv_lib_gc_GC_init" = xno; then
     AC_MSG_CHECKING(GC library location)
     AC_MSG_RESULT($with_gc)
@@ -466,7 +455,7 @@
       LDFLAGS="$LDFLAGS -L$dir/lib"
       AC_MSG_CHECKING($dir)
       unset ac_cv_lib_gc_GC_init
-      AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBS="$LIBS -L$dir/lib -lgc"; break])
+      AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBGC="-L$dir/lib -lgc"; break])
       LDFLAGS="$ldflags"
     done
     if test x"$gclibdir" = xno; then
@@ -475,9 +464,9 @@
  fi])
 #
 # ----------------------------------------------------------------
-# AC_W3M_SSL
+# AC_W3M_SSL_DIGEST_AUTH
 # ----------------------------------------------------------------
-AC_DEFUN([AC_W3M_SSL],
+AC_DEFUN([AC_W3M_SSL_DIGEST_AUTH],
 [AC_SUBST(USE_SSL)
 AC_SUBST(USE_SSL_VERIFY)
 AC_MSG_CHECKING(if SSL is suported)
@@ -519,7 +508,19 @@
     test x"$enable_sslverify" = xyes && AC_DEFINE(USE_SSL_VERIFY)
     AC_MSG_RESULT($enable_sslverify)
   fi
-fi])
+fi
+AC_SUBST(USE_DIGEST_AUTH)
+AC_MSG_CHECKING(if digest auth is enabled)
+AC_ARG_ENABLE(digest_auth,
+ [  --disable-digest-auth		disable digest auth],,
+ [enable_digest_auth="yes"])
+if test x"$enable_digest_auth" = xyes -a x"$w3m_ssl" = xfound; then
+  AC_DEFINE(USE_DIGEST_AUTH)
+else
+  enable_digest_auth="no"
+fi
+AC_MSG_RESULT($enable_digest_auth)
+])
 #
 # ----------------------------------------------------------------
 # AC_W3M_ALARM
Index: cookie.c
===================================================================
RCS file: /cvsroot/w3m/w3m/cookie.c,v
retrieving revision 1.10
diff -u -r1.10 cookie.c
--- cookie.c	10 Dec 2006 10:53:22 -0000	1.10
+++ cookie.c	26 Jul 2010 11:21:11 -0000
@@ -258,6 +258,30 @@
 };
 
 int
+check_avoid_wrong_number_of_dots_domain( Str domain )
+{
+   TextListItem *tl;
+    int avoid_wrong_number_of_dots_domain = FALSE;
+
+    if (Cookie_avoid_wrong_number_of_dots_domains && 
+            Cookie_avoid_wrong_number_of_dots_domains->nitem > 0) {
+        for (tl = Cookie_avoid_wrong_number_of_dots_domains->first;
+                tl != NULL; tl = tl->next) {
+            if (domain_match(domain->ptr, tl->ptr)) {
+                avoid_wrong_number_of_dots_domain = TRUE;
+                break;
+            }
+        }
+    }
+
+    if (avoid_wrong_number_of_dots_domain == TRUE) {
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+int
 add_cookie(ParsedURL *pu, Str name, Str value,
 	   time_t expires, Str domain, Str path,
 	   int flag, Str comment, int version, Str port, Str commentURL)
@@ -304,7 +328,11 @@
 				     domain->ptr + domain->length,
 				     3);
 	    if (n < 2) {
-		COOKIE_ERROR(COO_ESPECIAL);
+		if ( check_avoid_wrong_number_of_dots_domain(domain) ) {
+		    ;
+		} else {
+		    COOKIE_ERROR(COO_ESPECIAL);
+		}
 	    }
 	    else if (n == 2) {
 		char **sdomain;
@@ -315,8 +343,13 @@
 			strcasecmp(*sdomain, &domain->ptr[offset]) == 0)
 			ok = 1;
 		}
-		if (!ok)
-		    COOKIE_ERROR(COO_ESPECIAL);
+		if (!ok) {
+		    if ( check_avoid_wrong_number_of_dots_domain(domain) ) {
+		        ;
+		    } else {
+		        COOKIE_ERROR(COO_ESPECIAL);
+		    }
+		}
 	    }
 	}
 	else {