[news.admin] Here is my version of the microsoft fix

gdb@ninja.UUCP (David Butler) (10/12/88)

The biggest problem is that there should be no white space in the
message-ID field.  Under normal conditions this not possible but
there are aways exceptions.

My fix is to eliminate any white space in the message-id when it is
parsed.  This allows the broken software to still get messages out
and not kill us.  This code will be included if you define CHECK_IDENT
in your cc flags.

I'm using Bnews 2.11 patchlevel 14.

This is not a context diff, you will have to insert it by hand.  In
file header.c about line number 201 you will see this:

		case MESSAGEID:
			getfield(hp->ident, sizeof(hp->ident));
			break

Change it to:

		case MESSAGEID:
			getfield(hp->ident, sizeof(hp->ident));
#ifdef CHECK_IDENT
			{
				register char *p1, *p2;
				
				for (p1 = p2 = hp->ident;
				    *p2 != '\0'; ++p1, ++p2) {
					if (*p2 < ' ' && *++p2 == '\0') {
						break;
					}
					if (p1 != p2) {
						*p1 = *p2;
					}
				}
				if (p1 != p2) {
					*p1 = *p2;
				}
			}
#endif
			break;

====================|==========================================================
G. David Butler II  | "There is nothing good or bad, but thinking makes it so."
gdb@ninja.UUCP      | -Shakespeare

gdb@ninja.UUCP (David Butler) (10/13/88)

Im sorry about this but I made a stupid mistake in my code.
I didn't catch spaces!!! :-) here is the line:

	if (*p2 < ' ' && *++p2 == '\0') {

It should be:

	if (*p2 <= ' ' && *++p2 == '\0') {
                 ^-- here is that bug

Please correct this line.  Also you may want to remove the #ifdef. Thanks.

Here is the whole correction.  In header.c about line 201 find:

		case MESSAGEID:
			getfield(hp->ident, sizeof(hp->ident));
			break;

Change it to:

		case MESSAGEID:
			getfield(hp->ident, sizeof(hp->ident));
			{
				register char *p1, *p2;
				
				for (p1 = p2 = hp->ident;
				    *p2 != '\0'; ++p1, ++p2) {
					if (*p2 <= ' ' && *++p2 == '\0') {
						break;
					}
					if (p1 != p2) {
						*p1 = *p2;
					}
				}
				if (p1 != p2) {
					*p1 = *p2;
				}
			}
			break;

====================|==========================================================
G. David Butler II  | "There is nothing good or bad, but thinking makes it so."
gdb@ninja.UUCP      | -Shakespeare