Uploaded image for project: 'OpenAM Agents'
  1. OpenAM Agents
  2. AMAGENTS-1456

More then one conditional URL continues looking for a match

    XMLWordPrintable

    Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.0
    • 4.2.0.0
    • Nginx Agents
    • Tested and reproduced using
      AM 5.5.1
      Web Agent Nginx 4.1.0-26 for centos7
      Nginx version: nginx/1.11.10 (nginx-plus-r12-p3)

      Description

      When configuring more than one url in AM via Realms > [Realm Name] > Agents > Web > [Agent Name] > Advanced > Custom Properties and add the com.forgerock.agents.conditional.login.url property e.g.

      com.forgerock.agents.conditional.login.url[0]

      com.forgerock.agents.conditional.login.url[1]

       The agent tries to match conditional URL and even if it gets a match it continues to next set of conditional URL for a further match.

      This should match on the first find and then break the following code snippet is in question:

      for (i = 0; i < r->conf->cond_login_url_sz; i++) {
      1944             am_config_map_t *m = &r->conf->cond_login_url[i];
      1945
      1946             /* configuration parameter value: pattern|url1,url2,... */
      1947
      1948             size_t sep = strcspn(m->value, "|");
      1949             if (sep > 0 && sep < strlen(m->value)) {
      1950
      1951                 char *pattern = strndup(m->value, sep);
      1952                 if (pattern != NULL) {
      1953                     cond_url_match = r->conf->url_eval_case_ignore ?
      1954                             stristr(url, pattern) != NULL : strstr(url, pattern) != NULL;
      1955                     AM_LOG_DEBUG(r->instance_id, "%s conditional login pattern: %s, url: %s, match status: %s",
      1956                             thisfunc, pattern, url, cond_url_match ? "match" : "no match");
      1957                     free(pattern);
      1958                 }
      1959
      1960                 if (cond_url_match) {
      1961                     const char *f, *w, *value = m->value + sep + 1;
      1962                     if (ISVALID(value)) {
      1963                         /* split url values into map entries */
      1964                         map_sz = char_count(value, ',', NULL) + 1;
      1965                         map = (am_config_map_t *) malloc(map_sz * sizeof (am_config_map_t));
      1966                         if (map != NULL) {
      1967                             for (j = 0, f = value; *(w = am_strsep2(&f, ",")); j++) {
      1968                                 (&map[j])>name = (&map[j])>value = strndup(w, f - w);
      1969                             }
      1970                             local_alloc = AM_TRUE;
      1971                         }
      1972                     }
      1973                 }
      1974             }
      1975         }

      Line 1972 should have a break;

        Attachments

          Activity

            People

            mareks Mareks Malnacs
            eliot.kerslake Eliot Kerslake [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: