changeset 391:6cb66f5a0479 noffle

[svn] * docs/noffle.1,src/configure.h,src/configfile.c,src/noffle.c: Add optional "auth" parameter to '--server' option. This turns on client authorisation regardless of the setting of authenticate-client. Useful if you want the same Noffle to authenticate or not depending on what/how it gets invoked.
author bears
date Fri, 23 May 2003 10:33:10 +0100
parents 2ad4c1c97734
children 794030e45053
files ChangeLog docs/noffle.1 src/configfile.c src/configfile.h src/noffle.c
diffstat 5 files changed, 41 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 22 10:04:38 2003 +0100
+++ b/ChangeLog	Fri May 23 10:33:10 2003 +0100
@@ -1,3 +1,9 @@
+Fri May 23 2003 Jim Hague <jim.hague@acm.org>
+
+* docs/noffle.1,src/configure.h,src/configfile.c,src/noffle.c: Add optional
+  "auth" parameter to '--server' option. This turns on client authorisation
+  regardless of the setting of authenticate-client. Useful if you want the
+  same Noffle to authenticate or not depending on what/how it gets invoked.
 
 Thu May 22 2003 Jim Hague <jim.hague@acm.org>
 
--- a/docs/noffle.1	Thu May 22 10:04:38 2003 +0100
+++ b/docs/noffle.1	Fri May 23 10:33:10 2003 +0100
@@ -1,5 +1,5 @@
 .TH noffle 1
-.\" $Id: noffle.1 505 2003-04-01 10:27:45Z godisch $
+.\" $Id: noffle.1 533 2003-05-23 09:33:10Z bears $
 .SH NAME
 noffle \- Usenet package optimized for dialup connections.
 
@@ -63,7 +63,7 @@
 \-R | \-\-requested
 .br
 .B noffle
-\-r | \-\-server
+\-r | \-\-server [auth]
 .br
 .B noffle
 \-s | \-\-subscribe-over <group>
@@ -307,7 +307,7 @@
 This option is only available to news administrators.
 
 .TP
-.B \-r, \-\-server
+.B \-r, \-\-server [auth]
 Run as NNTP server on standard input and standard output. This is
 intended to be called by
 .BR inetd (8)
@@ -317,6 +317,12 @@
 .BR syslogd (8)
 daemon which is usually configured to write them to
 .B /var/log/news.
+If the optional
+.B auth
+parameter is given, then client authentication is enabled
+(assuming NOFFLE was built with authentication enabled)
+regardless of the setting of the configuration
+.BR authenticate-client .
 A list of the NNTP commands that are understood by
 .B noffle
 can be retrieved by running the server and typing
--- a/src/configfile.c	Thu May 22 10:04:38 2003 +0100
+++ b/src/configfile.c	Fri May 23 10:33:10 2003 +0100
@@ -6,7 +6,7 @@
     SPOOLDIR
     VERSION
 
-  $Id: configfile.c 495 2003-03-24 23:32:48Z bears $
+  $Id: configfile.c 533 2003-05-23 09:33:10Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -160,6 +160,11 @@
 const char * Cfg_noffleUser( void ) { return config.noffleUser; }
 const char * Cfg_noffleGroup( void ) { return config.noffleGroup; }
 
+void Cfg_setClientAuth( Bool needsAuth )
+{
+    config.clientAuth = needsAuth;
+}
+
 void
 Cfg_beginServEnum( void )
 {
--- a/src/configfile.h	Thu May 22 10:04:38 2003 +0100
+++ b/src/configfile.h	Fri May 23 10:33:10 2003 +0100
@@ -3,7 +3,7 @@
 
   Common declarations and handling of the configuration file.
 
-  $Id: configfile.h 495 2003-03-24 23:32:48Z bears $
+  $Id: configfile.h 533 2003-05-23 09:33:10Z bears $
 */
 
 #ifndef CONFIGFILE_H
@@ -49,6 +49,7 @@
 void Cfg_authInfo( const char *name, Str user, Str pass );
 
 Bool Cfg_needClientAuth( void );
+void Cfg_setClientAuth( Bool needsAuth );
 
 /* Return expire period for named group. */
 int Cfg_expire( const char *grp );
--- a/src/noffle.c	Thu May 22 10:04:38 2003 +0100
+++ b/src/noffle.c	Fri May 23 10:33:10 2003 +0100
@@ -10,7 +10,7 @@
   received for some seconds (to allow multiple clients connect at the same
   time).
 
-  $Id: noffle.c 532 2003-05-22 09:04:38Z bears $
+  $Id: noffle.c 533 2003-05-23 09:33:10Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -574,7 +574,7 @@
       " -p | --post                      Post article on stdin\n"
       " -q | --query groups [server]     Get group list from server\n"
       " -q | --query desc [server]       Get group descriptions from server\n"
-      " -r | --server                    Run as server on stdin/stdout\n"
+      " -r | --server [auth]             Run as server on stdin/stdout\n"
       " -R | --requested                 List articles marked for download\n"
       " -s | --subscribe-over <grp>      Add group to fetch list (overview)\n"
       " -S | --subscribe-full <grp>      Add group to fetch list (full)\n"
@@ -1039,7 +1039,22 @@
         }
         break;
     case 'r':
-        Log_inf( "Starting as server" );
+	if ( *argv != NULL )
+	{
+	    if ( strcmp( *argv, "auth" ) != 0 )
+	    {
+                fprintf( stderr, "Unknown argument -r %s\n", *argv );
+                result = EXIT_FAILURE;
+		break;
+	    }
+
+	    Cfg_setClientAuth( TRUE );
+	    p = ", authentication enabled from command line";
+	}
+	else
+	    p = "";
+
+	Log_inf( "Starting as server%s", p );
         Server_run();
         break;
     case 'R':