Process a new section (rsync module). * Returns True on success, False on failure. */
| 473 | /* Process a new section (rsync module). |
| 474 | * Returns True on success, False on failure. */ |
| 475 | static BOOL do_section(char *sectionname) |
| 476 | { |
| 477 | BOOL isglobal; |
| 478 | |
| 479 | if (*sectionname == ']') { /* A special push/pop/reset directive from params.c */ |
| 480 | bInGlobalSection = 1; |
| 481 | if (strcmp(sectionname+1, "push") == 0) { |
| 482 | all_vars *vp = EXPAND_ITEM_LIST(&Vars_stack, all_vars, 2); |
| 483 | memcpy(vp, &Vars, sizeof Vars); |
| 484 | } else if (strcmp(sectionname+1, "pop") == 0 |
| 485 | || strcmp(sectionname+1, "reset") == 0) { |
| 486 | all_vars *vp = ((all_vars*)Vars_stack.items) + Vars_stack.count - 1; |
| 487 | if (!Vars_stack.count) |
| 488 | return False; |
| 489 | memcpy(&Vars, vp, sizeof Vars); |
| 490 | if (sectionname[1] == 'p') |
| 491 | Vars_stack.count--; |
| 492 | } else |
| 493 | return False; |
| 494 | return True; |
| 495 | } |
| 496 | |
| 497 | isglobal = strwiEQ(sectionname, GLOBAL_NAME); |
| 498 | |
| 499 | /* At the end of the global section, add any --dparam items. */ |
| 500 | if (bInGlobalSection && !isglobal) { |
| 501 | if (!section_list.count) |
| 502 | set_dparams(0); |
| 503 | } |
| 504 | |
| 505 | /* if we've just struck a global section, note the fact. */ |
| 506 | bInGlobalSection = isglobal; |
| 507 | |
| 508 | /* check for multiple global sections */ |
| 509 | if (bInGlobalSection) |
| 510 | return True; |
| 511 | |
| 512 | #if 0 |
| 513 | /* If we have a current section, tidy it up before moving on. */ |
| 514 | if (iSectionIndex >= 0) { |
| 515 | /* Add any tidy work as needed ... */ |
| 516 | if (problem) |
| 517 | return False; |
| 518 | } |
| 519 | #endif |
| 520 | |
| 521 | if (strchr(sectionname, '/') != NULL) { |
| 522 | rprintf(FLOG, "Warning: invalid section name in configuration file: %s\n", sectionname); |
| 523 | return False; |
| 524 | } |
| 525 | |
| 526 | if ((iSectionIndex = add_a_section(sectionname)) < 0) { |
| 527 | rprintf(FLOG, "Failed to add a new module\n"); |
| 528 | bInGlobalSection = True; |
| 529 | return False; |
| 530 | } |
| 531 | |
| 532 | return True; |
nothing calls this directly
no test coverage detected