[PATCH] TLS information in nnrpd perlauth

Harald Welte laforge at gnumonks.org
Tue Feb 12 10:48:48 UTC 2002


Hi!

I've made the following patch, it adds tls information to the nnrpd perlauth
attributes hash.

This way a perlauth authentication plugin can distinguish between encrypted
and plaintext sessions.

Maybe it's worthwile to update the pythonauth module as well, but I don't
know anything about python :(


--- inn-2.3.2/nnrpd/perl.c	Thu May  3 22:27:32 2001
+++ inn-2.3.2-perlauth/nnrpd/perl.c	Tue Feb 12 10:13:54 2002
@@ -39,6 +39,11 @@
 #include <XSUB.h>
 #include "ppport.h"
 
+#ifdef HAVE_SSL
+#include <openssl/ssl.h>
+extern SSL *tls_conn;
+#endif
+
 extern BOOL PerlFilterActive;
 extern HEADER	Table[], *EndOfTable;
 extern char LogName[];
@@ -212,6 +217,12 @@
     hv_store(attribs, "hostname", 8, newSVpv(ClientHost, 0), 0);
     hv_store(attribs, "interface", 9, newSVpv(ServerHost, 0), 0);
     hv_store(attribs, "ipaddress", 9, newSVpv(ClientIP, 0), 0);
+#ifdef HAVE_SSL
+    if (tls_conn)
+	    hv_store(attribs, "tls", 3, newSViv(1), 0);
+    else
+#endif
+	    hv_store(attribs, "tls", 3, newSViv(0), 0);
     
     PUSHMARK(SP);
     rc = perl_call_pv("authenticate", G_EVAL|G_ARRAY);
@@ -307,6 +318,13 @@
     hv_store(attribs, "interface", 9, newSVpv(ServerHost, 0), 0);
     hv_store(attribs, "username", 8, newSVpv(user, 0), 0);
     hv_store(attribs, "password", 8, newSVpv(passwd, 0), 0);
+#ifdef HAVE_SSL
+    if (tls_conn)
+	    hv_store(attribs, "tls", 3, newSViv(1), 0);
+    else
+#endif
+	    hv_store(attribs, "tls", 3, newSViv(0), 0);
+
     
     PUSHMARK(SP);
     rc = perl_call_pv("authenticate", G_EVAL|G_ARRAY);
-- 
Live long and prosper
- Harald Welte / laforge at gnumonks.org               http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M+ 
V-- PS++ PE-- Y++ PGP++ t+ 5-- !X !R tv-- b+++ !DI !D G+ e* h--- r++ y+(*)


More information about the inn-workers mailing list