Commit 99eafc49 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

security:choose_mech fix DEAD CODE warning

... by removing the "do {} while (0)" block.

Coverity CID 1306669
parent 45bad4ac
Loading
Loading
Loading
Loading
+43 −46
Original line number Original line Diff line number Diff line
@@ -480,7 +480,6 @@ static CURLcode choose_mech(struct connectdata *conn)
  void *tmp_allocation;
  void *tmp_allocation;
  const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
  const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;


  do {
  tmp_allocation = realloc(conn->app_data, mech->size);
  tmp_allocation = realloc(conn->app_data, mech->size);
  if(tmp_allocation == NULL) {
  if(tmp_allocation == NULL) {
    failf(data, "Failed realloc of size %u", mech->size);
    failf(data, "Failed realloc of size %u", mech->size);
@@ -494,7 +493,7 @@ static CURLcode choose_mech(struct connectdata *conn)
    if(ret) {
    if(ret) {
      infof(data, "Failed initialization for %s. Skipping it.\n",
      infof(data, "Failed initialization for %s. Skipping it.\n",
            mech->name);
            mech->name);
        continue;
      return CURLE_FAILED_INIT;
    }
    }
  }
  }


@@ -521,15 +520,14 @@ static CURLcode choose_mech(struct connectdata *conn)
      }
      }
      break;
      break;
    }
    }
      continue;
    return CURLE_LOGIN_DENIED;
  }
  }


  /* Authenticate */
  /* Authenticate */
  ret = mech->auth(conn->app_data, conn);
  ret = mech->auth(conn->app_data, conn);


    if(ret == AUTH_CONTINUE)
  if(ret != AUTH_CONTINUE) {
      continue;
    if(ret != AUTH_OK) {
    else if(ret != AUTH_OK) {
      /* Mechanism has dumped the error to stderr, don't error here. */
      /* Mechanism has dumped the error to stderr, don't error here. */
      return -1;
      return -1;
    }
    }
@@ -545,8 +543,7 @@ static CURLcode choose_mech(struct connectdata *conn)
    /* Set the requested protection level */
    /* Set the requested protection level */
    /* BLOCKING */
    /* BLOCKING */
    (void)sec_set_protection_level(conn);
    (void)sec_set_protection_level(conn);

  }
  } WHILE_FALSE;


  return CURLE_OK;
  return CURLE_OK;
}
}