Patches: TLS and mark_unavailable_read

Jörg Sommer <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
Hi John,

please, can you apply this patch as soon as possible, because Debian
prepares it's release this weekend. The patch works for me, but you're
much more familiar with the code.

#v+
commit a11019df6a7f0e8141d0607301617233c4d0a496
Author: Jörg Sommer <[email protected]>
Date:   Thu Jul 24 21:06:53 2008 +0200

    Add configure option --with-gnutls to enable GNU TLS support
    
    The only thing that is missing for GNU TLS support are defines and the
    linker options. The code is already ready.

diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 703cce5..6c9557d 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -203,6 +203,11 @@ AC_SUBST(INCICONV)dnl# AM_GNU_GETTEXT does not do this.  Why???
 AC_ARG_WITH(nss-compat,
     [  --with-nss-compat       Use NSS compat library instead of OpenSSL],
     [use_nss_compat=$withval], [use_nss_compat=no])
+AC_ARG_WITH(gnutls,
+    AS_HELP_STRING([--with-gnutls[=path]],
+                   [Use GNU TLS library instead of OpenSSL]),
+    [use_gnutls=$withval; jd_use_ssl=$withval],
+    [use_gnutls=no; jd_use_ssl=no])
 AC_CACHE_CHECK(if you want SSL support,jd_use_ssl,
 [
   AC_ARG_WITH(ssl, 
@@ -219,6 +224,10 @@ x|xyes)
    then
      SSLINC="-I/usr/local/include/nss_compat_ossl -I/usr/local/include/nss3 -I/usr/local/include/nspr4"
      SSLLIB="-L/usr/local/lib -lnss_compat_ossl"
+   elif test "x$use_gnutls" != xno
+   then
+     SSLINC=
+     SSLLIB="-lgnutls-openssl"
    else
      SSLINC="-I/usr/local/ssl/include"
      SSLLIB="-L/usr/local/ssl/lib -lssl -lcrypto"
@@ -228,6 +237,10 @@ x|xyes)
    if test "x$use_nss_compat" != xno; then
      SSLINC="-I$jd_use_ssl/include/nss_compat_ossl -I$jd_use_ssl/include/nss3 -I$jd_use_ssl/include/nspr4"
      SSLLIB="-L$jd_use_ssl/lib -lnss_compat_ossl"
+   elif test "x$use_gnutls" != xno
+   then
+     SSLINC="-I$jd_use_ssl/inlcude"
+     SSLLIB="-L$jd_use_ssl/lib -lgnutls-extra -lgnutls -ltasn1 -lgcrypt -lgnutls-openssl"
    else
      SSLINC="-I$jd_use_ssl/include"
      SSLLIB="-L$jd_use_ssl/lib -lssl -lcrypto"
@@ -235,11 +248,14 @@ x|xyes)
 esac
 AC_SUBST(SSLINC)
 AC_SUBST(SSLLIB)
-if test "x$SSLINC" != x; then
+if test "x$SSLINC$SSLLIB" != x; then
  AC_DEFINE(USE_SSL)
  if test "x$use_nss_compat" != xno; then
    AC_DEFINE(USE_NSS_COMPAT)
  fi
+ if test "x$use_gnutls" != xno; then
+   AC_DEFINE(USE_GNUTLS)
+ fi
 fi
 
 #---------------------------------------------------------------------------
diff --git a/src/config.hin b/src/config.hin
index 8ba7e82..c809fed 100644
--- a/src/config.hin
+++ b/src/config.hin
@@ -19,6 +19,9 @@
 /* define if you want to use NSS compat library instead of OpenSSL */
 #undef USE_NSS_COMPAT
 
+/* define if you want to use GNU TLS library instead of OpenSSL */
+#undef USE_GNUTLS
+
 /* define if you have stdlib.h */
 #undef HAVE_STDLIB_H
 
@@ -161,8 +164,12 @@
 # define SLRN_HAS_SSL_SUPPORT	0
 #endif
 
-#define SLRN_HAS_GNUTLS_SUPPORT 0      /* untested */
-#define SLTCP_HAS_GNUTLS_SUPPORT SLRN_HAS_GNUTLS_SUPPORT
+#ifdef USE_GNUTLS
+# define SLTCP_HAS_GNUTLS_SUPPORT 1
+#else
+# define SLTCP_HAS_GNUTLS_SUPPORT 0
+#endif
+
 #define SLTCP_HAS_SSL_SUPPORT SLRN_HAS_SSL_SUPPORT
 
 #ifdef USE_NSS_COMPAT
#v-

And what do you think about this patch? Is it okay for you? Do you like
this option?

#v+
commit b2ec8f7532cf3e47338758a10b91f8d06c45198a
Author: Jörg Sommer <[email protected]>
Date:   Thu Jul 24 21:25:20 2008 +0200

    New option to control marking of unavailable articles

    If you share the same jnewsrc with a server and a slrnpull spool of this
    server while the later is only a subset of the server, slrn would mark
    all articles not in the slrnpull spool as read. You can set the new
    option mark_unavailable_read to 0 to make slrn keep articles they aren't
    available by the server.

diff --git a/src/art.c b/src/art.c
index cfd7e00..6db757f 100644
--- a/src/art.c
+++ b/src/art.c
@@ -6578,7 +6578,7 @@ static void update_ranges (void) /*{{{*/
    r_new = slrn_ranges_clone (Current_Group->range.next);
 
    /* Mark old (unavailable) articles as read */
-   if (Slrn_Server_Min > 1)
+   if (Slrn_Server_Min > 1 && Slrn_Mark_Unavailable_Articles_Read)
      r_new = slrn_ranges_add (r_new, 1, Slrn_Server_Min - 1);
 
    /* Now, mark blocks of articles read / unread */
diff --git a/src/group.c b/src/group.c
index df8cfc6..0270931 100644
--- a/src/group.c
+++ b/src/group.c
@@ -92,6 +92,7 @@ int Slrn_Unsubscribe_New_Groups = 0;
 int Slrn_Check_New_Groups = 1;
 int Slrn_Drop_Bogus_Groups = 1;
 int Slrn_Max_Queued_Groups = 20;
+int Slrn_Mark_Unavailable_Articles_Read = 1;
 
 SLKeyMap_List_Type *Slrn_Group_Keymap;
 int *Slrn_Prefix_Arg_Ptr;
@@ -150,7 +151,7 @@ static NNTP_Artnum_Type count_unread (Slrn_Range_Type *r)
 void slrn_group_recount_unread (Slrn_Group_Type *g)
 {
    /* Make sure old (unavailable) messages are marked read */
-   if (g->range.min>1)
+   if (g->range.min>1 && Slrn_Mark_Unavailable_Articles_Read)
      g->range.next = slrn_ranges_add (g->range.next, 1, g->range.min-1);
    g->unread = count_unread (&g->range);
 }   
diff --git a/src/group.h b/src/group.h
index 797205d..1452a46 100644
--- a/src/group.h
+++ b/src/group.h
@@ -97,3 +97,4 @@ extern int Slrn_Write_Newsrc_Flags;
 extern int Slrn_Display_Cursor_Bar;
 extern int Slrn_Drop_Bogus_Groups;
 extern int Slrn_Max_Queued_Groups;
+extern int Slrn_Mark_Unavailable_Articles_Read;
diff --git a/src/startup.c b/src/startup.c
index d62bfe9..4d27f37 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -621,6 +621,7 @@ Slrn_Int_Var_Type Slrn_Int_Variables [] = /*{{{*/
      {"uncollapse_threads", &Slrn_Uncollapse_Threads, NULL},
      {"read_active", &Slrn_List_Active_File, NULL},
      {"drop_bogus_groups", &Slrn_Drop_Bogus_Groups, NULL},
+     {"mark_unavailable_read", &Slrn_Mark_Unavailable_Articles_Read, NULL},
      {"prefer_head", &Slrn_Prefer_Head, NULL},
      {"use_metamail", &Slrn_Use_Meta_Mail, NULL},
 #if SLRN_HAS_UUDEVIEW
#v-

Bye, Jörg.
-- 
„Dass man etwas durchdringen kann, wenn man es durchschaut
 hat, ist der Irrtum der Fliege an der Fensterscheibe.“ (Nietzsche)

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.