Mercurial > noffle
comparison src/configfile.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 | 18d6c61ed4e7 |
| children | f35a7d45efd5 |
comparison
equal
deleted
inserted
replaced
| 286:6443163104a8 | 287:01755687c565 |
|---|---|
| 4 The following macros must be set, when compiling this file: | 4 The following macros must be set, when compiling this file: |
| 5 CONFIGFILE | 5 CONFIGFILE |
| 6 SPOOLDIR | 6 SPOOLDIR |
| 7 VERSION | 7 VERSION |
| 8 | 8 |
| 9 $Id: configfile.c 405 2002-11-10 15:06:33Z bears $ | 9 $Id: configfile.c 419 2003-01-10 23:11:43Z bears $ |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #if HAVE_CONFIG_H | 12 #if HAVE_CONFIG_H |
| 13 #include <config.h> | 13 #include <config.h> |
| 14 #endif | 14 #endif |
| 77 Bool autoUnsubscribe; | 77 Bool autoUnsubscribe; |
| 78 Bool infoAlways; | 78 Bool infoAlways; |
| 79 Bool replaceMsgId; | 79 Bool replaceMsgId; |
| 80 Str hostnameMsgId; | 80 Str hostnameMsgId; |
| 81 Bool postLocal; | 81 Bool postLocal; |
| 82 Bool clientAuth; | |
| 82 Str defaultAutoSubscribeMode; | 83 Str defaultAutoSubscribeMode; |
| 83 Str mailTo; | 84 Str mailTo; |
| 84 int defaultExpire; | 85 int defaultExpire; |
| 85 int numServ; | 86 int numServ; |
| 86 int maxServ; | 87 int maxServ; |
| 93 int maxAutoSubscribeMode; | 94 int maxAutoSubscribeMode; |
| 94 AutoSubscribeModeEntry *autoSubscribeMode; | 95 AutoSubscribeModeEntry *autoSubscribeMode; |
| 95 Str pathHeader; | 96 Str pathHeader; |
| 96 Str fromDomain; | 97 Str fromDomain; |
| 97 Str organization; | 98 Str organization; |
| 99 Str noffleUser; | |
| 100 Str noffleGroup; | |
| 98 } config = | 101 } config = |
| 99 { | 102 { |
| 100 SPOOLDIR, /* spoolDir */ | 103 SPOOLDIR, /* spoolDir */ |
| 101 VERSION, /* version */ | 104 VERSION, /* version */ |
| 102 300, /* maxFetch */ | 105 300, /* maxFetch */ |
| 107 FALSE, /* autoUnsubscribe */ | 110 FALSE, /* autoUnsubscribe */ |
| 108 TRUE, /* infoAlways */ | 111 TRUE, /* infoAlways */ |
| 109 FALSE, /* replaceMsgId */ | 112 FALSE, /* replaceMsgId */ |
| 110 "", /* hostnameMsgId */ | 113 "", /* hostnameMsgId */ |
| 111 FALSE, /* postLocal */ | 114 FALSE, /* postLocal */ |
| 115 FALSE, /* clientAuth */ | |
| 112 "over", /* defaultAutoSubscribeMode */ | 116 "over", /* defaultAutoSubscribeMode */ |
| 113 "", /* mailTo */ | 117 "", /* mailTo */ |
| 114 14, /* defaultExpire */ | 118 14, /* defaultExpire */ |
| 115 0, /* numServ */ | 119 0, /* numServ */ |
| 116 0, /* maxServ */ | 120 0, /* maxServ */ |
| 122 0, /* numAutoSubscribeMode */ | 126 0, /* numAutoSubscribeMode */ |
| 123 0, /* maxAutoSubscribeMode */ | 127 0, /* maxAutoSubscribeMode */ |
| 124 NULL, /* autoSubscribeMode */ | 128 NULL, /* autoSubscribeMode */ |
| 125 "", /* pathHeader */ | 129 "", /* pathHeader */ |
| 126 "", /* fromDomain */ | 130 "", /* fromDomain */ |
| 127 "" /* organization */ | 131 "", /* organization */ |
| 132 "news", /* user Noffle runs as */ | |
| 133 "news" /* group Noffle runs as */ | |
| 128 }; | 134 }; |
| 129 | 135 |
| 130 const char * Cfg_spoolDir( void ) { return config.spoolDir; } | 136 const char * Cfg_spoolDir( void ) { return config.spoolDir; } |
| 131 const char * Cfg_version( void ) { return config.version; } | 137 const char * Cfg_version( void ) { return config.version; } |
| 132 | 138 |
| 138 Bool Cfg_autoSubscribe( void ) { return config.autoSubscribe; } | 144 Bool Cfg_autoSubscribe( void ) { return config.autoSubscribe; } |
| 139 Bool Cfg_infoAlways( void ) { return config.infoAlways; } | 145 Bool Cfg_infoAlways( void ) { return config.infoAlways; } |
| 140 Bool Cfg_replaceMsgId( void ) { return config.replaceMsgId; } | 146 Bool Cfg_replaceMsgId( void ) { return config.replaceMsgId; } |
| 141 const char * Cfg_hostnameMsgId( void ) { return config.hostnameMsgId; } | 147 const char * Cfg_hostnameMsgId( void ) { return config.hostnameMsgId; } |
| 142 Bool Cfg_postLocal( void ) { return config.postLocal; } | 148 Bool Cfg_postLocal( void ) { return config.postLocal; } |
| 149 Bool Cfg_needClientAuth( void ) { return config.clientAuth; } | |
| 143 const char * Cfg_defaultAutoSubscribeMode( void ) { | 150 const char * Cfg_defaultAutoSubscribeMode( void ) { |
| 144 return config.defaultAutoSubscribeMode; } | 151 return config.defaultAutoSubscribeMode; } |
| 145 const char * Cfg_mailTo( void ) { return config.mailTo; } | 152 const char * Cfg_mailTo( void ) { return config.mailTo; } |
| 146 int Cfg_defaultExpire( void ) { return config.defaultExpire; } | 153 int Cfg_defaultExpire( void ) { return config.defaultExpire; } |
| 147 const char * Cfg_pathHeader( void ) { return config.pathHeader; } | 154 const char * Cfg_pathHeader( void ) { return config.pathHeader; } |
| 148 const char * Cfg_fromDomain( void ) { return config.fromDomain; } | 155 const char * Cfg_fromDomain( void ) { return config.fromDomain; } |
| 149 const char * Cfg_organization( void ) { return config.organization; } | 156 const char * Cfg_organization( void ) { return config.organization; } |
| 157 const char * Cfg_noffleUser( void ) { return config.noffleUser; } | |
| 158 const char * Cfg_noffleGroup( void ) { return config.noffleGroup; } | |
| 150 | 159 |
| 151 void | 160 void |
| 152 Cfg_beginServEnum( void ) | 161 Cfg_beginServEnum( void ) |
| 153 { | 162 { |
| 154 config.servIdx = 0; | 163 config.servIdx = 0; |
| 157 Bool | 166 Bool |
| 158 Cfg_nextServ( Str name ) | 167 Cfg_nextServ( Str name ) |
| 159 { | 168 { |
| 160 if ( config.servIdx >= config.numServ ) | 169 if ( config.servIdx >= config.numServ ) |
| 161 return FALSE; | 170 return FALSE; |
| 162 strcpy( name, config.serv[ config.servIdx ].name ); | 171 Utl_cpyStr( name, config.serv[ config.servIdx ].name ); |
| 163 ++config.servIdx; | 172 ++config.servIdx; |
| 164 return TRUE; | 173 return TRUE; |
| 165 } | 174 } |
| 166 | 175 |
| 167 static Bool | 176 static Bool |
| 207 { | 216 { |
| 208 int idx; | 217 int idx; |
| 209 | 218 |
| 210 if ( searchServ( name, &idx ) ) | 219 if ( searchServ( name, &idx ) ) |
| 211 { | 220 { |
| 212 strcpy( user, config.serv[ idx ].user ); | 221 Utl_cpyStr( user, config.serv[ idx ].user ); |
| 213 strcpy( pass, config.serv[ idx ].pass ); | 222 Utl_cpyStr( pass, config.serv[ idx ].pass ); |
| 214 } | 223 } |
| 215 else | 224 else |
| 216 { | 225 { |
| 217 user[ 0 ] = '\0'; | 226 user[ 0 ] = '\0'; |
| 218 pass[ 0 ] = '\0'; | 227 pass[ 0 ] = '\0'; |
| 262 GroupEnum *res; | 271 GroupEnum *res; |
| 263 int servIdx; | 272 int servIdx; |
| 264 | 273 |
| 265 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); | 274 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
| 266 if ( res == NULL ) | 275 if ( res == NULL ) |
| 267 { | 276 Log_fatal( "Malloc of GroupEnum failed." ); |
| 268 Log_err( "Malloc of GroupEnum failed." ); | |
| 269 exit( EXIT_FAILURE ); | |
| 270 } | |
| 271 if ( ! searchServ( name, &servIdx ) ) | 277 if ( ! searchServ( name, &servIdx ) ) |
| 272 res->groupEntry = NULL; | 278 res->groupEntry = NULL; |
| 273 else | 279 else |
| 274 res->groupEntry = &config.serv[ servIdx ].getgroups; | 280 res->groupEntry = &config.serv[ servIdx ].getgroups; |
| 275 GrEn_first( res ); | 281 GrEn_first( res ); |
| 282 GroupEnum *res; | 288 GroupEnum *res; |
| 283 int servIdx; | 289 int servIdx; |
| 284 | 290 |
| 285 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); | 291 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
| 286 if ( res == NULL ) | 292 if ( res == NULL ) |
| 287 { | 293 Log_fatal( "Malloc of GroupEnum failed." ); |
| 288 Log_err( "Malloc of GroupEnum failed." ); | |
| 289 exit( EXIT_FAILURE ); | |
| 290 } | |
| 291 if ( ! searchServ( name, &servIdx ) ) | 294 if ( ! searchServ( name, &servIdx ) ) |
| 292 res->groupEntry = NULL; | 295 res->groupEntry = NULL; |
| 293 else | 296 else |
| 294 res->groupEntry = &config.serv[ servIdx ].omitgroups; | 297 res->groupEntry = &config.serv[ servIdx ].omitgroups; |
| 295 GrEn_first( res ); | 298 GrEn_first( res ); |
| 326 static void | 329 static void |
| 327 getBool( Bool *variable, const char *line ) | 330 getBool( Bool *variable, const char *line ) |
| 328 { | 331 { |
| 329 Str value, name, lowerLn; | 332 Str value, name, lowerLn; |
| 330 | 333 |
| 331 strcpy( lowerLn, line ); | 334 Utl_cpyStr( lowerLn, line ); |
| 332 Utl_toLower( lowerLn ); | 335 Utl_toLower( lowerLn ); |
| 333 if ( sscanf( lowerLn, "%s %s", name, value ) != 2 ) | 336 if ( sscanf( lowerLn, MAXCHAR_FMT " " MAXCHAR_FMT, name, value ) != 2 ) |
| 334 { | 337 { |
| 335 logSyntaxErr( line ); | 338 logSyntaxErr( line ); |
| 336 return; | 339 return; |
| 337 } | 340 } |
| 338 | 341 |
| 348 getInt( int *variable, int min, int max, const char *line ) | 351 getInt( int *variable, int min, int max, const char *line ) |
| 349 { | 352 { |
| 350 int value; | 353 int value; |
| 351 Str name; | 354 Str name; |
| 352 | 355 |
| 353 if ( sscanf( line, "%s %d", name, &value ) != 2 ) | 356 if ( sscanf( line, MAXCHAR_FMT " %d", name, &value ) != 2 ) |
| 354 { | 357 { |
| 355 logSyntaxErr( line ); | 358 logSyntaxErr( line ); |
| 356 return; | 359 return; |
| 357 } | 360 } |
| 358 if ( value < min || value > max ) | 361 if ( value < min || value > max ) |
| 366 static void | 369 static void |
| 367 getStr( char *variable, const char *line ) | 370 getStr( char *variable, const char *line ) |
| 368 { | 371 { |
| 369 Str dummy; | 372 Str dummy; |
| 370 | 373 |
| 371 if ( sscanf( line, "%s %s", dummy, variable ) != 2 ) | 374 if ( sscanf( line, MAXCHAR_FMT " " MAXCHAR_FMT, dummy, variable ) != 2 ) |
| 372 { | 375 { |
| 373 logSyntaxErr( line ); | 376 logSyntaxErr( line ); |
| 374 return; | 377 return; |
| 375 } | 378 } |
| 376 } | 379 } |
| 392 int r, len; | 395 int r, len; |
| 393 ServEntry entry; | 396 ServEntry entry; |
| 394 | 397 |
| 395 memset( &entry, 0, sizeof( entry ) ); | 398 memset( &entry, 0, sizeof( entry ) ); |
| 396 user[ 0 ] = pass[ 0 ] = '\0'; | 399 user[ 0 ] = pass[ 0 ] = '\0'; |
| 397 r = sscanf( line, "%s %s %s %s", | 400 r = sscanf( line, |
| 401 MAXCHAR_FMT " " MAXCHAR_FMT " " MAXCHAR_FMT " " MAXCHAR_FMT, | |
| 398 dummy, name, user, pass ); | 402 dummy, name, user, pass ); |
| 399 if ( r < 2 ) | 403 if ( r < 2 ) |
| 400 { | 404 { |
| 401 logSyntaxErr( line ); | 405 logSyntaxErr( line ); |
| 402 return; | 406 return; |
| 415 if ( config.maxServ < config.numServ + 1 ) | 419 if ( config.maxServ < config.numServ + 1 ) |
| 416 { | 420 { |
| 417 if ( ! ( config.serv = realloc( config.serv, | 421 if ( ! ( config.serv = realloc( config.serv, |
| 418 ( config.maxServ + 5 ) | 422 ( config.maxServ + 5 ) |
| 419 * sizeof( ServEntry ) ) ) ) | 423 * sizeof( ServEntry ) ) ) ) |
| 420 { | 424 Log_fatal( "Could not realloc server list" ); |
| 421 Log_err( "Could not realloc server list" ); | |
| 422 exit( EXIT_FAILURE ); | |
| 423 } | |
| 424 config.maxServ += 5; | 425 config.maxServ += 5; |
| 425 } | 426 } |
| 426 config.serv[ config.numServ++ ] = entry; | 427 config.serv[ config.numServ++ ] = entry; |
| 427 } | 428 } |
| 428 | 429 |
| 431 { | 432 { |
| 432 Str dummy, pattern; | 433 Str dummy, pattern; |
| 433 ExpireEntry entry; | 434 ExpireEntry entry; |
| 434 int days; | 435 int days; |
| 435 | 436 |
| 436 if ( sscanf( line, "%s %s %d", dummy, pattern, &days ) != 3 ) | 437 if ( sscanf( line, MAXCHAR_FMT " " MAXCHAR_FMT " %d", |
| 438 dummy, pattern, &days ) != 3 ) | |
| 437 { | 439 { |
| 438 logSyntaxErr( line ); | 440 logSyntaxErr( line ); |
| 439 return; | 441 return; |
| 440 } | 442 } |
| 441 else | 443 else |
| 454 if ( config.maxExpire < config.numExpire + 1 ) | 456 if ( config.maxExpire < config.numExpire + 1 ) |
| 455 { | 457 { |
| 456 if ( ! ( config.expire = realloc( config.expire, | 458 if ( ! ( config.expire = realloc( config.expire, |
| 457 ( config.maxExpire + 5 ) | 459 ( config.maxExpire + 5 ) |
| 458 * sizeof( ExpireEntry ) ) ) ) | 460 * sizeof( ExpireEntry ) ) ) ) |
| 459 { | 461 Log_fatal( "Could not realloc expire list" ); |
| 460 Log_err( "Could not realloc expire list" ); | |
| 461 exit( EXIT_FAILURE ); | |
| 462 } | |
| 463 config.maxExpire += 5; | 462 config.maxExpire += 5; |
| 464 } | 463 } |
| 465 config.expire[ config.numExpire++ ] = entry; | 464 config.expire[ config.numExpire++ ] = entry; |
| 466 } | 465 } |
| 467 } | 466 } |
| 505 if ( g->maxGroup < g->numGroup + 1 ) | 504 if ( g->maxGroup < g->numGroup + 1 ) |
| 506 { | 505 { |
| 507 if ( ! ( g->groups = realloc( g->groups, | 506 if ( ! ( g->groups = realloc( g->groups, |
| 508 ( g->maxGroup + 5 ) | 507 ( g->maxGroup + 5 ) |
| 509 * sizeof( char * ) ) ) ) | 508 * sizeof( char * ) ) ) ) |
| 510 { | 509 Log_fatal( "Could not realloc group list" ); |
| 511 Log_err( "Could not realloc group list" ); | |
| 512 exit( EXIT_FAILURE ); | |
| 513 } | |
| 514 g->maxGroup += 5; | 510 g->maxGroup += 5; |
| 515 } | 511 } |
| 516 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); | 512 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); |
| 517 } | 513 } |
| 518 del_Itl( patterns) ; | 514 del_Itl( patterns) ; |
| 568 mask |= LOG_DBG_PROTOCOL; | 564 mask |= LOG_DBG_PROTOCOL; |
| 569 else if ( strcmp( maskName, "requests" ) == 0 ) | 565 else if ( strcmp( maskName, "requests" ) == 0 ) |
| 570 mask |= LOG_DBG_REQUESTS; | 566 mask |= LOG_DBG_REQUESTS; |
| 571 else if ( strcmp( maskName, "server" ) == 0 ) | 567 else if ( strcmp( maskName, "server" ) == 0 ) |
| 572 mask |= LOG_DBG_SERVER; | 568 mask |= LOG_DBG_SERVER; |
| 569 else if ( strcmp( maskName, "auth" ) == 0 ) | |
| 570 mask |= LOG_DBG_AUTH; | |
| 573 else | 571 else |
| 574 logSyntaxErr( line ); | 572 logSyntaxErr( line ); |
| 575 } | 573 } |
| 576 del_Itl( maskNames) ; | 574 del_Itl( maskNames) ; |
| 577 Log_setDbgMask( mask ); | 575 Log_setDbgMask( mask ); |
| 591 { | 589 { |
| 592 Str dummy, pattern, mode; | 590 Str dummy, pattern, mode; |
| 593 AutoSubscribeModeEntry entry; | 591 AutoSubscribeModeEntry entry; |
| 594 int items; | 592 int items; |
| 595 | 593 |
| 596 items = sscanf( line, "%s %s %s", dummy, pattern, mode ); | 594 items = sscanf( line, MAXCHAR_FMT " " MAXCHAR_FMT " " MAXCHAR_FMT, |
| 595 dummy, pattern, mode ); | |
| 597 if ( items == 2 ) | 596 if ( items == 2 ) |
| 598 { | 597 { |
| 599 /* Backwards compat. default-auto-subscribe-mode */ | 598 /* Backwards compat. default-auto-subscribe-mode */ |
| 600 Utl_cpyStr( mode, pattern ); | 599 Utl_cpyStr( mode, pattern ); |
| 601 Utl_toLower( mode ); | 600 Utl_toLower( mode ); |
| 602 if ( ! isValidAutoSubscribeMode( mode ) ) | 601 if ( ! isValidAutoSubscribeMode( mode ) ) |
| 603 { | 602 { |
| 604 logSyntaxErr( line ); | 603 logSyntaxErr( line ); |
| 605 return; | 604 return; |
| 606 } | 605 } |
| 607 strcpy( config.defaultAutoSubscribeMode, mode ); | 606 Utl_cpyStr( config.defaultAutoSubscribeMode, mode ); |
| 608 return; | 607 return; |
| 609 } | 608 } |
| 610 else if ( items != 3 ) | 609 else if ( items != 3 ) |
| 611 { | 610 { |
| 612 logSyntaxErr( line ); | 611 logSyntaxErr( line ); |
| 628 { | 627 { |
| 629 if ( ! ( config.autoSubscribeMode = | 628 if ( ! ( config.autoSubscribeMode = |
| 630 realloc( config.autoSubscribeMode, | 629 realloc( config.autoSubscribeMode, |
| 631 ( config.maxAutoSubscribeMode + 5 ) | 630 ( config.maxAutoSubscribeMode + 5 ) |
| 632 * sizeof( AutoSubscribeModeEntry ) ) ) ) | 631 * sizeof( AutoSubscribeModeEntry ) ) ) ) |
| 633 { | 632 Log_fatal( "Could not realloc auto subscribe mode list" ); |
| 634 Log_err( "Could not realloc auto subscribe mode list" ); | |
| 635 exit( EXIT_FAILURE ); | |
| 636 } | |
| 637 config.maxAutoSubscribeMode += 5; | 633 config.maxAutoSubscribeMode += 5; |
| 638 } | 634 } |
| 639 config.autoSubscribeMode[ config.numAutoSubscribeMode++ ] = entry; | 635 config.autoSubscribeMode[ config.numAutoSubscribeMode++ ] = entry; |
| 640 } | 636 } |
| 641 | 637 |
| 917 { | 913 { |
| 918 char *p; | 914 char *p; |
| 919 FILE *f; | 915 FILE *f; |
| 920 Str file, line, lowerLine, name, s; | 916 Str file, line, lowerLine, name, s; |
| 921 | 917 |
| 922 snprintf( file, MAXCHAR, CONFIGFILE ); | 918 Utl_cpyStr( file, CONFIGFILE ); |
| 923 if ( ! ( f = fopen( file, "r" ) ) ) | 919 if ( ! ( f = fopen( file, "r" ) ) ) |
| 924 { | 920 { |
| 925 Log_err( "Cannot read %s", file ); | 921 Log_err( "Cannot read %s", file ); |
| 926 return; | 922 return; |
| 927 } | 923 } |
| 932 Utl_cpyStr( lowerLine, p ); | 928 Utl_cpyStr( lowerLine, p ); |
| 933 Utl_toLower( lowerLine ); | 929 Utl_toLower( lowerLine ); |
| 934 p = lowerLine; | 930 p = lowerLine; |
| 935 if ( *p == '\0' ) | 931 if ( *p == '\0' ) |
| 936 continue; | 932 continue; |
| 937 if ( sscanf( p, "%s", name ) != 1 ) | 933 if ( sscanf( p, MAXCHAR_FMT, name ) != 1 ) |
| 938 Log_err( "Syntax error in %s: %s", file, line ); | 934 Log_err( "Syntax error in %s: %s", file, line ); |
| 939 else if ( strcmp( "max-fetch", name ) == 0 ) | 935 else if ( strcmp( "max-fetch", name ) == 0 ) |
| 940 getInt( &config.maxFetch, 0, INT_MAX, p ); | 936 getInt( &config.maxFetch, 0, INT_MAX, p ); |
| 941 else if ( strcmp( "auto-unsubscribe-days", name ) == 0 ) | 937 else if ( strcmp( "auto-unsubscribe-days", name ) == 0 ) |
| 942 getInt( &config.autoUnsubscribe, -1, INT_MAX, p ); | 938 getInt( &config.autoUnsubscribe, -1, INT_MAX, p ); |
| 957 else if ( strcmp( "hostname", name ) == 0 ) | 953 else if ( strcmp( "hostname", name ) == 0 ) |
| 958 /* use line, do not change to lowercase */ | 954 /* use line, do not change to lowercase */ |
| 959 getStr( config.hostnameMsgId, line ); | 955 getStr( config.hostnameMsgId, line ); |
| 960 else if ( strcmp( "post-locally", name ) == 0 ) | 956 else if ( strcmp( "post-locally", name ) == 0 ) |
| 961 getBool( &config.postLocal, p ); | 957 getBool( &config.postLocal, p ); |
| 958 else if ( strcmp( "authenticate-client", name ) == 0 ) | |
| 959 getBool( &config.clientAuth, p ); | |
| 962 else if ( strcmp( "default-auto-subscribe-mode", name ) == 0 ) | 960 else if ( strcmp( "default-auto-subscribe-mode", name ) == 0 ) |
| 963 { | 961 { |
| 964 getStr( s, p ); | 962 getStr( s, p ); |
| 965 if ( ! isValidAutoSubscribeMode( s ) ) | 963 if ( ! isValidAutoSubscribeMode( s ) ) |
| 966 { | 964 { |
| 967 logSyntaxErr( line ); | 965 logSyntaxErr( line ); |
| 968 return; | 966 return; |
| 969 } | 967 } |
| 970 else | 968 else |
| 971 strcpy( config.defaultAutoSubscribeMode, s ); | 969 Utl_cpyStr( config.defaultAutoSubscribeMode, s ); |
| 972 } | 970 } |
| 973 else if ( strcmp( "mail-to", name ) == 0 ) | 971 else if ( strcmp( "mail-to", name ) == 0 ) |
| 974 getStr( config.mailTo, p ); | 972 getStr( config.mailTo, p ); |
| 975 else if ( strcmp( "expire", name ) == 0 ) | 973 else if ( strcmp( "expire", name ) == 0 ) |
| 976 getExpire( p ); | 974 getExpire( p ); |
| 987 else if ( strcmp( "from-domain", name ) == 0 ) | 985 else if ( strcmp( "from-domain", name ) == 0 ) |
| 988 getStr( config.fromDomain, p ); | 986 getStr( config.fromDomain, p ); |
| 989 /* The following need line because they may have uppercase data */ | 987 /* The following need line because they may have uppercase data */ |
| 990 else if ( strcmp( "organization", name ) == 0 ) | 988 else if ( strcmp( "organization", name ) == 0 ) |
| 991 getText( config.organization, line ); | 989 getText( config.organization, line ); |
| 990 else if ( strcmp( "noffle-user", name ) == 0 ) | |
| 991 getText( config.noffleUser, line ); | |
| 992 else if ( strcmp( "noffle-group", name ) == 0 ) | |
| 993 getText( config.noffleUser, line ); | |
| 992 else if ( strcmp( "server", name ) == 0 ) | 994 else if ( strcmp( "server", name ) == 0 ) |
| 993 getServ( line ); | 995 getServ( line ); |
| 994 else if ( strcmp( "filter", name ) == 0 ) | 996 else if ( strcmp( "filter", name ) == 0 ) |
| 995 getFilter( line ); | 997 getFilter( line ); |
| 996 else | 998 else |
| 997 Log_err( "Unknown config option: %s", name ); | 999 Log_err( "Unknown config option: %s", name ); |
| 998 } | 1000 } |
| 999 fclose( f ); | 1001 fclose( f ); |
| 1000 if ( ! config.numServ ) | 1002 if ( ! config.numServ ) |
| 1001 { | 1003 Log_fatal( "Config file contains no server" ); |
| 1002 Log_err( "Config file contains no server" ); | 1004 } |
| 1003 exit( EXIT_FAILURE ); | |
| 1004 } | |
| 1005 } |
