Mercurial > noffle
changeset 247:7a830ce3211e noffle
[svn] *** empty log message ***
author | mirkol |
---|---|
date | Tue, 26 Mar 2002 17:52:01 +0000 |
parents | 6f3a55d18659 |
children | cd022deb8390 |
files | src/database.c src/post.c src/protocol.c |
diffstat | 3 files changed, 44 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/database.c Fri Mar 15 15:25:46 2002 +0000 +++ b/src/database.c Tue Mar 26 17:52:01 2002 +0000 @@ -1,7 +1,7 @@ /* database.c - $Id: database.c 375 2002-03-15 10:50:33Z bears $ + $Id: database.c 379 2002-03-26 17:52:01Z mirkol $ Uses GNU gdbm library. Using Berkeley db (included in libc6) was cumbersome. It is based on Berkeley db 1.85, which has severe bugs @@ -147,23 +147,23 @@ Log_err( "Entry in database '%s' is corrupt (lastAccess)", msgId ); return FALSE; } - p = Utl_getLn( db.subj, p ); - p = Utl_getLn( db.from, p ); - p = Utl_getLn( db.date, p ); - p = Utl_getLn( db.ref, p ); - p = Utl_getLn( db.xref, p ); + p = Utl_getHeaderLn( db.subj, p ); + p = Utl_getHeaderLn( db.from, p ); + p = Utl_getHeaderLn( db.date, p ); + p = Utl_getHeaderLn( db.ref, p ); + p = Utl_getHeaderLn( db.xref, p ); if ( ! p ) { Log_err( "Entry in database '%s' is corrupt (overview)", msgId ); return FALSE; } - p = Utl_getLn( t, p ); + p = Utl_getHeaderLn( t, p ); if ( ! p || sscanf( t, "%u", &db.bytes ) != 1 ) { Log_err( "Entry in database '%s' is corrupt (bytes)", msgId ); return FALSE; } - p = Utl_getLn( t, p ); + p = Utl_getHeaderLn( t, p ); if ( ! p || sscanf( t, "%u", &db.lines ) != 1 ) { Log_err( "Entry in database '%s' is corrupt (lines)", msgId );
--- a/src/post.c Fri Mar 15 15:25:46 2002 +0000 +++ b/src/post.c Tue Mar 26 17:52:01 2002 +0000 @@ -1,7 +1,7 @@ /* post.c - $Id: post.c 371 2002-02-26 17:13:31Z bears $ + $Id: post.c 379 2002-03-26 17:52:01Z mirkol $ */ #if HAVE_CONFIG_H @@ -184,31 +184,40 @@ article.text = s; replyToFound = pathFound = orgFound = FALSE; - + + field[ 0 ] = '\0'; + /* Grab header lines first, getting overview info as we go. */ while ( ( p = Utl_getHeaderLn( line, p ) ) != NULL && line[ 0 ] != '\0' && Prt_getField( field, value, line ) ) { + if ( field [ 0 ] == '\0' ) + { + /* Error! Continuation without preceding header. */ + Log_err( "First header line started with white space" ); + return FALSE; + } /* Look for headers we need to stash. */ if ( strcmp( field, "subject" ) == 0 ) { - Utl_cpyStr( article.over.subject, value ); + Utl_catStr( article.over.subject, value ); DynStr_appLn( s, line ); } else if ( strcmp ( field, "from" ) == 0 ) { - Utl_cpyStr( article.over.from, value ); + Utl_catStr( article.over.from, value ); DynStr_appLn( s, line ); } else if ( strcmp ( field, "date" ) == 0 ) - Utl_cpyStr( article.over.date, value ); + Utl_catStr( article.over.date, value ); else if ( strcmp ( field, "references" ) == 0 ) { - Utl_cpyStr( article.over.ref, value ); + Utl_catStr( article.over.ref, value ); DynStr_appLn( s, line ); } else if ( strcmp ( field, "message-id" ) == 0 ) + /* Utl_catStr( article.over.msgId, value ); */ Utl_cpyStr( article.over.msgId, value ); else if ( strcmp ( field, "newsgroups" ) == 0 ) {
--- a/src/protocol.c Fri Mar 15 15:25:46 2002 +0000 +++ b/src/protocol.c Tue Mar 26 17:52:01 2002 +0000 @@ -1,7 +1,7 @@ /* protocol.c - $Id: protocol.c 375 2002-03-15 10:50:33Z bears $ + $Id: protocol.c 379 2002-03-26 17:52:01Z mirkol $ */ #if HAVE_CONFIG_H @@ -166,19 +166,27 @@ Utl_cpyStr( lineLower, line ); Utl_toLower( lineLower ); p = Utl_stripWhiteSpace( lineLower ); - dst = resultField; - while ( ! isspace( *p ) && *p != ':' && *p != '\0' ) - *(dst++) = *(p++); - *dst = '\0'; - while ( isspace( *p ) ) - ++p; - if ( *p == ':' ) + if ( p == lineLower ) { - ++p; - strcpy( t, line + ( p - lineLower ) ); - p = Utl_stripWhiteSpace( t ); - strcpy( resultValue, p ); - return TRUE; + dst = resultField; + while ( ! isspace( *p ) && *p != ':' && *p != '\0' ) + *(dst++) = *(p++); + *dst = '\0'; + while ( isspace( *p ) ) + ++p; + if ( *p == ':' ) + { + ++p; + strcpy( t, line + ( p - lineLower ) ); + p = Utl_stripWhiteSpace( t ); + strcpy( resultValue, p ); + return TRUE; + } + } + else /* continued header. */ + { + strcpy( resultValue, lineLower ); /* include starting whitespace */ + return TRUE; } return FALSE; }