INN commit: trunk/nnrpd (perl.c)

INN Commit rra at isc.org
Tue Jun 12 21:10:06 UTC 2012


    Date: Tuesday, June 12, 2012 @ 14:10:06
  Author: iulius
Revision: 9420

auth_init() should be optional in perl_auth

The documentation (doc/hook-perl) for nnrpd auth hook says:

	If a Perl function auth_init() is defined by that file, it is 
	called immediately after the file is loaded.

And later:

	Provided the file loads without errors, auth_init() (if present) 
	runs without fatal errors, and a Perl function authenticate() is 
	defined, authenticate() will then be called

This suggests that auth_init() is optional, but it actually isn't.  When 
it's not defined, the auth hook will fail:

200 isis.rt.uk.eu.org InterNetNews NNRP server INN 2.5.2 ready (posting ok)
authinfo user test
381 Enter password
authinfo pass test
400 Internal error (3).  Goodbye!

It seems more sensible to not require an auth_init() function, as most
hooks probably won't need it.

Thanks to River Tarnell for the bug report.

Modified:
  trunk/nnrpd/perl.c

--------+
 perl.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Modified: perl.c
===================================================================
--- perl.c	2012-06-12 20:43:53 UTC (rev 9419)
+++ perl.c	2012-06-12 21:10:06 UTC (rev 9420)
@@ -308,17 +308,15 @@
     if (!PerlFilterActive)
         return;
 
+    if (perl_get_cv("auth_init", 0) == NULL) {
+        return;
+    }
+
     ENTER;
     SAVETMPS;
     PUSHMARK(SP);
     PUTBACK;
 
-    if (perl_get_cv("auth_init", 0) == NULL) {
-        syslog(L_ERROR, "Perl function auth_init not defined");
-        Reply("%d Internal error (3).  Goodbye!\r\n", NNTP_FAIL_TERMINATING);
-        ExitWithStats(1, true);
-    }
-
     rc = perl_call_pv("auth_init", G_EVAL|G_DISCARD);
 
     SPAGAIN;



More information about the inn-committers mailing list