comparison src/protocol.c @ 251:030c41dfd9ba noffle

[svn] * src/protocol.c: Change strcpy to Utl_strcpy and replace ascii check with isascii().
author bears
date Wed, 26 Jun 2002 14:13:26 +0100
parents 93d5d8b098da
children 3477050e8d10
comparison
equal deleted inserted replaced
250:93d5d8b098da 251:030c41dfd9ba
1 /* 1 /*
2 protocol.c 2 protocol.c
3 3
4 $Id: protocol.c 382 2002-06-05 22:03:44Z mirkol $ 4 $Id: protocol.c 383 2002-06-26 13:13:26Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
299 if ( len > 250 ) 299 if ( len > 250 )
300 return FALSE; /* see draft-ietf-usefor-article-06.txt, ch 5.3 */ 300 return FALSE; /* see draft-ietf-usefor-article-06.txt, ch 5.3 */
301 p = strchr( msgId, '@' ); 301 p = strchr( msgId, '@' );
302 if ( msgId[ 0 ] != '<' || msgId[ len - 1 ] != '>' || p == NULL ) 302 if ( msgId[ 0 ] != '<' || msgId[ len - 1 ] != '>' || p == NULL )
303 return FALSE; 303 return FALSE;
304 strcpy( domain, p + 1 ); 304 Utl_cpyStr( domain, p + 1 );
305 domain[ strlen( domain ) - 1 ] = '\0'; 305 domain[ strlen( domain ) - 1 ] = '\0';
306 headLen = p - msgId - 1; 306 headLen = p - msgId - 1;
307 Utl_cpyStrN( head, msgId + 1, headLen ); 307 Utl_cpyStrN( head, msgId + 1, headLen );
308 head[ headLen ] = '\0'; 308 head[ headLen ] = '\0';
309 for ( p = msgId ; *p != '\0' ; p++ ) 309 for ( p = msgId ; *p != '\0' ; p++ )
310 { 310 {
311 if ( ( (unsigned char ) *p ) >= 128 ) 311 if ( ! isascii( *p ) )
312 return FALSE; /* pure 7bit ASCII */ 312 return FALSE;
313 } 313 }
314 if ( strpbrk( head, specials ) ) 314 if ( strpbrk( head, specials ) )
315 return FALSE; 315 return FALSE;
316 if ( strpbrk( domain, specials ) ) 316 if ( strpbrk( domain, specials ) )
317 return FALSE;
318 /*
319 To do: Maybe compare domain with a config option
320 and replace it by the config option, if not equal.
321 */
322 if ( strchr( domain, '.' ) == NULL )
323 return FALSE; 317 return FALSE;
324 return TRUE; 318 return TRUE;
325 } 319 }
326 320
327 void 321 void