Mercurial > noffle
changeset 264:94b7962a0fbe noffle
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
* src/server.c: Correctly implement LISTGROUP when the optional group name
parameter is omitted.
author | bears |
---|---|
date | Mon, 05 Aug 2002 23:05:02 +0100 |
parents | 0e56fd09921e |
children | 1cafe0f3f0ec |
files | src/group.c src/server.c |
diffstat | 2 files changed, 33 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/group.c Thu Jul 04 21:51:03 2002 +0100 +++ b/src/group.c Mon Aug 05 23:05:02 2002 +0100 @@ -7,7 +7,7 @@ loadGrp() and saveGrp(). This is done transparently. Access to the groups database is done by group name, by the functions defined in group.h. - $Id: group.c 382 2002-06-05 22:03:44Z mirkol $ + $Id: group.c 396 2002-08-05 22:05:02Z bears $ */ #if HAVE_CONFIG_H @@ -466,6 +466,17 @@ Grp_isValidName( const char *name) { size_t i; + int len; + + /* Groups with lengthy names like + alt.the.lame.troll.should.be.posting.again.in.just.a.few.more.weeks.from.what.he.said + or + microsoft.public.windows.inetexplorer.ie55.programming.components.codedownload + are most likely bogus groups that have been mistakenly created. + */ + len = strlen( name ); + if ( len > MAX_GROUPNAME || len < 1 ) + return FALSE; for ( i = 0; i < sizeof( forbiddenGroupNames ) / @@ -477,14 +488,6 @@ ( ! Wld_match( name, forbiddenGroupNames[i].pattern ) ) ) return FALSE; } - /* Groups with lengthy names like - alt.the.lame.troll.should.be.posting.again.in.just.a.few.more.weeks.from.what.he.said - or - microsoft.public.windows.inetexplorer.ie55.programming.components.codedownload - are most likely bogus groups that have been mistakenly created. - */ - if ( strlen( name ) > MAX_GROUPNAME ) - return FALSE; /* no match? then assume the group is valid. */ return TRUE; }
--- a/src/server.c Thu Jul 04 21:51:03 2002 +0100 +++ b/src/server.c Mon Aug 05 23:05:02 2002 +0100 @@ -1,7 +1,7 @@ /* server.c - $Id: server.c 391 2002-06-26 13:30:26Z bears $ + $Id: server.c 396 2002-08-05 22:05:02Z bears $ */ #if HAVE_CONFIG_H @@ -843,24 +843,33 @@ static Bool doListgrp( char *arg, const Cmd *cmd ) { - const Over *ov; int first, last, i; UNUSED( cmd ); - if ( ! Grp_exists( arg ) ) - putStat( STAT_NO_SUCH_GRP, "No such group" ); + if ( *arg != '\0' ) + { + if ( ! Grp_exists( arg ) ) + { + putStat( STAT_NO_SUCH_GRP, "No such group" ); + return TRUE; + } + changeToGrp( arg ); + } else { - changeToGrp( arg ); - first = Cont_first(); - last = Cont_last(); - putStat( STAT_GRP_SELECTED, "Article list" ); - for ( i = first; i <= last; ++i ) - if ( ( ov = Cont_get( i ) ) ) - putTxtLn( "%lu", i ); - putEndOfTxt(); + if ( ! loadGrpIfSelected() ) + return TRUE; + } + + first = Cont_first(); + last = Cont_last(); + putStat( STAT_GRP_SELECTED, "Article list" ); + for ( i = first; i <= last; ++i ) + if ( Cont_get( i ) != NULL ) + putTxtLn( "%d", i ); + putEndOfTxt(); return TRUE; }