comparison src/client.c @ 287:01755687c565 noffle

[svn] * src/configfile.c: Change snprintf() to Utl_cpyStr(); * src/configfile.c,src/fetch.c,src/fetchlist.c,src/protocol.c, src/server.c: Replace strcpy() with Utl_cpyStr() where appropriate. See Debian bug 168128. * src/client.c. Replace strcpy() here too. * src/configfile.h,src/configfile.c,docs/noffle.conf.5: Add noffle-user and noffle-group configs. * src/control.c,src/configfile.c,src/noffle.c: Replace [s]scanf("%s") with [s]scanf(MAXCHAR_FMT).
author bears
date Fri, 10 Jan 2003 23:11:43 +0000
parents 9c54bf672ca1
children 1aa690671cd7
comparison
equal deleted inserted replaced
286:6443163104a8 287:01755687c565
1 /* 1 /*
2 client.c 2 client.c
3 3
4 $Id: client.c 412 2002-12-24 09:08:59Z bears $ 4 $Id: client.c 419 2003-01-10 23:11:43Z 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
106 putCmdLn( const char *line ) 106 putCmdLn( const char *line )
107 { 107 {
108 Bool err; 108 Bool err;
109 unsigned int n; 109 unsigned int n;
110 110
111 strcpy( client.lastCmd, line ); 111 Utl_cpyStr( client.lastCmd, line );
112 strcpy( client.lastStat, "[no status available]" ); 112 Utl_cpyStr( client.lastStat, "[no status available]" );
113 Log_dbg( LOG_DBG_PROTOCOL, "[S] %s", line ); 113 Log_dbg( LOG_DBG_PROTOCOL, "[S] %s", line );
114 n = fprintf( client.out, "%s\r\n", line ); 114 n = fprintf( client.out, "%s\r\n", line );
115 err = ( n != strlen( line ) + 2 ); 115 err = ( n != strlen( line ) + 2 );
116 if ( err ) 116 if ( err )
117 logBreakDown();; 117 logBreakDown();;
200 if ( ( result == STAT_AUTH_REQUIRED 200 if ( ( result == STAT_AUTH_REQUIRED
201 || result == STAT_AUTH_REQUIRED_DEPREC ) 201 || result == STAT_AUTH_REQUIRED_DEPREC )
202 && ! client.auth ) 202 && ! client.auth )
203 { 203 {
204 client.auth = TRUE; 204 client.auth = TRUE;
205 strcpy( lastCmd, client.lastCmd ); 205 Utl_cpyStr( lastCmd, client.lastCmd );
206 result = performAuth(); 206 result = performAuth();
207 if ( result == STAT_AUTH_ACCEPTED 207 if ( result == STAT_AUTH_ACCEPTED
208 || result == STAT_AUTH_ACCEPTED_DEPREC ) 208 || result == STAT_AUTH_ACCEPTED_DEPREC )
209 { 209 {
210 putCmd( lastCmd ); 210 putCmd( lastCmd );
284 Utl_cpyStr( s, serv ); 284 Utl_cpyStr( s, serv );
285 pStart = Utl_stripWhiteSpace( s ); 285 pStart = Utl_stripWhiteSpace( s );
286 pColon = strstr( pStart, ":" ); 286 pColon = strstr( pStart, ":" );
287 if ( pColon == NULL ) 287 if ( pColon == NULL )
288 { 288 {
289 strcpy( host, pStart ); 289 Utl_cpyStr( host, pStart );
290 port = 119; 290 port = 119;
291 } 291 }
292 else 292 else
293 { 293 {
294 *pColon = '\0'; 294 *pColon = '\0';
295 strcpy( host, pStart ); 295 Utl_cpyStr( host, pStart );
296 if ( sscanf( pColon + 1, "%hu", &port ) != 1 ) 296 if ( sscanf( pColon + 1, "%hu", &port ) != 1 )
297 { 297 {
298 Log_err( "Syntax error in server name: '%s'", serv ); 298 Log_err( "Syntax error in server name: '%s'", serv );
299 return FALSE;; 299 return FALSE;;
300 } 300 }
627 result = STAT_PROGRAM_FAULT; 627 result = STAT_PROGRAM_FAULT;
628 break; 628 break;
629 } 629 }
630 if ( *noServerPattern && ! isGetGroup( name ) ) 630 if ( *noServerPattern && ! isGetGroup( name ) )
631 continue; 631 continue;
632 strcpy( dsc, Utl_restOfLn( line, 1 ) ); 632 Utl_cpyStr( dsc, Utl_restOfLn( line, 1 ) );
633 if ( Grp_exists( name ) ) 633 if ( Grp_exists( name ) )
634 { 634 {
635 Log_dbg( LOG_DBG_FETCH, "Description of %s: %s", name, dsc ); 635 Log_dbg( LOG_DBG_FETCH, "Description of %s: %s", name, dsc );
636 Grp_setDsc( name, dsc ); 636 Grp_setDsc( name, dsc );
637 } 637 }
1235 if ( IS_FATAL( stat ) ) 1235 if ( IS_FATAL( stat ) )
1236 return stat; 1236 return stat;
1237 else if ( stat != STAT_SEND_ART ) 1237 else if ( stat != STAT_SEND_ART )
1238 { 1238 {
1239 Log_err( "Posting of %s not allowed: %s", msgId, client.lastStat ); 1239 Log_err( "Posting of %s not allowed: %s", msgId, client.lastStat );
1240 strcpy( errStr, client.lastStat ); 1240 Utl_cpyStr( errStr, client.lastStat );
1241 return stat; 1241 return stat;
1242 } 1242 }
1243 putTxtBuf( artTxt ); 1243 putTxtBuf( artTxt );
1244 putEndOfTxt(); 1244 putEndOfTxt();
1245 stat = getStat(); 1245 stat = getStat();
1246 if ( IS_FATAL( stat ) ) 1246 if ( IS_FATAL( stat ) )
1247 return stat; 1247 return stat;
1248 else if ( stat != STAT_POST_OK ) 1248 else if ( stat != STAT_POST_OK )
1249 { 1249 {
1250 Log_err( "Posting of %s failed: %s", msgId, client.lastStat ); 1250 Log_err( "Posting of %s failed: %s", msgId, client.lastStat );
1251 strcpy( errStr, client.lastStat ); 1251 Utl_cpyStr( errStr, client.lastStat );
1252 return stat; 1252 return stat;
1253 } 1253 }
1254 Log_inf( "Posted %s (Status: %s)", msgId, client.lastStat ); 1254 Log_inf( "Posted %s (Status: %s)", msgId, client.lastStat );
1255 return STAT_OK; 1255 return STAT_OK;
1256 } 1256 }