| 679 | |
| 680 | |
| 681 | static int parse_conf_string(const char *confstring, |
| 682 | char **extra_avps_file, int *lib_mode) |
| 683 | { |
| 684 | char *p; |
| 685 | |
| 686 | *extra_avps_file = NULL; |
| 687 | *lib_mode = 0; |
| 688 | |
| 689 | if (!confstring) |
| 690 | goto out; |
| 691 | |
| 692 | p = strcasestr(confstring, "extra-avps-file"); |
| 693 | if (p) { |
| 694 | p += strlen("extra-avps-file"); |
| 695 | while (*p != '/' && *p != '\0') |
| 696 | p++; |
| 697 | |
| 698 | if (*p != '/') { |
| 699 | fd_log_error("'extra-avps-file' requires an absolute file path\n"); |
| 700 | } else { |
| 701 | char *e = p; |
| 702 | while (!isspace(*e) && *e != ';' && *e != '\0') |
| 703 | e++; |
| 704 | *extra_avps_file = malloc(e - p + 1); |
| 705 | memcpy(*extra_avps_file, p, e - p); |
| 706 | (*extra_avps_file)[e - p] = '\0'; |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | p = strcasestr(confstring, "library-mode"); |
| 711 | if (p) { |
| 712 | p += strlen("library-mode"); |
| 713 | while (!isdigit(*p) && *p != ';' && *p != '\0') |
| 714 | p++; |
| 715 | if (isdigit(*p) && *p != '0') |
| 716 | *lib_mode = 1; |
| 717 | } |
| 718 | |
| 719 | out: |
| 720 | fd_log_debug("[INIT] extra-avps-file: %s", *extra_avps_file); |
| 721 | fd_log_debug("[INIT] library-mode: %d", *lib_mode); |
| 722 | return 0; |
| 723 | } |
| 724 | |
| 725 | |
| 726 | /* entry point: register handlers for Accounting and Digest Auth */ |